So here's what happens:

1- Embed an entity in the wysiwyg
2- Hit the undo button (if you have it enabled on the wysiwyg) or just hit ctrl+z
3- The element you embedded with disppear momentarily, but then re-appears again!
4- Now double-click the undo button (or just hit ctrl+z twice real quick, as if double-clicking it)
5- Now the element you embedded goes away for good

Analysis:

I think that embedding an entity actually has 2 steps:
1- Adding the code
2- Actually adding the HTML to render the entity. (Triggered by adding the code)

And hitting undo, only undoes step 2. But as CKEditor re-renders the content after the undo, step 2 is triggered again because the code from step 1 is still there.

Possible solution:

I'm not experienced with CKEditor's API, but maybe it's possible to smartly trigger an extra undo when needed?

If not possible, maybe someone else has a suggestion?

Comments

khaled.zaidan created an issue. See original summary.

wim leers’s picture

Status: Active » Closed (duplicate)
Issue tags: +Media Initiative
Related issues: +#2813813: CKEditor's "undo" functionality not working