mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
refactor(ckeditor5/codeblock): simplify copy clipboard plugin
This commit is contained in:
parent
a77d89f4c7
commit
622d026efc
@ -3,18 +3,11 @@ import copyIcon from "../icons/copy.svg?raw";
|
||||
|
||||
export default class CopyToClipboardButton extends Plugin {
|
||||
|
||||
static get requires() {
|
||||
return [ CopyToClipboardEditing, CopyToClipboardUI ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class CopyToClipboardUI extends Plugin {
|
||||
|
||||
public init() {
|
||||
const editor = this.editor;
|
||||
const componentFactory = editor.ui.componentFactory;
|
||||
editor.commands.add("copyToClipboard", new CopyToClipboardCommand(this.editor));
|
||||
|
||||
const componentFactory = editor.ui.componentFactory;
|
||||
componentFactory.add("copyToClipboard", locale => {
|
||||
const button = new ButtonView(locale);
|
||||
button.set({
|
||||
@ -32,14 +25,6 @@ export class CopyToClipboardUI extends Plugin {
|
||||
|
||||
}
|
||||
|
||||
export class CopyToClipboardEditing extends Plugin {
|
||||
|
||||
public init() {
|
||||
this.editor.commands.add("copyToClipboard", new CopyToClipboardCommand(this.editor));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class CopyToClipboardCommand extends Command {
|
||||
|
||||
execute(...args: Array<unknown>) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user