#5901: Use text nodes content directly instead of stringifying using data processor in code-block #7240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
as suggested by @oleq at #5901 (comment).
Ignore HTML elements inside
<pre><code>
.Closes: #5901.
Suggested merge commit message (convention)
Fix (code-block): Stop rendering
when restoring the state of an empty code block. Closes #5901.Additional information
There is still an issue with dom to view conversion
https://github.com/ckeditor/ckeditor5/compare/i/5901-code-blocks?expand=1#diff-82a5336a00edfc515fb87b52fc38eafbR892-R901
as you can see, filler element is not cleared on
getData
From what I have found,
domConverter
https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/domconverter.js#L1027 usesgetDataWithoutFiller
which strips onlyINLINE_FILLER
. I tried to change_processDataFromDomText
to strip the block filler. However, it does not identify
inside<code>
as block filler, because<code>
is an inline element.I could do more changes, to let it change it anyway, given it already checked it's inside
<pre>
element which accepts onlyPhrasing content
. But I have a doubt regarding that:From what I understand
domConverter
is not aware ofcode-block
feature. Therefore, for it<code>
is as inline as any other element like<strong>
, even inside<pre>
. Shouldn't we use\u200b
(zero-width space) in the first place? The pre-formatted behavior of<pre>
guarantees the height for us?//cc @Reinmar