Mercurial Hosting > sceditor
diff src/icons/material.js @ 13:8d32537e0ca7
icons again
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 07 Aug 2022 14:28:14 -0600 |
parents | 73d62b7a0713 |
children |
line wrap: on
line diff
--- a/src/icons/material.js Sun Aug 07 13:58:27 2022 -0600 +++ b/src/icons/material.js Sun Aug 07 14:28:14 2022 -0600 @@ -77,56 +77,53 @@ 'youtube': '<path d="M10,16.5V7.5L16,12M20,4.4C19.4,4.2 15.7,4 12,4C8.3,4 4.6,4.19 4,4.38C2.44,4.9 2,8.4 2,12C2,15.59 2.44,19.1 4,19.61C4.6,19.81 8.3,20 12,20C15.7,20 19.4,19.81 20,19.61C21.56,19.1 22,15.59 22,12C22,8.4 21.56,4.91 20,4.4Z" />' }; - sceditor.icons.fn = function () { - var nodes = {}; + var nodes = {}; - var colorPath; + var colorPath; - return { - create: function (command) { - if (command in icons) { - // Using viewbox="1 1 22 22" to trim off the 1 unit border - // around the SVG icons. - // Default is viewbox="0 0 24 24" - nodes[command] = sceditor.dom.parseHTML( - '<svg xmlns="http://www.w3.org/2000/svg" ' + - 'viewbox="1 1 22 22" unselectable="on">' + - icons[command] + - '</svg>' - ).firstChild; + sceditor.icons = { + create: function (command) { + if (command in icons) { + // Using viewbox="1 1 22 22" to trim off the 1 unit border + // around the SVG icons. + // Default is viewbox="0 0 24 24" + nodes[command] = sceditor.dom.parseHTML( + '<svg xmlns="http://www.w3.org/2000/svg" ' + + 'viewbox="1 1 22 22" unselectable="on">' + + icons[command] + + '</svg>' + ).firstChild; - if (command === 'color') { - colorPath = nodes[command].querySelector('.sce-color'); - } + if (command === 'color') { + colorPath = nodes[command].querySelector('.sce-color'); + } + } + + return nodes[command]; + }, + update: function (isSourceMode, currentNode) { + if (colorPath) { + var color = 'inherit'; + + if (!isSourceMode && currentNode) { + color = currentNode.ownerDocument + .queryCommandValue('forecolor'); } - return nodes[command]; - }, - update: function (isSourceMode, currentNode) { - if (colorPath) { - var color = 'inherit'; + dom.css(colorPath, 'fill', color); + } + }, + rtl: function (isRtl) { + var gripNode = nodes.grip; - if (!isSourceMode && currentNode) { - color = currentNode.ownerDocument - .queryCommandValue('forecolor'); - } + if (gripNode) { + var transform = isRtl ? 'scaleX(-1)' : ''; - dom.css(colorPath, 'fill', color); - } - }, - rtl: function (isRtl) { - var gripNode = nodes.grip; - - if (gripNode) { - var transform = isRtl ? 'scaleX(-1)' : ''; - - dom.css(gripNode, 'transform', transform); - dom.css(gripNode, 'msTransform', transform); - dom.css(gripNode, 'webkitTransform', transform); - } + dom.css(gripNode, 'transform', transform); + dom.css(gripNode, 'msTransform', transform); + dom.css(gripNode, 'webkitTransform', transform); } - }; + }, + icons: icons }; - - sceditor.icons.icons = icons; })(document, sceditor);