mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 04:59:04 +01:00
chore(ckeditor5): fix references: Position -> ModelPosition
This commit is contained in:
parent
4ae3272cdf
commit
abafa8c2d2
@ -5,7 +5,7 @@ import { BalloonEditor, DecoupledEditor, FindAndReplaceEditing, FindCommand } fr
|
|||||||
import "./translation_overrides.js";
|
import "./translation_overrides.js";
|
||||||
export { EditorWatchdog } from "ckeditor5";
|
export { EditorWatchdog } from "ckeditor5";
|
||||||
export { PREMIUM_PLUGINS } from "./plugins.js";
|
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 type { TemplateDefinition } from "ckeditor5-premium-features";
|
||||||
export { default as buildExtraCommands } from "./extra_slash_commands.js";
|
export { default as buildExtraCommands } from "./extra_slash_commands.js";
|
||||||
|
|
||||||
|
|||||||
@ -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';
|
import FileUploadCommand from './fileuploadcommand';
|
||||||
|
|
||||||
export default class FileUploadEditing extends Plugin {
|
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 ) => {
|
this.listenTo( editor.plugins.get( Clipboard ), 'inputTransformation', ( evt, data ) => {
|
||||||
const fetchableFiles = Array.from( editor.editing.view.createRangeIn( data.content ) )
|
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 => {
|
.map( value => {
|
||||||
return { promise: fetchLocalFile( value.item ), fileElement: value as unknown as ViewElement };
|
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 ) {
|
function fetchLocalFile( link: ViewItem ) {
|
||||||
return new Promise<File>( ( resolve, reject ) => {
|
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 works asynchronously and so does not block the browser UI when processing data.
|
||||||
fetch( href )
|
fetch( href )
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* https://github.com/zadam/trilium/issues/978
|
* 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 {
|
export default class IndentBlockShortcutPlugin extends Plugin {
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export default class IndentBlockShortcutPlugin extends Plugin {
|
|||||||
|
|
||||||
// in table TAB should switch cells
|
// in table TAB should switch cells
|
||||||
isInTable() {
|
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) {
|
while (el) {
|
||||||
if ("name" in el && el.name === 'tableCell') {
|
if ("name" in el && el.name === 'tableCell') {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* https://github.com/TriliumNext/Trilium/issues/1002
|
* 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 {
|
export default class MoveBlockUpDownPlugin extends Plugin {
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -46,7 +46,7 @@ export default class MoveBlockUpDownPlugin extends Plugin {
|
|||||||
|
|
||||||
abstract class MoveBlockUpDownCommand extends Command {
|
abstract class MoveBlockUpDownCommand extends Command {
|
||||||
|
|
||||||
abstract getSibling(selectedBlock: ModelElement): Node | null;
|
abstract getSibling(selectedBlock: ModelElement): ModelNode | null;
|
||||||
abstract get offset(): "before" | "after";
|
abstract get offset(): "before" | "after";
|
||||||
|
|
||||||
override execute() {
|
override execute() {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import type { ModelElement, Position, Writer } from "ckeditor5";
|
import type { ModelElement, ModelPosition, Writer } from "ckeditor5";
|
||||||
import type { Node, Editor } from "ckeditor5";
|
import type { ModelNode, Editor } from "ckeditor5";
|
||||||
import { Plugin } from "ckeditor5";
|
import { Plugin } from "ckeditor5";
|
||||||
|
|
||||||
interface SpanStackEntry {
|
interface SpanStackEntry {
|
||||||
className: string;
|
className: string;
|
||||||
posStart: Position;
|
posStart: ModelPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -79,7 +79,7 @@ export default class SyntaxHighlighting extends Plugin {
|
|||||||
const changes = document.differ.getChanges();
|
const changes = document.differ.getChanges();
|
||||||
let dirtyCodeBlocks = new Set<ModelElement>();
|
let dirtyCodeBlocks = new Set<ModelElement>();
|
||||||
|
|
||||||
function lookForCodeBlocks(node: ModelElement | Node) {
|
function lookForCodeBlocks(node: ModelElement | ModelNode) {
|
||||||
if (!("getChildren" in node)) {
|
if (!("getChildren" in node)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ export default class SyntaxHighlighting extends Plugin {
|
|||||||
let spanStack: SpanStackEntry[] = [];
|
let spanStack: SpanStackEntry[] = [];
|
||||||
let iChild = -1;
|
let iChild = -1;
|
||||||
let childText = "";
|
let childText = "";
|
||||||
let child: Node | null = null;
|
let child: ModelNode | null = null;
|
||||||
let iChildText = 0;
|
let iChildText = 0;
|
||||||
|
|
||||||
while (iHtml < html.length) {
|
while (iHtml < html.length) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user