w8tcha / CKEditor-TextSelection-Plugin

The plugin that makes the editor keep it's text-selection when switching between WYSIWYG and Source mode, and scrolls the selection into the viewport.
MIT License
10 stars 7 forks source link

Content lost when clicking undo after switching from WYSIWYG to SOURCE and back to WYSIWYG #25

Closed abogaart closed 8 years ago

abogaart commented 8 years ago

Hi!

Recently one of our editors found an issue where a piece of content is out when 'undo' is clicked after switching from WYSIWYG to SOURCE and back to WYSIWYG.

The full reproduction path is as follows:

Expected: the last action would be undone, i.e. making a few characters bold. Observed: all changes that were made after switching back to are lost.

I think this issue is caused because the function 'createBookmark' is called twice when switching from to which in turn causes the lockmanager to never become unlocked (as the locked.level value stays above 0).

I found a workaround which is to simply call editor.undoManager.unlock() in the last line of createBookmark, but that might not play well with previous fixes done in this area?

w8tcha commented 8 years ago

Ok i fixed this in the codemirror plugin https://github.com/w8tcha/CKEditor-CodeMirror-Plugin/commit/7b36076ce27a83c6087781b998e96f657813c073

abogaart commented 8 years ago

Works like a charm, thanks a lot!