mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 08:54:33 +08:00
Added custom, More consistent hr insertion
Since the previous hr plugin caused large empty p tags
This commit is contained in:
@ -198,6 +198,30 @@ module.exports = function (ngApp, events) {
|
||||
}
|
||||
|
||||
scope.tinymce.extraSetups.push(tinyMceSetup);
|
||||
|
||||
// Custom tinyMCE plugins
|
||||
tinymce.PluginManager.add('customhr', function(editor) {
|
||||
editor.addCommand('InsertHorizontalRule', function() {
|
||||
var hrElem = document.createElement('hr');
|
||||
var cNode = editor.selection.getNode();
|
||||
var parentNode = cNode.parentNode;
|
||||
parentNode.insertBefore(hrElem, cNode);
|
||||
});
|
||||
|
||||
editor.addButton('hr', {
|
||||
icon: 'hr',
|
||||
tooltip: 'Horizontal line',
|
||||
cmd: 'InsertHorizontalRule'
|
||||
});
|
||||
|
||||
editor.addMenuItem('hr', {
|
||||
icon: 'hr',
|
||||
text: 'Horizontal line',
|
||||
cmd: 'InsertHorizontalRule',
|
||||
context: 'insert'
|
||||
});
|
||||
});
|
||||
|
||||
tinymce.init(scope.tinymce);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user