8
0
Quellcode durchsuchen

Fixed problem with selection.

Maksymilian Barnaś vor 9 Jahren
Ursprung
Commit
953a8a4de4
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      packages/ckeditor5-autoformat/src/inlineautoformatengine.js

+ 5 - 3
packages/ckeditor5-autoformat/src/inlineautoformatengine.js

@@ -153,11 +153,13 @@ export default class InlineAutoformatEngine {
 
 				editor.document.enqueueChanges( () => {
 					selection.setRanges( [ rangeToFormat ] );
+				} );
 
-					formatClb( this.editor, rangeToFormat, batch );
+				// formatClb executes command that has its own enqueueChanges block.
+				formatClb( this.editor, rangeToFormat, batch );
 
-					// FIXME: Problematic part. Changing selection after formatting breaks the formatting.
-					// selection.collapseToEnd();
+				editor.document.enqueueChanges( () => {
+					selection.collapseToEnd();
 				} );
 			} );