Refines text insertion handling for writing prompts: - Collapses text selection before insertion - Adds more intelligent newline management - Uses Intl.DateTimeFormat for consistent timestamp generation Enhances edge case handling for cursor and text positioning