2022-02-05 18:15:58 -05:00
|
|
|
/**
|
|
|
|
* @param {Editor} editor
|
|
|
|
*/
|
2023-04-19 05:46:13 -04:00
|
|
|
function register(editor) {
|
2023-04-18 17:20:02 -04:00
|
|
|
editor.addCommand('InsertHorizontalRule', () => {
|
|
|
|
const hrElem = document.createElement('hr');
|
|
|
|
const cNode = editor.selection.getNode();
|
|
|
|
const {parentNode} = cNode;
|
2022-02-05 18:15:58 -05:00
|
|
|
parentNode.insertBefore(hrElem, cNode);
|
|
|
|
});
|
|
|
|
|
2022-11-10 08:30:48 -05:00
|
|
|
editor.ui.registry.addButton('customhr', {
|
2022-02-05 18:15:58 -05:00
|
|
|
icon: 'horizontal-rule',
|
2022-02-06 16:17:08 -05:00
|
|
|
tooltip: 'Insert horizontal line',
|
2022-02-05 18:15:58 -05:00
|
|
|
onAction() {
|
|
|
|
editor.execCommand('InsertHorizontalRule');
|
2023-04-18 17:20:02 -04:00
|
|
|
},
|
2022-02-05 18:15:58 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return {register}
|
|
|
|
*/
|
2023-04-19 05:46:13 -04:00
|
|
|
export function getPlugin() {
|
2022-02-05 18:15:58 -05:00
|
|
|
return register;
|
2023-04-18 17:20:02 -04:00
|
|
|
}
|