-
Notifications
You must be signed in to change notification settings - Fork 463
🐛(frontend) prevent duplicate as first character in title #1595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
5e4f415 to
7ed8ea5
Compare
|
Size Change: +55 B (0%) Total Size: 4.07 MB
|
135ea9a to
99eb65d
Compare
AntoLC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (isTopRoot) { | ||
| const sanitizedTitle = updateDocTitle(doc, inputText); | ||
| setTitleDisplay(sanitizedTitle); | ||
| return sanitizedTitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return does not seem necessary, same here:
docs/src/frontend/apps/impress/src/features/docs/doc-header/components/DocTitle.tsx
Line 140 in 99eb65d
| return sanitizedTitleWithoutEmoji; |
| const leadingSpacesLength = title.match(/^\s+/)?.[0]?.length ?? 0; | ||
| const trimmedStart = title.slice(leadingSpacesLength); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const leadingSpacesLength = title.match(/^\s+/)?.[0]?.length ?? 0; | |
| const trimmedStart = title.slice(leadingSpacesLength); | |
| const trimmedTitle = title.trimStart(); |
| doc, | ||
| emoji ? `${emoji} ${inputText}` : inputText, | ||
| ); | ||
| const { emoji: pastedEmoji } = getEmojiAndTitle(inputText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the second getEmojiAndTitle under ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the second
getEmojiAndTitleunder ?
Yes. After saving, we read the sanitized title and display it without the icon emoji. This keeps the UI in sync with the saved value and keeps the icon separate.
1c7c611 to
56a1c16
Compare
8a0b04e to
47b2f80
Compare
e5ee88f to
0cb373f
Compare
ensures icon and title are visually distinct in sub-document headers Signed-off-by: Cyril <[email protected]>
0cb373f to
3fee1f2
Compare

Purpose
Fix duplicated emoji when pasting an emoji at the beginning of a sub‑doc title. The pasted emoji must stay in the title and must not be turned into the sub‑doc icon.
issue : 1592
copypasteemojis.mp4
Proposal
getEmojiAndTitle