2022-02-05 18:15:58 -05:00
|
|
|
/**
|
|
|
|
* @param {Editor} editor
|
|
|
|
* @param {String} url
|
|
|
|
*/
|
|
|
|
function register(editor, url) {
|
|
|
|
editor.addCommand('InsertHorizontalRule', function () {
|
|
|
|
let hrElem = document.createElement('hr');
|
|
|
|
let cNode = editor.selection.getNode();
|
|
|
|
let parentNode = cNode.parentNode;
|
|
|
|
parentNode.insertBefore(hrElem, cNode);
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.ui.registry.addButton('hr', {
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {WysiwygConfigOptions} options
|
|
|
|
* @return {register}
|
|
|
|
*/
|
|
|
|
export function getPlugin(options) {
|
|
|
|
return register;
|
|
|
|
}
|