|
@@ -155,14 +155,15 @@ export default class InlineAutoformatEditing {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const selection = editor.model.document.selection;
|
|
|
|
|
|
|
+ const model = editor.model;
|
|
|
|
|
+ const selection = model.document.selection;
|
|
|
|
|
|
|
|
// Do nothing if selection is not collapsed.
|
|
// Do nothing if selection is not collapsed.
|
|
|
if ( !selection.isCollapsed ) {
|
|
if ( !selection.isCollapsed ) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const changes = Array.from( editor.model.document.differ.getChanges() );
|
|
|
|
|
|
|
+ const changes = Array.from( model.document.differ.getChanges() );
|
|
|
const entry = changes[ 0 ];
|
|
const entry = changes[ 0 ];
|
|
|
|
|
|
|
|
// Typing is represented by only a single change.
|
|
// Typing is represented by only a single change.
|
|
@@ -170,8 +171,6 @@ export default class InlineAutoformatEditing {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const model = editor.model;
|
|
|
|
|
-
|
|
|
|
|
const focus = selection.focus;
|
|
const focus = selection.focus;
|
|
|
const block = focus.parent;
|
|
const block = focus.parent;
|
|
|
const { text, range } = getLastTextLine( model.createRange( model.createPositionAt( block, 0 ), focus ), model );
|
|
const { text, range } = getLastTextLine( model.createRange( model.createPositionAt( block, 0 ), focus ), model );
|
|
@@ -184,7 +183,7 @@ export default class InlineAutoformatEditing {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Use enqueueChange to create new batch to separate typing batch from the auto-format changes.
|
|
// Use enqueueChange to create new batch to separate typing batch from the auto-format changes.
|
|
|
- editor.model.enqueueChange( writer => {
|
|
|
|
|
|
|
+ model.enqueueChange( writer => {
|
|
|
// Apply format.
|
|
// Apply format.
|
|
|
const hasChanged = formatCallback( writer, rangesToFormat );
|
|
const hasChanged = formatCallback( writer, rangesToFormat );
|
|
|
|
|
|