File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
src/frontend/apps/impress/src/features/docs Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ and this project adheres to
1818 - ♿(frontend) improve screen reader support in DocShare modal #1628
1919- 🐛(frontend) fix toolbar not activated when reader #1640
2020- 🐛(frontend) preserve left panel width on window resize #1588
21+ - 🐛(frontend) prevent duplicate as first character in title #1595
2122
2223## [ 3.10.0] - 2025-11-18
2324
Original file line number Diff line number Diff line change @@ -122,11 +122,17 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
122122 if ( isTopRoot ) {
123123 const sanitizedTitle = updateDocTitle ( doc , inputText ) ;
124124 setTitleDisplay ( sanitizedTitle ) ;
125+ return sanitizedTitle ;
125126 } else {
126- const sanitizedTitle = updateDocTitle (
127- doc ,
128- emoji ? `${ emoji } ${ inputText } ` : inputText ,
129- ) ;
127+ const { emoji : pastedEmoji } = getEmojiAndTitle ( inputText ) ;
128+ const textPreservingPastedEmoji = pastedEmoji
129+ ? `\u200B${ inputText } `
130+ : inputText ;
131+ const finalTitle = emoji
132+ ? `${ emoji } ${ textPreservingPastedEmoji } `
133+ : textPreservingPastedEmoji ;
134+
135+ const sanitizedTitle = updateDocTitle ( doc , finalTitle ) ;
130136 const { titleWithoutEmoji : sanitizedTitleWithoutEmoji } =
131137 getEmojiAndTitle ( sanitizedTitle ) ;
132138
Original file line number Diff line number Diff line change @@ -26,12 +26,13 @@ export const getEmojiAndTitle = (title: string) => {
2626 // Use emoji-regex library for comprehensive emoji detection compatible with ES5
2727 const regex = emojiRegex ( ) ;
2828
29- // Check if the title starts with an emoji
30- const match = title . match ( regex ) ;
29+ // Ignore leading spaces when checking for a leading emoji
30+ const trimmedTitle = title . trimStart ( ) ;
31+ const match = trimmedTitle . match ( regex ) ;
3132
32- if ( match && title . startsWith ( match [ 0 ] ) ) {
33+ if ( match && trimmedTitle . startsWith ( match [ 0 ] ) ) {
3334 const emoji = match [ 0 ] ;
34- const titleWithoutEmoji = title . substring ( emoji . length ) . trim ( ) ;
35+ const titleWithoutEmoji = trimmedTitle . substring ( emoji . length ) . trim ( ) ;
3536 return { emoji, titleWithoutEmoji } ;
3637 }
3738
You can’t perform that action at this time.
0 commit comments