-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Pasting a plain text will inherit selection attributes #7778
Conversation
I wonder if that's a correct heuristic for detecting whether text attributes should be inherited, as it actually does not check what was in the clipboard but instead what is it in the model. It's not something that was discussed, but it has its merits. @Mgsy, you know most about the issues that our community and customers are reporting. Could you test it from the user perspective and tell us how do you feel about this approach? |
Well we can't check view data for that also. We could however introduce some additional data for the listeners. The ctrl+shift+v pastes The other thing is how browser behaves when pasting plain text. AFAICS there are two cases:
But OTOH the @pomek's check operates on model level, after conversion so it would probably catch the situation of pasting not-enabled formatting (let's say strikethrouhg) in editor. In the end we will insert single text node (without attributes) so considering pasting "
If, we'd like option 1 in this case I think that this check will actually be valid. If we however would like option 2 better - then we should check for a true plain text in the clipboard. @pomek - before we get agreement on solution I see that we have too little tests:
|
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.
As in the discussion comment above - a few more tests are needed:
- Plain text in data transfer set in
text/html
andtext/plain
. - As above but in Chrome-style:
<meta http-equiv="content-type" content="text/html; charset=utf-8">foo
(thenfoo
intext/plain
). - Unsupported formatting in
text/html
.
@jodator, I added the mentioned tests. |
Good idea, we could consider that. That'd be a bit more complex as the HTML could look like this: As for the other things that @jodator wrote, I think that we need to be predictable:
|
Suggested merge commit message (convention)
Feature (clipboard): Pasting a plain text will inherit selection attributes. Closes #1006.