-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix(NcRichContenteditable): past content to an empty field fails #6241
Conversation
082ab64
to
236385b
Compare
if (!this.isFF || !window.getSelection) { | ||
return | ||
} |
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 you remove this method, isFF
is also not needed anymore.
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.
Unrelated to pasting issue, but noticed:
if input is started or ended with embedded HTML (mention) "@Test01 anyword @Test01"
:
- 🐞 in FF cursor isn't moving to the very start or end with ⬅️ ➡️ keys (⬆️ ⬇️ are working)
- 🐞 in Safari cursor jumps to the very beginning
- ✅ in Chrome everything is fine
// Some browsers add a newline at the end of the contenteditable | ||
text = text === '\n' ? '' : text |
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 comment seems to not document the following line. Let's adjust to something like
// Some browsers add a newline at the end of the contenteditable | |
text = text === '\n' ? '' : text | |
// Browsers keep <br> after erasing contenteditable | |
text = text === '\n' ? '' : text |
- Some browsers => browsers (it is not browser-specific. Or is it?)
- At the end => after erasing (not the ending but entire content is checked)
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 text = this.parseContent(htmlOrText).replace(/^\n$/, '')
Tried to put it in parseContent, but it's breaking the component due to comparing trimmed values, so should be good here
236385b
to
04830b9
Compare
We don't remove it when there is text because browser will add it anyway, we remove when it's the only text (browser leftover) |
It doesn't hurt (unlike then it contains only |
/backport to next |
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.
Tested in Chrome, Firefox, Safari
// Some browsers add a newline at the end of the contenteditable | ||
text = text === '\n' ? '' : text |
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 text = this.parseContent(htmlOrText).replace(/^\n$/, '')
Tried to put it in parseContent, but it's breaking the component due to comparing trimmed values, so should be good here
Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
…is content) Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
…e but has one new line (browser dependent) Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
04830b9
to
6267b67
Compare
☑️ Resolves
🖼️ Screenshots
🏁 Checklist
next
requested with a Vue 3 upgrade