@ckeditor/ckeditor5-basic-styles 0.0.0-nightly-20240602.0 → 0.0.0-nightly-20240604.0
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/README.md +0 -6
- package/dist/index.js +154 -268
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6,53 +6,35 @@ import { Command, Plugin, icons } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
|
6
6
|
import { ButtonView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
7
7
|
import { TwoStepCaretMovement, inlineHighlight } from '@ckeditor/ckeditor5-typing/dist/index.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
* An extension of the base {@link module:core/command~Command} class, which provides utilities for a command
|
|
11
|
-
* that toggles a single attribute on a text or an element.
|
|
12
|
-
*
|
|
13
|
-
* `AttributeCommand` uses {@link module:engine/model/document~Document#selection}
|
|
14
|
-
* to decide which nodes (if any) should be changed, and applies or removes the attribute from them.
|
|
15
|
-
*
|
|
16
|
-
* The command checks the {@link module:engine/model/model~Model#schema} to decide if it can be enabled
|
|
17
|
-
* for the current selection and to which nodes the attribute can be applied.
|
|
18
|
-
*/ class AttributeCommand extends Command {
|
|
19
|
-
/**
|
|
20
|
-
* The attribute that will be set by the command.
|
|
21
|
-
*/ attributeKey;
|
|
22
|
-
/**
|
|
23
|
-
* @param attributeKey Attribute that will be set by the command.
|
|
24
|
-
*/ constructor(editor, attributeKey){
|
|
25
|
-
super(editor);
|
|
26
|
-
this.attributeKey = attributeKey;
|
|
27
|
-
}
|
|
9
|
+
class AttributeCommand extends Command {
|
|
28
10
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
* Updates the command's {@link #value} and {@link #isEnabled} based on the current selection.
|
|
12
|
+
*/ refresh() {
|
|
31
13
|
const model = this.editor.model;
|
|
32
14
|
const doc = model.document;
|
|
33
15
|
this.value = this._getValueFromFirstAllowedNode();
|
|
34
16
|
this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);
|
|
35
17
|
}
|
|
36
18
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
19
|
+
* Executes the command – applies the attribute to the selection or removes it from the selection.
|
|
20
|
+
*
|
|
21
|
+
* If the command is active (`value == true`), it will remove attributes. Otherwise, it will set attributes.
|
|
22
|
+
*
|
|
23
|
+
* The execution result differs, depending on the {@link module:engine/model/document~Document#selection}:
|
|
24
|
+
*
|
|
25
|
+
* * If the selection is on a range, the command applies the attribute to all nodes in that range
|
|
26
|
+
* (if they are allowed to have this attribute by the {@link module:engine/model/schema~Schema schema}).
|
|
27
|
+
* * If the selection is collapsed in a non-empty node, the command applies the attribute to the
|
|
28
|
+
* {@link module:engine/model/document~Document#selection} itself (note that typed characters copy attributes from the selection).
|
|
29
|
+
* * If the selection is collapsed in an empty node, the command applies the attribute to the parent node of the selection (note
|
|
30
|
+
* that the selection inherits all attributes from a node if it is in an empty node).
|
|
31
|
+
*
|
|
32
|
+
* @fires execute
|
|
33
|
+
* @param options Command options.
|
|
34
|
+
* @param options.forceValue If set, it will force the command behavior. If `true`,
|
|
35
|
+
* the command will apply the attribute, otherwise the command will remove the attribute.
|
|
36
|
+
* If not set, the command will look for its current value to decide what it should do.
|
|
37
|
+
*/ execute(options = {}) {
|
|
56
38
|
const model = this.editor.model;
|
|
57
39
|
const doc = model.document;
|
|
58
40
|
const selection = doc.selection;
|
|
@@ -77,11 +59,11 @@ import { TwoStepCaretMovement, inlineHighlight } from '@ckeditor/ckeditor5-typin
|
|
|
77
59
|
});
|
|
78
60
|
}
|
|
79
61
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
62
|
+
* Checks the attribute value of the first node in the selection that allows the attribute.
|
|
63
|
+
* For the collapsed selection returns the selection attribute.
|
|
64
|
+
*
|
|
65
|
+
* @returns The attribute value.
|
|
66
|
+
*/ _getValueFromFirstAllowedNode() {
|
|
85
67
|
const model = this.editor.model;
|
|
86
68
|
const schema = model.schema;
|
|
87
69
|
const selection = model.document.selection;
|
|
@@ -97,23 +79,24 @@ import { TwoStepCaretMovement, inlineHighlight } from '@ckeditor/ckeditor5-typin
|
|
|
97
79
|
}
|
|
98
80
|
return false;
|
|
99
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* @param attributeKey Attribute that will be set by the command.
|
|
84
|
+
*/ constructor(editor, attributeKey){
|
|
85
|
+
super(editor);
|
|
86
|
+
this.attributeKey = attributeKey;
|
|
87
|
+
}
|
|
100
88
|
}
|
|
101
89
|
|
|
102
90
|
const BOLD$1 = 'bold';
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* as a `<strong>` element.
|
|
108
|
-
*/ class BoldEditing extends Plugin {
|
|
109
|
-
/**
|
|
110
|
-
* @inheritDoc
|
|
111
|
-
*/ static get pluginName() {
|
|
91
|
+
class BoldEditing extends Plugin {
|
|
92
|
+
/**
|
|
93
|
+
* @inheritDoc
|
|
94
|
+
*/ static get pluginName() {
|
|
112
95
|
return 'BoldEditing';
|
|
113
96
|
}
|
|
114
97
|
/**
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
* @inheritDoc
|
|
99
|
+
*/ init() {
|
|
117
100
|
const editor = this.editor;
|
|
118
101
|
const t = this.editor.t;
|
|
119
102
|
// Allow bold attribute on text nodes.
|
|
@@ -168,8 +151,6 @@ const BOLD$1 = 'bold';
|
|
|
168
151
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
169
152
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
170
153
|
*/ /**
|
|
171
|
-
* @module basic-styles/utils
|
|
172
|
-
*/ /**
|
|
173
154
|
* Returns a function that creates a (toolbar or menu bar) button for a basic style feature.
|
|
174
155
|
*/ function getButtonCreator({ editor, commandName, plugin, icon, label, keystroke }) {
|
|
175
156
|
return (ButtonClass)=>{
|
|
@@ -192,17 +173,15 @@ const BOLD$1 = 'bold';
|
|
|
192
173
|
}
|
|
193
174
|
|
|
194
175
|
const BOLD = 'bold';
|
|
195
|
-
|
|
196
|
-
* The bold UI feature. It introduces the Bold button.
|
|
197
|
-
*/ class BoldUI extends Plugin {
|
|
176
|
+
class BoldUI extends Plugin {
|
|
198
177
|
/**
|
|
199
|
-
|
|
200
|
-
|
|
178
|
+
* @inheritDoc
|
|
179
|
+
*/ static get pluginName() {
|
|
201
180
|
return 'BoldUI';
|
|
202
181
|
}
|
|
203
182
|
/**
|
|
204
|
-
|
|
205
|
-
|
|
183
|
+
* @inheritDoc
|
|
184
|
+
*/ init() {
|
|
206
185
|
const editor = this.editor;
|
|
207
186
|
const t = editor.locale.t;
|
|
208
187
|
const command = editor.commands.get(BOLD);
|
|
@@ -229,53 +208,40 @@ const BOLD = 'bold';
|
|
|
229
208
|
}
|
|
230
209
|
}
|
|
231
210
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
* and the {@glink api/basic-styles package page}.
|
|
237
|
-
*
|
|
238
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/bold/boldediting~BoldEditing bold editing feature}
|
|
239
|
-
* and {@link module:basic-styles/bold/boldui~BoldUI bold UI feature}.
|
|
240
|
-
*/ class Bold extends Plugin {
|
|
241
|
-
/**
|
|
242
|
-
* @inheritDoc
|
|
243
|
-
*/ static get requires() {
|
|
211
|
+
class Bold extends Plugin {
|
|
212
|
+
/**
|
|
213
|
+
* @inheritDoc
|
|
214
|
+
*/ static get requires() {
|
|
244
215
|
return [
|
|
245
216
|
BoldEditing,
|
|
246
217
|
BoldUI
|
|
247
218
|
];
|
|
248
219
|
}
|
|
249
220
|
/**
|
|
250
|
-
|
|
251
|
-
|
|
221
|
+
* @inheritDoc
|
|
222
|
+
*/ static get pluginName() {
|
|
252
223
|
return 'Bold';
|
|
253
224
|
}
|
|
254
225
|
}
|
|
255
226
|
|
|
256
227
|
const CODE$1 = 'code';
|
|
257
228
|
const HIGHLIGHT_CLASS = 'ck-code_selected';
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
* as a `<code>` element.
|
|
263
|
-
*/ class CodeEditing extends Plugin {
|
|
264
|
-
/**
|
|
265
|
-
* @inheritDoc
|
|
266
|
-
*/ static get pluginName() {
|
|
229
|
+
class CodeEditing extends Plugin {
|
|
230
|
+
/**
|
|
231
|
+
* @inheritDoc
|
|
232
|
+
*/ static get pluginName() {
|
|
267
233
|
return 'CodeEditing';
|
|
268
234
|
}
|
|
269
235
|
/**
|
|
270
|
-
|
|
271
|
-
|
|
236
|
+
* @inheritDoc
|
|
237
|
+
*/ static get requires() {
|
|
272
238
|
return [
|
|
273
239
|
TwoStepCaretMovement
|
|
274
240
|
];
|
|
275
241
|
}
|
|
276
242
|
/**
|
|
277
|
-
|
|
278
|
-
|
|
243
|
+
* @inheritDoc
|
|
244
|
+
*/ init() {
|
|
279
245
|
const editor = this.editor;
|
|
280
246
|
const t = this.editor.t;
|
|
281
247
|
// Allow code attribute on text nodes.
|
|
@@ -325,17 +291,15 @@ const HIGHLIGHT_CLASS = 'ck-code_selected';
|
|
|
325
291
|
var codeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z\"/></svg>";
|
|
326
292
|
|
|
327
293
|
const CODE = 'code';
|
|
328
|
-
|
|
329
|
-
* The code UI feature. It introduces the Code button.
|
|
330
|
-
*/ class CodeUI extends Plugin {
|
|
294
|
+
class CodeUI extends Plugin {
|
|
331
295
|
/**
|
|
332
|
-
|
|
333
|
-
|
|
296
|
+
* @inheritDoc
|
|
297
|
+
*/ static get pluginName() {
|
|
334
298
|
return 'CodeUI';
|
|
335
299
|
}
|
|
336
300
|
/**
|
|
337
|
-
|
|
338
|
-
|
|
301
|
+
* @inheritDoc
|
|
302
|
+
*/ init() {
|
|
339
303
|
const editor = this.editor;
|
|
340
304
|
const t = editor.locale.t;
|
|
341
305
|
const createButton = getButtonCreator({
|
|
@@ -362,45 +326,32 @@ const CODE = 'code';
|
|
|
362
326
|
}
|
|
363
327
|
}
|
|
364
328
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
* and the {@glink api/basic-styles package page}.
|
|
370
|
-
*
|
|
371
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/code/codeediting~CodeEditing code editing feature}
|
|
372
|
-
* and {@link module:basic-styles/code/codeui~CodeUI code UI feature}.
|
|
373
|
-
*/ class Code extends Plugin {
|
|
374
|
-
/**
|
|
375
|
-
* @inheritDoc
|
|
376
|
-
*/ static get requires() {
|
|
329
|
+
class Code extends Plugin {
|
|
330
|
+
/**
|
|
331
|
+
* @inheritDoc
|
|
332
|
+
*/ static get requires() {
|
|
377
333
|
return [
|
|
378
334
|
CodeEditing,
|
|
379
335
|
CodeUI
|
|
380
336
|
];
|
|
381
337
|
}
|
|
382
338
|
/**
|
|
383
|
-
|
|
384
|
-
|
|
339
|
+
* @inheritDoc
|
|
340
|
+
*/ static get pluginName() {
|
|
385
341
|
return 'Code';
|
|
386
342
|
}
|
|
387
343
|
}
|
|
388
344
|
|
|
389
345
|
const ITALIC$1 = 'italic';
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
* which renders to the view as an `<i>` element.
|
|
395
|
-
*/ class ItalicEditing extends Plugin {
|
|
396
|
-
/**
|
|
397
|
-
* @inheritDoc
|
|
398
|
-
*/ static get pluginName() {
|
|
346
|
+
class ItalicEditing extends Plugin {
|
|
347
|
+
/**
|
|
348
|
+
* @inheritDoc
|
|
349
|
+
*/ static get pluginName() {
|
|
399
350
|
return 'ItalicEditing';
|
|
400
351
|
}
|
|
401
352
|
/**
|
|
402
|
-
|
|
403
|
-
|
|
353
|
+
* @inheritDoc
|
|
354
|
+
*/ init() {
|
|
404
355
|
const editor = this.editor;
|
|
405
356
|
const t = this.editor.t;
|
|
406
357
|
// Allow italic attribute on text nodes.
|
|
@@ -442,17 +393,15 @@ const ITALIC$1 = 'italic';
|
|
|
442
393
|
var italicIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z\"/></svg>";
|
|
443
394
|
|
|
444
395
|
const ITALIC = 'italic';
|
|
445
|
-
|
|
446
|
-
* The italic UI feature. It introduces the Italic button.
|
|
447
|
-
*/ class ItalicUI extends Plugin {
|
|
396
|
+
class ItalicUI extends Plugin {
|
|
448
397
|
/**
|
|
449
|
-
|
|
450
|
-
|
|
398
|
+
* @inheritDoc
|
|
399
|
+
*/ static get pluginName() {
|
|
451
400
|
return 'ItalicUI';
|
|
452
401
|
}
|
|
453
402
|
/**
|
|
454
|
-
|
|
455
|
-
|
|
403
|
+
* @inheritDoc
|
|
404
|
+
*/ init() {
|
|
456
405
|
const editor = this.editor;
|
|
457
406
|
const command = editor.commands.get(ITALIC);
|
|
458
407
|
const t = editor.locale.t;
|
|
@@ -479,46 +428,32 @@ const ITALIC = 'italic';
|
|
|
479
428
|
}
|
|
480
429
|
}
|
|
481
430
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
* and the {@glink api/basic-styles package page}.
|
|
487
|
-
*
|
|
488
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/italic/italicediting~ItalicEditing} and
|
|
489
|
-
* {@link module:basic-styles/italic/italicui~ItalicUI} plugins.
|
|
490
|
-
*/ class Italic extends Plugin {
|
|
491
|
-
/**
|
|
492
|
-
* @inheritDoc
|
|
493
|
-
*/ static get requires() {
|
|
431
|
+
class Italic extends Plugin {
|
|
432
|
+
/**
|
|
433
|
+
* @inheritDoc
|
|
434
|
+
*/ static get requires() {
|
|
494
435
|
return [
|
|
495
436
|
ItalicEditing,
|
|
496
437
|
ItalicUI
|
|
497
438
|
];
|
|
498
439
|
}
|
|
499
440
|
/**
|
|
500
|
-
|
|
501
|
-
|
|
441
|
+
* @inheritDoc
|
|
442
|
+
*/ static get pluginName() {
|
|
502
443
|
return 'Italic';
|
|
503
444
|
}
|
|
504
445
|
}
|
|
505
446
|
|
|
506
447
|
const STRIKETHROUGH$1 = 'strikethrough';
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
* `strikethroughsthrough` attribute in the model which renders to the view
|
|
512
|
-
* as a `<s>` element.
|
|
513
|
-
*/ class StrikethroughEditing extends Plugin {
|
|
514
|
-
/**
|
|
515
|
-
* @inheritDoc
|
|
516
|
-
*/ static get pluginName() {
|
|
448
|
+
class StrikethroughEditing extends Plugin {
|
|
449
|
+
/**
|
|
450
|
+
* @inheritDoc
|
|
451
|
+
*/ static get pluginName() {
|
|
517
452
|
return 'StrikethroughEditing';
|
|
518
453
|
}
|
|
519
454
|
/**
|
|
520
|
-
|
|
521
|
-
|
|
455
|
+
* @inheritDoc
|
|
456
|
+
*/ init() {
|
|
522
457
|
const editor = this.editor;
|
|
523
458
|
const t = this.editor.t;
|
|
524
459
|
// Allow strikethrough attribute on text nodes.
|
|
@@ -561,17 +496,15 @@ const STRIKETHROUGH$1 = 'strikethrough';
|
|
|
561
496
|
var strikethroughIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z\"/><path d=\"M3 10.5V9h14v1.5z\"/></svg>";
|
|
562
497
|
|
|
563
498
|
const STRIKETHROUGH = 'strikethrough';
|
|
564
|
-
|
|
565
|
-
* The strikethrough UI feature. It introduces the Strikethrough button.
|
|
566
|
-
*/ class StrikethroughUI extends Plugin {
|
|
499
|
+
class StrikethroughUI extends Plugin {
|
|
567
500
|
/**
|
|
568
|
-
|
|
569
|
-
|
|
501
|
+
* @inheritDoc
|
|
502
|
+
*/ static get pluginName() {
|
|
570
503
|
return 'StrikethroughUI';
|
|
571
504
|
}
|
|
572
505
|
/**
|
|
573
|
-
|
|
574
|
-
|
|
506
|
+
* @inheritDoc
|
|
507
|
+
*/ init() {
|
|
575
508
|
const editor = this.editor;
|
|
576
509
|
const t = editor.locale.t;
|
|
577
510
|
const createButton = getButtonCreator({
|
|
@@ -599,45 +532,32 @@ const STRIKETHROUGH = 'strikethrough';
|
|
|
599
532
|
}
|
|
600
533
|
}
|
|
601
534
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
* and the {@glink api/basic-styles package page}.
|
|
607
|
-
*
|
|
608
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/strikethrough/strikethroughediting~StrikethroughEditing} and
|
|
609
|
-
* {@link module:basic-styles/strikethrough/strikethroughui~StrikethroughUI} plugins.
|
|
610
|
-
*/ class Strikethrough extends Plugin {
|
|
611
|
-
/**
|
|
612
|
-
* @inheritDoc
|
|
613
|
-
*/ static get requires() {
|
|
535
|
+
class Strikethrough extends Plugin {
|
|
536
|
+
/**
|
|
537
|
+
* @inheritDoc
|
|
538
|
+
*/ static get requires() {
|
|
614
539
|
return [
|
|
615
540
|
StrikethroughEditing,
|
|
616
541
|
StrikethroughUI
|
|
617
542
|
];
|
|
618
543
|
}
|
|
619
544
|
/**
|
|
620
|
-
|
|
621
|
-
|
|
545
|
+
* @inheritDoc
|
|
546
|
+
*/ static get pluginName() {
|
|
622
547
|
return 'Strikethrough';
|
|
623
548
|
}
|
|
624
549
|
}
|
|
625
550
|
|
|
626
551
|
const SUBSCRIPT$1 = 'subscript';
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
* as a `<sub>` element.
|
|
632
|
-
*/ class SubscriptEditing extends Plugin {
|
|
633
|
-
/**
|
|
634
|
-
* @inheritDoc
|
|
635
|
-
*/ static get pluginName() {
|
|
552
|
+
class SubscriptEditing extends Plugin {
|
|
553
|
+
/**
|
|
554
|
+
* @inheritDoc
|
|
555
|
+
*/ static get pluginName() {
|
|
636
556
|
return 'SubscriptEditing';
|
|
637
557
|
}
|
|
638
558
|
/**
|
|
639
|
-
|
|
640
|
-
|
|
559
|
+
* @inheritDoc
|
|
560
|
+
*/ init() {
|
|
641
561
|
const editor = this.editor;
|
|
642
562
|
// Allow sub attribute on text nodes.
|
|
643
563
|
editor.model.schema.extend('$text', {
|
|
@@ -667,17 +587,15 @@ const SUBSCRIPT$1 = 'subscript';
|
|
|
667
587
|
var subscriptIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z\"/></svg>";
|
|
668
588
|
|
|
669
589
|
const SUBSCRIPT = 'subscript';
|
|
670
|
-
|
|
671
|
-
* The subscript UI feature. It introduces the Subscript button.
|
|
672
|
-
*/ class SubscriptUI extends Plugin {
|
|
590
|
+
class SubscriptUI extends Plugin {
|
|
673
591
|
/**
|
|
674
|
-
|
|
675
|
-
|
|
592
|
+
* @inheritDoc
|
|
593
|
+
*/ static get pluginName() {
|
|
676
594
|
return 'SubscriptUI';
|
|
677
595
|
}
|
|
678
596
|
/**
|
|
679
|
-
|
|
680
|
-
|
|
597
|
+
* @inheritDoc
|
|
598
|
+
*/ init() {
|
|
681
599
|
const editor = this.editor;
|
|
682
600
|
const t = editor.locale.t;
|
|
683
601
|
const createButton = getButtonCreator({
|
|
@@ -704,42 +622,32 @@ const SUBSCRIPT = 'subscript';
|
|
|
704
622
|
}
|
|
705
623
|
}
|
|
706
624
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
* {@link module:basic-styles/subscript/subscriptui~SubscriptUI} plugins.
|
|
712
|
-
*/ class Subscript extends Plugin {
|
|
713
|
-
/**
|
|
714
|
-
* @inheritDoc
|
|
715
|
-
*/ static get requires() {
|
|
625
|
+
class Subscript extends Plugin {
|
|
626
|
+
/**
|
|
627
|
+
* @inheritDoc
|
|
628
|
+
*/ static get requires() {
|
|
716
629
|
return [
|
|
717
630
|
SubscriptEditing,
|
|
718
631
|
SubscriptUI
|
|
719
632
|
];
|
|
720
633
|
}
|
|
721
634
|
/**
|
|
722
|
-
|
|
723
|
-
|
|
635
|
+
* @inheritDoc
|
|
636
|
+
*/ static get pluginName() {
|
|
724
637
|
return 'Subscript';
|
|
725
638
|
}
|
|
726
639
|
}
|
|
727
640
|
|
|
728
641
|
const SUPERSCRIPT$1 = 'superscript';
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
* as a `<super>` element.
|
|
734
|
-
*/ class SuperscriptEditing extends Plugin {
|
|
735
|
-
/**
|
|
736
|
-
* @inheritDoc
|
|
737
|
-
*/ static get pluginName() {
|
|
642
|
+
class SuperscriptEditing extends Plugin {
|
|
643
|
+
/**
|
|
644
|
+
* @inheritDoc
|
|
645
|
+
*/ static get pluginName() {
|
|
738
646
|
return 'SuperscriptEditing';
|
|
739
647
|
}
|
|
740
648
|
/**
|
|
741
|
-
|
|
742
|
-
|
|
649
|
+
* @inheritDoc
|
|
650
|
+
*/ init() {
|
|
743
651
|
const editor = this.editor;
|
|
744
652
|
// Allow super attribute on text nodes.
|
|
745
653
|
editor.model.schema.extend('$text', {
|
|
@@ -769,17 +677,15 @@ const SUPERSCRIPT$1 = 'superscript';
|
|
|
769
677
|
var superscriptIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z\"/></svg>";
|
|
770
678
|
|
|
771
679
|
const SUPERSCRIPT = 'superscript';
|
|
772
|
-
|
|
773
|
-
* The superscript UI feature. It introduces the Superscript button.
|
|
774
|
-
*/ class SuperscriptUI extends Plugin {
|
|
680
|
+
class SuperscriptUI extends Plugin {
|
|
775
681
|
/**
|
|
776
|
-
|
|
777
|
-
|
|
682
|
+
* @inheritDoc
|
|
683
|
+
*/ static get pluginName() {
|
|
778
684
|
return 'SuperscriptUI';
|
|
779
685
|
}
|
|
780
686
|
/**
|
|
781
|
-
|
|
782
|
-
|
|
687
|
+
* @inheritDoc
|
|
688
|
+
*/ init() {
|
|
783
689
|
const editor = this.editor;
|
|
784
690
|
const t = editor.locale.t;
|
|
785
691
|
const createButton = getButtonCreator({
|
|
@@ -806,42 +712,32 @@ const SUPERSCRIPT = 'superscript';
|
|
|
806
712
|
}
|
|
807
713
|
}
|
|
808
714
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
* {@link module:basic-styles/superscript/superscriptui~SuperscriptUI} plugins.
|
|
814
|
-
*/ class Superscript extends Plugin {
|
|
815
|
-
/**
|
|
816
|
-
* @inheritDoc
|
|
817
|
-
*/ static get requires() {
|
|
715
|
+
class Superscript extends Plugin {
|
|
716
|
+
/**
|
|
717
|
+
* @inheritDoc
|
|
718
|
+
*/ static get requires() {
|
|
818
719
|
return [
|
|
819
720
|
SuperscriptEditing,
|
|
820
721
|
SuperscriptUI
|
|
821
722
|
];
|
|
822
723
|
}
|
|
823
724
|
/**
|
|
824
|
-
|
|
825
|
-
|
|
725
|
+
* @inheritDoc
|
|
726
|
+
*/ static get pluginName() {
|
|
826
727
|
return 'Superscript';
|
|
827
728
|
}
|
|
828
729
|
}
|
|
829
730
|
|
|
830
731
|
const UNDERLINE$1 = 'underline';
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
* and introduces the `underline` attribute in the model which renders to the view as an `<u>` element.
|
|
836
|
-
*/ class UnderlineEditing extends Plugin {
|
|
837
|
-
/**
|
|
838
|
-
* @inheritDoc
|
|
839
|
-
*/ static get pluginName() {
|
|
732
|
+
class UnderlineEditing extends Plugin {
|
|
733
|
+
/**
|
|
734
|
+
* @inheritDoc
|
|
735
|
+
*/ static get pluginName() {
|
|
840
736
|
return 'UnderlineEditing';
|
|
841
737
|
}
|
|
842
738
|
/**
|
|
843
|
-
|
|
844
|
-
|
|
739
|
+
* @inheritDoc
|
|
740
|
+
*/ init() {
|
|
845
741
|
const editor = this.editor;
|
|
846
742
|
const t = this.editor.t;
|
|
847
743
|
// Allow strikethrough attribute on text nodes.
|
|
@@ -880,17 +776,15 @@ const UNDERLINE$1 = 'underline';
|
|
|
880
776
|
var underlineIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z\"/></svg>";
|
|
881
777
|
|
|
882
778
|
const UNDERLINE = 'underline';
|
|
883
|
-
|
|
884
|
-
* The underline UI feature. It introduces the Underline button.
|
|
885
|
-
*/ class UnderlineUI extends Plugin {
|
|
779
|
+
class UnderlineUI extends Plugin {
|
|
886
780
|
/**
|
|
887
|
-
|
|
888
|
-
|
|
781
|
+
* @inheritDoc
|
|
782
|
+
*/ static get pluginName() {
|
|
889
783
|
return 'UnderlineUI';
|
|
890
784
|
}
|
|
891
785
|
/**
|
|
892
|
-
|
|
893
|
-
|
|
786
|
+
* @inheritDoc
|
|
787
|
+
*/ init() {
|
|
894
788
|
const editor = this.editor;
|
|
895
789
|
const command = editor.commands.get(UNDERLINE);
|
|
896
790
|
const t = editor.locale.t;
|
|
@@ -917,26 +811,18 @@ const UNDERLINE = 'underline';
|
|
|
917
811
|
}
|
|
918
812
|
}
|
|
919
813
|
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
* and the {@glink api/basic-styles package page}.
|
|
925
|
-
*
|
|
926
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/underline/underlineediting~UnderlineEditing} and
|
|
927
|
-
* {@link module:basic-styles/underline/underlineui~UnderlineUI} plugins.
|
|
928
|
-
*/ class Underline extends Plugin {
|
|
929
|
-
/**
|
|
930
|
-
* @inheritDoc
|
|
931
|
-
*/ static get requires() {
|
|
814
|
+
class Underline extends Plugin {
|
|
815
|
+
/**
|
|
816
|
+
* @inheritDoc
|
|
817
|
+
*/ static get requires() {
|
|
932
818
|
return [
|
|
933
819
|
UnderlineEditing,
|
|
934
820
|
UnderlineUI
|
|
935
821
|
];
|
|
936
822
|
}
|
|
937
823
|
/**
|
|
938
|
-
|
|
939
|
-
|
|
824
|
+
* @inheritDoc
|
|
825
|
+
*/ static get pluginName() {
|
|
940
826
|
return 'Underline';
|
|
941
827
|
}
|
|
942
828
|
}
|