- editor.on( 'beforeUndoImage', beforeData );
- editor.on( 'afterUndoImage', afterData );
- editor.on( 'beforeGetData', beforeData, null, null, 0 );
- editor.on( 'getData', afterData );
- }
-
- function beforeData() {
- var editable = editor.editable();
- if ( !editable )
- return;
-
- var fillingChar = getFillingChar( editable );
-
- if ( fillingChar ) {
- // If the selection's focus or anchor is located in the filling char's text node,
- // we need to restore the selection in afterData, because it will be lost
- // when setting text. Selection's direction must be preserved.
- // (#7437, #12489, #12491 comment:3)
- var sel = editor.document.$.getSelection();
- if ( sel.type != 'None' && ( sel.anchorNode == fillingChar.$ || sel.focusNode == fillingChar.$ ) )
- selectionBookmark = createNativeSelectionBookmark( sel );
-
- fillingCharBefore = fillingChar.getText();
- fillingChar.setText( replaceFillingChar( fillingCharBefore ) );
- }
- }
-
- function afterData() {
- var editable = editor.editable();
- if ( !editable )
- return;
-
- var fillingChar = getFillingChar( editable );
-
- if ( fillingChar ) {
- fillingChar.setText( fillingCharBefore );
-
- if ( selectionBookmark ) {
- moveNativeSelectionToBookmark( editor.document.$, selectionBookmark );
- selectionBookmark = null;
+ // Filter Undo snapshot's HTML to get rid of Filling Char Sequence.
+ // Note: CKEDITOR.dom.range.createBookmark2() normalizes snapshot's
+ // bookmarks to anticipate the removal of FCSeq from the snapshot's HTML (#13816).
+ editor.on( 'getSnapshot', function( evt ) {
+ if ( evt.data ) {
+ evt.data = removeFillingCharSequenceString( evt.data );