-
-
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
Plain text to HTML conversion removes linebreaks #766
Comments
If we supported soft line breaks already this would look good – just like in Sublime. But the problem is that bazillion of In other words – we need to understand what most users would expect in which cases. Right now, IIRC, we follow some native behaviour (but the visual result is wrong because |
@ryanfeeley do you have any user feedback regarding this to paste here? |
Some recent related feedback:
|
Also:
|
/me looks at the last comment (just to be clear there are good comments about other stuff too ;) ) |
True! Most comments are positive, but if we only listen to those ones we'll never improve. |
Thanks for the feedback, guys. But, frankly speaking, until your editor doesn't support soft line-breaks it's hard to understand what people expect. Right now they see that nearly all line breaks are lost when pasting a plain-text. But that doesn't help understanding how plain-text should be converted to HTML when paragraphs and soft line-breaks were supported. From our perspective we need to:
In your case, you can choose. Either start with 1. or with 2. If you want to start with 1. then there's a community plugin https://github.com/alexeckermann/ckeditor5-soft-break (although, I don't know how well it works). If you want to start with 2., then you need to plug a similar listener to this one: https://github.com/ckeditor/ckeditor5-clipboard/blob/3045e1e3ecd69dd8ef5de3838d40693cf0e9ef6d/src/clipboard.js#L136-L157 and tune the |
cc @Natim @sebastienbarbier for visibility |
Stopgap solution might be converting new lines to paragraphs. Of course it's not perfect, but still pretty close to what people expect and miles better than current "non-solution". Looks like one liner: https://github.com/ckeditor/ckeditor5-clipboard/blob/587c2aac8fe42c4a062db9c69de2b7222f6b693b/src/utils/plaintexttohtml.js#L10-L40 Just replace the current handling with |
I would use |
I fixed to |
We're adding a support for
Should it be: 1) <p>Foo<br>Bar</p><p>Bom</p> or 2) <p>Foo</p><p>Bar</p><p>Bom</p> or maybe 3) <p>Foo</p><p>Bar</p><p></p><p>Bom</p> I'm for option 1 because it's close to Markdown. WDYT? |
Wrong: CKEditor 4 does "1" when pasting text from Notepad on Windows. CKEditor does "3" when pasting text content copied from Terminal or Vim on OSX. For me personally, option "1" is more intuitive. |
Follow up of the mozilla/notes#534.
Right now, all linebreaks from a plain text are removed after pasting it to the editor. Current algorithm for this case looks like this:
We don't support soft-line breaks, so the outcome is a single-line of text. The problem is most visible in case of pasting content from, i.e. Sublime Text to our editor.
As we talked with @Reinmar, it concerns this part of the code:
https://github.com/ckeditor/ckeditor5-clipboard/blob/587c2aac8fe42c4a062db9c69de2b7222f6b693b/src/utils/plaintexttohtml.js#L10-L40
The text was updated successfully, but these errors were encountered: