@ckeditor/ckeditor5-basic-styles 0.0.0-internal-20251218.0 → 0.0.0-internal-20260224.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 +1 -1
- package/ckeditor5-metadata.json +7 -7
- package/{src → dist}/attributecommand.d.ts +2 -2
- package/{src → dist}/augmentation.d.ts +1 -1
- package/{src → dist}/bold/boldediting.d.ts +2 -2
- package/{src → dist}/bold/boldui.d.ts +2 -2
- package/{src → dist}/bold.d.ts +2 -2
- package/{src → dist}/code/codeediting.d.ts +3 -3
- package/{src → dist}/code/codeui.d.ts +2 -2
- package/{src → dist}/code.d.ts +2 -2
- package/dist/index-content.css +1 -1
- package/dist/index-editor.css +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/{src → dist}/index.d.ts +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/{src → dist}/italic/italicediting.d.ts +2 -2
- package/{src → dist}/italic/italicui.d.ts +2 -2
- package/{src → dist}/italic.d.ts +2 -2
- package/{src → dist}/strikethrough/strikethroughediting.d.ts +2 -2
- package/{src → dist}/strikethrough/strikethroughui.d.ts +2 -2
- package/{src → dist}/strikethrough.d.ts +2 -2
- package/{src → dist}/subscript/subscriptediting.d.ts +2 -2
- package/{src → dist}/subscript/subscriptui.d.ts +2 -2
- package/{src → dist}/subscript.d.ts +2 -2
- package/{src → dist}/superscript/superscriptediting.d.ts +2 -2
- package/{src → dist}/superscript/superscriptui.d.ts +2 -2
- package/{src → dist}/superscript.d.ts +2 -2
- package/dist/translations/af.d.ts +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.d.ts +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.d.ts +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.d.ts +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.d.ts +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.d.ts +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.d.ts +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.d.ts +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.d.ts +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.d.ts +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.d.ts +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.d.ts +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.d.ts +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.d.ts +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.d.ts +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.d.ts +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.d.ts +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.d.ts +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.d.ts +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.d.ts +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.d.ts +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.d.ts +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.d.ts +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.d.ts +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.d.ts +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.d.ts +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.d.ts +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.d.ts +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.d.ts +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.d.ts +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.d.ts +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.d.ts +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.d.ts +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.d.ts +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.d.ts +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.d.ts +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.d.ts +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.d.ts +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.d.ts +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.d.ts +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.d.ts +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.d.ts +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.d.ts +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.d.ts +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.d.ts +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.d.ts +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.d.ts +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.d.ts +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.d.ts +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.d.ts +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.d.ts +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.d.ts +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.d.ts +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.d.ts +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.d.ts +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.d.ts +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.d.ts +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.d.ts +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.d.ts +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.d.ts +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.d.ts +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.d.ts +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.d.ts +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.d.ts +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.d.ts +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.d.ts +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.d.ts +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.d.ts +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.d.ts +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.d.ts +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.d.ts +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.d.ts +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.d.ts +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/{src → dist}/underline/underlineediting.d.ts +2 -2
- package/{src → dist}/underline/underlineui.d.ts +2 -2
- package/{src → dist}/underline.d.ts +2 -2
- package/{src → dist}/utils.d.ts +3 -3
- package/package.json +25 -48
- package/build/basic-styles.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -14
- package/lang/translations/af.po +0 -60
- package/lang/translations/ar.po +0 -60
- package/lang/translations/ast.po +0 -60
- package/lang/translations/az.po +0 -60
- package/lang/translations/be.po +0 -60
- package/lang/translations/bg.po +0 -60
- package/lang/translations/bn.po +0 -60
- package/lang/translations/bs.po +0 -60
- package/lang/translations/ca.po +0 -60
- package/lang/translations/cs.po +0 -60
- package/lang/translations/da.po +0 -60
- package/lang/translations/de-ch.po +0 -60
- package/lang/translations/de.po +0 -60
- package/lang/translations/el.po +0 -60
- package/lang/translations/en-au.po +0 -60
- package/lang/translations/en-gb.po +0 -60
- package/lang/translations/en.po +0 -60
- package/lang/translations/eo.po +0 -60
- package/lang/translations/es-co.po +0 -60
- package/lang/translations/es.po +0 -60
- package/lang/translations/et.po +0 -60
- package/lang/translations/eu.po +0 -60
- package/lang/translations/fa.po +0 -60
- package/lang/translations/fi.po +0 -60
- package/lang/translations/fr.po +0 -60
- package/lang/translations/gl.po +0 -60
- package/lang/translations/gu.po +0 -60
- package/lang/translations/he.po +0 -60
- package/lang/translations/hi.po +0 -60
- package/lang/translations/hr.po +0 -60
- package/lang/translations/hu.po +0 -60
- package/lang/translations/hy.po +0 -60
- package/lang/translations/id.po +0 -60
- package/lang/translations/it.po +0 -60
- package/lang/translations/ja.po +0 -60
- package/lang/translations/jv.po +0 -60
- package/lang/translations/kk.po +0 -60
- package/lang/translations/km.po +0 -60
- package/lang/translations/kn.po +0 -60
- package/lang/translations/ko.po +0 -60
- package/lang/translations/ku.po +0 -60
- package/lang/translations/lt.po +0 -60
- package/lang/translations/lv.po +0 -60
- package/lang/translations/ms.po +0 -60
- package/lang/translations/nb.po +0 -60
- package/lang/translations/ne.po +0 -60
- package/lang/translations/nl.po +0 -60
- package/lang/translations/no.po +0 -60
- package/lang/translations/oc.po +0 -60
- package/lang/translations/pl.po +0 -60
- package/lang/translations/pt-br.po +0 -60
- package/lang/translations/pt.po +0 -60
- package/lang/translations/ro.po +0 -60
- package/lang/translations/ru.po +0 -60
- package/lang/translations/si.po +0 -60
- package/lang/translations/sk.po +0 -60
- package/lang/translations/sl.po +0 -60
- package/lang/translations/sq.po +0 -60
- package/lang/translations/sr-latn.po +0 -60
- package/lang/translations/sr.po +0 -60
- package/lang/translations/sv.po +0 -60
- package/lang/translations/th.po +0 -60
- package/lang/translations/ti.po +0 -60
- package/lang/translations/tk.po +0 -60
- package/lang/translations/tr.po +0 -60
- package/lang/translations/tt.po +0 -60
- package/lang/translations/ug.po +0 -60
- package/lang/translations/uk.po +0 -60
- package/lang/translations/ur.po +0 -60
- package/lang/translations/uz.po +0 -60
- package/lang/translations/vi.po +0 -60
- package/lang/translations/zh-cn.po +0 -60
- package/lang/translations/zh.po +0 -60
- package/src/attributecommand.js +0 -109
- package/src/augmentation.js +0 -5
- package/src/bold/boldediting.js +0 -78
- package/src/bold/boldui.js +0 -47
- package/src/bold.js +0 -39
- package/src/code/codeediting.js +0 -73
- package/src/code/codeui.js +0 -47
- package/src/code.js +0 -40
- package/src/index.js +0 -31
- package/src/italic/italicediting.js +0 -68
- package/src/italic/italicui.js +0 -47
- package/src/italic.js +0 -39
- package/src/strikethrough/strikethroughediting.js +0 -70
- package/src/strikethrough/strikethroughui.js +0 -47
- package/src/strikethrough.js +0 -39
- package/src/subscript/subscriptediting.js +0 -56
- package/src/subscript/subscriptui.js +0 -46
- package/src/subscript.js +0 -36
- package/src/superscript/superscriptediting.js +0 -56
- package/src/superscript/superscriptui.js +0 -46
- package/src/superscript.js +0 -36
- package/src/underline/underlineediting.js +0 -65
- package/src/underline/underlineui.js +0 -47
- package/src/underline.js +0 -39
- package/src/utils.js +0 -40
- package/theme/code.css +0 -14
package/src/attributecommand.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/attributecommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
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~ModelDocument#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
|
-
*/
|
|
19
|
-
export class AttributeCommand extends Command {
|
|
20
|
-
/**
|
|
21
|
-
* The attribute that will be set by the command.
|
|
22
|
-
*/
|
|
23
|
-
attributeKey;
|
|
24
|
-
/**
|
|
25
|
-
* @param attributeKey Attribute that will be set by the command.
|
|
26
|
-
*/
|
|
27
|
-
constructor(editor, attributeKey) {
|
|
28
|
-
super(editor);
|
|
29
|
-
this.attributeKey = attributeKey;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Updates the command's {@link #value} and {@link #isEnabled} based on the current selection.
|
|
33
|
-
*/
|
|
34
|
-
refresh() {
|
|
35
|
-
const model = this.editor.model;
|
|
36
|
-
const doc = model.document;
|
|
37
|
-
this.value = this._getValueFromFirstAllowedNode();
|
|
38
|
-
this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Executes the command – applies the attribute to the selection or removes it from the selection.
|
|
42
|
-
*
|
|
43
|
-
* If the command is active (`value == true`), it will remove attributes. Otherwise, it will set attributes.
|
|
44
|
-
*
|
|
45
|
-
* The execution result differs, depending on the {@link module:engine/model/document~ModelDocument#selection}:
|
|
46
|
-
*
|
|
47
|
-
* * If the selection is on a range, the command applies the attribute to all nodes in that range
|
|
48
|
-
* (if they are allowed to have this attribute by the {@link module:engine/model/schema~ModelSchema schema}).
|
|
49
|
-
* * If the selection is collapsed in a non-empty node, the command applies the attribute to the
|
|
50
|
-
* {@link module:engine/model/document~ModelDocument#selection} itself (note that typed characters copy attributes from the selection).
|
|
51
|
-
* * If the selection is collapsed in an empty node, the command applies the attribute to the parent node of the selection (note
|
|
52
|
-
* that the selection inherits all attributes from a node if it is in an empty node).
|
|
53
|
-
*
|
|
54
|
-
* @fires execute
|
|
55
|
-
* @param options Command options.
|
|
56
|
-
* @param options.forceValue If set, it will force the command behavior. If `true`,
|
|
57
|
-
* the command will apply the attribute, otherwise the command will remove the attribute.
|
|
58
|
-
* If not set, the command will look for its current value to decide what it should do.
|
|
59
|
-
*/
|
|
60
|
-
execute(options = {}) {
|
|
61
|
-
const model = this.editor.model;
|
|
62
|
-
const doc = model.document;
|
|
63
|
-
const selection = doc.selection;
|
|
64
|
-
const value = (options.forceValue === undefined) ? !this.value : options.forceValue;
|
|
65
|
-
model.change(writer => {
|
|
66
|
-
if (selection.isCollapsed) {
|
|
67
|
-
if (value) {
|
|
68
|
-
writer.setSelectionAttribute(this.attributeKey, true);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
writer.removeSelectionAttribute(this.attributeKey);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey);
|
|
76
|
-
for (const range of ranges) {
|
|
77
|
-
if (value) {
|
|
78
|
-
writer.setAttribute(this.attributeKey, value, range);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
writer.removeAttribute(this.attributeKey, range);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Checks the attribute value of the first node in the selection that allows the attribute.
|
|
89
|
-
* For the collapsed selection returns the selection attribute.
|
|
90
|
-
*
|
|
91
|
-
* @returns The attribute value.
|
|
92
|
-
*/
|
|
93
|
-
_getValueFromFirstAllowedNode() {
|
|
94
|
-
const model = this.editor.model;
|
|
95
|
-
const schema = model.schema;
|
|
96
|
-
const selection = model.document.selection;
|
|
97
|
-
if (selection.isCollapsed) {
|
|
98
|
-
return selection.hasAttribute(this.attributeKey);
|
|
99
|
-
}
|
|
100
|
-
for (const range of selection.getRanges()) {
|
|
101
|
-
for (const item of range.getItems()) {
|
|
102
|
-
if (schema.checkAttribute(item, this.attributeKey)) {
|
|
103
|
-
return item.hasAttribute(this.attributeKey);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
}
|
package/src/augmentation.js
DELETED
package/src/bold/boldediting.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/bold/boldediting
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { AttributeCommand } from '../attributecommand.js';
|
|
10
|
-
const BOLD = 'bold';
|
|
11
|
-
/**
|
|
12
|
-
* The bold editing feature.
|
|
13
|
-
*
|
|
14
|
-
* It registers the `'bold'` command and introduces the `bold` attribute in the model which renders to the view
|
|
15
|
-
* as a `<strong>` element.
|
|
16
|
-
*/
|
|
17
|
-
export class BoldEditing extends Plugin {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get pluginName() {
|
|
22
|
-
return 'BoldEditing';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get isOfficialPlugin() {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
init() {
|
|
34
|
-
const editor = this.editor;
|
|
35
|
-
const t = this.editor.t;
|
|
36
|
-
// Allow bold attribute on text nodes.
|
|
37
|
-
editor.model.schema.extend('$text', { allowAttributes: BOLD });
|
|
38
|
-
editor.model.schema.setAttributeProperties(BOLD, {
|
|
39
|
-
isFormatting: true,
|
|
40
|
-
copyOnEnter: true
|
|
41
|
-
});
|
|
42
|
-
// Build converter from model to view for data and editing pipelines.
|
|
43
|
-
editor.conversion.attributeToElement({
|
|
44
|
-
model: BOLD,
|
|
45
|
-
view: 'strong',
|
|
46
|
-
upcastAlso: [
|
|
47
|
-
'b',
|
|
48
|
-
viewElement => {
|
|
49
|
-
const fontWeight = viewElement.getStyle('font-weight');
|
|
50
|
-
if (!fontWeight) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
// Value of the `font-weight` attribute can be defined as a string or a number.
|
|
54
|
-
if (fontWeight == 'bold' || Number(fontWeight) >= 600) {
|
|
55
|
-
return {
|
|
56
|
-
name: true,
|
|
57
|
-
styles: ['font-weight']
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
});
|
|
64
|
-
// Create bold command.
|
|
65
|
-
editor.commands.add(BOLD, new AttributeCommand(editor, BOLD));
|
|
66
|
-
// Set the Ctrl+B keystroke.
|
|
67
|
-
editor.keystrokes.set('CTRL+B', BOLD);
|
|
68
|
-
// Add the information about the keystroke to the accessibility database.
|
|
69
|
-
editor.accessibility.addKeystrokeInfos({
|
|
70
|
-
keystrokes: [
|
|
71
|
-
{
|
|
72
|
-
label: t('Bold text'),
|
|
73
|
-
keystroke: 'CTRL+B'
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
package/src/bold/boldui.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/bold/boldui
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { IconBold } from 'ckeditor5/src/icons.js';
|
|
10
|
-
import { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
11
|
-
import { getButtonCreator } from '../utils.js';
|
|
12
|
-
const BOLD = 'bold';
|
|
13
|
-
/**
|
|
14
|
-
* The bold UI feature. It introduces the Bold button.
|
|
15
|
-
*/
|
|
16
|
-
export class BoldUI extends Plugin {
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
static get pluginName() {
|
|
21
|
-
return 'BoldUI';
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
static get isOfficialPlugin() {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
init() {
|
|
33
|
-
const editor = this.editor;
|
|
34
|
-
const t = editor.locale.t;
|
|
35
|
-
const createButton = getButtonCreator({
|
|
36
|
-
editor,
|
|
37
|
-
commandName: BOLD,
|
|
38
|
-
plugin: this,
|
|
39
|
-
icon: IconBold,
|
|
40
|
-
label: t('Bold'),
|
|
41
|
-
keystroke: 'CTRL+B'
|
|
42
|
-
});
|
|
43
|
-
// Add bold button to feature components.
|
|
44
|
-
editor.ui.componentFactory.add(BOLD, () => createButton(ButtonView));
|
|
45
|
-
editor.ui.componentFactory.add('menuBar:' + BOLD, () => createButton(MenuBarMenuListItemButtonView));
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/bold.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/bold
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { BoldEditing } from './bold/boldediting.js';
|
|
10
|
-
import { BoldUI } from './bold/boldui.js';
|
|
11
|
-
/**
|
|
12
|
-
* The bold feature.
|
|
13
|
-
*
|
|
14
|
-
* For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
|
|
15
|
-
* and the {@glink api/basic-styles package page}.
|
|
16
|
-
*
|
|
17
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/bold/boldediting~BoldEditing bold editing feature}
|
|
18
|
-
* and {@link module:basic-styles/bold/boldui~BoldUI bold UI feature}.
|
|
19
|
-
*/
|
|
20
|
-
export class Bold extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get requires() {
|
|
25
|
-
return [BoldEditing, BoldUI];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
static get pluginName() {
|
|
31
|
-
return 'Bold';
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
static get isOfficialPlugin() {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|
package/src/code/codeediting.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/code/codeediting
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { TwoStepCaretMovement, inlineHighlight } from 'ckeditor5/src/typing.js';
|
|
10
|
-
import { AttributeCommand } from '../attributecommand.js';
|
|
11
|
-
const CODE = 'code';
|
|
12
|
-
const HIGHLIGHT_CLASS = 'ck-code_selected';
|
|
13
|
-
/**
|
|
14
|
-
* The code editing feature.
|
|
15
|
-
*
|
|
16
|
-
* It registers the `'code'` command and introduces the `code` attribute in the model which renders to the view
|
|
17
|
-
* as a `<code>` element.
|
|
18
|
-
*/
|
|
19
|
-
export class CodeEditing extends Plugin {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get pluginName() {
|
|
24
|
-
return 'CodeEditing';
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get isOfficialPlugin() {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get requires() {
|
|
36
|
-
return [TwoStepCaretMovement];
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
init() {
|
|
42
|
-
const editor = this.editor;
|
|
43
|
-
const t = this.editor.t;
|
|
44
|
-
// Allow code attribute on text nodes.
|
|
45
|
-
editor.model.schema.extend('$text', { allowAttributes: CODE });
|
|
46
|
-
editor.model.schema.setAttributeProperties(CODE, {
|
|
47
|
-
isFormatting: true,
|
|
48
|
-
copyOnEnter: false
|
|
49
|
-
});
|
|
50
|
-
editor.conversion.attributeToElement({
|
|
51
|
-
model: CODE,
|
|
52
|
-
view: 'code'
|
|
53
|
-
});
|
|
54
|
-
// Create code command.
|
|
55
|
-
editor.commands.add(CODE, new AttributeCommand(editor, CODE));
|
|
56
|
-
// Enable two-step caret movement for `code` attribute.
|
|
57
|
-
editor.plugins.get(TwoStepCaretMovement).registerAttribute(CODE);
|
|
58
|
-
// Setup highlight over selected element.
|
|
59
|
-
inlineHighlight(editor, CODE, 'code', HIGHLIGHT_CLASS);
|
|
60
|
-
// Add the information about the keystroke to the accessibility database.
|
|
61
|
-
editor.accessibility.addKeystrokeInfos({
|
|
62
|
-
keystrokes: [
|
|
63
|
-
{
|
|
64
|
-
label: t('Move out of an inline code style'),
|
|
65
|
-
keystroke: [
|
|
66
|
-
['arrowleft', 'arrowleft'],
|
|
67
|
-
['arrowright', 'arrowright']
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
package/src/code/codeui.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/code/codeui
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { IconCode } from 'ckeditor5/src/icons.js';
|
|
10
|
-
import { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
11
|
-
import { getButtonCreator } from '../utils.js';
|
|
12
|
-
import '../../theme/code.css';
|
|
13
|
-
const CODE = 'code';
|
|
14
|
-
/**
|
|
15
|
-
* The code UI feature. It introduces the Code button.
|
|
16
|
-
*/
|
|
17
|
-
export class CodeUI extends Plugin {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get pluginName() {
|
|
22
|
-
return 'CodeUI';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get isOfficialPlugin() {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
init() {
|
|
34
|
-
const editor = this.editor;
|
|
35
|
-
const t = editor.locale.t;
|
|
36
|
-
const createButton = getButtonCreator({
|
|
37
|
-
editor,
|
|
38
|
-
commandName: CODE,
|
|
39
|
-
plugin: this,
|
|
40
|
-
icon: IconCode,
|
|
41
|
-
label: t('Code')
|
|
42
|
-
});
|
|
43
|
-
// Add code button to feature components.
|
|
44
|
-
editor.ui.componentFactory.add(CODE, () => createButton(ButtonView));
|
|
45
|
-
editor.ui.componentFactory.add('menuBar:' + CODE, () => createButton(MenuBarMenuListItemButtonView));
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/code.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/code
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { CodeEditing } from './code/codeediting.js';
|
|
10
|
-
import { CodeUI } from './code/codeui.js';
|
|
11
|
-
import '../theme/code.css';
|
|
12
|
-
/**
|
|
13
|
-
* The code feature.
|
|
14
|
-
*
|
|
15
|
-
* For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
|
|
16
|
-
* and the {@glink api/basic-styles package page}.
|
|
17
|
-
*
|
|
18
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/code/codeediting~CodeEditing code editing feature}
|
|
19
|
-
* and {@link module:basic-styles/code/codeui~CodeUI code UI feature}.
|
|
20
|
-
*/
|
|
21
|
-
export class Code extends Plugin {
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
static get requires() {
|
|
26
|
-
return [CodeEditing, CodeUI];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
static get pluginName() {
|
|
32
|
-
return 'Code';
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @inheritDoc
|
|
36
|
-
*/
|
|
37
|
-
static get isOfficialPlugin() {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
}
|
package/src/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles
|
|
7
|
-
*/
|
|
8
|
-
export { Bold } from './bold.js';
|
|
9
|
-
export { BoldEditing } from './bold/boldediting.js';
|
|
10
|
-
export { BoldUI } from './bold/boldui.js';
|
|
11
|
-
export { Code } from './code.js';
|
|
12
|
-
export { CodeEditing } from './code/codeediting.js';
|
|
13
|
-
export { CodeUI } from './code/codeui.js';
|
|
14
|
-
export { Italic } from './italic.js';
|
|
15
|
-
export { ItalicEditing } from './italic/italicediting.js';
|
|
16
|
-
export { ItalicUI } from './italic/italicui.js';
|
|
17
|
-
export { Strikethrough } from './strikethrough.js';
|
|
18
|
-
export { StrikethroughEditing } from './strikethrough/strikethroughediting.js';
|
|
19
|
-
export { StrikethroughUI } from './strikethrough/strikethroughui.js';
|
|
20
|
-
export { Subscript } from './subscript.js';
|
|
21
|
-
export { SubscriptEditing } from './subscript/subscriptediting.js';
|
|
22
|
-
export { SubscriptUI } from './subscript/subscriptui.js';
|
|
23
|
-
export { Superscript } from './superscript.js';
|
|
24
|
-
export { SuperscriptEditing } from './superscript/superscriptediting.js';
|
|
25
|
-
export { SuperscriptUI } from './superscript/superscriptui.js';
|
|
26
|
-
export { Underline } from './underline.js';
|
|
27
|
-
export { UnderlineEditing } from './underline/underlineediting.js';
|
|
28
|
-
export { UnderlineUI } from './underline/underlineui.js';
|
|
29
|
-
export { AttributeCommand } from './attributecommand.js';
|
|
30
|
-
export { getButtonCreator as _getBasicStylesButtonCreator } from './utils.js';
|
|
31
|
-
import './augmentation.js';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/italic/italicediting
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { AttributeCommand } from '../attributecommand.js';
|
|
10
|
-
const ITALIC = 'italic';
|
|
11
|
-
/**
|
|
12
|
-
* The italic editing feature.
|
|
13
|
-
*
|
|
14
|
-
* It registers the `'italic'` command, the <kbd>Ctrl+I</kbd> keystroke and introduces the `italic` attribute in the model
|
|
15
|
-
* which renders to the view as an `<i>` element.
|
|
16
|
-
*/
|
|
17
|
-
export class ItalicEditing extends Plugin {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get pluginName() {
|
|
22
|
-
return 'ItalicEditing';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get isOfficialPlugin() {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @inheritDoc
|
|
32
|
-
*/
|
|
33
|
-
init() {
|
|
34
|
-
const editor = this.editor;
|
|
35
|
-
const t = this.editor.t;
|
|
36
|
-
// Allow italic attribute on text nodes.
|
|
37
|
-
editor.model.schema.extend('$text', { allowAttributes: ITALIC });
|
|
38
|
-
editor.model.schema.setAttributeProperties(ITALIC, {
|
|
39
|
-
isFormatting: true,
|
|
40
|
-
copyOnEnter: true
|
|
41
|
-
});
|
|
42
|
-
editor.conversion.attributeToElement({
|
|
43
|
-
model: ITALIC,
|
|
44
|
-
view: 'i',
|
|
45
|
-
upcastAlso: [
|
|
46
|
-
'em',
|
|
47
|
-
{
|
|
48
|
-
styles: {
|
|
49
|
-
'font-style': 'italic'
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
});
|
|
54
|
-
// Create italic command.
|
|
55
|
-
editor.commands.add(ITALIC, new AttributeCommand(editor, ITALIC));
|
|
56
|
-
// Set the Ctrl+I keystroke.
|
|
57
|
-
editor.keystrokes.set('CTRL+I', ITALIC);
|
|
58
|
-
// Add the information about the keystroke to the accessibility database.
|
|
59
|
-
editor.accessibility.addKeystrokeInfos({
|
|
60
|
-
keystrokes: [
|
|
61
|
-
{
|
|
62
|
-
label: t('Italic text'),
|
|
63
|
-
keystroke: 'CTRL+I'
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
package/src/italic/italicui.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/italic/italicui
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { IconItalic } from 'ckeditor5/src/icons.js';
|
|
10
|
-
import { MenuBarMenuListItemButtonView, ButtonView } from 'ckeditor5/src/ui.js';
|
|
11
|
-
import { getButtonCreator } from '../utils.js';
|
|
12
|
-
const ITALIC = 'italic';
|
|
13
|
-
/**
|
|
14
|
-
* The italic UI feature. It introduces the Italic button.
|
|
15
|
-
*/
|
|
16
|
-
export class ItalicUI extends Plugin {
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
static get pluginName() {
|
|
21
|
-
return 'ItalicUI';
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
static get isOfficialPlugin() {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
init() {
|
|
33
|
-
const editor = this.editor;
|
|
34
|
-
const t = editor.locale.t;
|
|
35
|
-
const createButton = getButtonCreator({
|
|
36
|
-
editor,
|
|
37
|
-
commandName: ITALIC,
|
|
38
|
-
plugin: this,
|
|
39
|
-
icon: IconItalic,
|
|
40
|
-
keystroke: 'CTRL+I',
|
|
41
|
-
label: t('Italic')
|
|
42
|
-
});
|
|
43
|
-
// Add bold button to feature components.
|
|
44
|
-
editor.ui.componentFactory.add(ITALIC, () => createButton(ButtonView));
|
|
45
|
-
editor.ui.componentFactory.add('menuBar:' + ITALIC, () => createButton(MenuBarMenuListItemButtonView));
|
|
46
|
-
}
|
|
47
|
-
}
|
package/src/italic.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
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
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module basic-styles/italic
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { ItalicEditing } from './italic/italicediting.js';
|
|
10
|
-
import { ItalicUI } from './italic/italicui.js';
|
|
11
|
-
/**
|
|
12
|
-
* The italic feature.
|
|
13
|
-
*
|
|
14
|
-
* For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide
|
|
15
|
-
* and the {@glink api/basic-styles package page}.
|
|
16
|
-
*
|
|
17
|
-
* This is a "glue" plugin which loads the {@link module:basic-styles/italic/italicediting~ItalicEditing} and
|
|
18
|
-
* {@link module:basic-styles/italic/italicui~ItalicUI} plugins.
|
|
19
|
-
*/
|
|
20
|
-
export class Italic extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get requires() {
|
|
25
|
-
return [ItalicEditing, ItalicUI];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
static get pluginName() {
|
|
31
|
-
return 'Italic';
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
static get isOfficialPlugin() {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|