mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	chore(ckeditor5-footnotes): fix references: Text -> ModelText
This commit is contained in:
		
							parent
							
								
									c4787dae23
								
							
						
					
					
						commit
						bb6e22cdb7
					
				@ -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 { COMMANDS, ELEMENTS } from '../constants.js';
 | 
				
			||||||
import { modelQueryElement, modelQueryElementsAll } from '../utils.js';
 | 
					import { modelQueryElement, modelQueryElementsAll } from '../utils.js';
 | 
				
			||||||
@ -74,7 +74,7 @@ const formatCallback = ( ranges: Array<Range>, editor: Editor, rootElement: Elem
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	const text = [ ...ranges[ 0 ].getItems() ][ 0 ];
 | 
						const text = [ ...ranges[ 0 ].getItems() ][ 0 ];
 | 
				
			||||||
	if ( !( text instanceof TextProxy || text instanceof Text ) ) {
 | 
						if ( !( text instanceof TextProxy || text instanceof ModelText ) ) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	const match = text.data.match( /[0-9]+/ );
 | 
						const match = text.data.match( /[0-9]+/ );
 | 
				
			||||||
 | 
				
			|||||||
@ -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
 | 
					// There's ample DRY violation in this file; type checking
 | 
				
			||||||
// polymorphism without full typescript is just incredibly finicky.
 | 
					// polymorphism without full typescript is just incredibly finicky.
 | 
				
			||||||
@ -36,13 +36,13 @@ export const modelQueryElementsAll = (
 | 
				
			|||||||
export const modelQueryTextAll = (
 | 
					export const modelQueryTextAll = (
 | 
				
			||||||
	editor: Editor,
 | 
						editor: Editor,
 | 
				
			||||||
	rootElement: Element,
 | 
						rootElement: Element,
 | 
				
			||||||
	predicate: ( item: Text | TextProxy ) => boolean = _ => true
 | 
						predicate: ( item: ModelText | TextProxy ) => boolean = _ => true
 | 
				
			||||||
): Array<Text | TextProxy> => {
 | 
					): Array<ModelText | TextProxy> => {
 | 
				
			||||||
	const range = editor.model.createRangeIn( rootElement );
 | 
						const range = editor.model.createRangeIn( rootElement );
 | 
				
			||||||
	const output: Array<Text | TextProxy> = [];
 | 
						const output: Array<ModelText | TextProxy> = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for ( const item of range.getItems() ) {
 | 
						for ( const item of range.getItems() ) {
 | 
				
			||||||
		if ( !( item instanceof Text || item instanceof TextProxy ) ) {
 | 
							if ( !( item instanceof ModelText || item instanceof TextProxy ) ) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -83,12 +83,12 @@ export const modelQueryElement = (
 | 
				
			|||||||
export const modelQueryText = (
 | 
					export const modelQueryText = (
 | 
				
			||||||
	editor: Editor,
 | 
						editor: Editor,
 | 
				
			||||||
	rootElement: Element,
 | 
						rootElement: Element,
 | 
				
			||||||
	predicate: ( item: Text | TextProxy ) => boolean = _ => true
 | 
						predicate: ( item: ModelText | TextProxy ) => boolean = _ => true
 | 
				
			||||||
): Text | TextProxy | null => {
 | 
					): ModelText | TextProxy | null => {
 | 
				
			||||||
	const range = editor.model.createRangeIn( rootElement );
 | 
						const range = editor.model.createRangeIn( rootElement );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for ( const item of range.getItems() ) {
 | 
						for ( const item of range.getItems() ) {
 | 
				
			||||||
		if ( !( item instanceof Text || item instanceof TextProxy ) ) {
 | 
							if ( !( item instanceof ModelText || item instanceof TextProxy ) ) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user