diff --git a/packages/ckeditor5-footnotes/src/footnote-editing/auto-formatting.ts b/packages/ckeditor5-footnotes/src/footnote-editing/auto-formatting.ts index 1390b3a26..926819fb0 100644 --- a/packages/ckeditor5-footnotes/src/footnote-editing/auto-formatting.ts +++ b/packages/ckeditor5-footnotes/src/footnote-editing/auto-formatting.ts @@ -1,4 +1,4 @@ -import { type Editor, Text, TextProxy, type Element, type Range, type Autoformat, inlineAutoformatEditing } from 'ckeditor5'; +import { type Editor, ModelText, TextProxy, type Element, type Range, type Autoformat, inlineAutoformatEditing } from 'ckeditor5'; import { COMMANDS, ELEMENTS } from '../constants.js'; import { modelQueryElement, modelQueryElementsAll } from '../utils.js'; @@ -74,7 +74,7 @@ const formatCallback = ( ranges: Array, editor: Editor, rootElement: Elem return; } const text = [ ...ranges[ 0 ].getItems() ][ 0 ]; - if ( !( text instanceof TextProxy || text instanceof Text ) ) { + if ( !( text instanceof TextProxy || text instanceof ModelText ) ) { return false; } const match = text.data.match( /[0-9]+/ ); diff --git a/packages/ckeditor5-footnotes/src/utils.ts b/packages/ckeditor5-footnotes/src/utils.ts index 5121b8b5c..b54ae8c8f 100644 --- a/packages/ckeditor5-footnotes/src/utils.ts +++ b/packages/ckeditor5-footnotes/src/utils.ts @@ -1,4 +1,4 @@ -import { type Editor, Element, Text, TextProxy, ViewElement } from 'ckeditor5'; +import { type Editor, Element, ModelText, TextProxy, ViewElement } from 'ckeditor5'; // There's ample DRY violation in this file; type checking // polymorphism without full typescript is just incredibly finicky. @@ -36,13 +36,13 @@ export const modelQueryElementsAll = ( export const modelQueryTextAll = ( editor: Editor, rootElement: Element, - predicate: ( item: Text | TextProxy ) => boolean = _ => true -): Array => { + predicate: ( item: ModelText | TextProxy ) => boolean = _ => true +): Array => { const range = editor.model.createRangeIn( rootElement ); - const output: Array = []; + const output: Array = []; for ( const item of range.getItems() ) { - if ( !( item instanceof Text || item instanceof TextProxy ) ) { + if ( !( item instanceof ModelText || item instanceof TextProxy ) ) { continue; } @@ -83,12 +83,12 @@ export const modelQueryElement = ( export const modelQueryText = ( editor: Editor, rootElement: Element, - predicate: ( item: Text | TextProxy ) => boolean = _ => true -): Text | TextProxy | null => { + predicate: ( item: ModelText | TextProxy ) => boolean = _ => true +): ModelText | TextProxy | null => { const range = editor.model.createRangeIn( rootElement ); for ( const item of range.getItems() ) { - if ( !( item instanceof Text || item instanceof TextProxy ) ) { + if ( !( item instanceof ModelText || item instanceof TextProxy ) ) { continue; }