Skip to content

Undoing content inserted within a paragraph results in an error caused by a bad position path during the undo transformation #17267

@aStewartDesign

Description

@aStewartDesign

📝 Provide detailed reproduction steps (if any)

  1. Use model.change(() => model.insertContent(...)) to insert two document fragments in the middle of a paragraph
  2. Execute the undo command twice
  3. On the second undo command, an error is thrown: CKEditorError: model-position-path-incorrect-format {"path":[]}

See my test case here which throws this error.

✔️ Expected result

No error is thrown and both changes are undone successfully.

❌ Actual result

An error is thrown: CKEditorError: model-position-path-incorrect-format {"path":[]}

❓ Possible solution

In my debugging, it seems like a bad path is getting created during the undo operation transformation. Even though the editor model only has one paragraph in it, an operation position is getting transformed into a position with the path [26]. I traced the bad path back to this transformation function which calls Position._getTransformedByMove, with the bad path ultimately getting created in Position._getCombined. After playing around with this a bit, I'm not exactly sure how to fix this so the positions get transformed correctly however this seems to be the location where the bad path is originally coming from.

📃 Other details

  • Browser: Chrome v130
  • OS: MacOS
  • First affected CKEditor version: unknown
  • Installed CKEditor plugins: ckeditor5-undo

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

Metadata

Metadata

Assignees

Labels

package:engineresolution:resolvedThis issue was already resolved (e.g. by another ticket).squad:collaborationIssue to be handled by the Collaboration team.type:bugThis issue reports a buggy (incorrect) behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions