浏览代码

Fixed problem with selection.

Maksymilian Barnaś 9 年之前
父节点
当前提交
953a8a4de4
共有 1 个文件被更改,包括 5 次插入3 次删除
  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();
 				} );
 			} );