mirror of
https://github.com/zadam/trilium.git
synced 2025-10-06 05:25:37 +08:00
chore(ckeditor5-math): fix references: LivePosition -> ModelLivePosition
This commit is contained in:
parent
de91326c12
commit
da8eecf774
1 changed files with 8 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Clipboard, Plugin, type Editor, LivePosition, LiveRange, Undo } from 'ckeditor5';
|
||||
import { Clipboard, Plugin, type Editor, ModelLivePosition, LiveRange, Undo } from 'ckeditor5';
|
||||
import { extractDelimiters, hasDelimiters, delimitersCounts } from './utils.js';
|
||||
|
||||
export default class AutoMath extends Plugin {
|
||||
|
@ -11,7 +11,7 @@ export default class AutoMath extends Plugin {
|
|||
}
|
||||
|
||||
private _timeoutId: null | number;
|
||||
private _positionToInsert: null | LivePosition;
|
||||
private _positionToInsert: null | ModelLivePosition;
|
||||
|
||||
constructor( editor: Editor ) {
|
||||
super( editor );
|
||||
|
@ -31,10 +31,10 @@ export default class AutoMath extends Plugin {
|
|||
return;
|
||||
}
|
||||
|
||||
const leftLivePosition = LivePosition.fromPosition( firstRange.start );
|
||||
const leftLivePosition = ModelLivePosition.fromPosition( firstRange.start );
|
||||
leftLivePosition.stickiness = 'toPrevious';
|
||||
|
||||
const rightLivePosition = LivePosition.fromPosition( firstRange.end );
|
||||
const rightLivePosition = ModelLivePosition.fromPosition( firstRange.end );
|
||||
rightLivePosition.stickiness = 'toNext';
|
||||
|
||||
modelDocument.once( 'change:data', () => {
|
||||
|
@ -63,8 +63,8 @@ export default class AutoMath extends Plugin {
|
|||
}
|
||||
|
||||
private _mathBetweenPositions(
|
||||
leftPosition: LivePosition,
|
||||
rightPosition: LivePosition
|
||||
leftPosition: ModelLivePosition,
|
||||
rightPosition: ModelLivePosition
|
||||
) {
|
||||
const editor = this.editor;
|
||||
|
||||
|
@ -97,7 +97,7 @@ export default class AutoMath extends Plugin {
|
|||
return;
|
||||
}
|
||||
|
||||
this._positionToInsert = LivePosition.fromPosition( leftPosition );
|
||||
this._positionToInsert = ModelLivePosition.fromPosition( leftPosition );
|
||||
|
||||
// With timeout user can undo conversation if want use plain text
|
||||
this._timeoutId = window.setTimeout( () => {
|
||||
|
@ -106,7 +106,7 @@ export default class AutoMath extends Plugin {
|
|||
|
||||
writer.remove( equationRange );
|
||||
|
||||
let insertPosition: LivePosition | null;
|
||||
let insertPosition: ModelLivePosition | null;
|
||||
|
||||
// Check if position where the math element should be inserted is still valid.
|
||||
if ( this._positionToInsert?.root.rootName !== '$graveyard' ) {
|
||||
|
|
Loading…
Add table
Reference in a new issue