Ckeditor5: [FF] Typing space after inline element boundary doesn't work

Created on 19 Jun 2018  Â·  5Comments  Â·  Source: ckeditor/ckeditor5

  1. Press bold (on),
  2. Type "a",
  3. Press bold (off),
  4. Press Space

Expected: <p><b>a</b> []</p>

Actual: <p><b>a</b>[]</p>

bug

All 5 comments

I pushed ckeditor5-typing@t/ckeditor5/1083 with a temporary fix.

It looks like a regression - it was fixed here: https://github.com/ckeditor/ckeditor5-engine/pull/1204

Yes and no. The bug was there all the time. Or rather – lack of functionality. It manifested itself once we enabled support for <br>s.

The problem was in what's @pomek and @scofalik were pinging me for some time – lack of support for diffing not-only-text content:

https://github.com/ckeditor/ckeditor5-typing/blob/039f5d3e5ac4cc698208121c67e56d5642a0fe24/src/input.js#L215

@ma2ciek I think this is a little different case. This one takes place in typing. It was "hidden" earlier because we didn't convert <br />. Now we do and it messed up some algorithms in typing.

As far as the solution goes, it looks okay for now. However, I don't like this part of code

// Skip situations when common ancestor has any elements (cause they are too hard).
if ( !hasOnlyTextNodesOrBrs( modelFromDomChildren ) || !hasOnlyTextNodesOrBrs( currentModelChildren ) ) {
    return;
}

Which caused the bug. The moment we will allow more inline elements that will be rendered, the bug will manifest again.

Actually, there is a problem with indexes even now if we will have a "real" <br /> inside the text. So we need to do something to keep the indexes correct. Unfortunatelly, simply changing non-texts to a character won't work correctly cause the Firefox'es bogus br will be changed to that character and inserted.

Was this page helpful?
0 / 5 - 0 ratings