@ckeditor/ckeditor5-alignment 41.3.0-alpha.1 → 41.3.0-alpha.3

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.
Files changed (135) hide show
  1. package/dist/translations/af.d.ts +8 -0
  2. package/dist/translations/af.js +5 -0
  3. package/dist/translations/ar.d.ts +8 -0
  4. package/dist/translations/ar.js +5 -0
  5. package/dist/translations/az.d.ts +8 -0
  6. package/dist/translations/az.js +5 -0
  7. package/dist/translations/bg.d.ts +8 -0
  8. package/dist/translations/bg.js +5 -0
  9. package/dist/translations/bn.d.ts +8 -0
  10. package/dist/translations/bn.js +5 -0
  11. package/dist/translations/bs.d.ts +8 -0
  12. package/dist/translations/bs.js +5 -0
  13. package/dist/translations/ca.d.ts +8 -0
  14. package/dist/translations/ca.js +5 -0
  15. package/dist/translations/cs.d.ts +8 -0
  16. package/dist/translations/cs.js +5 -0
  17. package/dist/translations/da.d.ts +8 -0
  18. package/dist/translations/da.js +5 -0
  19. package/dist/translations/de-ch.d.ts +8 -0
  20. package/dist/translations/de-ch.js +5 -0
  21. package/dist/translations/de.d.ts +8 -0
  22. package/dist/translations/de.js +5 -0
  23. package/dist/translations/el.d.ts +8 -0
  24. package/dist/translations/el.js +5 -0
  25. package/dist/translations/en-au.d.ts +8 -0
  26. package/dist/translations/en-au.js +5 -0
  27. package/dist/translations/en-gb.d.ts +8 -0
  28. package/dist/translations/en-gb.js +5 -0
  29. package/dist/translations/en.d.ts +8 -0
  30. package/dist/translations/en.js +5 -0
  31. package/dist/translations/es-co.d.ts +8 -0
  32. package/dist/translations/es-co.js +5 -0
  33. package/dist/translations/es.d.ts +8 -0
  34. package/dist/translations/es.js +5 -0
  35. package/dist/translations/et.d.ts +8 -0
  36. package/dist/translations/et.js +5 -0
  37. package/dist/translations/fa.d.ts +8 -0
  38. package/dist/translations/fa.js +5 -0
  39. package/dist/translations/fi.d.ts +8 -0
  40. package/dist/translations/fi.js +5 -0
  41. package/dist/translations/fr.d.ts +8 -0
  42. package/dist/translations/fr.js +5 -0
  43. package/dist/translations/gl.d.ts +8 -0
  44. package/dist/translations/gl.js +5 -0
  45. package/dist/translations/he.d.ts +8 -0
  46. package/dist/translations/he.js +5 -0
  47. package/dist/translations/hi.d.ts +8 -0
  48. package/dist/translations/hi.js +5 -0
  49. package/dist/translations/hr.d.ts +8 -0
  50. package/dist/translations/hr.js +5 -0
  51. package/dist/translations/hu.d.ts +8 -0
  52. package/dist/translations/hu.js +5 -0
  53. package/dist/translations/id.d.ts +8 -0
  54. package/dist/translations/id.js +5 -0
  55. package/dist/translations/it.d.ts +8 -0
  56. package/dist/translations/it.js +5 -0
  57. package/dist/translations/ja.d.ts +8 -0
  58. package/dist/translations/ja.js +5 -0
  59. package/dist/translations/jv.d.ts +8 -0
  60. package/dist/translations/jv.js +5 -0
  61. package/dist/translations/kk.d.ts +8 -0
  62. package/dist/translations/kk.js +5 -0
  63. package/dist/translations/km.d.ts +8 -0
  64. package/dist/translations/km.js +5 -0
  65. package/dist/translations/ko.d.ts +8 -0
  66. package/dist/translations/ko.js +5 -0
  67. package/dist/translations/ku.d.ts +8 -0
  68. package/dist/translations/ku.js +5 -0
  69. package/dist/translations/lt.d.ts +8 -0
  70. package/dist/translations/lt.js +5 -0
  71. package/dist/translations/lv.d.ts +8 -0
  72. package/dist/translations/lv.js +5 -0
  73. package/dist/translations/ms.d.ts +8 -0
  74. package/dist/translations/ms.js +5 -0
  75. package/dist/translations/nb.d.ts +8 -0
  76. package/dist/translations/nb.js +5 -0
  77. package/dist/translations/ne.d.ts +8 -0
  78. package/dist/translations/ne.js +5 -0
  79. package/dist/translations/nl.d.ts +8 -0
  80. package/dist/translations/nl.js +5 -0
  81. package/dist/translations/no.d.ts +8 -0
  82. package/dist/translations/no.js +5 -0
  83. package/dist/translations/pl.d.ts +8 -0
  84. package/dist/translations/pl.js +5 -0
  85. package/dist/translations/pt-br.d.ts +8 -0
  86. package/dist/translations/pt-br.js +5 -0
  87. package/dist/translations/pt.d.ts +8 -0
  88. package/dist/translations/pt.js +5 -0
  89. package/dist/translations/ro.d.ts +8 -0
  90. package/dist/translations/ro.js +5 -0
  91. package/dist/translations/ru.d.ts +8 -0
  92. package/dist/translations/ru.js +5 -0
  93. package/dist/translations/sk.d.ts +8 -0
  94. package/dist/translations/sk.js +5 -0
  95. package/dist/translations/sl.d.ts +8 -0
  96. package/dist/translations/sl.js +5 -0
  97. package/dist/translations/sq.d.ts +8 -0
  98. package/dist/translations/sq.js +5 -0
  99. package/dist/translations/sr-latn.d.ts +8 -0
  100. package/dist/translations/sr-latn.js +5 -0
  101. package/dist/translations/sr.d.ts +8 -0
  102. package/dist/translations/sr.js +5 -0
  103. package/dist/translations/sv.d.ts +8 -0
  104. package/dist/translations/sv.js +5 -0
  105. package/dist/translations/th.d.ts +8 -0
  106. package/dist/translations/th.js +5 -0
  107. package/dist/translations/tk.d.ts +8 -0
  108. package/dist/translations/tk.js +5 -0
  109. package/dist/translations/tr.d.ts +8 -0
  110. package/dist/translations/tr.js +5 -0
  111. package/dist/translations/ug.d.ts +8 -0
  112. package/dist/translations/ug.js +5 -0
  113. package/dist/translations/uk.d.ts +8 -0
  114. package/dist/translations/uk.js +5 -0
  115. package/dist/translations/ur.d.ts +8 -0
  116. package/dist/translations/ur.js +5 -0
  117. package/dist/translations/uz.d.ts +8 -0
  118. package/dist/translations/uz.js +5 -0
  119. package/dist/translations/vi.d.ts +8 -0
  120. package/dist/translations/vi.js +5 -0
  121. package/dist/translations/zh-cn.d.ts +8 -0
  122. package/dist/translations/zh-cn.js +5 -0
  123. package/dist/translations/zh.d.ts +8 -0
  124. package/dist/translations/zh.js +5 -0
  125. package/dist/types/alignment.d.ts +4 -0
  126. package/dist/types/alignmentcommand.d.ts +4 -0
  127. package/dist/types/alignmentconfig.d.ts +4 -0
  128. package/dist/types/alignmentediting.d.ts +4 -0
  129. package/dist/types/alignmentui.d.ts +4 -0
  130. package/dist/types/augmentation.d.ts +4 -0
  131. package/dist/types/index.d.ts +4 -0
  132. package/dist/types/utils.d.ts +4 -0
  133. package/package.json +2 -2
  134. package/dist/index.js +0 -512
  135. package/dist/index.js.map +0 -1
package/dist/index.js DELETED
@@ -1,512 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- import { Command, Plugin, icons } from '@ckeditor/ckeditor5-core/dist/index.js';
6
- import { logWarning, CKEditorError, first } from '@ckeditor/ckeditor5-utils/dist/index.js';
7
- import { createDropdown, addToolbarToDropdown, ButtonView } from '@ckeditor/ckeditor5-ui/dist/index.js';
8
-
9
- /**
10
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
11
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
12
- */
13
- /**
14
- * @module alignment/utils
15
- */
16
- /**
17
- * The list of supported alignment options:
18
- *
19
- * * `'left'`,
20
- * * `'right'`,
21
- * * `'center'`,
22
- * * `'justify'`
23
- */
24
- const supportedOptions = ['left', 'right', 'center', 'justify'];
25
- /**
26
- * Checks whether the passed option is supported by {@link module:alignment/alignmentediting~AlignmentEditing}.
27
- *
28
- * @param option The option value to check.
29
- */
30
- function isSupported(option) {
31
- return supportedOptions.includes(option);
32
- }
33
- /**
34
- * Checks whether alignment is the default one considering the direction
35
- * of the editor content.
36
- *
37
- * @param alignment The name of the alignment to check.
38
- * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
39
- */
40
- function isDefault(alignment, locale) {
41
- // Right now only LTR is supported so the 'left' value is always the default one.
42
- if (locale.contentLanguageDirection == 'rtl') {
43
- return alignment === 'right';
44
- }
45
- else {
46
- return alignment === 'left';
47
- }
48
- }
49
- /**
50
- * Brings the configuration to the common form, an array of objects.
51
- *
52
- * @param configuredOptions Alignment plugin configuration.
53
- * @returns Normalized object holding the configuration.
54
- */
55
- function normalizeAlignmentOptions(configuredOptions) {
56
- const normalizedOptions = configuredOptions
57
- .map(option => {
58
- let result;
59
- if (typeof option == 'string') {
60
- result = { name: option };
61
- }
62
- else {
63
- result = option;
64
- }
65
- return result;
66
- })
67
- // Remove all unknown options.
68
- .filter(option => {
69
- const isNameValid = supportedOptions.includes(option.name);
70
- if (!isNameValid) {
71
- /**
72
- * The `name` in one of the `alignment.options` is not recognized.
73
- * The available options are: `'left'`, `'right'`, `'center'` and `'justify'`.
74
- *
75
- * @error alignment-config-name-not-recognized
76
- * @param option Options with unknown value of the `name` property.
77
- */
78
- logWarning('alignment-config-name-not-recognized', { option });
79
- }
80
- return isNameValid;
81
- });
82
- const classNameCount = normalizedOptions.filter(option => Boolean(option.className)).length;
83
- // We either use classes for all styling options or for none.
84
- if (classNameCount && classNameCount < normalizedOptions.length) {
85
- /**
86
- * The `className` property has to be defined for all options once at least one option declares `className`.
87
- *
88
- * @error alignment-config-classnames-are-missing
89
- * @param configuredOptions Contents of `alignment.options`.
90
- */
91
- throw new CKEditorError('alignment-config-classnames-are-missing', { configuredOptions });
92
- }
93
- // Validate resulting config.
94
- normalizedOptions.forEach((option, index, allOptions) => {
95
- const succeedingOptions = allOptions.slice(index + 1);
96
- const nameAlreadyExists = succeedingOptions.some(item => item.name == option.name);
97
- if (nameAlreadyExists) {
98
- /**
99
- * The same `name` in one of the `alignment.options` was already declared.
100
- * Each `name` representing one alignment option can be set exactly once.
101
- *
102
- * @error alignment-config-name-already-defined
103
- * @param option First option that declares given `name`.
104
- * @param configuredOptions Contents of `alignment.options`.
105
- */
106
- throw new CKEditorError('alignment-config-name-already-defined', { option, configuredOptions });
107
- }
108
- // The `className` property is present. Check for duplicates then.
109
- if (option.className) {
110
- const classNameAlreadyExists = succeedingOptions.some(item => item.className == option.className);
111
- if (classNameAlreadyExists) {
112
- /**
113
- * The same `className` in one of the `alignment.options` was already declared.
114
- *
115
- * @error alignment-config-classname-already-defined
116
- * @param option First option that declares given `className`.
117
- * @param configuredOptions
118
- * Contents of `alignment.options`.
119
- */
120
- throw new CKEditorError('alignment-config-classname-already-defined', { option, configuredOptions });
121
- }
122
- }
123
- });
124
- return normalizedOptions;
125
- }
126
-
127
- /**
128
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
129
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
130
- */
131
- /**
132
- * @module alignment/alignmentcommand
133
- */
134
- const ALIGNMENT = 'alignment';
135
- /**
136
- * The alignment command plugin.
137
- */
138
- class AlignmentCommand extends Command {
139
- /**
140
- * @inheritDoc
141
- */
142
- refresh() {
143
- const editor = this.editor;
144
- const locale = editor.locale;
145
- const firstBlock = first(this.editor.model.document.selection.getSelectedBlocks());
146
- // As first check whether to enable or disable the command as the value will always be false if the command cannot be enabled.
147
- this.isEnabled = Boolean(firstBlock) && this._canBeAligned(firstBlock);
148
- if (this.isEnabled && firstBlock.hasAttribute('alignment')) {
149
- this.value = firstBlock.getAttribute('alignment');
150
- }
151
- else {
152
- this.value = locale.contentLanguageDirection === 'rtl' ? 'right' : 'left';
153
- }
154
- }
155
- /**
156
- * Executes the command. Applies the alignment `value` to the selected blocks.
157
- * If no `value` is passed, the `value` is the default one or it is equal to the currently selected block's alignment attribute,
158
- * the command will remove the attribute from the selected blocks.
159
- *
160
- * @param options Options for the executed command.
161
- * @param options.value The value to apply.
162
- * @fires execute
163
- */
164
- execute(options = {}) {
165
- const editor = this.editor;
166
- const locale = editor.locale;
167
- const model = editor.model;
168
- const doc = model.document;
169
- const value = options.value;
170
- model.change(writer => {
171
- // Get only those blocks from selected that can have alignment set
172
- const blocks = Array.from(doc.selection.getSelectedBlocks()).filter(block => this._canBeAligned(block));
173
- const currentAlignment = blocks[0].getAttribute('alignment');
174
- // Remove alignment attribute if current alignment is:
175
- // - default (should not be stored in model as it will bloat model data)
176
- // - equal to currently set
177
- // - or no value is passed - denotes default alignment.
178
- const removeAlignment = isDefault(value, locale) || currentAlignment === value || !value;
179
- if (removeAlignment) {
180
- removeAlignmentFromSelection(blocks, writer);
181
- }
182
- else {
183
- setAlignmentOnSelection(blocks, writer, value);
184
- }
185
- });
186
- }
187
- /**
188
- * Checks whether a block can have alignment set.
189
- *
190
- * @param block The block to be checked.
191
- */
192
- _canBeAligned(block) {
193
- return this.editor.model.schema.checkAttribute(block, ALIGNMENT);
194
- }
195
- }
196
- /**
197
- * Removes the alignment attribute from blocks.
198
- */
199
- function removeAlignmentFromSelection(blocks, writer) {
200
- for (const block of blocks) {
201
- writer.removeAttribute(ALIGNMENT, block);
202
- }
203
- }
204
- /**
205
- * Sets the alignment attribute on blocks.
206
- */
207
- function setAlignmentOnSelection(blocks, writer, alignment) {
208
- for (const block of blocks) {
209
- writer.setAttribute(ALIGNMENT, alignment, block);
210
- }
211
- }
212
-
213
- /**
214
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
215
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
216
- */
217
- /**
218
- * @module alignment/alignmentediting
219
- */
220
- /**
221
- * The alignment editing feature. It introduces the {@link module:alignment/alignmentcommand~AlignmentCommand command} and adds
222
- * the `alignment` attribute for block elements in the {@link module:engine/model/model~Model model}.
223
- */
224
- class AlignmentEditing extends Plugin {
225
- /**
226
- * @inheritDoc
227
- */
228
- static get pluginName() {
229
- return 'AlignmentEditing';
230
- }
231
- /**
232
- * @inheritDoc
233
- */
234
- constructor(editor) {
235
- super(editor);
236
- editor.config.define('alignment', {
237
- options: supportedOptions.map(option => ({ name: option }))
238
- });
239
- }
240
- /**
241
- * @inheritDoc
242
- */
243
- init() {
244
- const editor = this.editor;
245
- const locale = editor.locale;
246
- const schema = editor.model.schema;
247
- const options = normalizeAlignmentOptions(editor.config.get('alignment.options'));
248
- // Filter out unsupported options and those that are redundant, e.g. `left` in LTR / `right` in RTL mode.
249
- const optionsToConvert = options.filter(option => isSupported(option.name) && !isDefault(option.name, locale));
250
- // Once there is at least one `className` defined, we switch to alignment with classes.
251
- const shouldUseClasses = optionsToConvert.some(option => !!option.className);
252
- // Allow alignment attribute on all blocks.
253
- schema.extend('$block', { allowAttributes: 'alignment' });
254
- editor.model.schema.setAttributeProperties('alignment', { isFormatting: true });
255
- if (shouldUseClasses) {
256
- editor.conversion.attributeToAttribute(buildClassDefinition(optionsToConvert));
257
- }
258
- else {
259
- // Downcast inline styles.
260
- editor.conversion.for('downcast').attributeToAttribute(buildDowncastInlineDefinition(optionsToConvert));
261
- }
262
- const upcastInlineDefinitions = buildUpcastInlineDefinitions(optionsToConvert);
263
- // Always upcast from inline styles.
264
- for (const definition of upcastInlineDefinitions) {
265
- editor.conversion.for('upcast').attributeToAttribute(definition);
266
- }
267
- const upcastCompatibilityDefinitions = buildUpcastCompatibilityDefinitions(optionsToConvert);
268
- // Always upcast from deprecated `align` attribute.
269
- for (const definition of upcastCompatibilityDefinitions) {
270
- editor.conversion.for('upcast').attributeToAttribute(definition);
271
- }
272
- editor.commands.add('alignment', new AlignmentCommand(editor));
273
- }
274
- }
275
- /**
276
- * Prepare downcast conversion definition for inline alignment styling.
277
- */
278
- function buildDowncastInlineDefinition(options) {
279
- const view = {};
280
- for (const { name } of options) {
281
- view[name] = {
282
- key: 'style',
283
- value: {
284
- 'text-align': name
285
- }
286
- };
287
- }
288
- const definition = {
289
- model: {
290
- key: 'alignment',
291
- values: options.map(option => option.name)
292
- },
293
- view
294
- };
295
- return definition;
296
- }
297
- /**
298
- * Prepare upcast definitions for inline alignment styles.
299
- */
300
- function buildUpcastInlineDefinitions(options) {
301
- const definitions = [];
302
- for (const { name } of options) {
303
- definitions.push({
304
- view: {
305
- key: 'style',
306
- value: {
307
- 'text-align': name
308
- }
309
- },
310
- model: {
311
- key: 'alignment',
312
- value: name
313
- }
314
- });
315
- }
316
- return definitions;
317
- }
318
- /**
319
- * Prepare upcast definitions for deprecated `align` attribute.
320
- */
321
- function buildUpcastCompatibilityDefinitions(options) {
322
- const definitions = [];
323
- for (const { name } of options) {
324
- definitions.push({
325
- view: {
326
- key: 'align',
327
- value: name
328
- },
329
- model: {
330
- key: 'alignment',
331
- value: name
332
- }
333
- });
334
- }
335
- return definitions;
336
- }
337
- /**
338
- * Prepare conversion definitions for upcast and downcast alignment with classes.
339
- */
340
- function buildClassDefinition(options) {
341
- const view = {};
342
- for (const option of options) {
343
- view[option.name] = {
344
- key: 'class',
345
- value: option.className
346
- };
347
- }
348
- const definition = {
349
- model: {
350
- key: 'alignment',
351
- values: options.map(option => option.name)
352
- },
353
- view
354
- };
355
- return definition;
356
- }
357
-
358
- /**
359
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
360
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
361
- */
362
- /**
363
- * @module alignment/alignmentui
364
- */
365
- const iconsMap = new Map([
366
- ['left', icons.alignLeft],
367
- ['right', icons.alignRight],
368
- ['center', icons.alignCenter],
369
- ['justify', icons.alignJustify]
370
- ]);
371
- /**
372
- * The default alignment UI plugin.
373
- *
374
- * It introduces the `'alignment:left'`, `'alignment:right'`, `'alignment:center'` and `'alignment:justify'` buttons
375
- * and the `'alignment'` dropdown.
376
- */
377
- class AlignmentUI extends Plugin {
378
- /**
379
- * Returns the localized option titles provided by the plugin.
380
- *
381
- * The following localized titles corresponding with
382
- * {@link module:alignment/alignmentconfig~AlignmentConfig#options} are available:
383
- *
384
- * * `'left'`,
385
- * * `'right'`,
386
- * * `'center'`,
387
- * * `'justify'`.
388
- *
389
- * @readonly
390
- */
391
- get localizedOptionTitles() {
392
- const t = this.editor.t;
393
- return {
394
- 'left': t('Align left'),
395
- 'right': t('Align right'),
396
- 'center': t('Align center'),
397
- 'justify': t('Justify')
398
- };
399
- }
400
- /**
401
- * @inheritDoc
402
- */
403
- static get pluginName() {
404
- return 'AlignmentUI';
405
- }
406
- /**
407
- * @inheritDoc
408
- */
409
- init() {
410
- const editor = this.editor;
411
- const componentFactory = editor.ui.componentFactory;
412
- const t = editor.t;
413
- const options = normalizeAlignmentOptions(editor.config.get('alignment.options'));
414
- options
415
- .map(option => option.name)
416
- .filter(isSupported)
417
- .forEach(option => this._addButton(option));
418
- componentFactory.add('alignment', locale => {
419
- const dropdownView = createDropdown(locale);
420
- // Add existing alignment buttons to dropdown's toolbar.
421
- addToolbarToDropdown(dropdownView, () => options.map(option => componentFactory.create(`alignment:${option.name}`)), {
422
- enableActiveItemFocusOnDropdownOpen: true,
423
- isVertical: true,
424
- ariaLabel: t('Text alignment toolbar')
425
- });
426
- // Configure dropdown properties an behavior.
427
- dropdownView.buttonView.set({
428
- label: t('Text alignment'),
429
- tooltip: true
430
- });
431
- dropdownView.extendTemplate({
432
- attributes: {
433
- class: 'ck-alignment-dropdown'
434
- }
435
- });
436
- // The default icon depends on the direction of the content.
437
- const defaultIcon = locale.contentLanguageDirection === 'rtl' ? iconsMap.get('right') : iconsMap.get('left');
438
- const command = editor.commands.get('alignment');
439
- // Change icon to reflect current selection's alignment.
440
- dropdownView.buttonView.bind('icon').to(command, 'value', value => iconsMap.get(value) || defaultIcon);
441
- // Enable button if any of the buttons is enabled.
442
- dropdownView.bind('isEnabled').to(command, 'isEnabled');
443
- // Focus the editable after executing the command.
444
- // Overrides a default behaviour where the focus is moved to the dropdown button (#12125).
445
- this.listenTo(dropdownView, 'execute', () => {
446
- editor.editing.view.focus();
447
- });
448
- return dropdownView;
449
- });
450
- }
451
- /**
452
- * Helper method for initializing the button and linking it with an appropriate command.
453
- *
454
- * @param option The name of the alignment option for which the button is added.
455
- */
456
- _addButton(option) {
457
- const editor = this.editor;
458
- editor.ui.componentFactory.add(`alignment:${option}`, locale => {
459
- const command = editor.commands.get('alignment');
460
- const buttonView = new ButtonView(locale);
461
- buttonView.set({
462
- label: this.localizedOptionTitles[option],
463
- icon: iconsMap.get(option),
464
- tooltip: true,
465
- isToggleable: true
466
- });
467
- // Bind button model to command.
468
- buttonView.bind('isEnabled').to(command);
469
- buttonView.bind('isOn').to(command, 'value', value => value === option);
470
- // Execute command.
471
- this.listenTo(buttonView, 'execute', () => {
472
- editor.execute('alignment', { value: option });
473
- editor.editing.view.focus();
474
- });
475
- return buttonView;
476
- });
477
- }
478
- }
479
-
480
- /**
481
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
482
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
483
- */
484
- /**
485
- * @module alignment/alignment
486
- */
487
- /**
488
- * The text alignment plugin.
489
- *
490
- * For a detailed overview, check the {@glink features/text-alignment Text alignment} feature guide
491
- * and the {@glink api/alignment package page}.
492
- *
493
- * This is a "glue" plugin which loads the {@link module:alignment/alignmentediting~AlignmentEditing} and
494
- * {@link module:alignment/alignmentui~AlignmentUI} plugins.
495
- */
496
- class Alignment extends Plugin {
497
- /**
498
- * @inheritDoc
499
- */
500
- static get requires() {
501
- return [AlignmentEditing, AlignmentUI];
502
- }
503
- /**
504
- * @inheritDoc
505
- */
506
- static get pluginName() {
507
- return 'Alignment';
508
- }
509
- }
510
-
511
- export { Alignment, AlignmentEditing, AlignmentUI };
512
- //# sourceMappingURL=index.js.map