mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	refactor(ckeditor5/codeblock): simplify copy clipboard plugin
This commit is contained in:
		| @@ -3,18 +3,11 @@ import copyIcon from "../icons/copy.svg?raw"; | |||||||
|  |  | ||||||
| export default class CopyToClipboardButton extends Plugin { | export default class CopyToClipboardButton extends Plugin { | ||||||
|  |  | ||||||
|     static get requires() { |  | ||||||
|         return [ CopyToClipboardEditing, CopyToClipboardUI ]; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export class CopyToClipboardUI extends Plugin { |  | ||||||
|  |  | ||||||
|     public init() { |     public init() { | ||||||
|         const editor = this.editor; |         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 => { |         componentFactory.add("copyToClipboard", locale => { | ||||||
|             const button = new ButtonView(locale); |             const button = new ButtonView(locale); | ||||||
|             button.set({ |             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 { | export class CopyToClipboardCommand extends Command { | ||||||
|  |  | ||||||
|     execute(...args: Array<unknown>) { |     execute(...args: Array<unknown>) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user