CKEditor breaks while changing text format from one with image data caption enabled to the text format without it.

Created on 29 August 2023, about 1 year ago
Updated 29 February 2024, 9 months ago

Problem/Motivation

While changing text format from one with a `Caption images` filter enabled to text format without that filter and table plugin enabled editor breaks with error `mapping-model-position-view-parent-not-found`:

CKEditorError: mapping-model-position-view-parent-not-found {"modelPosition":{"root":"main","path":[1,0,0],"stickiness":"toNext"}}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-mapping-model-position-view-parent-not-found
    at Uo.on.priority (ckeditor5-dll.js?v=38.1.0:5:241522)
    at Uo.fire (ckeditor5-dll.js?v=38.1.0:5:552555)
    at Uo.toViewPosition (ckeditor5-dll.js?v=38.1.0:5:244001)
    at downcastDispatcher.on.priority (ckeditor5-dll.js?v=38.1.0:5:287553)
    at ni.fire (ckeditor5-dll.js?v=38.1.0:5:552555)
    at ni._testAndFire (ckeditor5-dll.js?v=38.1.0:5:251237)
    at ni._convertInsert (ckeditor5-dll.js?v=38.1.0:5:249326)
    at Object.convertChildren (ckeditor5-dll.js?v=38.1.0:5:251678)
    at downcastDispatcher.on.priority (ckeditor5-dll.js?v=38.1.0:5:287780)
    at ni.fire (ckeditor5-dll.js?v=38.1.0:5:552555)

It only happens when text format with a disabled `Caption images` filter has a tables plugin enabled (see attached videos).
Could be somehow related to: https://www.drupal.org/project/drupal/issues/3269619

Steps to reproduce

1. Create two text formats:
-The first one with the `Caption images` filter and image plugin enabled.
-The second one without a filter but with an image plugin and a table plugin.
2. Create an article using the first text format.
3. Add an image with a data caption.
4. Change the text format to the second one.
5. Content disappeared and an error occurred in the console.

The error occurs only if the second text format has table plugin enabled. See the attached videos.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
CKEditor 5 

Last updated about 15 hours ago

Created by

🇵🇱Poland dolszewski

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • JavaScript

    Affects the content, performance, or handling of Javascript.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Postponed: needs info about 1 year ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Can you please:

    1. Provide sample markup to reproduce this problem?
    2. Can you export your editor.editor.SOMETHING.yml and filter.format.SOMETHING.yml and upload them here?

    Thanks!

    🙏

  • 🇵🇱Poland dolszewski

    @wim-leers
    I have added config files to the issue.

    Sample markup:
    <img src="https://www.drupal.org/files/docs/user_guide/en/images/coverimage.png" alt="TEST" data-caption="some text">

  • Status changed to Active 9 months ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Next time, please change the status, that'll make it clear the additional info is now present 😊

Production build 0.71.5 2024