mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-29 20:23:52 +08:00
e711290d8b
Had to do some manual fixing of the app.js file due to misplaced comments
29 lines
693 B
JavaScript
29 lines
693 B
JavaScript
/**
|
|
* @param {Editor} editor
|
|
* @param {String} url
|
|
*/
|
|
function register(editor, url) {
|
|
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');
|
|
},
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @param {WysiwygConfigOptions} options
|
|
* @return {register}
|
|
*/
|
|
export function getPlugin(options) {
|
|
return register;
|
|
}
|