@ckeditor/ckeditor5-alignment 0.0.0-internal-20241017.0 → 0.0.0-internal-20241206.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/LICENSE.md +7 -2
- package/README.md +18 -7
- package/build/translations/ast.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/gu.js +1 -0
- package/build/translations/hy.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/oc.js +1 -0
- package/build/translations/si.js +1 -0
- package/dist/index.js +89 -89
- package/dist/index.js.map +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/ast.umd.js +11 -0
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/eo.umd.js +11 -0
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/eu.umd.js +11 -0
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gu.d.ts +8 -0
- package/dist/translations/gu.js +5 -0
- package/dist/translations/gu.umd.js +11 -0
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hy.d.ts +8 -0
- package/dist/translations/hy.js +5 -0
- package/dist/translations/hy.umd.js +11 -0
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/kn.umd.js +11 -0
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/oc.d.ts +8 -0
- package/dist/translations/oc.js +5 -0
- package/dist/translations/oc.umd.js +11 -0
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.d.ts +8 -0
- package/dist/translations/si.js +5 -0
- package/dist/translations/si.umd.js +11 -0
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/lang/translations/af.po +3 -9
- package/lang/translations/ar.po +4 -10
- package/lang/translations/ast.po +36 -0
- package/lang/translations/az.po +3 -9
- package/lang/translations/bg.po +3 -9
- package/lang/translations/bn.po +3 -9
- package/lang/translations/bs.po +4 -10
- package/lang/translations/ca.po +3 -9
- package/lang/translations/cs.po +4 -10
- package/lang/translations/da.po +3 -9
- package/lang/translations/de-ch.po +3 -9
- package/lang/translations/de.po +3 -9
- package/lang/translations/el.po +3 -9
- package/lang/translations/en-au.po +3 -9
- package/lang/translations/en-gb.po +3 -9
- package/lang/translations/en.po +5 -11
- package/lang/translations/eo.po +36 -0
- package/lang/translations/es-co.po +4 -10
- package/lang/translations/es.po +4 -10
- package/lang/translations/et.po +3 -9
- package/lang/translations/eu.po +36 -0
- package/lang/translations/fa.po +4 -10
- package/lang/translations/fi.po +3 -9
- package/lang/translations/fr.po +4 -10
- package/lang/translations/gl.po +3 -9
- package/lang/translations/gu.po +36 -0
- package/lang/translations/he.po +4 -10
- package/lang/translations/hi.po +3 -9
- package/lang/translations/hr.po +4 -10
- package/lang/translations/hu.po +3 -9
- package/lang/translations/hy.po +36 -0
- package/lang/translations/id.po +3 -9
- package/lang/translations/it.po +4 -10
- package/lang/translations/ja.po +3 -9
- package/lang/translations/jv.po +4 -10
- package/lang/translations/kk.po +4 -10
- package/lang/translations/km.po +3 -9
- package/lang/translations/kn.po +36 -0
- package/lang/translations/ko.po +3 -9
- package/lang/translations/ku.po +3 -9
- package/lang/translations/lt.po +4 -10
- package/lang/translations/lv.po +4 -10
- package/lang/translations/ms.po +3 -9
- package/lang/translations/nb.po +3 -9
- package/lang/translations/ne.po +3 -9
- package/lang/translations/nl.po +3 -9
- package/lang/translations/no.po +3 -9
- package/lang/translations/oc.po +36 -0
- package/lang/translations/pl.po +4 -10
- package/lang/translations/pt-br.po +4 -10
- package/lang/translations/pt.po +4 -10
- package/lang/translations/ro.po +4 -10
- package/lang/translations/ru.po +4 -10
- package/lang/translations/si.po +36 -0
- package/lang/translations/sk.po +4 -10
- package/lang/translations/sl.po +4 -10
- package/lang/translations/sq.po +3 -9
- package/lang/translations/sr-latn.po +4 -10
- package/lang/translations/sr.po +4 -10
- package/lang/translations/sv.po +3 -9
- package/lang/translations/th.po +3 -9
- package/lang/translations/ti.po +3 -9
- package/lang/translations/tk.po +3 -9
- package/lang/translations/tr.po +3 -9
- package/lang/translations/tt.po +3 -9
- package/lang/translations/ug.po +4 -10
- package/lang/translations/uk.po +4 -10
- package/lang/translations/ur.po +3 -9
- package/lang/translations/uz.po +4 -10
- package/lang/translations/vi.po +3 -9
- package/lang/translations/zh-cn.po +3 -9
- package/lang/translations/zh.po +3 -9
- package/package.json +25 -7
- package/src/alignment.d.ts +1 -1
- package/src/alignment.js +1 -1
- package/src/alignmentcommand.d.ts +1 -1
- package/src/alignmentcommand.js +1 -1
- package/src/alignmentconfig.d.ts +1 -1
- package/src/alignmentconfig.js +1 -1
- package/src/alignmentediting.d.ts +1 -1
- package/src/alignmentediting.js +1 -1
- package/src/alignmentui.d.ts +1 -1
- package/src/alignmentui.js +1 -1
- package/src/augmentation.d.ts +1 -1
- package/src/augmentation.js +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/utils.d.ts +1 -1
- package/src/utils.js +1 -1
- package/dist/alignment.d.ts +0 -37
- package/dist/alignmentcommand.d.ts +0 -47
- package/dist/alignmentconfig.d.ts +0 -76
- package/dist/alignmentediting.d.ts +0 -34
- package/dist/alignmentui.d.ts +0 -73
- package/dist/augmentation.d.ts +0 -27
- package/dist/index.d.ts +0 -17
- package/dist/utils.d.ts +0 -43
package/LICENSE.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
Software License Agreement
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
|
-
**CKEditor 5
|
|
4
|
+
**CKEditor 5 Text alignment feature** (https://github.com/ckeditor/ckeditor5)<br>
|
|
5
5
|
Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
6
|
|
|
7
|
-
Licensed under
|
|
7
|
+
Licensed under a dual-license model, this software is available under:
|
|
8
|
+
|
|
9
|
+
* the [GNU General Public License Version 2 or later](https://www.gnu.org/licenses/gpl.html),
|
|
10
|
+
* or commercial license terms from CKSource Holding sp. z o.o.
|
|
11
|
+
|
|
12
|
+
For more information, see: [https://ckeditor.com/legal/ckeditor-licensing-options](https://ckeditor.com/legal/ckeditor-licensing-options).
|
|
8
13
|
|
|
9
14
|
Sources of Intellectual Property Included in CKEditor
|
|
10
15
|
-----------------------------------------------------
|
package/README.md
CHANGED
|
@@ -3,10 +3,22 @@ CKEditor 5 text alignment feature
|
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@ckeditor/ckeditor5-alignment)
|
|
5
5
|
[](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
|
|
6
|
-
[](https://app.circleci.com/pipelines/github/ckeditor/ckeditor5?branch=master)
|
|
7
7
|
|
|
8
8
|
This package implements text alignment support for CKEditor 5.
|
|
9
9
|
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
This plugin is part of the `ckeditor5` package. Install the whole package to use it.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install ckeditor5
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Create free account
|
|
19
|
+
|
|
20
|
+
If you want to check full CKEditor 5 capabilities, sign up for a [free non-commitment 14-day trial](https://portal.ckeditor.com/checkout?plan=free).
|
|
21
|
+
|
|
10
22
|
## Demo
|
|
11
23
|
|
|
12
24
|
Check out the [demo in the text alignment feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/text-alignment.html#demo).
|
|
@@ -15,12 +27,11 @@ Check out the [demo in the text alignment feature guide](https://ckeditor.com/do
|
|
|
15
27
|
|
|
16
28
|
See the [`@ckeditor/ckeditor5-alignment` package](https://ckeditor.com/docs/ckeditor5/latest/api/alignment.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
|
|
17
29
|
|
|
18
|
-
##
|
|
30
|
+
## License
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
npm install ckeditor5
|
|
22
|
-
```
|
|
32
|
+
Licensed under a dual-license model, this software is available under:
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
* the [GNU General Public License Version 2 or later](https://www.gnu.org/licenses/gpl.html),
|
|
35
|
+
* or commercial license terms from CKSource Holding sp. z o.o.
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
For more information, see: [https://ckeditor.com/legal/ckeditor-licensing-options](https://ckeditor.com/legal/ckeditor-licensing-options).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const t=n.ast=n.ast||{};t.dictionary=Object.assign(t.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.eo=n.eo||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.eu=n.eu||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.gu=n.gu||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.hy=n.hy||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.kn=n.kn||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.oc=n.oc||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(i){const n=i.si=i.si||{};n.dictionary=Object.assign(n.dictionary||{},{"Align center":"","Align left":"","Align right":"",Justify:"","Text alignment":"","Text alignment toolbar":""})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
package/dist/index.js
CHANGED
|
@@ -63,12 +63,12 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
63
63
|
const isNameValid = supportedOptions.includes(option.name);
|
|
64
64
|
if (!isNameValid) {
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
* The `name` in one of the `alignment.options` is not recognized.
|
|
67
|
+
* The available options are: `'left'`, `'right'`, `'center'` and `'justify'`.
|
|
68
|
+
*
|
|
69
|
+
* @error alignment-config-name-not-recognized
|
|
70
|
+
* @param option Options with unknown value of the `name` property.
|
|
71
|
+
*/ logWarning('alignment-config-name-not-recognized', {
|
|
72
72
|
option
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -78,11 +78,11 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
78
78
|
// We either use classes for all styling options or for none.
|
|
79
79
|
if (classNameCount && classNameCount < normalizedOptions.length) {
|
|
80
80
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
* The `className` property has to be defined for all options once at least one option declares `className`.
|
|
82
|
+
*
|
|
83
|
+
* @error alignment-config-classnames-are-missing
|
|
84
|
+
* @param configuredOptions Contents of `alignment.options`.
|
|
85
|
+
*/ throw new CKEditorError('alignment-config-classnames-are-missing', {
|
|
86
86
|
configuredOptions
|
|
87
87
|
});
|
|
88
88
|
}
|
|
@@ -92,13 +92,13 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
92
92
|
const nameAlreadyExists = succeedingOptions.some((item)=>item.name == option.name);
|
|
93
93
|
if (nameAlreadyExists) {
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
* The same `name` in one of the `alignment.options` was already declared.
|
|
96
|
+
* Each `name` representing one alignment option can be set exactly once.
|
|
97
|
+
*
|
|
98
|
+
* @error alignment-config-name-already-defined
|
|
99
|
+
* @param option First option that declares given `name`.
|
|
100
|
+
* @param configuredOptions Contents of `alignment.options`.
|
|
101
|
+
*/ throw new CKEditorError('alignment-config-name-already-defined', {
|
|
102
102
|
option,
|
|
103
103
|
configuredOptions
|
|
104
104
|
});
|
|
@@ -108,13 +108,13 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
108
108
|
const classNameAlreadyExists = succeedingOptions.some((item)=>item.className == option.className);
|
|
109
109
|
if (classNameAlreadyExists) {
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
* The same `className` in one of the `alignment.options` was already declared.
|
|
112
|
+
*
|
|
113
|
+
* @error alignment-config-classname-already-defined
|
|
114
|
+
* @param option First option that declares given `className`.
|
|
115
|
+
* @param configuredOptions
|
|
116
|
+
* Contents of `alignment.options`.
|
|
117
|
+
*/ throw new CKEditorError('alignment-config-classname-already-defined', {
|
|
118
118
|
option,
|
|
119
119
|
configuredOptions
|
|
120
120
|
});
|
|
@@ -129,8 +129,8 @@ const ALIGNMENT = 'alignment';
|
|
|
129
129
|
* The alignment command plugin.
|
|
130
130
|
*/ class AlignmentCommand extends Command {
|
|
131
131
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
* @inheritDoc
|
|
133
|
+
*/ refresh() {
|
|
134
134
|
const editor = this.editor;
|
|
135
135
|
const locale = editor.locale;
|
|
136
136
|
const firstBlock = first(this.editor.model.document.selection.getSelectedBlocks());
|
|
@@ -143,14 +143,14 @@ const ALIGNMENT = 'alignment';
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
* Executes the command. Applies the alignment `value` to the selected blocks.
|
|
147
|
+
* If no `value` is passed, the `value` is the default one or it is equal to the currently selected block's alignment attribute,
|
|
148
|
+
* the command will remove the attribute from the selected blocks.
|
|
149
|
+
*
|
|
150
|
+
* @param options Options for the executed command.
|
|
151
|
+
* @param options.value The value to apply.
|
|
152
|
+
* @fires execute
|
|
153
|
+
*/ execute(options = {}) {
|
|
154
154
|
const editor = this.editor;
|
|
155
155
|
const locale = editor.locale;
|
|
156
156
|
const model = editor.model;
|
|
@@ -173,10 +173,10 @@ const ALIGNMENT = 'alignment';
|
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
* Checks whether a block can have alignment set.
|
|
177
|
+
*
|
|
178
|
+
* @param block The block to be checked.
|
|
179
|
+
*/ _canBeAligned(block) {
|
|
180
180
|
return this.editor.model.schema.checkAttribute(block, ALIGNMENT);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -200,18 +200,18 @@ const ALIGNMENT = 'alignment';
|
|
|
200
200
|
* the `alignment` attribute for block elements in the {@link module:engine/model/model~Model model}.
|
|
201
201
|
*/ class AlignmentEditing extends Plugin {
|
|
202
202
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
* @inheritDoc
|
|
204
|
+
*/ static get pluginName() {
|
|
205
205
|
return 'AlignmentEditing';
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
* @inheritDoc
|
|
209
|
+
*/ static get isOfficialPlugin() {
|
|
210
210
|
return true;
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
* @inheritDoc
|
|
214
|
+
*/ constructor(editor){
|
|
215
215
|
super(editor);
|
|
216
216
|
editor.config.define('alignment', {
|
|
217
217
|
options: supportedOptions.map((option)=>({
|
|
@@ -220,8 +220,8 @@ const ALIGNMENT = 'alignment';
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
* @inheritDoc
|
|
224
|
+
*/ init() {
|
|
225
225
|
const editor = this.editor;
|
|
226
226
|
const locale = editor.locale;
|
|
227
227
|
const schema = editor.model.schema;
|
|
@@ -360,18 +360,18 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
360
360
|
* and the `'alignment'` dropdown.
|
|
361
361
|
*/ class AlignmentUI extends Plugin {
|
|
362
362
|
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
363
|
+
* Returns the localized option titles provided by the plugin.
|
|
364
|
+
*
|
|
365
|
+
* The following localized titles corresponding with
|
|
366
|
+
* {@link module:alignment/alignmentconfig~AlignmentConfig#options} are available:
|
|
367
|
+
*
|
|
368
|
+
* * `'left'`,
|
|
369
|
+
* * `'right'`,
|
|
370
|
+
* * `'center'`,
|
|
371
|
+
* * `'justify'`.
|
|
372
|
+
*
|
|
373
|
+
* @readonly
|
|
374
|
+
*/ get localizedOptionTitles() {
|
|
375
375
|
const t = this.editor.t;
|
|
376
376
|
return {
|
|
377
377
|
'left': t('Align left'),
|
|
@@ -381,18 +381,18 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
381
381
|
};
|
|
382
382
|
}
|
|
383
383
|
/**
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
* @inheritDoc
|
|
385
|
+
*/ static get pluginName() {
|
|
386
386
|
return 'AlignmentUI';
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
* @inheritDoc
|
|
390
|
+
*/ static get isOfficialPlugin() {
|
|
391
391
|
return true;
|
|
392
392
|
}
|
|
393
393
|
/**
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
* @inheritDoc
|
|
395
|
+
*/ init() {
|
|
396
396
|
const editor = this.editor;
|
|
397
397
|
const options = normalizeAlignmentOptions(editor.config.get('alignment.options'));
|
|
398
398
|
options.map((option)=>option.name).filter(isSupported).forEach((option)=>this._addButton(option));
|
|
@@ -400,20 +400,20 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
400
400
|
this._addMenuBarMenu(options);
|
|
401
401
|
}
|
|
402
402
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
403
|
+
* Helper method for initializing the button and linking it with an appropriate command.
|
|
404
|
+
*
|
|
405
|
+
* @param option The name of the alignment option for which the button is added.
|
|
406
|
+
*/ _addButton(option) {
|
|
407
407
|
const editor = this.editor;
|
|
408
408
|
editor.ui.componentFactory.add(`alignment:${option}`, (locale)=>this._createButton(locale, option));
|
|
409
409
|
}
|
|
410
410
|
/**
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
411
|
+
* Helper method for creating the button view element.
|
|
412
|
+
*
|
|
413
|
+
* @param locale Editor locale.
|
|
414
|
+
* @param option The name of the alignment option for which the button is added.
|
|
415
|
+
* @param buttonAttrs Optional parameters passed to button view instance.
|
|
416
|
+
*/ _createButton(locale, option, buttonAttrs = {}) {
|
|
417
417
|
const editor = this.editor;
|
|
418
418
|
const command = editor.commands.get('alignment');
|
|
419
419
|
const buttonView = new ButtonView(locale);
|
|
@@ -437,10 +437,10 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
437
437
|
return buttonView;
|
|
438
438
|
}
|
|
439
439
|
/**
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
440
|
+
* Helper method for initializing the toolnar dropdown and linking it with an appropriate command.
|
|
441
|
+
*
|
|
442
|
+
* @param option The name of the alignment option for which the button is added.
|
|
443
|
+
*/ _addToolbarDropdown(options) {
|
|
444
444
|
const editor = this.editor;
|
|
445
445
|
const factory = editor.ui.componentFactory;
|
|
446
446
|
factory.add('alignment', (locale)=>{
|
|
@@ -481,10 +481,10 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
481
481
|
});
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
484
|
+
* Creates a menu for all alignment options to use either in menu bar.
|
|
485
|
+
*
|
|
486
|
+
* @param options Normalized alignment options from config.
|
|
487
|
+
*/ _addMenuBarMenu(options) {
|
|
488
488
|
const editor = this.editor;
|
|
489
489
|
editor.ui.componentFactory.add('menuBar:alignment', (locale)=>{
|
|
490
490
|
const command = editor.commands.get('alignment');
|
|
@@ -536,21 +536,21 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
536
536
|
* {@link module:alignment/alignmentui~AlignmentUI} plugins.
|
|
537
537
|
*/ class Alignment extends Plugin {
|
|
538
538
|
/**
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
* @inheritDoc
|
|
540
|
+
*/ static get requires() {
|
|
541
541
|
return [
|
|
542
542
|
AlignmentEditing,
|
|
543
543
|
AlignmentUI
|
|
544
544
|
];
|
|
545
545
|
}
|
|
546
546
|
/**
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
* @inheritDoc
|
|
548
|
+
*/ static get pluginName() {
|
|
549
549
|
return 'Alignment';
|
|
550
550
|
}
|
|
551
551
|
/**
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
* @inheritDoc
|
|
553
|
+
*/ static get isOfficialPlugin() {
|
|
554
554
|
return true;
|
|
555
555
|
}
|
|
556
556
|
}
|