mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
chore(ckeditor5-footnotes): initialize empty plugin
This commit is contained in:
7
packages/ckeditor5-footnotes/src/augmentation.ts
Normal file
7
packages/ckeditor5-footnotes/src/augmentation.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Footnotes } from './index.js';
|
||||
|
||||
declare module '@ckeditor/ckeditor5-core' {
|
||||
interface PluginsMap {
|
||||
[ Footnotes.pluginName ]: Footnotes;
|
||||
}
|
||||
}
|
||||
39
packages/ckeditor5-footnotes/src/footnotes.ts
Normal file
39
packages/ckeditor5-footnotes/src/footnotes.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Plugin, ButtonView } from 'ckeditor5';
|
||||
|
||||
import ckeditor5Icon from '../theme/icons/ckeditor.svg';
|
||||
|
||||
export default class Footnotes extends Plugin {
|
||||
public static get pluginName() {
|
||||
return 'Footnotes' as const;
|
||||
}
|
||||
|
||||
public init(): void {
|
||||
const editor = this.editor;
|
||||
const t = editor.t;
|
||||
const model = editor.model;
|
||||
|
||||
// Register the "footnotes" button, so it can be displayed in the toolbar.
|
||||
editor.ui.componentFactory.add( 'footnotes', locale => {
|
||||
const view = new ButtonView( locale );
|
||||
|
||||
view.set( {
|
||||
label: t( 'Footnotes' ),
|
||||
icon: ckeditor5Icon,
|
||||
tooltip: true
|
||||
} );
|
||||
|
||||
// Insert a text into the editor after clicking the button.
|
||||
this.listenTo( view, 'execute', () => {
|
||||
model.change( writer => {
|
||||
const textNode = writer.createText( 'Hello CKEditor 5!' );
|
||||
|
||||
model.insertContent( textNode );
|
||||
} );
|
||||
|
||||
editor.editing.view.focus();
|
||||
} );
|
||||
|
||||
return view;
|
||||
} );
|
||||
}
|
||||
}
|
||||
8
packages/ckeditor5-footnotes/src/index.ts
Normal file
8
packages/ckeditor5-footnotes/src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import ckeditor from './../theme/icons/ckeditor.svg';
|
||||
import './augmentation.js';
|
||||
|
||||
export { default as Footnotes } from './footnotes.js';
|
||||
|
||||
export const icons = {
|
||||
ckeditor
|
||||
};
|
||||
Reference in New Issue
Block a user