chore(nx/ckeditor): initialize emptyproject for keyboard-marker

This commit is contained in:
Elian Doran
2025-05-04 14:17:47 +03:00
parent c5fc51365d
commit b5fa9f8ea4
29 changed files with 29326 additions and 110 deletions

View File

@@ -0,0 +1,7 @@
import type { KeyboardMarker } from './index.js';
declare module 'ckeditor5' {
interface PluginsMap {
[ KeyboardMarker.pluginName ]: KeyboardMarker;
}
}

View File

@@ -0,0 +1,8 @@
import ckeditor from './../theme/icons/ckeditor.svg';
import './augmentation.js';
export { default as KeyboardMarker } from './keyboardmarker.js';
export const icons = {
ckeditor
};

View File

@@ -0,0 +1,39 @@
import { Plugin, ButtonView } from 'ckeditor5';
import ckeditor5Icon from '../theme/icons/ckeditor.svg';
export default class KeyboardMarker extends Plugin {
public static get pluginName() {
return 'KeyboardMarker' as const;
}
public init(): void {
const editor = this.editor;
const t = editor.t;
const model = editor.model;
// Register the "keyboardMarker" button, so it can be displayed in the toolbar.
editor.ui.componentFactory.add( 'keyboardMarker', locale => {
const view = new ButtonView( locale );
view.set( {
label: t( 'Keyboard marker' ),
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;
} );
}
}