mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
feat(insert time): change file name
This commit is contained in:
31
packages/ckeditor5/src/plugins/insert_date_time.ts
Normal file
31
packages/ckeditor5/src/plugins/insert_date_time.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ButtonView, Plugin } from 'ckeditor5';
|
||||
import dateTimeIcon from '../icons/date-time.svg?raw';
|
||||
|
||||
export default class InsertDateTimePlugin extends Plugin {
|
||||
init() {
|
||||
const editor = this.editor;
|
||||
|
||||
editor.ui.componentFactory.add('dateTime', locale => {
|
||||
const view = new ButtonView( locale );
|
||||
|
||||
view.set( {
|
||||
label: 'Date time',
|
||||
icon: dateTimeIcon,
|
||||
tooltip: true
|
||||
} );
|
||||
|
||||
// enable internal link only if the editor is not read only
|
||||
view.bind('isEnabled').to(editor, 'isReadOnly', isReadOnly => !isReadOnly);
|
||||
|
||||
view.on('execute', () => {
|
||||
const editorEl = editor.editing.view.getDomRoot();
|
||||
const component = glob.getComponentByEl(editorEl);
|
||||
|
||||
component.triggerCommand('insertDateTimeToText');
|
||||
editor.editing.view.focus();
|
||||
} );
|
||||
|
||||
return view;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user