@ckeditor/ckeditor5-alignment 0.0.0-internal-20241206.0 → 0.0.0-internal-20251211.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 +4 -4
- package/README.md +1 -1
- package/build/alignment.js +2 -2
- package/build/translations/be.js +1 -0
- package/ckeditor5-metadata.json +1 -1
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +2 -2
- package/dist/index.js +103 -97
- package/dist/index.js.map +1 -1
- package/dist/translations/af.d.ts +2 -2
- package/dist/translations/af.js +2 -2
- package/dist/translations/af.umd.js +2 -2
- package/dist/translations/ar.d.ts +2 -2
- package/dist/translations/ar.js +2 -2
- package/dist/translations/ar.umd.js +2 -2
- package/dist/translations/ast.d.ts +2 -2
- package/dist/translations/ast.js +2 -2
- package/dist/translations/ast.umd.js +2 -2
- package/dist/translations/az.d.ts +2 -2
- package/dist/translations/az.js +2 -2
- package/dist/translations/az.umd.js +2 -2
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- package/dist/translations/bg.d.ts +2 -2
- package/dist/translations/bg.js +2 -2
- package/dist/translations/bg.umd.js +2 -2
- package/dist/translations/bn.d.ts +2 -2
- package/dist/translations/bn.js +2 -2
- package/dist/translations/bn.umd.js +2 -2
- package/dist/translations/bs.d.ts +2 -2
- package/dist/translations/bs.js +2 -2
- package/dist/translations/bs.umd.js +2 -2
- package/dist/translations/ca.d.ts +2 -2
- package/dist/translations/ca.js +2 -2
- package/dist/translations/ca.umd.js +2 -2
- package/dist/translations/cs.d.ts +2 -2
- package/dist/translations/cs.js +2 -2
- package/dist/translations/cs.umd.js +2 -2
- package/dist/translations/da.d.ts +2 -2
- package/dist/translations/da.js +2 -2
- package/dist/translations/da.umd.js +2 -2
- package/dist/translations/de-ch.d.ts +2 -2
- package/dist/translations/de-ch.js +2 -2
- package/dist/translations/de-ch.umd.js +2 -2
- package/dist/translations/de.d.ts +2 -2
- package/dist/translations/de.js +2 -2
- package/dist/translations/de.umd.js +2 -2
- package/dist/translations/el.d.ts +2 -2
- package/dist/translations/el.js +2 -2
- package/dist/translations/el.umd.js +2 -2
- package/dist/translations/en-au.d.ts +2 -2
- package/dist/translations/en-au.js +2 -2
- package/dist/translations/en-au.umd.js +2 -2
- package/dist/translations/en-gb.d.ts +2 -2
- package/dist/translations/en-gb.js +2 -2
- package/dist/translations/en-gb.umd.js +2 -2
- package/dist/translations/en.d.ts +2 -2
- package/dist/translations/en.js +2 -2
- package/dist/translations/en.umd.js +2 -2
- package/dist/translations/eo.d.ts +2 -2
- package/dist/translations/eo.js +2 -2
- package/dist/translations/eo.umd.js +2 -2
- package/dist/translations/es-co.d.ts +2 -2
- package/dist/translations/es-co.js +2 -2
- package/dist/translations/es-co.umd.js +2 -2
- package/dist/translations/es.d.ts +2 -2
- package/dist/translations/es.js +2 -2
- package/dist/translations/es.umd.js +2 -2
- package/dist/translations/et.d.ts +2 -2
- package/dist/translations/et.js +2 -2
- package/dist/translations/et.umd.js +2 -2
- package/dist/translations/eu.d.ts +2 -2
- package/dist/translations/eu.js +2 -2
- package/dist/translations/eu.umd.js +2 -2
- package/dist/translations/fa.d.ts +2 -2
- package/dist/translations/fa.js +2 -2
- package/dist/translations/fa.umd.js +2 -2
- package/dist/translations/fi.d.ts +2 -2
- package/dist/translations/fi.js +2 -2
- package/dist/translations/fi.umd.js +2 -2
- package/dist/translations/fr.d.ts +2 -2
- package/dist/translations/fr.js +2 -2
- package/dist/translations/fr.umd.js +2 -2
- package/dist/translations/gl.d.ts +2 -2
- package/dist/translations/gl.js +2 -2
- package/dist/translations/gl.umd.js +2 -2
- package/dist/translations/gu.d.ts +2 -2
- package/dist/translations/gu.js +2 -2
- package/dist/translations/gu.umd.js +2 -2
- package/dist/translations/he.d.ts +2 -2
- package/dist/translations/he.js +2 -2
- package/dist/translations/he.umd.js +2 -2
- package/dist/translations/hi.d.ts +2 -2
- package/dist/translations/hi.js +2 -2
- package/dist/translations/hi.umd.js +2 -2
- package/dist/translations/hr.d.ts +2 -2
- package/dist/translations/hr.js +2 -2
- package/dist/translations/hr.umd.js +2 -2
- package/dist/translations/hu.d.ts +2 -2
- package/dist/translations/hu.js +2 -2
- package/dist/translations/hu.umd.js +2 -2
- package/dist/translations/hy.d.ts +2 -2
- package/dist/translations/hy.js +2 -2
- package/dist/translations/hy.umd.js +2 -2
- package/dist/translations/id.d.ts +2 -2
- package/dist/translations/id.js +2 -2
- package/dist/translations/id.umd.js +2 -2
- package/dist/translations/it.d.ts +2 -2
- package/dist/translations/it.js +2 -2
- package/dist/translations/it.umd.js +2 -2
- package/dist/translations/ja.d.ts +2 -2
- package/dist/translations/ja.js +2 -2
- package/dist/translations/ja.umd.js +2 -2
- package/dist/translations/jv.d.ts +2 -2
- package/dist/translations/jv.js +2 -2
- package/dist/translations/jv.umd.js +2 -2
- package/dist/translations/kk.d.ts +2 -2
- package/dist/translations/kk.js +2 -2
- package/dist/translations/kk.umd.js +2 -2
- package/dist/translations/km.d.ts +2 -2
- package/dist/translations/km.js +2 -2
- package/dist/translations/km.umd.js +2 -2
- package/dist/translations/kn.d.ts +2 -2
- package/dist/translations/kn.js +2 -2
- package/dist/translations/kn.umd.js +2 -2
- package/dist/translations/ko.d.ts +2 -2
- package/dist/translations/ko.js +2 -2
- package/dist/translations/ko.umd.js +2 -2
- package/dist/translations/ku.d.ts +2 -2
- package/dist/translations/ku.js +2 -2
- package/dist/translations/ku.umd.js +2 -2
- package/dist/translations/lt.d.ts +2 -2
- package/dist/translations/lt.js +2 -2
- package/dist/translations/lt.umd.js +2 -2
- package/dist/translations/lv.d.ts +2 -2
- package/dist/translations/lv.js +2 -2
- package/dist/translations/lv.umd.js +2 -2
- package/dist/translations/ms.d.ts +2 -2
- package/dist/translations/ms.js +2 -2
- package/dist/translations/ms.umd.js +2 -2
- package/dist/translations/nb.d.ts +2 -2
- package/dist/translations/nb.js +2 -2
- package/dist/translations/nb.umd.js +2 -2
- package/dist/translations/ne.d.ts +2 -2
- package/dist/translations/ne.js +2 -2
- package/dist/translations/ne.umd.js +2 -2
- package/dist/translations/nl.d.ts +2 -2
- package/dist/translations/nl.js +2 -2
- package/dist/translations/nl.umd.js +2 -2
- package/dist/translations/no.d.ts +2 -2
- package/dist/translations/no.js +2 -2
- package/dist/translations/no.umd.js +2 -2
- package/dist/translations/oc.d.ts +2 -2
- package/dist/translations/oc.js +2 -2
- package/dist/translations/oc.umd.js +2 -2
- package/dist/translations/pl.d.ts +2 -2
- package/dist/translations/pl.js +2 -2
- package/dist/translations/pl.umd.js +2 -2
- package/dist/translations/pt-br.d.ts +2 -2
- package/dist/translations/pt-br.js +2 -2
- package/dist/translations/pt-br.umd.js +2 -2
- package/dist/translations/pt.d.ts +2 -2
- package/dist/translations/pt.js +2 -2
- package/dist/translations/pt.umd.js +2 -2
- package/dist/translations/ro.d.ts +2 -2
- package/dist/translations/ro.js +2 -2
- package/dist/translations/ro.umd.js +2 -2
- package/dist/translations/ru.d.ts +2 -2
- package/dist/translations/ru.js +2 -2
- package/dist/translations/ru.umd.js +2 -2
- package/dist/translations/si.d.ts +2 -2
- package/dist/translations/si.js +2 -2
- package/dist/translations/si.umd.js +2 -2
- package/dist/translations/sk.d.ts +2 -2
- package/dist/translations/sk.js +2 -2
- package/dist/translations/sk.umd.js +2 -2
- package/dist/translations/sl.d.ts +2 -2
- package/dist/translations/sl.js +2 -2
- package/dist/translations/sl.umd.js +2 -2
- package/dist/translations/sq.d.ts +2 -2
- package/dist/translations/sq.js +2 -2
- package/dist/translations/sq.umd.js +2 -2
- package/dist/translations/sr-latn.d.ts +2 -2
- package/dist/translations/sr-latn.js +2 -2
- package/dist/translations/sr-latn.umd.js +2 -2
- package/dist/translations/sr.d.ts +2 -2
- package/dist/translations/sr.js +2 -2
- package/dist/translations/sr.umd.js +2 -2
- package/dist/translations/sv.d.ts +2 -2
- package/dist/translations/sv.js +2 -2
- package/dist/translations/sv.umd.js +2 -2
- package/dist/translations/th.d.ts +2 -2
- package/dist/translations/th.js +2 -2
- package/dist/translations/th.umd.js +2 -2
- package/dist/translations/ti.d.ts +2 -2
- package/dist/translations/ti.js +2 -2
- package/dist/translations/ti.umd.js +2 -2
- package/dist/translations/tk.d.ts +2 -2
- package/dist/translations/tk.js +2 -2
- package/dist/translations/tk.umd.js +2 -2
- package/dist/translations/tr.d.ts +2 -2
- package/dist/translations/tr.js +2 -2
- package/dist/translations/tr.umd.js +2 -2
- package/dist/translations/tt.d.ts +2 -2
- package/dist/translations/tt.js +2 -2
- package/dist/translations/tt.umd.js +2 -2
- package/dist/translations/ug.d.ts +2 -2
- package/dist/translations/ug.js +2 -2
- package/dist/translations/ug.umd.js +2 -2
- package/dist/translations/uk.d.ts +2 -2
- package/dist/translations/uk.js +2 -2
- package/dist/translations/uk.umd.js +2 -2
- package/dist/translations/ur.d.ts +2 -2
- package/dist/translations/ur.js +2 -2
- package/dist/translations/ur.umd.js +2 -2
- package/dist/translations/uz.d.ts +2 -2
- package/dist/translations/uz.js +2 -2
- package/dist/translations/uz.umd.js +2 -2
- package/dist/translations/vi.d.ts +2 -2
- package/dist/translations/vi.js +2 -2
- package/dist/translations/vi.umd.js +2 -2
- package/dist/translations/zh-cn.d.ts +2 -2
- package/dist/translations/zh-cn.js +2 -2
- package/dist/translations/zh-cn.umd.js +2 -2
- package/dist/translations/zh.d.ts +2 -2
- package/dist/translations/zh.js +2 -2
- package/dist/translations/zh.umd.js +2 -2
- package/lang/translations/af.po +1 -1
- package/lang/translations/ar.po +1 -1
- package/lang/translations/ast.po +1 -1
- package/lang/translations/az.po +1 -1
- package/lang/translations/be.po +36 -0
- package/lang/translations/bg.po +1 -1
- package/lang/translations/bn.po +1 -1
- package/lang/translations/bs.po +1 -1
- package/lang/translations/ca.po +1 -1
- package/lang/translations/cs.po +1 -1
- package/lang/translations/da.po +1 -1
- package/lang/translations/de-ch.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +1 -1
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/en-gb.po +1 -1
- package/lang/translations/en.po +1 -1
- package/lang/translations/eo.po +1 -1
- package/lang/translations/es-co.po +1 -1
- package/lang/translations/es.po +1 -1
- package/lang/translations/et.po +1 -1
- package/lang/translations/eu.po +1 -1
- package/lang/translations/fa.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/gu.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/hy.po +1 -1
- package/lang/translations/id.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/jv.po +1 -1
- package/lang/translations/kk.po +1 -1
- package/lang/translations/km.po +1 -1
- package/lang/translations/kn.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/ku.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/ms.po +1 -1
- package/lang/translations/nb.po +1 -1
- package/lang/translations/ne.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/oc.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/pt.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/si.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sl.po +1 -1
- package/lang/translations/sq.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/ti.po +1 -1
- package/lang/translations/tk.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/tt.po +1 -1
- package/lang/translations/ug.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/ur.po +1 -1
- package/lang/translations/uz.po +1 -1
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +1 -1
- package/lang/translations/zh.po +1 -1
- package/package.json +13 -9
- package/src/alignment.d.ts +4 -4
- package/src/alignment.js +4 -4
- package/src/alignmentcommand.d.ts +5 -5
- package/src/alignmentcommand.js +2 -2
- package/src/alignmentconfig.d.ts +4 -4
- package/src/alignmentconfig.js +1 -1
- package/src/alignmentediting.d.ts +2 -2
- package/src/alignmentediting.js +3 -3
- package/src/alignmentui.d.ts +5 -5
- package/src/alignmentui.js +9 -8
- package/src/augmentation.d.ts +1 -1
- package/src/augmentation.js +1 -1
- package/src/index.d.ts +7 -6
- package/src/index.js +6 -4
- package/src/utils.d.ts +8 -3
- package/src/utils.js +12 -7
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 Text alignment feature** (https://github.com/ckeditor/ckeditor5)<br>
|
|
5
|
-
Copyright (c) 2003–
|
|
5
|
+
Copyright (c) 2003–2025, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
6
|
|
|
7
7
|
Licensed under a dual-license model, this software is available under:
|
|
8
8
|
|
|
@@ -11,10 +11,10 @@ Licensed under a dual-license model, this software is available under:
|
|
|
11
11
|
|
|
12
12
|
For more information, see: [https://ckeditor.com/legal/ckeditor-licensing-options](https://ckeditor.com/legal/ckeditor-licensing-options).
|
|
13
13
|
|
|
14
|
-
Sources of Intellectual Property Included in CKEditor
|
|
15
|
-
|
|
14
|
+
Sources of Intellectual Property Included in CKEditor 5
|
|
15
|
+
------------------------------------------------------------
|
|
16
16
|
|
|
17
|
-
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
|
|
17
|
+
Where not otherwise indicated, all CKEditor 5 content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor 5 will incorporate work done by developers outside of CKSource with their express permission.
|
|
18
18
|
|
|
19
19
|
Trademarks
|
|
20
20
|
----------
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@ CKEditor 5 text alignment feature
|
|
|
2
2
|
========================================
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@ckeditor/ckeditor5-alignment)
|
|
5
|
-
[](https://codecov.io/gh/ckeditor/ckeditor5)
|
|
6
6
|
[](https://app.circleci.com/pipelines/github/ckeditor/ckeditor5?branch=master)
|
|
7
7
|
|
|
8
8
|
This package implements text alignment support for CKEditor 5.
|
package/build/alignment.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Align center":"Align center","Align left":"Align left","Align right":"Align right",Justify:"Justify","Text alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
|
|
2
2
|
/*!
|
|
3
|
-
* @license Copyright (c) 2003-
|
|
3
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var e={
|
|
5
|
+
*/(()=>{var e={237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,n)=>{e.exports=n(237)("./src/ui.js")},355:(e,t,n)=>{e.exports=n(237)("./src/icons.js")},584:(e,t,n)=>{e.exports=n(237)("./src/utils.js")},782:(e,t,n)=>{e.exports=n(237)("./src/core.js")}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{Alignment:()=>p,AlignmentCommand:()=>c,AlignmentEditing:()=>u,AlignmentUI:()=>f,_ALIGNMENT_SUPPORTED_OPTIONS:()=>o,_isAlignmentSupported:()=>a,_isDefaultAlignment:()=>r,_normalizeAlignmentOptions:()=>l});var e=n(782),t=n(584);const o=["left","right","center","justify"];function a(e){return o.includes(e)}function r(e,t){return"rtl"==t.contentLanguageDirection?"right"===e:"left"===e}function l(e){const n=e.map(e=>{let t;return t="string"==typeof e?{name:e}:e,t}).filter(e=>{const n=o.includes(e.name);return n||(0,t.logWarning)("alignment-config-name-not-recognized",{option:e}),n}),i=n.filter(e=>Boolean(e.className)).length;if(i&&i<n.length)throw new t.CKEditorError("alignment-config-classnames-are-missing",{configuredOptions:e});return n.forEach((n,i,o)=>{const a=o.slice(i+1);if(a.some(e=>e.name==n.name))throw new t.CKEditorError("alignment-config-name-already-defined",{option:n,configuredOptions:e});if(n.className){if(a.some(e=>e.className==n.className))throw new t.CKEditorError("alignment-config-classname-already-defined",{option:n,configuredOptions:e})}}),n}const s="alignment";class c extends e.Command{refresh(){const e=this.editor.locale,n=(0,t.first)(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=Boolean(n)&&this._canBeAligned(n),this.isEnabled&&n.hasAttribute("alignment")?this.value=n.getAttribute("alignment"):this.value="rtl"===e.contentLanguageDirection?"right":"left"}execute(e={}){const t=this.editor,n=t.locale,i=t.model,o=i.document,a=e.value;i.change(e=>{const t=Array.from(o.selection.getSelectedBlocks()).filter(e=>this._canBeAligned(e)),i=t[0].getAttribute("alignment");r(a,n)||i===a||!a?function(e,t){for(const n of e)t.removeAttribute(s,n)}(t,e):function(e,t,n){for(const i of e)t.setAttribute(s,n,i)}(t,e,a)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,s)}}class u extends e.Plugin{static get pluginName(){return"AlignmentEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("alignment",{options:o.map(e=>({name:e}))})}init(){const e=this.editor,t=e.locale,n=e.model.schema,i=l(e.config.get("alignment.options")).filter(e=>a(e.name)&&!r(e.name,t)),o=i.some(e=>!!e.className);n.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),o?e.conversion.attributeToAttribute(function(e){const t={};for(const n of e)t[n.name]={key:"class",value:n.className};const n={model:{key:"alignment",values:e.map(e=>e.name)},view:t};return n}(i)):e.conversion.for("downcast").attributeToAttribute(function(e){const t={};for(const{name:n}of e)t[n]={key:"style",value:{"text-align":n}};const n={model:{key:"alignment",values:e.map(e=>e.name)},view:t};return n}(i));const s=function(e){const t=[];for(const{name:n}of e)t.push({view:{key:"style",value:{"text-align":n}},model:{key:"alignment",value:n}});return t}(i);for(const t of s)e.conversion.for("upcast").attributeToAttribute(t);const u=function(e){const t=[];for(const{name:n}of e)t.push({view:{key:"align",value:n},model:{key:"alignment",value:n}});return t}(i);for(const t of u)e.conversion.for("upcast").attributeToAttribute(t);e.commands.add("alignment",new c(e))}}var g=n(311),d=n(355);const m=(()=>new Map([["left",d.IconAlignLeft],["right",d.IconAlignRight],["center",d.IconAlignCenter],["justify",d.IconAlignJustify]]))();class f extends e.Plugin{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}static get isOfficialPlugin(){return!0}init(){const e=l(this.editor.config.get("alignment.options"));e.map(e=>e.name).filter(a).forEach(e=>this._addButton(e)),this._addToolbarDropdown(e),this._addMenuBarMenu(e)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,t=>this._createButton(t,e))}_createButton(e,t,n={}){const i=this.editor,o=i.commands.get("alignment"),a=new g.ButtonView(e);return a.set({label:this.localizedOptionTitles[t],icon:m.get(t),tooltip:!0,isToggleable:!0,...n}),a.bind("isEnabled").to(o),a.bind("isOn").to(o,"value",e=>e===t),this.listenTo(a,"execute",()=>{i.execute("alignment",{value:t}),i.editing.view.focus()}),a}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",n=>{const i=(0,g.createDropdown)(n),o="rtl"===n.uiLanguageDirection?"w":"e",a=n.t;(0,g.addToolbarToDropdown)(i,()=>e.map(e=>this._createButton(n,e.name,{tooltipPosition:o})),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:a("Text alignment toolbar")}),i.buttonView.set({label:a("Text alignment"),tooltip:!0}),i.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const r="rtl"===n.contentLanguageDirection?m.get("right"):m.get("left"),l=t.commands.get("alignment");return i.buttonView.bind("icon").to(l,"value",e=>m.get(e)||r),i.bind("isEnabled").to(l,"isEnabled"),this.listenTo(i,"execute",()=>{t.editing.view.focus()}),i})}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",n=>{const i=t.commands.get("alignment"),o=n.t,a=new g.MenuBarMenuView(n),r=new g.MenuBarMenuListView(n);a.bind("isEnabled").to(i),r.set({ariaLabel:o("Text alignment"),role:"menu"}),a.buttonView.set({label:o("Text alignment")});for(const o of e){const e=new g.MenuBarMenuListItemView(n,a),l=new g.MenuBarMenuListItemButtonView(n);l.delegate("execute").to(a),l.set({label:this.localizedOptionTitles[o.name],icon:m.get(o.name),role:"menuitemcheckbox",isToggleable:!0}),l.on("execute",()=>{t.execute("alignment",{value:o.name}),t.editing.view.focus()}),l.bind("isOn").to(i,"value",e=>e===o.name),l.bind("isEnabled").to(i,"isEnabled"),e.children.add(l),r.items.add(e)}return a.panelView.children.add(r),a})}}class p extends e.Plugin{static get requires(){return[u,f]}static get pluginName(){return"Alignment"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).alignment=i})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(n){const i=n.be=n.be||{};i.dictionary=Object.assign(i.dictionary||{},{"Align center":"Выраўнаваць па цэнтры","Align left":"Выраўнаваць па левым краі","Align right":"Выраўнаваць па правым краі",Justify:"Выраўнаваць па шырыні","Text alignment":"Выраўнаваць тэкст","Text alignment toolbar":"Выраўноўванне"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
package/ckeditor5-metadata.json
CHANGED
package/dist/index-content.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
package/dist/index-editor.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import { Command, Plugin
|
|
5
|
+
import { Command, Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
6
|
import { logWarning, CKEditorError, first } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
7
7
|
import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
8
|
+
import { IconAlignLeft, IconAlignRight, IconAlignCenter, IconAlignJustify } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @module alignment/utils
|
|
@@ -15,6 +16,8 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
15
16
|
* * `'right'`,
|
|
16
17
|
* * `'center'`,
|
|
17
18
|
* * `'justify'`
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
18
21
|
*/ const supportedOptions = [
|
|
19
22
|
'left',
|
|
20
23
|
'right',
|
|
@@ -24,6 +27,7 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
24
27
|
/**
|
|
25
28
|
* Checks whether the passed option is supported by {@link module:alignment/alignmentediting~AlignmentEditing}.
|
|
26
29
|
*
|
|
30
|
+
* @internal
|
|
27
31
|
* @param option The option value to check.
|
|
28
32
|
*/ function isSupported(option) {
|
|
29
33
|
return supportedOptions.includes(option);
|
|
@@ -32,6 +36,7 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
32
36
|
* Checks whether alignment is the default one considering the direction
|
|
33
37
|
* of the editor content.
|
|
34
38
|
*
|
|
39
|
+
* @internal
|
|
35
40
|
* @param alignment The name of the alignment to check.
|
|
36
41
|
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
37
42
|
*/ function isDefault(alignment, locale) {
|
|
@@ -45,6 +50,7 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
45
50
|
/**
|
|
46
51
|
* Brings the configuration to the common form, an array of objects.
|
|
47
52
|
*
|
|
53
|
+
* @internal
|
|
48
54
|
* @param configuredOptions Alignment plugin configuration.
|
|
49
55
|
* @returns Normalized object holding the configuration.
|
|
50
56
|
*/ function normalizeAlignmentOptions(configuredOptions) {
|
|
@@ -63,12 +69,12 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
63
69
|
const isNameValid = supportedOptions.includes(option.name);
|
|
64
70
|
if (!isNameValid) {
|
|
65
71
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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 {object} option Options with unknown value of the `name` property.
|
|
77
|
+
*/ logWarning('alignment-config-name-not-recognized', {
|
|
72
78
|
option
|
|
73
79
|
});
|
|
74
80
|
}
|
|
@@ -78,11 +84,11 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
78
84
|
// We either use classes for all styling options or for none.
|
|
79
85
|
if (classNameCount && classNameCount < normalizedOptions.length) {
|
|
80
86
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
* The `className` property has to be defined for all options once at least one option declares `className`.
|
|
88
|
+
*
|
|
89
|
+
* @error alignment-config-classnames-are-missing
|
|
90
|
+
* @param {object} configuredOptions Contents of `alignment.options`.
|
|
91
|
+
*/ throw new CKEditorError('alignment-config-classnames-are-missing', {
|
|
86
92
|
configuredOptions
|
|
87
93
|
});
|
|
88
94
|
}
|
|
@@ -92,13 +98,13 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
92
98
|
const nameAlreadyExists = succeedingOptions.some((item)=>item.name == option.name);
|
|
93
99
|
if (nameAlreadyExists) {
|
|
94
100
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* The same `name` in one of the `alignment.options` was already declared.
|
|
102
|
+
* Each `name` representing one alignment option can be set exactly once.
|
|
103
|
+
*
|
|
104
|
+
* @error alignment-config-name-already-defined
|
|
105
|
+
* @param {object} option First option that declares given `name`.
|
|
106
|
+
* @param {object} configuredOptions Contents of `alignment.options`.
|
|
107
|
+
*/ throw new CKEditorError('alignment-config-name-already-defined', {
|
|
102
108
|
option,
|
|
103
109
|
configuredOptions
|
|
104
110
|
});
|
|
@@ -108,13 +114,13 @@ import { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuView, Menu
|
|
|
108
114
|
const classNameAlreadyExists = succeedingOptions.some((item)=>item.className == option.className);
|
|
109
115
|
if (classNameAlreadyExists) {
|
|
110
116
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
* The same `className` in one of the `alignment.options` was already declared.
|
|
118
|
+
*
|
|
119
|
+
* @error alignment-config-classname-already-defined
|
|
120
|
+
* @param {object} option First option that declares given `className`.
|
|
121
|
+
* @param {object} configuredOptions
|
|
122
|
+
* Contents of `alignment.options`.
|
|
123
|
+
*/ throw new CKEditorError('alignment-config-classname-already-defined', {
|
|
118
124
|
option,
|
|
119
125
|
configuredOptions
|
|
120
126
|
});
|
|
@@ -129,8 +135,8 @@ const ALIGNMENT = 'alignment';
|
|
|
129
135
|
* The alignment command plugin.
|
|
130
136
|
*/ class AlignmentCommand extends Command {
|
|
131
137
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
* @inheritDoc
|
|
139
|
+
*/ refresh() {
|
|
134
140
|
const editor = this.editor;
|
|
135
141
|
const locale = editor.locale;
|
|
136
142
|
const firstBlock = first(this.editor.model.document.selection.getSelectedBlocks());
|
|
@@ -143,14 +149,14 @@ const ALIGNMENT = 'alignment';
|
|
|
143
149
|
}
|
|
144
150
|
}
|
|
145
151
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
* Executes the command. Applies the alignment `value` to the selected blocks.
|
|
153
|
+
* If no `value` is passed, the `value` is the default one or it is equal to the currently selected block's alignment attribute,
|
|
154
|
+
* the command will remove the attribute from the selected blocks.
|
|
155
|
+
*
|
|
156
|
+
* @param options Options for the executed command.
|
|
157
|
+
* @param options.value The value to apply.
|
|
158
|
+
* @fires execute
|
|
159
|
+
*/ execute(options = {}) {
|
|
154
160
|
const editor = this.editor;
|
|
155
161
|
const locale = editor.locale;
|
|
156
162
|
const model = editor.model;
|
|
@@ -173,10 +179,10 @@ const ALIGNMENT = 'alignment';
|
|
|
173
179
|
});
|
|
174
180
|
}
|
|
175
181
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
* Checks whether a block can have alignment set.
|
|
183
|
+
*
|
|
184
|
+
* @param block The block to be checked.
|
|
185
|
+
*/ _canBeAligned(block) {
|
|
180
186
|
return this.editor.model.schema.checkAttribute(block, ALIGNMENT);
|
|
181
187
|
}
|
|
182
188
|
}
|
|
@@ -200,18 +206,18 @@ const ALIGNMENT = 'alignment';
|
|
|
200
206
|
* the `alignment` attribute for block elements in the {@link module:engine/model/model~Model model}.
|
|
201
207
|
*/ class AlignmentEditing extends Plugin {
|
|
202
208
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
* @inheritDoc
|
|
210
|
+
*/ static get pluginName() {
|
|
205
211
|
return 'AlignmentEditing';
|
|
206
212
|
}
|
|
207
213
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
* @inheritDoc
|
|
215
|
+
*/ static get isOfficialPlugin() {
|
|
210
216
|
return true;
|
|
211
217
|
}
|
|
212
218
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
* @inheritDoc
|
|
220
|
+
*/ constructor(editor){
|
|
215
221
|
super(editor);
|
|
216
222
|
editor.config.define('alignment', {
|
|
217
223
|
options: supportedOptions.map((option)=>({
|
|
@@ -220,8 +226,8 @@ const ALIGNMENT = 'alignment';
|
|
|
220
226
|
});
|
|
221
227
|
}
|
|
222
228
|
/**
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
* @inheritDoc
|
|
230
|
+
*/ init() {
|
|
225
231
|
const editor = this.editor;
|
|
226
232
|
const locale = editor.locale;
|
|
227
233
|
const schema = editor.model.schema;
|
|
@@ -338,19 +344,19 @@ const ALIGNMENT = 'alignment';
|
|
|
338
344
|
const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
339
345
|
[
|
|
340
346
|
'left',
|
|
341
|
-
|
|
347
|
+
IconAlignLeft
|
|
342
348
|
],
|
|
343
349
|
[
|
|
344
350
|
'right',
|
|
345
|
-
|
|
351
|
+
IconAlignRight
|
|
346
352
|
],
|
|
347
353
|
[
|
|
348
354
|
'center',
|
|
349
|
-
|
|
355
|
+
IconAlignCenter
|
|
350
356
|
],
|
|
351
357
|
[
|
|
352
358
|
'justify',
|
|
353
|
-
|
|
359
|
+
IconAlignJustify
|
|
354
360
|
]
|
|
355
361
|
]))();
|
|
356
362
|
/**
|
|
@@ -360,18 +366,18 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
360
366
|
* and the `'alignment'` dropdown.
|
|
361
367
|
*/ class AlignmentUI extends Plugin {
|
|
362
368
|
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
369
|
+
* Returns the localized option titles provided by the plugin.
|
|
370
|
+
*
|
|
371
|
+
* The following localized titles corresponding with
|
|
372
|
+
* {@link module:alignment/alignmentconfig~AlignmentConfig#options} are available:
|
|
373
|
+
*
|
|
374
|
+
* * `'left'`,
|
|
375
|
+
* * `'right'`,
|
|
376
|
+
* * `'center'`,
|
|
377
|
+
* * `'justify'`.
|
|
378
|
+
*
|
|
379
|
+
* @readonly
|
|
380
|
+
*/ get localizedOptionTitles() {
|
|
375
381
|
const t = this.editor.t;
|
|
376
382
|
return {
|
|
377
383
|
'left': t('Align left'),
|
|
@@ -381,18 +387,18 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
381
387
|
};
|
|
382
388
|
}
|
|
383
389
|
/**
|
|
384
|
-
|
|
385
|
-
|
|
390
|
+
* @inheritDoc
|
|
391
|
+
*/ static get pluginName() {
|
|
386
392
|
return 'AlignmentUI';
|
|
387
393
|
}
|
|
388
394
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
395
|
+
* @inheritDoc
|
|
396
|
+
*/ static get isOfficialPlugin() {
|
|
391
397
|
return true;
|
|
392
398
|
}
|
|
393
399
|
/**
|
|
394
|
-
|
|
395
|
-
|
|
400
|
+
* @inheritDoc
|
|
401
|
+
*/ init() {
|
|
396
402
|
const editor = this.editor;
|
|
397
403
|
const options = normalizeAlignmentOptions(editor.config.get('alignment.options'));
|
|
398
404
|
options.map((option)=>option.name).filter(isSupported).forEach((option)=>this._addButton(option));
|
|
@@ -400,20 +406,20 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
400
406
|
this._addMenuBarMenu(options);
|
|
401
407
|
}
|
|
402
408
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
409
|
+
* Helper method for initializing the button and linking it with an appropriate command.
|
|
410
|
+
*
|
|
411
|
+
* @param option The name of the alignment option for which the button is added.
|
|
412
|
+
*/ _addButton(option) {
|
|
407
413
|
const editor = this.editor;
|
|
408
414
|
editor.ui.componentFactory.add(`alignment:${option}`, (locale)=>this._createButton(locale, option));
|
|
409
415
|
}
|
|
410
416
|
/**
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
+
* Helper method for creating the button view element.
|
|
418
|
+
*
|
|
419
|
+
* @param locale Editor locale.
|
|
420
|
+
* @param option The name of the alignment option for which the button is added.
|
|
421
|
+
* @param buttonAttrs Optional parameters passed to button view instance.
|
|
422
|
+
*/ _createButton(locale, option, buttonAttrs = {}) {
|
|
417
423
|
const editor = this.editor;
|
|
418
424
|
const command = editor.commands.get('alignment');
|
|
419
425
|
const buttonView = new ButtonView(locale);
|
|
@@ -437,10 +443,10 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
437
443
|
return buttonView;
|
|
438
444
|
}
|
|
439
445
|
/**
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
446
|
+
* Helper method for initializing the toolnar dropdown and linking it with an appropriate command.
|
|
447
|
+
*
|
|
448
|
+
* @param options The name of the alignment option for which the button is added.
|
|
449
|
+
*/ _addToolbarDropdown(options) {
|
|
444
450
|
const editor = this.editor;
|
|
445
451
|
const factory = editor.ui.componentFactory;
|
|
446
452
|
factory.add('alignment', (locale)=>{
|
|
@@ -481,10 +487,10 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
481
487
|
});
|
|
482
488
|
}
|
|
483
489
|
/**
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
490
|
+
* Creates a menu for all alignment options to use either in menu bar.
|
|
491
|
+
*
|
|
492
|
+
* @param options Normalized alignment options from config.
|
|
493
|
+
*/ _addMenuBarMenu(options) {
|
|
488
494
|
const editor = this.editor;
|
|
489
495
|
editor.ui.componentFactory.add('menuBar:alignment', (locale)=>{
|
|
490
496
|
const command = editor.commands.get('alignment');
|
|
@@ -536,24 +542,24 @@ const iconsMap = /* #__PURE__ */ (()=>new Map([
|
|
|
536
542
|
* {@link module:alignment/alignmentui~AlignmentUI} plugins.
|
|
537
543
|
*/ class Alignment extends Plugin {
|
|
538
544
|
/**
|
|
539
|
-
|
|
540
|
-
|
|
545
|
+
* @inheritDoc
|
|
546
|
+
*/ static get requires() {
|
|
541
547
|
return [
|
|
542
548
|
AlignmentEditing,
|
|
543
549
|
AlignmentUI
|
|
544
550
|
];
|
|
545
551
|
}
|
|
546
552
|
/**
|
|
547
|
-
|
|
548
|
-
|
|
553
|
+
* @inheritDoc
|
|
554
|
+
*/ static get pluginName() {
|
|
549
555
|
return 'Alignment';
|
|
550
556
|
}
|
|
551
557
|
/**
|
|
552
|
-
|
|
553
|
-
|
|
558
|
+
* @inheritDoc
|
|
559
|
+
*/ static get isOfficialPlugin() {
|
|
554
560
|
return true;
|
|
555
561
|
}
|
|
556
562
|
}
|
|
557
563
|
|
|
558
|
-
export { Alignment, AlignmentEditing, AlignmentUI };
|
|
564
|
+
export { Alignment, AlignmentCommand, AlignmentEditing, AlignmentUI, supportedOptions as _ALIGNMENT_SUPPORTED_OPTIONS, isSupported as _isAlignmentSupported, isDefault as _isDefaultAlignment, normalizeAlignmentOptions as _normalizeAlignmentOptions };
|
|
559
565
|
//# sourceMappingURL=index.js.map
|