mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-10-31 03:50:27 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			617 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			617 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * @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;
 | |
| }
 |