@ckeditor/ckeditor5-basic-styles 41.4.2 → 42.0.0-alpha.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/dist/index.js CHANGED
@@ -6,35 +6,53 @@ 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
- class AttributeCommand extends Command {
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
+ }
10
28
  /**
11
- * Updates the command's {@link #value} and {@link #isEnabled} based on the current selection.
12
- */ refresh() {
29
+ * Updates the command's {@link #value} and {@link #isEnabled} based on the current selection.
30
+ */ refresh() {
13
31
  const model = this.editor.model;
14
32
  const doc = model.document;
15
33
  this.value = this._getValueFromFirstAllowedNode();
16
34
  this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);
17
35
  }
18
36
  /**
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 = {}) {
37
+ * Executes the command – applies the attribute to the selection or removes it from the selection.
38
+ *
39
+ * If the command is active (`value == true`), it will remove attributes. Otherwise, it will set attributes.
40
+ *
41
+ * The execution result differs, depending on the {@link module:engine/model/document~Document#selection}:
42
+ *
43
+ * * If the selection is on a range, the command applies the attribute to all nodes in that range
44
+ * (if they are allowed to have this attribute by the {@link module:engine/model/schema~Schema schema}).
45
+ * * If the selection is collapsed in a non-empty node, the command applies the attribute to the
46
+ * {@link module:engine/model/document~Document#selection} itself (note that typed characters copy attributes from the selection).
47
+ * * If the selection is collapsed in an empty node, the command applies the attribute to the parent node of the selection (note
48
+ * that the selection inherits all attributes from a node if it is in an empty node).
49
+ *
50
+ * @fires execute
51
+ * @param options Command options.
52
+ * @param options.forceValue If set, it will force the command behavior. If `true`,
53
+ * the command will apply the attribute, otherwise the command will remove the attribute.
54
+ * If not set, the command will look for its current value to decide what it should do.
55
+ */ execute(options = {}) {
38
56
  const model = this.editor.model;
39
57
  const doc = model.document;
40
58
  const selection = doc.selection;
@@ -59,11 +77,11 @@ class AttributeCommand extends Command {
59
77
  });
60
78
  }
61
79
  /**
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() {
80
+ * Checks the attribute value of the first node in the selection that allows the attribute.
81
+ * For the collapsed selection returns the selection attribute.
82
+ *
83
+ * @returns The attribute value.
84
+ */ _getValueFromFirstAllowedNode() {
67
85
  const model = this.editor.model;
68
86
  const schema = model.schema;
69
87
  const selection = model.document.selection;
@@ -79,24 +97,23 @@ class AttributeCommand extends Command {
79
97
  }
80
98
  return false;
81
99
  }
82
- /**
83
- * @param attributeKey Attribute that will be set by the command.
84
- */ constructor(editor, attributeKey){
85
- super(editor);
86
- this.attributeKey = attributeKey;
87
- }
88
100
  }
89
101
 
90
102
  const BOLD$1 = 'bold';
91
- class BoldEditing extends Plugin {
92
- /**
93
- * @inheritDoc
94
- */ static get pluginName() {
103
+ /**
104
+ * The bold editing feature.
105
+ *
106
+ * It registers the `'bold'` command and introduces the `bold` attribute in the model which renders to the view
107
+ * as a `<strong>` element.
108
+ */ class BoldEditing extends Plugin {
109
+ /**
110
+ * @inheritDoc
111
+ */ static get pluginName() {
95
112
  return 'BoldEditing';
96
113
  }
97
114
  /**
98
- * @inheritDoc
99
- */ init() {
115
+ * @inheritDoc
116
+ */ init() {
100
117
  const editor = this.editor;
101
118
  const t = this.editor.t;
102
119
  // Allow bold attribute on text nodes.
@@ -151,6 +168,8 @@ class BoldEditing extends Plugin {
151
168
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
152
169
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
153
170
  */ /**
171
+ * @module basic-styles/utils
172
+ */ /**
154
173
  * Returns a function that creates a (toolbar or menu bar) button for a basic style feature.
155
174
  */ function getButtonCreator({ editor, commandName, plugin, icon, label, keystroke }) {
156
175
  return (ButtonClass)=>{
@@ -173,15 +192,17 @@ class BoldEditing extends Plugin {
173
192
  }
174
193
 
175
194
  const BOLD = 'bold';
176
- class BoldUI extends Plugin {
195
+ /**
196
+ * The bold UI feature. It introduces the Bold button.
197
+ */ class BoldUI extends Plugin {
177
198
  /**
178
- * @inheritDoc
179
- */ static get pluginName() {
199
+ * @inheritDoc
200
+ */ static get pluginName() {
180
201
  return 'BoldUI';
181
202
  }
182
203
  /**
183
- * @inheritDoc
184
- */ init() {
204
+ * @inheritDoc
205
+ */ init() {
185
206
  const editor = this.editor;
186
207
  const t = editor.locale.t;
187
208
  const command = editor.commands.get(BOLD);
@@ -208,40 +229,53 @@ class BoldUI extends Plugin {
208
229
  }
209
230
  }
210
231
 
211
- class Bold extends Plugin {
212
- /**
213
- * @inheritDoc
214
- */ static get requires() {
232
+ /**
233
+ * The bold feature.
234
+ *
235
+ * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
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() {
215
244
  return [
216
245
  BoldEditing,
217
246
  BoldUI
218
247
  ];
219
248
  }
220
249
  /**
221
- * @inheritDoc
222
- */ static get pluginName() {
250
+ * @inheritDoc
251
+ */ static get pluginName() {
223
252
  return 'Bold';
224
253
  }
225
254
  }
226
255
 
227
256
  const CODE$1 = 'code';
228
257
  const HIGHLIGHT_CLASS = 'ck-code_selected';
229
- class CodeEditing extends Plugin {
230
- /**
231
- * @inheritDoc
232
- */ static get pluginName() {
258
+ /**
259
+ * The code editing feature.
260
+ *
261
+ * It registers the `'code'` command and introduces the `code` attribute in the model which renders to the view
262
+ * as a `<code>` element.
263
+ */ class CodeEditing extends Plugin {
264
+ /**
265
+ * @inheritDoc
266
+ */ static get pluginName() {
233
267
  return 'CodeEditing';
234
268
  }
235
269
  /**
236
- * @inheritDoc
237
- */ static get requires() {
270
+ * @inheritDoc
271
+ */ static get requires() {
238
272
  return [
239
273
  TwoStepCaretMovement
240
274
  ];
241
275
  }
242
276
  /**
243
- * @inheritDoc
244
- */ init() {
277
+ * @inheritDoc
278
+ */ init() {
245
279
  const editor = this.editor;
246
280
  const t = this.editor.t;
247
281
  // Allow code attribute on text nodes.
@@ -291,15 +325,17 @@ class CodeEditing extends Plugin {
291
325
  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>";
292
326
 
293
327
  const CODE = 'code';
294
- class CodeUI extends Plugin {
328
+ /**
329
+ * The code UI feature. It introduces the Code button.
330
+ */ class CodeUI extends Plugin {
295
331
  /**
296
- * @inheritDoc
297
- */ static get pluginName() {
332
+ * @inheritDoc
333
+ */ static get pluginName() {
298
334
  return 'CodeUI';
299
335
  }
300
336
  /**
301
- * @inheritDoc
302
- */ init() {
337
+ * @inheritDoc
338
+ */ init() {
303
339
  const editor = this.editor;
304
340
  const t = editor.locale.t;
305
341
  const createButton = getButtonCreator({
@@ -326,32 +362,45 @@ class CodeUI extends Plugin {
326
362
  }
327
363
  }
328
364
 
329
- class Code extends Plugin {
330
- /**
331
- * @inheritDoc
332
- */ static get requires() {
365
+ /**
366
+ * The code feature.
367
+ *
368
+ * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
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() {
333
377
  return [
334
378
  CodeEditing,
335
379
  CodeUI
336
380
  ];
337
381
  }
338
382
  /**
339
- * @inheritDoc
340
- */ static get pluginName() {
383
+ * @inheritDoc
384
+ */ static get pluginName() {
341
385
  return 'Code';
342
386
  }
343
387
  }
344
388
 
345
389
  const ITALIC$1 = 'italic';
346
- class ItalicEditing extends Plugin {
347
- /**
348
- * @inheritDoc
349
- */ static get pluginName() {
390
+ /**
391
+ * The italic editing feature.
392
+ *
393
+ * It registers the `'italic'` command, the <kbd>Ctrl+I</kbd> keystroke and introduces the `italic` attribute in the model
394
+ * which renders to the view as an `<i>` element.
395
+ */ class ItalicEditing extends Plugin {
396
+ /**
397
+ * @inheritDoc
398
+ */ static get pluginName() {
350
399
  return 'ItalicEditing';
351
400
  }
352
401
  /**
353
- * @inheritDoc
354
- */ init() {
402
+ * @inheritDoc
403
+ */ init() {
355
404
  const editor = this.editor;
356
405
  const t = this.editor.t;
357
406
  // Allow italic attribute on text nodes.
@@ -393,15 +442,17 @@ class ItalicEditing extends Plugin {
393
442
  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>";
394
443
 
395
444
  const ITALIC = 'italic';
396
- class ItalicUI extends Plugin {
445
+ /**
446
+ * The italic UI feature. It introduces the Italic button.
447
+ */ class ItalicUI extends Plugin {
397
448
  /**
398
- * @inheritDoc
399
- */ static get pluginName() {
449
+ * @inheritDoc
450
+ */ static get pluginName() {
400
451
  return 'ItalicUI';
401
452
  }
402
453
  /**
403
- * @inheritDoc
404
- */ init() {
454
+ * @inheritDoc
455
+ */ init() {
405
456
  const editor = this.editor;
406
457
  const command = editor.commands.get(ITALIC);
407
458
  const t = editor.locale.t;
@@ -428,32 +479,46 @@ class ItalicUI extends Plugin {
428
479
  }
429
480
  }
430
481
 
431
- class Italic extends Plugin {
432
- /**
433
- * @inheritDoc
434
- */ static get requires() {
482
+ /**
483
+ * The italic feature.
484
+ *
485
+ * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
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() {
435
494
  return [
436
495
  ItalicEditing,
437
496
  ItalicUI
438
497
  ];
439
498
  }
440
499
  /**
441
- * @inheritDoc
442
- */ static get pluginName() {
500
+ * @inheritDoc
501
+ */ static get pluginName() {
443
502
  return 'Italic';
444
503
  }
445
504
  }
446
505
 
447
506
  const STRIKETHROUGH$1 = 'strikethrough';
448
- class StrikethroughEditing extends Plugin {
449
- /**
450
- * @inheritDoc
451
- */ static get pluginName() {
507
+ /**
508
+ * The strikethrough editing feature.
509
+ *
510
+ * It registers the `'strikethrough'` command, the <kbd>Ctrl+Shift+X</kbd> keystroke and introduces the
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() {
452
517
  return 'StrikethroughEditing';
453
518
  }
454
519
  /**
455
- * @inheritDoc
456
- */ init() {
520
+ * @inheritDoc
521
+ */ init() {
457
522
  const editor = this.editor;
458
523
  const t = this.editor.t;
459
524
  // Allow strikethrough attribute on text nodes.
@@ -496,15 +561,17 @@ class StrikethroughEditing extends Plugin {
496
561
  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>";
497
562
 
498
563
  const STRIKETHROUGH = 'strikethrough';
499
- class StrikethroughUI extends Plugin {
564
+ /**
565
+ * The strikethrough UI feature. It introduces the Strikethrough button.
566
+ */ class StrikethroughUI extends Plugin {
500
567
  /**
501
- * @inheritDoc
502
- */ static get pluginName() {
568
+ * @inheritDoc
569
+ */ static get pluginName() {
503
570
  return 'StrikethroughUI';
504
571
  }
505
572
  /**
506
- * @inheritDoc
507
- */ init() {
573
+ * @inheritDoc
574
+ */ init() {
508
575
  const editor = this.editor;
509
576
  const t = editor.locale.t;
510
577
  const createButton = getButtonCreator({
@@ -532,32 +599,45 @@ class StrikethroughUI extends Plugin {
532
599
  }
533
600
  }
534
601
 
535
- class Strikethrough extends Plugin {
536
- /**
537
- * @inheritDoc
538
- */ static get requires() {
602
+ /**
603
+ * The strikethrough feature.
604
+ *
605
+ * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
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() {
539
614
  return [
540
615
  StrikethroughEditing,
541
616
  StrikethroughUI
542
617
  ];
543
618
  }
544
619
  /**
545
- * @inheritDoc
546
- */ static get pluginName() {
620
+ * @inheritDoc
621
+ */ static get pluginName() {
547
622
  return 'Strikethrough';
548
623
  }
549
624
  }
550
625
 
551
626
  const SUBSCRIPT$1 = 'subscript';
552
- class SubscriptEditing extends Plugin {
553
- /**
554
- * @inheritDoc
555
- */ static get pluginName() {
627
+ /**
628
+ * The subscript editing feature.
629
+ *
630
+ * It registers the `sub` command and introduces the `sub` attribute in the model which renders to the view
631
+ * as a `<sub>` element.
632
+ */ class SubscriptEditing extends Plugin {
633
+ /**
634
+ * @inheritDoc
635
+ */ static get pluginName() {
556
636
  return 'SubscriptEditing';
557
637
  }
558
638
  /**
559
- * @inheritDoc
560
- */ init() {
639
+ * @inheritDoc
640
+ */ init() {
561
641
  const editor = this.editor;
562
642
  // Allow sub attribute on text nodes.
563
643
  editor.model.schema.extend('$text', {
@@ -587,15 +667,17 @@ class SubscriptEditing extends Plugin {
587
667
  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>";
588
668
 
589
669
  const SUBSCRIPT = 'subscript';
590
- class SubscriptUI extends Plugin {
670
+ /**
671
+ * The subscript UI feature. It introduces the Subscript button.
672
+ */ class SubscriptUI extends Plugin {
591
673
  /**
592
- * @inheritDoc
593
- */ static get pluginName() {
674
+ * @inheritDoc
675
+ */ static get pluginName() {
594
676
  return 'SubscriptUI';
595
677
  }
596
678
  /**
597
- * @inheritDoc
598
- */ init() {
679
+ * @inheritDoc
680
+ */ init() {
599
681
  const editor = this.editor;
600
682
  const t = editor.locale.t;
601
683
  const createButton = getButtonCreator({
@@ -622,32 +704,42 @@ class SubscriptUI extends Plugin {
622
704
  }
623
705
  }
624
706
 
625
- class Subscript extends Plugin {
626
- /**
627
- * @inheritDoc
628
- */ static get requires() {
707
+ /**
708
+ * The subscript feature.
709
+ *
710
+ * It loads the {@link module:basic-styles/subscript/subscriptediting~SubscriptEditing} and
711
+ * {@link module:basic-styles/subscript/subscriptui~SubscriptUI} plugins.
712
+ */ class Subscript extends Plugin {
713
+ /**
714
+ * @inheritDoc
715
+ */ static get requires() {
629
716
  return [
630
717
  SubscriptEditing,
631
718
  SubscriptUI
632
719
  ];
633
720
  }
634
721
  /**
635
- * @inheritDoc
636
- */ static get pluginName() {
722
+ * @inheritDoc
723
+ */ static get pluginName() {
637
724
  return 'Subscript';
638
725
  }
639
726
  }
640
727
 
641
728
  const SUPERSCRIPT$1 = 'superscript';
642
- class SuperscriptEditing extends Plugin {
643
- /**
644
- * @inheritDoc
645
- */ static get pluginName() {
729
+ /**
730
+ * The superscript editing feature.
731
+ *
732
+ * It registers the `super` command and introduces the `super` attribute in the model which renders to the view
733
+ * as a `<super>` element.
734
+ */ class SuperscriptEditing extends Plugin {
735
+ /**
736
+ * @inheritDoc
737
+ */ static get pluginName() {
646
738
  return 'SuperscriptEditing';
647
739
  }
648
740
  /**
649
- * @inheritDoc
650
- */ init() {
741
+ * @inheritDoc
742
+ */ init() {
651
743
  const editor = this.editor;
652
744
  // Allow super attribute on text nodes.
653
745
  editor.model.schema.extend('$text', {
@@ -677,15 +769,17 @@ class SuperscriptEditing extends Plugin {
677
769
  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>";
678
770
 
679
771
  const SUPERSCRIPT = 'superscript';
680
- class SuperscriptUI extends Plugin {
772
+ /**
773
+ * The superscript UI feature. It introduces the Superscript button.
774
+ */ class SuperscriptUI extends Plugin {
681
775
  /**
682
- * @inheritDoc
683
- */ static get pluginName() {
776
+ * @inheritDoc
777
+ */ static get pluginName() {
684
778
  return 'SuperscriptUI';
685
779
  }
686
780
  /**
687
- * @inheritDoc
688
- */ init() {
781
+ * @inheritDoc
782
+ */ init() {
689
783
  const editor = this.editor;
690
784
  const t = editor.locale.t;
691
785
  const createButton = getButtonCreator({
@@ -712,32 +806,42 @@ class SuperscriptUI extends Plugin {
712
806
  }
713
807
  }
714
808
 
715
- class Superscript extends Plugin {
716
- /**
717
- * @inheritDoc
718
- */ static get requires() {
809
+ /**
810
+ * The superscript feature.
811
+ *
812
+ * It loads the {@link module:basic-styles/superscript/superscriptediting~SuperscriptEditing} and
813
+ * {@link module:basic-styles/superscript/superscriptui~SuperscriptUI} plugins.
814
+ */ class Superscript extends Plugin {
815
+ /**
816
+ * @inheritDoc
817
+ */ static get requires() {
719
818
  return [
720
819
  SuperscriptEditing,
721
820
  SuperscriptUI
722
821
  ];
723
822
  }
724
823
  /**
725
- * @inheritDoc
726
- */ static get pluginName() {
824
+ * @inheritDoc
825
+ */ static get pluginName() {
727
826
  return 'Superscript';
728
827
  }
729
828
  }
730
829
 
731
830
  const UNDERLINE$1 = 'underline';
732
- class UnderlineEditing extends Plugin {
733
- /**
734
- * @inheritDoc
735
- */ static get pluginName() {
831
+ /**
832
+ * The underline editing feature.
833
+ *
834
+ * It registers the `'underline'` command, the <kbd>Ctrl+U</kbd> keystroke
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() {
736
840
  return 'UnderlineEditing';
737
841
  }
738
842
  /**
739
- * @inheritDoc
740
- */ init() {
843
+ * @inheritDoc
844
+ */ init() {
741
845
  const editor = this.editor;
742
846
  const t = this.editor.t;
743
847
  // Allow strikethrough attribute on text nodes.
@@ -776,15 +880,17 @@ class UnderlineEditing extends Plugin {
776
880
  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>";
777
881
 
778
882
  const UNDERLINE = 'underline';
779
- class UnderlineUI extends Plugin {
883
+ /**
884
+ * The underline UI feature. It introduces the Underline button.
885
+ */ class UnderlineUI extends Plugin {
780
886
  /**
781
- * @inheritDoc
782
- */ static get pluginName() {
887
+ * @inheritDoc
888
+ */ static get pluginName() {
783
889
  return 'UnderlineUI';
784
890
  }
785
891
  /**
786
- * @inheritDoc
787
- */ init() {
892
+ * @inheritDoc
893
+ */ init() {
788
894
  const editor = this.editor;
789
895
  const command = editor.commands.get(UNDERLINE);
790
896
  const t = editor.locale.t;
@@ -811,18 +917,26 @@ class UnderlineUI extends Plugin {
811
917
  }
812
918
  }
813
919
 
814
- class Underline extends Plugin {
815
- /**
816
- * @inheritDoc
817
- */ static get requires() {
920
+ /**
921
+ * The underline feature.
922
+ *
923
+ * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
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() {
818
932
  return [
819
933
  UnderlineEditing,
820
934
  UnderlineUI
821
935
  ];
822
936
  }
823
937
  /**
824
- * @inheritDoc
825
- */ static get pluginName() {
938
+ * @inheritDoc
939
+ */ static get pluginName() {
826
940
  return 'Underline';
827
941
  }
828
942
  }