Mercurial Hosting > sceditor
diff src/plugins/alternative-lists.js @ 30:db061869f28f
remove sceditor.command, add options.onCreate
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 12 Aug 2022 00:54:39 -0600 |
parents | ea32a44b5a6e |
children |
line wrap: on
line diff
--- a/src/plugins/alternative-lists.js Thu Aug 11 19:54:03 2022 -0600 +++ b/src/plugins/alternative-lists.js Fri Aug 12 00:54:39 2022 -0600 @@ -34,7 +34,6 @@ */ var bulletHandler; var orderedHandler; - var insertListTag; base.init = function (editor) { var opts = editor.opts; @@ -45,8 +44,8 @@ } // Override only txtExec implementation - sceditor.command.get('orderedlist').txtExec = orderedHandler; - sceditor.command.get('bulletlist').txtExec = bulletHandler; + editor.commands.orderedlist.txtExec = orderedHandler; + editor.commands.bulletlist.txtExec = bulletHandler; // Override current implementation sceditor.formats.bbcode.set('list', { @@ -119,10 +118,10 @@ }); }; - insertListTag = function (editor, listType, selected) { - var content = ''; + function insertListTag(editor, listType, selected) { + let content = ''; - utils.each(selected.split(/\r?\n/), function (item) { + utils.each(selected.split(/\r?\n/), function (_, item) { content += (content ? '\n' : '') + '[*]' + item; }); @@ -141,17 +140,11 @@ * @param {node} caller * @private */ - orderedHandler = function (caller, selected) { -console.log('a'); - var editor = this; - + orderedHandler = function (editor, caller, selected) { insertListTag(editor, '1', selected); }; - bulletHandler = function (caller, selected) { -console.log('b'); - var editor = this; - + bulletHandler = function (editor, caller, selected) { insertListTag(editor, '', selected); };