Skip to content
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

With ListStyles enabled, modeling throws TypeError if a list is preceded by non-tagged content #8262

Closed
KevinMc opened this issue Oct 15, 2020 · 3 comments · Fixed by #8293
Closed
Assignees
Labels
package:list squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@KevinMc
Copy link

KevinMc commented Oct 15, 2020

📝 Provide detailed reproduction steps (if any)

We've got a variety of legacy HTML data created with older rich text editors, some of which contains elements that aren't surrounded by element tags. For example:

If there are missing paragraph or other tags prior to a list
<ol>
    <li>Item one</li>
</ol>
Then the editor won't model
  1. Given the above source HTML data
  2. Load an editor with the ListStyles plugin enabled

✔️ Expected result

The content should be modeled and editable by the editor.

❌ Actual result

A TypeError occurs:

TypeError: Cannot read property 'getAttribute' of null
    at Tm (ckeditor.js:5)
    at Pm.setAttribute (ckeditor.js:5)
    at Yp.t.on.priority (ckeditor.js:5)
    at Yp.fire (ckeditor.js:5)
    at Yp._convertItem (ckeditor.js:5)
    at Yp._convertChildren (ckeditor.js:5)
    at Yp.<anonymous> (ckeditor.js:5)
    at Yp.fire (ckeditor.js:5)
    at Yp._convertItem (ckeditor.js:5)
    at Yp._convertChildren (ckeditor.js:5)

If the ListStyles plugin is disabled, then the editor functions as expected.

📃 Other details

  • Browser: Chrome 86
  • OS: macOS 10.15
  • CKEditor version: 22.0.x
  • Installed CKEditor plugins: Bold, Italics, List, ListStyles
  • Build ID: eom5f2mlp9sw-494y9pll8mj2
@KevinMc KevinMc added the type:bug This issue reports a buggy (incorrect) behavior. label Oct 15, 2020
@sanchonarancho
Copy link

the same problem in my build:

There was a problem initializing the editor. CKEditorError: i is null Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-i is null
    pc writer.js:1487
    setAttribute writer.js:380
    init liststyleediting.js:218
    fire emittermixin.js:209
    _convertItem upcastdispatcher.js:249
    _convertChildren upcastdispatcher.js:282
    Ha upcasthelpers.js:448
    fire emittermixin.js:209
    _convertItem upcastdispatcher.js:249
    _convertChildren upcastdispatcher.js:282
    Ha upcasthelpers.js:448
    fire emittermixin.js:209
    _convertItem upcastdispatcher.js:253
    convert upcastdispatcher.js:207
    toModel datacontroller.js:414
    change model.js:178
    toModel datacontroller.js:413
    parse datacontroller.js:395
    init datacontroller.js:314
    _runPendingChanges model.js:830
    enqueueChange model.js:236
    init datacontroller.js:311
    decorate observablemixin.js:255
    fire emittermixin.js:209
    t observablemixin.js:259
    create classiceditor.js:209
    promise callback*create/< classiceditor.js:200
    create classiceditor.js:194
    <anonymous> index.html:34

html:

    <p>
       www
    </p>

    qqq

    <p>
       eee
    </p>

    <ul>
        <li>rrr</li>
    </ul>
    <p>
       ttt
    </p>

@FilipTokarski
Copy link
Member

Hi, thanks for the report. I can confirm this bug. If I remove the ListStyle plugin, everything works fine ( even with normal List plugin ).
cc @pomek

@Mgsy Mgsy added the squad:core Issue to be handled by the Core team. label Oct 19, 2020
@Mgsy
Copy link
Member

Mgsy commented Oct 19, 2020

Short copy/paste line for a quick reproduction:

editor.setData( `If there are missing paragraph or other tags prior to a list
<ol>
    <li>Item one</li>
</ol>
Then the editor won't model` )

@AnnaTomanek AnnaTomanek added this to the iteration 37 milestone Oct 19, 2020
mlewand added a commit that referenced this issue Oct 20, 2020
…lement is being surrounded with raw text nodes. Closes #8262.

Non-tagged elements will not blow up the list style feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:list squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants