Mercurial Hosting > sceditor
diff src/sceditor.js @ 13:8d32537e0ca7
icons again
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 07 Aug 2022 14:28:14 -0600 |
parents | 933a459aa182 |
children | ea930990b601 |
line wrap: on
line diff
--- a/src/sceditor.js Sun Aug 07 13:58:27 2022 -0600 +++ b/src/sceditor.js Sun Aug 07 14:28:14 2022 -0600 @@ -5724,7 +5724,13 @@ * @type {?Object} * @private */ - var icons; + let icons = sceditor.icons; + if(!icons) { + let cssUrl = baseUrl + 'icons/famfamfam/famfamfam.css'; + let html = '<style>@import "' + cssUrl + '";</style>'; + document.head.insertAdjacentHTML('beforeend',html); + sceditor.icons = icons = {}; + } /** * Private functions @@ -6138,8 +6144,6 @@ unselectable: 'on' }); - icons = SCEditor.icons.fn(); - each(groups, function (_, menuItems) { group = createElement('div', { className: 'sceditor-group' @@ -6161,7 +6165,7 @@ command.tooltip || commandName) }, true).firstChild; - if (icons && icons.create) { + if (icons.create) { var icon = icons.create(commandName); if (icon) { insertBefore(icons.create(commandName), @@ -6316,7 +6320,7 @@ e.preventDefault(); }; - if (icons && icons.create) { + if (icons.create) { var icon = icons.create('grip'); if (icon) { appendChild(grip, icon); @@ -6510,7 +6514,7 @@ removeClass(editorContainer, 'ltr'); addClass(editorContainer, dir); - if (icons && icons.rtl) { + if (icons.rtl) { icons.rtl(rtl); } @@ -7895,7 +7899,7 @@ toggleClass(btn, activeClass, state > 0); } - if (icons && icons.update) { + if (icons.update) { icons.update(isSource, parent, firstBlock); } }; @@ -8930,15 +8934,6 @@ SCEditor.locale = {}; SCEditor.formats = {}; - SCEditor.icons = {}; - - // default icons - SCEditor.icons.fn = function() { - let cssUrl = baseUrl + 'icons/famfamfam/famfamfam.css'; - let html = '<style>@import "' + cssUrl + '";</style>'; - document.head.insertAdjacentHTML('beforeend',html); - return {}; - }; /** @@ -9072,7 +9067,6 @@ hasStyle: hasStyle }, locale: SCEditor.locale, - icons: SCEditor.icons, utils: { each: each, isEmptyObject: isEmptyObject,