Mercurial Hosting > sceditor
comparison 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 |
comparison
equal
deleted
inserted
replaced
12:933a459aa182 | 13:8d32537e0ca7 |
---|---|
75 // Austin Andrews @Templarian - https://materialdesignicons.com/ | 75 // Austin Andrews @Templarian - https://materialdesignicons.com/ |
76 'unlink': '<path d="M2,5.27L3.28,4L20,20.72L18.73,22L14.73,18H13V16.27L9.73,13H8V11.27L5.5,8.76C4.5,9.5 3.9,10.68 3.9,12C3.9,14.26 5.74,16.1 8,16.1H11V18H8A6,6 0 0,1 2,12C2,10.16 2.83,8.5 4.14,7.41L2,5.27M16,6A6,6 0 0,1 22,12C22,14.21 20.8,16.15 19,17.19L17.6,15.77C19.07,15.15 20.1,13.7 20.1,12C20.1,9.73 18.26,7.9 16,7.9H13V6H16M8,6H11V7.9H9.72L7.82,6H8M16,11V13H14.82L12.82,11H16Z" />', | 76 'unlink': '<path d="M2,5.27L3.28,4L20,20.72L18.73,22L14.73,18H13V16.27L9.73,13H8V11.27L5.5,8.76C4.5,9.5 3.9,10.68 3.9,12C3.9,14.26 5.74,16.1 8,16.1H11V18H8A6,6 0 0,1 2,12C2,10.16 2.83,8.5 4.14,7.41L2,5.27M16,6A6,6 0 0,1 22,12C22,14.21 20.8,16.15 19,17.19L17.6,15.77C19.07,15.15 20.1,13.7 20.1,12C20.1,9.73 18.26,7.9 16,7.9H13V6H16M8,6H11V7.9H9.72L7.82,6H8M16,11V13H14.82L12.82,11H16Z" />', |
77 '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" />' | 77 '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" />' |
78 }; | 78 }; |
79 | 79 |
80 sceditor.icons.fn = function () { | 80 var nodes = {}; |
81 var nodes = {}; | |
82 | 81 |
83 var colorPath; | 82 var colorPath; |
84 | 83 |
85 return { | 84 sceditor.icons = { |
86 create: function (command) { | 85 create: function (command) { |
87 if (command in icons) { | 86 if (command in icons) { |
88 // Using viewbox="1 1 22 22" to trim off the 1 unit border | 87 // Using viewbox="1 1 22 22" to trim off the 1 unit border |
89 // around the SVG icons. | 88 // around the SVG icons. |
90 // Default is viewbox="0 0 24 24" | 89 // Default is viewbox="0 0 24 24" |
91 nodes[command] = sceditor.dom.parseHTML( | 90 nodes[command] = sceditor.dom.parseHTML( |
92 '<svg xmlns="http://www.w3.org/2000/svg" ' + | 91 '<svg xmlns="http://www.w3.org/2000/svg" ' + |
93 'viewbox="1 1 22 22" unselectable="on">' + | 92 'viewbox="1 1 22 22" unselectable="on">' + |
94 icons[command] + | 93 icons[command] + |
95 '</svg>' | 94 '</svg>' |
96 ).firstChild; | 95 ).firstChild; |
97 | 96 |
98 if (command === 'color') { | 97 if (command === 'color') { |
99 colorPath = nodes[command].querySelector('.sce-color'); | 98 colorPath = nodes[command].querySelector('.sce-color'); |
100 } | 99 } |
100 } | |
101 | |
102 return nodes[command]; | |
103 }, | |
104 update: function (isSourceMode, currentNode) { | |
105 if (colorPath) { | |
106 var color = 'inherit'; | |
107 | |
108 if (!isSourceMode && currentNode) { | |
109 color = currentNode.ownerDocument | |
110 .queryCommandValue('forecolor'); | |
101 } | 111 } |
102 | 112 |
103 return nodes[command]; | 113 dom.css(colorPath, 'fill', color); |
104 }, | 114 } |
105 update: function (isSourceMode, currentNode) { | 115 }, |
106 if (colorPath) { | 116 rtl: function (isRtl) { |
107 var color = 'inherit'; | 117 var gripNode = nodes.grip; |
108 | 118 |
109 if (!isSourceMode && currentNode) { | 119 if (gripNode) { |
110 color = currentNode.ownerDocument | 120 var transform = isRtl ? 'scaleX(-1)' : ''; |
111 .queryCommandValue('forecolor'); | |
112 } | |
113 | 121 |
114 dom.css(colorPath, 'fill', color); | 122 dom.css(gripNode, 'transform', transform); |
115 } | 123 dom.css(gripNode, 'msTransform', transform); |
116 }, | 124 dom.css(gripNode, 'webkitTransform', transform); |
117 rtl: function (isRtl) { | |
118 var gripNode = nodes.grip; | |
119 | |
120 if (gripNode) { | |
121 var transform = isRtl ? 'scaleX(-1)' : ''; | |
122 | |
123 dom.css(gripNode, 'transform', transform); | |
124 dom.css(gripNode, 'msTransform', transform); | |
125 dom.css(gripNode, 'webkitTransform', transform); | |
126 } | |
127 } | 125 } |
128 }; | 126 }, |
127 icons: icons | |
129 }; | 128 }; |
130 | |
131 sceditor.icons.icons = icons; | |
132 })(document, sceditor); | 129 })(document, sceditor); |