Skip to content

Build your personal knowledge base with Trilium Notes

chore(ckeditor5): fix references: Position -> ModelPosition

Elian Doranabafa8c2d234
diff --git a/packages/ckeditor5/src/index.ts b/packages/ckeditor5/src/index.ts
index aa123d7732..0bdc4c493e 100644
--- a/packages/ckeditor5/src/index.ts
+++ b/packages/ckeditor5/src/index.ts
@@ -5,7 +5,7 @@ import { BalloonEditor, DecoupledEditor, FindAndReplaceEditing, FindCommand } fr
import "./translation_overrides.js";
export { EditorWatchdog } from "ckeditor5";
export { PREMIUM_PLUGINS } from "./plugins.js";
-export type { EditorConfig, MentionFeed, MentionFeedObjectItem, Node, Position, ModelElement, WatchdogConfig } from "ckeditor5";
+export type { EditorConfig, MentionFeed, MentionFeedObjectItem, ModelNode, ModelPosition, ModelElement, WatchdogConfig } from "ckeditor5";
export type { TemplateDefinition } from "ckeditor5-premium-features";
export { default as buildExtraCommands } from "./extra_slash_commands.js";
diff --git a/packages/ckeditor5/src/plugins/file_upload/fileuploadediting.ts b/packages/ckeditor5/src/plugins/file_upload/fileuploadediting.ts
index b44b11126a..ab8ad8d11c 100644
--- a/packages/ckeditor5/src/plugins/file_upload/fileuploadediting.ts
+++ b/packages/ckeditor5/src/plugins/file_upload/fileuploadediting.ts
@@ -1,4 +1,4 @@
-import { Clipboard, FileRepository, Notification, Plugin, UpcastWriter, ViewElement, type Editor, type FileLoader, type Item, type Node, type ViewItem, type ViewRange } from 'ckeditor5';
+import { Clipboard, FileRepository, Notification, Plugin, UpcastWriter, ViewElement, type Editor, type FileLoader, type Item, type ModelNode, type ViewItem, type ViewRange } from 'ckeditor5';
import FileUploadCommand from './fileuploadcommand';
export default class FileUploadEditing extends Plugin {
@@ -58,7 +58,7 @@ export default class FileUploadEditing extends Plugin {
this.listenTo( editor.plugins.get( Clipboard ), 'inputTransformation', ( evt, data ) => {
const fetchableFiles = Array.from( editor.editing.view.createRangeIn( data.content ) )
- .filter( value => isLocalFile( value.item ) && !(value.item as unknown as Node).getAttribute( 'uploadProcessed' ) )
+ .filter( value => isLocalFile( value.item ) && !(value.item as unknown as ModelNode).getAttribute( 'uploadProcessed' ) )
.map( value => {
return { promise: fetchLocalFile( value.item ), fileElement: value as unknown as ViewElement };
} );
@@ -195,7 +195,7 @@ export default class FileUploadEditing extends Plugin {
function fetchLocalFile( link: ViewItem ) {
return new Promise<File>( ( resolve, reject ) => {
- const href = (link as unknown as Node).getAttribute( 'href' ) as string;
+ const href = (link as unknown as ModelNode).getAttribute( 'href' ) as string;
// Fetch works asynchronously and so does not block the browser UI when processing data.
fetch( href )
diff --git a/packages/ckeditor5/src/plugins/indent_block_shortcut.ts b/packages/ckeditor5/src/plugins/indent_block_shortcut.ts
index 8eb282aada..12c8175530 100644
--- a/packages/ckeditor5/src/plugins/indent_block_shortcut.ts
+++ b/packages/ckeditor5/src/plugins/indent_block_shortcut.ts
@@ -2,7 +2,7 @@
* https://github.com/zadam/trilium/issues/978
*/
-import { DocumentFragment, ModelElement, Plugin, Position } from "ckeditor5";
+import { DocumentFragment, ModelElement, Plugin, ModelPosition } from "ckeditor5";
export default class IndentBlockShortcutPlugin extends Plugin {
@@ -28,7 +28,7 @@ export default class IndentBlockShortcutPlugin extends Plugin {
// in table TAB should switch cells
isInTable() {
- let el: Position | ModelElement | DocumentFragment | null = this.editor.model.document.selection.getFirstPosition();
+ let el: ModelPosition | ModelElement | DocumentFragment | null = this.editor.model.document.selection.getFirstPosition();
while (el) {
if ("name" in el && el.name === 'tableCell') {
diff --git a/packages/ckeditor5/src/plugins/move_block_updown.ts b/packages/ckeditor5/src/plugins/move_block_updown.ts
index 3346f66d9a..bcd2a4f8f6 100644
--- a/packages/ckeditor5/src/plugins/move_block_updown.ts
+++ b/packages/ckeditor5/src/plugins/move_block_updown.ts
@@ -2,7 +2,7 @@
* https://github.com/TriliumNext/Trilium/issues/1002
*/
-import { Command, DocumentSelection, ModelElement, Node, Plugin, Range } from 'ckeditor5';
+import { Command, DocumentSelection, ModelElement, ModelNode, Plugin, Range } from 'ckeditor5';
export default class MoveBlockUpDownPlugin extends Plugin {
init() {
@@ -46,7 +46,7 @@ export default class MoveBlockUpDownPlugin extends Plugin {
abstract class MoveBlockUpDownCommand extends Command {
- abstract getSibling(selectedBlock: ModelElement): Node | null;
+ abstract getSibling(selectedBlock: ModelElement): ModelNode | null;
abstract get offset(): "before" | "after";
override execute() {
diff --git a/packages/ckeditor5/src/plugins/syntax_highlighting/index.ts b/packages/ckeditor5/src/plugins/syntax_highlighting/index.ts
index 5257ca7610..e1df31b1c5 100644
--- a/packages/ckeditor5/src/plugins/syntax_highlighting/index.ts
+++ b/packages/ckeditor5/src/plugins/syntax_highlighting/index.ts
@@ -1,10 +1,10 @@
-import type { ModelElement, Position, Writer } from "ckeditor5";
-import type { Node, Editor } from "ckeditor5";
+import type { ModelElement, ModelPosition, Writer } from "ckeditor5";
+import type { ModelNode, Editor } from "ckeditor5";
import { Plugin } from "ckeditor5";
interface SpanStackEntry {
className: string;
- posStart: Position;
+ posStart: ModelPosition;
}
/*
@@ -79,7 +79,7 @@ export default class SyntaxHighlighting extends Plugin {
const changes = document.differ.getChanges();
let dirtyCodeBlocks = new Set<ModelElement>();
- function lookForCodeBlocks(node: ModelElement | Node) {
+ function lookForCodeBlocks(node: ModelElement | ModelNode) {
if (!("getChildren" in node)) {
return;
}
@@ -242,7 +242,7 @@ export default class SyntaxHighlighting extends Plugin {
let spanStack: SpanStackEntry[] = [];
let iChild = -1;
let childText = "";
- let child: Node | null = null;
+ let child: ModelNode | null = null;
let iChildText = 0;
while (iHtml < html.length) {