-
-
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
Content initializes incorrectly with specific init HTML #1580
Comments
Can you check if this is a regression? |
It's a regression and it doesn't occur in v11.1.0. |
Quick summary: the original problem does not occur anymore. It was connected with lists converter and (incorrect) There is still a problem with scenarios added by @Reinmar. Without debugging, I am 90% sure it is because wrong BTW.: <blockquote>
<div>Foo</div>
</blockquote>
<p>Bar</p> Produces incorrect editor data too (this is the other "mode" of autoparagraphing - changing unrecognized elements into |
I think we can close #1581 as DUP. |
Below are the results of my research on this subject. As I said earlier, the problem is with First of all, some facts:
I've made some quick research, I took
The thing is straightforward: an average converter should always set This is also intuitive but having such a straight rule also hinders some flexibility. It was also implemented like this... kind of. The implementation is not straightforward, functions are scattered between multiple files and you need to think about converters people might add. But most importantly, generating Enter auto-paragraphing. Auto-paragraphing uses <blockquote>
foo <strong>bar</strong>
</blockquote> When <blockQuote>
<paragraph>
foo <$text bold=true>bar</$text>
</paragraph>
</blockQuote> (Instead of To achieve this, auto-paragraphing sets Because of that, this part of code in the default upcast converter fails: const childrenResult = conversionApi.convertChildren( data.viewItem, conversionApi.writer.createPositionAt( modelElement, 0 ) );
data.modelRange = new ModelRange(
conversionApi.writer.createPositionBefore( modelElement ),
conversionApi.writer.createPositionAfter( childrenResult.modelCursor.parent )
);
if ( splitResult.cursorParent ) {
data.modelCursor = conversionApi.writer.createPositionAt( splitResult.cursorParent, 0 );
} else {
data.modelCursor = data.modelRange.end;
} As you can see it relies on the fact that conversionApi.writer.createPositionAfter( childrenResult.modelCursor.parent ) So we have a problem because we cannot have both solutions together implemented as they are. My first idea was to simply use So my other idea was to store "offset from the end of the parent" and the parent node and simulate <blockquote>
<p>
foo
<img src="abc.jpg" />
bar
</p>
</blockQuote> In this scenario, I cannot simply remember So, mid-conclusion is this:
At the moment I fixed the issue in the auto-paragraphing. I set However, I am not sure about this solution. I don't like it that I have such a strict rule on |
After a lengthy discussion with @pjasiun here's what we decided on. I think we agreed on a solution with the best advantages/drawbacks ratio :).
The first idea was to introduce
So instead we decided to integrate splitting more tightly in upcasting and
This way there's less to set in At first, I thought that we won't need the "middle" split parts and we will always use the last one but then I remembered the problems with |
Feature: Introduced `UpcastConversionApi#getSplitParts`. Also, provided a way to set upcast conversion helper fired for every view element. Closes ckeditor/ckeditor5#1580. Closes ckeditor/ckeditor5#1581.
Is this a bug report or feature request? (choose one)
🐞 Bug report
💻 Version of CKEditor
Latest master.
📋 Steps to reproduce
✅ Expected result
The paragraph is outside the blockquote.
❎ Actual result
The paragraph is inside the blockquote.
📃 Other details that might be useful
JSFiddle - https://jsfiddle.net/7n2oaurg/
It loads properly if the init HTML is wrapped within
div
:The text was updated successfully, but these errors were encountered: