mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
refactor(ckeditor5): add explicit override
This commit is contained in:
parent
74b7420942
commit
3eddb55aa2
@ -29,7 +29,7 @@ export class CopyToClipboardCommand extends Command {
|
|||||||
|
|
||||||
private executeCallback?: (text: string) => void;
|
private executeCallback?: (text: string) => void;
|
||||||
|
|
||||||
execute(...args: Array<unknown>) {
|
override execute(...args: Array<unknown>) {
|
||||||
const editor = this.editor;
|
const editor = this.editor;
|
||||||
const model = editor.model;
|
const model = editor.model;
|
||||||
const selection = model.document.selection;
|
const selection = model.document.selection;
|
||||||
|
@ -5,7 +5,7 @@ interface FileUploadOpts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class FileUploadCommand extends Command {
|
export default class FileUploadCommand extends Command {
|
||||||
refresh() {
|
override refresh() {
|
||||||
this.isEnabled = true;
|
this.isEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ export default class FileUploadCommand extends Command {
|
|||||||
* @param {Object} options Options for the executed command.
|
* @param {Object} options Options for the executed command.
|
||||||
* @param {File|Array.<File>} options.file The file or an array of files to upload.
|
* @param {File|Array.<File>} options.file The file or an array of files to upload.
|
||||||
*/
|
*/
|
||||||
execute( options: FileUploadOpts ) {
|
override execute( options: FileUploadOpts ) {
|
||||||
const editor = this.editor;
|
const editor = this.editor;
|
||||||
const model = editor.model;
|
const model = editor.model;
|
||||||
|
|
||||||
|
@ -135,14 +135,14 @@ class IncludeNoteEditing extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class InsertIncludeNoteCommand extends Command {
|
class InsertIncludeNoteCommand extends Command {
|
||||||
execute() {
|
override execute() {
|
||||||
const editorEl = this.editor.editing.view.getDomRoot();
|
const editorEl = this.editor.editing.view.getDomRoot();
|
||||||
const component = glob.getComponentByEl(editorEl);
|
const component = glob.getComponentByEl(editorEl);
|
||||||
|
|
||||||
component.triggerCommand('addIncludeNoteToText');
|
component.triggerCommand('addIncludeNoteToText');
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
override refresh() {
|
||||||
const model = this.editor.model;
|
const model = this.editor.model;
|
||||||
const selection = model.document.selection;
|
const selection = model.document.selection;
|
||||||
const firstPosition = selection.getFirstPosition();
|
const firstPosition = selection.getFirstPosition();
|
||||||
|
@ -34,7 +34,7 @@ abstract class MoveBlockUpDownCommand extends Command {
|
|||||||
abstract getSibling(selectedBlock: Element);
|
abstract getSibling(selectedBlock: Element);
|
||||||
abstract get offset(): "before" | "after";
|
abstract get offset(): "before" | "after";
|
||||||
|
|
||||||
refresh() {
|
override refresh() {
|
||||||
const selection = this.editor.model.document.selection;
|
const selection = this.editor.model.document.selection;
|
||||||
const selectedBlocks = this.getSelectedBlocks(selection);
|
const selectedBlocks = this.getSelectedBlocks(selection);
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ abstract class MoveBlockUpDownCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
override execute() {
|
||||||
const model = this.editor.model;
|
const model = this.editor.model;
|
||||||
const selection = model.document.selection;
|
const selection = model.document.selection;
|
||||||
const selectedBlocks = this.getSelectedBlocks(selection);
|
const selectedBlocks = this.getSelectedBlocks(selection);
|
||||||
|
@ -8,7 +8,7 @@ export default class ReferenceLink extends Plugin {
|
|||||||
|
|
||||||
class ReferenceLinkCommand extends Command {
|
class ReferenceLinkCommand extends Command {
|
||||||
|
|
||||||
execute({ href }: { href: string }) {
|
override execute({ href }: { href: string }) {
|
||||||
if (!href?.trim()) {
|
if (!href?.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ class ReferenceLinkCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
override refresh() {
|
||||||
const model = this.editor.model;
|
const model = this.editor.model;
|
||||||
const selection = model.document.selection;
|
const selection = model.document.selection;
|
||||||
this.isEnabled = selection.focus !== null && model.schema.checkChild(selection.focus.parent as Element, 'reference');
|
this.isEnabled = selection.focus !== null && model.schema.checkChild(selection.focus.parent as Element, 'reference');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user