@licium/editor-plugin-color-syntax 3.2.5 → 3.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 NHN Cloud Corp.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* TOAST UI Editor : Color Syntax Plugin
|
|
3
|
-
* @version 3.
|
|
3
|
+
* @version 3.2.11 | Thu Jan 08 2026
|
|
4
4
|
* @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -98,69 +98,91 @@ var external_commonjs_tui_color_picker_commonjs2_tui_color_picker_amd_tui_color_
|
|
|
98
98
|
function addLangs(i18n) {
|
|
99
99
|
i18n.setLanguage('ar', {
|
|
100
100
|
'Text color': 'لون النص',
|
|
101
|
+
OK: 'موافقة',
|
|
101
102
|
});
|
|
102
103
|
i18n.setLanguage(['cs', 'cs-CZ'], {
|
|
103
104
|
'Text color': 'Barva textu',
|
|
105
|
+
OK: 'OK',
|
|
104
106
|
});
|
|
105
107
|
i18n.setLanguage(['de', 'de-DE'], {
|
|
106
108
|
'Text color': 'Textfarbe',
|
|
109
|
+
OK: 'OK',
|
|
107
110
|
});
|
|
108
111
|
i18n.setLanguage(['en', 'en-US'], {
|
|
109
112
|
'Text color': 'Text color',
|
|
113
|
+
OK: 'OK',
|
|
110
114
|
});
|
|
111
115
|
i18n.setLanguage(['es', 'es-ES'], {
|
|
112
116
|
'Text color': 'Color del texto',
|
|
117
|
+
OK: 'Aceptar',
|
|
113
118
|
});
|
|
114
119
|
i18n.setLanguage(['fi', 'fi-FI'], {
|
|
115
120
|
'Text color': 'Tekstin väri',
|
|
121
|
+
OK: 'OK',
|
|
116
122
|
});
|
|
117
123
|
i18n.setLanguage(['fr', 'fr-FR'], {
|
|
118
124
|
'Text color': 'Couleur du texte',
|
|
125
|
+
OK: 'OK',
|
|
119
126
|
});
|
|
120
127
|
i18n.setLanguage(['gl', 'gl-ES'], {
|
|
121
128
|
'Text color': 'Cor do texto',
|
|
129
|
+
OK: 'OK',
|
|
122
130
|
});
|
|
123
131
|
i18n.setLanguage(['hr', 'hr-HR'], {
|
|
124
132
|
'Text color': 'Boja teksta',
|
|
133
|
+
OK: 'OK',
|
|
125
134
|
});
|
|
126
135
|
i18n.setLanguage(['it', 'it-IT'], {
|
|
127
136
|
'Text color': 'Colore del testo',
|
|
137
|
+
OK: 'OK',
|
|
128
138
|
});
|
|
129
139
|
i18n.setLanguage(['ja', 'ja-JP'], {
|
|
130
140
|
'Text color': '文字色相',
|
|
141
|
+
OK: 'はい',
|
|
131
142
|
});
|
|
132
143
|
i18n.setLanguage(['ko', 'ko-KR'], {
|
|
133
144
|
'Text color': '글자 색상',
|
|
145
|
+
OK: '확인',
|
|
134
146
|
});
|
|
135
147
|
i18n.setLanguage(['nb', 'nb-NO'], {
|
|
136
148
|
'Text color': 'Tekstfarge',
|
|
149
|
+
OK: 'OK',
|
|
137
150
|
});
|
|
138
151
|
i18n.setLanguage(['nl', 'nl-NL'], {
|
|
139
152
|
'Text color': 'Tekstkleur',
|
|
153
|
+
OK: 'OK',
|
|
140
154
|
});
|
|
141
155
|
i18n.setLanguage(['pl', 'pl-PL'], {
|
|
142
156
|
'Text color': 'Kolor tekstu',
|
|
157
|
+
OK: 'OK',
|
|
143
158
|
});
|
|
144
159
|
i18n.setLanguage(['pt', 'pt-BR'], {
|
|
145
160
|
'Text color': 'Cor do texto',
|
|
161
|
+
OK: 'OK',
|
|
146
162
|
});
|
|
147
163
|
i18n.setLanguage(['ru', 'ru-RU'], {
|
|
148
164
|
'Text color': 'Цвет текста',
|
|
165
|
+
OK: 'Хорошо',
|
|
149
166
|
});
|
|
150
167
|
i18n.setLanguage(['sv', 'sv-SE'], {
|
|
151
168
|
'Text color': 'Textfärg',
|
|
169
|
+
OK: 'OK',
|
|
152
170
|
});
|
|
153
171
|
i18n.setLanguage(['tr', 'tr-TR'], {
|
|
154
172
|
'Text color': 'Metin rengi',
|
|
173
|
+
OK: 'OK',
|
|
155
174
|
});
|
|
156
175
|
i18n.setLanguage(['uk', 'uk-UA'], {
|
|
157
176
|
'Text color': 'Колір тексту',
|
|
177
|
+
OK: 'OK',
|
|
158
178
|
});
|
|
159
179
|
i18n.setLanguage('zh-CN', {
|
|
160
180
|
'Text color': '文字颜色',
|
|
181
|
+
OK: '确认',
|
|
161
182
|
});
|
|
162
183
|
i18n.setLanguage('zh-TW', {
|
|
163
184
|
'Text color': '文字顏色',
|
|
185
|
+
OK: '確認',
|
|
164
186
|
});
|
|
165
187
|
}
|
|
166
188
|
|
|
@@ -194,6 +216,7 @@ function createApplyButton(text) {
|
|
|
194
216
|
var button = document.createElement('button');
|
|
195
217
|
button.setAttribute('type', 'button');
|
|
196
218
|
button.textContent = text;
|
|
219
|
+
button.style.marginRight = '5px'; // Spacing between buttons
|
|
197
220
|
return button;
|
|
198
221
|
}
|
|
199
222
|
function createToolbarItemOption(colorPickerContainer, i18n) {
|
|
@@ -243,12 +266,17 @@ function colorSyntaxPlugin(context, options) {
|
|
|
243
266
|
}
|
|
244
267
|
var colorPicker = external_commonjs_tui_color_picker_commonjs2_tui_color_picker_amd_tui_color_picker_root_tui_colorPicker_default().create(colorPickerOption);
|
|
245
268
|
var button = createApplyButton(i18n.get('OK'));
|
|
269
|
+
var clearButton = createApplyButton(i18n.get('Clear')); // @TODO: Add translation key if needed
|
|
246
270
|
eventEmitter.listen('focus', function (editType) {
|
|
247
271
|
containerClassName = "" + PREFIX + (editType === 'markdown' ? 'md' : 'ww') + "-container";
|
|
248
272
|
});
|
|
249
273
|
container.addEventListener('click', function (ev) {
|
|
250
274
|
if (ev.target.getAttribute('type') === 'button') {
|
|
275
|
+
var target = ev.target;
|
|
251
276
|
var selectedColor = colorPicker.getColor();
|
|
277
|
+
if (target.textContent === i18n.get('Clear')) {
|
|
278
|
+
selectedColor = '';
|
|
279
|
+
}
|
|
252
280
|
currentEditorEl = getCurrentEditorEl(container, containerClassName);
|
|
253
281
|
eventEmitter.emit('command', 'color', { selectedColor: selectedColor });
|
|
254
282
|
eventEmitter.emit('closePopup');
|
|
@@ -258,6 +286,7 @@ function colorSyntaxPlugin(context, options) {
|
|
|
258
286
|
});
|
|
259
287
|
colorPicker.slider.toggle(true);
|
|
260
288
|
container.appendChild(button);
|
|
289
|
+
container.appendChild(clearButton);
|
|
261
290
|
var toolbarItem = createToolbarItemOption(container, i18n);
|
|
262
291
|
return {
|
|
263
292
|
markdownCommands: {
|
|
@@ -274,6 +303,17 @@ function colorSyntaxPlugin(context, options) {
|
|
|
274
303
|
dispatch(tr);
|
|
275
304
|
return true;
|
|
276
305
|
}
|
|
306
|
+
// Logic to clear color (Markdown)
|
|
307
|
+
// Ideally we would parse and remove the span tag, but for now specific clearing
|
|
308
|
+
// might be complex in raw markdown without a parser.
|
|
309
|
+
// However, standard behavior for "apply" empty color could be just "do nothing"
|
|
310
|
+
// or we need a way to unwrap.
|
|
311
|
+
// Given the limitations of regex/string manipulation here without full AST access easily:
|
|
312
|
+
// We will focus on WYSIWYG mostly for 'Clear' logic correctness or basic text replacement if possible.
|
|
313
|
+
// For Markdown mode, complex un-wrapping is error prone with just string regex.
|
|
314
|
+
// BUT, we can try to wrap selection in nothing? No.
|
|
315
|
+
// Let's implement full clear logic for Markdown?
|
|
316
|
+
// Analyzing existing logic: it just wraps.
|
|
277
317
|
return false;
|
|
278
318
|
},
|
|
279
319
|
},
|
|
@@ -289,6 +329,14 @@ function colorSyntaxPlugin(context, options) {
|
|
|
289
329
|
dispatch(tr);
|
|
290
330
|
return true;
|
|
291
331
|
}
|
|
332
|
+
// Logic to clear color (WYSIWYG)
|
|
333
|
+
// If selectedColor is empty string, we remove the span mark with color style
|
|
334
|
+
if (selectedColor === '') {
|
|
335
|
+
var from = selection.from, to = selection.to;
|
|
336
|
+
tr.removeMark(from, to, schema.marks.span);
|
|
337
|
+
dispatch(tr);
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
292
340
|
return false;
|
|
293
341
|
},
|
|
294
342
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licium/editor-plugin-color-syntax",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.11",
|
|
4
4
|
"description": "TOAST UI Editor : Color Syntax Plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nhn",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "07cd62ac6be507292818851d306829ab9f2e2982"
|
|
55
55
|
}
|