mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Editors: Added lexical editor for testing
Started basic playground for testing lexical as a new WYSIWYG editor. Moved out tinymce to be under wysiwyg-tinymce instead so lexical is the default, but TinyMce code remains.
This commit is contained in:
26
resources/js/wysiwyg-tinymce/plugins-customhr.js
Normal file
26
resources/js/wysiwyg-tinymce/plugins-customhr.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @param {Editor} editor
|
||||
*/
|
||||
function register(editor) {
|
||||
editor.addCommand('InsertHorizontalRule', () => {
|
||||
const hrElem = document.createElement('hr');
|
||||
const cNode = editor.selection.getNode();
|
||||
const {parentNode} = cNode;
|
||||
parentNode.insertBefore(hrElem, cNode);
|
||||
});
|
||||
|
||||
editor.ui.registry.addButton('customhr', {
|
||||
icon: 'horizontal-rule',
|
||||
tooltip: 'Insert horizontal line',
|
||||
onAction() {
|
||||
editor.execCommand('InsertHorizontalRule');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {register}
|
||||
*/
|
||||
export function getPlugin() {
|
||||
return register;
|
||||
}
|
Reference in New Issue
Block a user