mirror of
https://github.com/zadam/trilium.git
synced 2025-10-09 23:18:46 +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';
|
import { extractDelimiters, hasDelimiters, delimitersCounts } from './utils.js';
|
||||||
|
|
||||||
export default class AutoMath extends Plugin {
|
export default class AutoMath extends Plugin {
|
||||||
|
@ -11,7 +11,7 @@ export default class AutoMath extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _timeoutId: null | number;
|
private _timeoutId: null | number;
|
||||||
private _positionToInsert: null | LivePosition;
|
private _positionToInsert: null | ModelLivePosition;
|
||||||
|
|
||||||
constructor( editor: Editor ) {
|
constructor( editor: Editor ) {
|
||||||
super( editor );
|
super( editor );
|
||||||
|
@ -31,10 +31,10 @@ export default class AutoMath extends Plugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const leftLivePosition = LivePosition.fromPosition( firstRange.start );
|
const leftLivePosition = ModelLivePosition.fromPosition( firstRange.start );
|
||||||
leftLivePosition.stickiness = 'toPrevious';
|
leftLivePosition.stickiness = 'toPrevious';
|
||||||
|
|
||||||
const rightLivePosition = LivePosition.fromPosition( firstRange.end );
|
const rightLivePosition = ModelLivePosition.fromPosition( firstRange.end );
|
||||||
rightLivePosition.stickiness = 'toNext';
|
rightLivePosition.stickiness = 'toNext';
|
||||||
|
|
||||||
modelDocument.once( 'change:data', () => {
|
modelDocument.once( 'change:data', () => {
|
||||||
|
@ -63,8 +63,8 @@ export default class AutoMath extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _mathBetweenPositions(
|
private _mathBetweenPositions(
|
||||||
leftPosition: LivePosition,
|
leftPosition: ModelLivePosition,
|
||||||
rightPosition: LivePosition
|
rightPosition: ModelLivePosition
|
||||||
) {
|
) {
|
||||||
const editor = this.editor;
|
const editor = this.editor;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ export default class AutoMath extends Plugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._positionToInsert = LivePosition.fromPosition( leftPosition );
|
this._positionToInsert = ModelLivePosition.fromPosition( leftPosition );
|
||||||
|
|
||||||
// With timeout user can undo conversation if want use plain text
|
// With timeout user can undo conversation if want use plain text
|
||||||
this._timeoutId = window.setTimeout( () => {
|
this._timeoutId = window.setTimeout( () => {
|
||||||
|
@ -106,7 +106,7 @@ export default class AutoMath extends Plugin {
|
||||||
|
|
||||||
writer.remove( equationRange );
|
writer.remove( equationRange );
|
||||||
|
|
||||||
let insertPosition: LivePosition | null;
|
let insertPosition: ModelLivePosition | null;
|
||||||
|
|
||||||
// Check if position where the math element should be inserted is still valid.
|
// Check if position where the math element should be inserted is still valid.
|
||||||
if ( this._positionToInsert?.root.rootName !== '$graveyard' ) {
|
if ( this._positionToInsert?.root.rootName !== '$graveyard' ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue