MCPcopy
hub / github.com/TriliumNext/Trilium / modelQueryElementsAll

Function modelQueryElementsAll

packages/ckeditor5-footnotes/src/utils.ts:12–30  ·  view source on GitHub ↗
(
	editor: Editor,
	rootElement: ModelElement,
	predicate: ( item: ModelElement ) => boolean = _ => true
)

Source from the content-addressed store, hash-verified

10 * the root for which the provided predicate returns true.
11 */
12export const modelQueryElementsAll = (
13 editor: Editor,
14 rootElement: ModelElement,
15 predicate: ( item: ModelElement ) => boolean = _ => true
16): Array<ModelElement> => {
17 const range = editor.model.createRangeIn( rootElement );
18 const output: Array<ModelElement> = [];
19
20 for ( const item of range.getItems() ) {
21 if ( !( item instanceof ModelElement ) ) {
22 continue;
23 }
24
25 if ( predicate( item ) ) {
26 output.push( item );
27 }
28 }
29 return output;
30};
31
32/**
33 * Returns an array of all descendant text nodes and text proxies of

Callers 6

formatCallbackFunction · 0.85
_removeFootnoteMethod · 0.85
_removeReferencesMethod · 0.85
_orderFootnotesMethod · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected