@ckeditor/ckeditor5-language 40.0.0 → 40.2.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 CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor&nbsp;5 text part language feature** – https://github.com/ckeditor/ckeditor5-language <br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 20032023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
14
14
  Trademarks
15
15
  ----------
16
16
 
17
- **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
17
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-language",
3
- "version": "40.0.0",
3
+ "version": "40.2.0",
4
4
  "description": "Text part language feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "40.0.0"
15
+ "ckeditor5": "40.2.0"
16
16
  },
17
17
  "author": "CKSource (http://cksource.com/)",
18
18
  "license": "GPL-2.0-or-later",
@@ -1,47 +1,47 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- import type { TextPartLanguageOption, TextPartLanguage, TextPartLanguageEditing, TextPartLanguageUI, TextPartLanguageCommand } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface LanguageConfig {
8
- /**
9
- * The available {@link module:language/textpartlanguage~TextPartLanguage}
10
- * options that allow setting the language of parts of the content.
11
- *
12
- * This configuration option is available only with the {@glink api/language text part language feature} enabled.
13
- *
14
- * Refer to the [WCAG 3.1.2 Language of Parts](https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html) specification
15
- * to learn more.
16
- *
17
- * To change the editor's UI language, refer to the {@glink features/ui-language Setting the UI language} guide.
18
- *
19
- * The default value is:
20
- *
21
- * ```ts
22
- * const config = [
23
- * { title: 'Arabic', languageCode: 'ar' },
24
- * { title: 'French', languageCode: 'fr' },
25
- * { title: 'Spanish', languageCode: 'es' }
26
- * ];
27
- * ```
28
- *
29
- * The `title` property will be used by the text part language dropdown to render available options.
30
- *
31
- * The `languageCode` property is used for the `lang` attribute in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
32
- *
33
- * You can also specify the optional `textDirection` property indicating the reading direction of the language.
34
- * Correct values are `ltr` and `rtl`. When the `textDirection` property is missing, the text part language feature will
35
- * specify the text direction by itself.
36
- */
37
- textPartLanguage?: Array<TextPartLanguageOption>;
38
- }
39
- interface PluginsMap {
40
- [TextPartLanguage.pluginName]: TextPartLanguage;
41
- [TextPartLanguageEditing.pluginName]: TextPartLanguageEditing;
42
- [TextPartLanguageUI.pluginName]: TextPartLanguageUI;
43
- }
44
- interface CommandsMap {
45
- textPartLanguage: TextPartLanguageCommand;
46
- }
47
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import type { TextPartLanguageOption, TextPartLanguage, TextPartLanguageEditing, TextPartLanguageUI, TextPartLanguageCommand } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface LanguageConfig {
8
+ /**
9
+ * The available {@link module:language/textpartlanguage~TextPartLanguage}
10
+ * options that allow setting the language of parts of the content.
11
+ *
12
+ * This configuration option is available only with the {@glink api/language text part language feature} enabled.
13
+ *
14
+ * Refer to the [WCAG 3.1.2 Language of Parts](https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html) specification
15
+ * to learn more.
16
+ *
17
+ * To change the editor's UI language, refer to the {@glink features/ui-language Setting the UI language} guide.
18
+ *
19
+ * The default value is:
20
+ *
21
+ * ```ts
22
+ * const config = [
23
+ * { title: 'Arabic', languageCode: 'ar' },
24
+ * { title: 'French', languageCode: 'fr' },
25
+ * { title: 'Spanish', languageCode: 'es' }
26
+ * ];
27
+ * ```
28
+ *
29
+ * The `title` property will be used by the text part language dropdown to render available options.
30
+ *
31
+ * The `languageCode` property is used for the `lang` attribute in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
32
+ *
33
+ * You can also specify the optional `textDirection` property indicating the reading direction of the language.
34
+ * Correct values are `ltr` and `rtl`. When the `textDirection` property is missing, the text part language feature will
35
+ * specify the text direction by itself.
36
+ */
37
+ textPartLanguage?: Array<TextPartLanguageOption>;
38
+ }
39
+ interface PluginsMap {
40
+ [TextPartLanguage.pluginName]: TextPartLanguage;
41
+ [TextPartLanguageEditing.pluginName]: TextPartLanguageEditing;
42
+ [TextPartLanguageUI.pluginName]: TextPartLanguageUI;
43
+ }
44
+ interface CommandsMap {
45
+ textPartLanguage: TextPartLanguageCommand;
46
+ }
47
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ export {};
package/src/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module language
7
- */
8
- export { default as TextPartLanguage } from './textpartlanguage';
9
- export { default as TextPartLanguageEditing } from './textpartlanguageediting';
10
- export { default as TextPartLanguageUI } from './textpartlanguageui';
11
- export type { TextPartLanguageOption } from './textpartlanguageconfig';
12
- export type { default as TextPartLanguageCommand } from './textpartlanguagecommand';
13
- import './augmentation';
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module language
7
+ */
8
+ export { default as TextPartLanguage } from './textpartlanguage';
9
+ export { default as TextPartLanguageEditing } from './textpartlanguageediting';
10
+ export { default as TextPartLanguageUI } from './textpartlanguageui';
11
+ export type { TextPartLanguageOption } from './textpartlanguageconfig';
12
+ export type { default as TextPartLanguageCommand } from './textpartlanguagecommand';
13
+ import './augmentation';
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module language
7
- */
8
- export { default as TextPartLanguage } from './textpartlanguage';
9
- export { default as TextPartLanguageEditing } from './textpartlanguageediting';
10
- export { default as TextPartLanguageUI } from './textpartlanguageui';
11
- import './augmentation';
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module language
7
+ */
8
+ export { default as TextPartLanguage } from './textpartlanguage';
9
+ export { default as TextPartLanguageEditing } from './textpartlanguageediting';
10
+ export { default as TextPartLanguageUI } from './textpartlanguageui';
11
+ import './augmentation';
@@ -1,35 +1,35 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module language/textpartlanguage
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import TextPartLanguageEditing from './textpartlanguageediting';
10
- import TextPartLanguageUI from './textpartlanguageui';
11
- /**
12
- * The text part language feature.
13
- *
14
- * This feature allows setting a language of the document's text part to support
15
- * [WCAG 3.1.2 Language of Parts](https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html) specification.
16
- *
17
- * To change the editor's UI language, refer to the {@glink features/ui-language Setting the UI language} guide.
18
- *
19
- * For more information about this feature, check the {@glink api/language package page} as well as the {@glink features/language
20
- * Text part language} feature guide.
21
- *
22
- * This is a "glue" plugin which loads the
23
- * {@link module:language/textpartlanguageediting~TextPartLanguageEditing text part language editing feature}
24
- * and the {@link module:language/textpartlanguageui~TextPartLanguageUI text part language UI feature}.
25
- */
26
- export default class TextPartLanguage extends Plugin {
27
- /**
28
- * @inheritDoc
29
- */
30
- static get requires(): readonly [typeof TextPartLanguageEditing, typeof TextPartLanguageUI];
31
- /**
32
- * @inheritDoc
33
- */
34
- static get pluginName(): "TextPartLanguage";
35
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module language/textpartlanguage
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import TextPartLanguageEditing from './textpartlanguageediting';
10
+ import TextPartLanguageUI from './textpartlanguageui';
11
+ /**
12
+ * The text part language feature.
13
+ *
14
+ * This feature allows setting a language of the document's text part to support
15
+ * [WCAG 3.1.2 Language of Parts](https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html) specification.
16
+ *
17
+ * To change the editor's UI language, refer to the {@glink features/ui-language Setting the UI language} guide.
18
+ *
19
+ * For more information about this feature, check the {@glink api/language package page} as well as the {@glink features/language
20
+ * Text part language} feature guide.
21
+ *
22
+ * This is a "glue" plugin which loads the
23
+ * {@link module:language/textpartlanguageediting~TextPartLanguageEditing text part language editing feature}
24
+ * and the {@link module:language/textpartlanguageui~TextPartLanguageUI text part language UI feature}.
25
+ */
26
+ export default class TextPartLanguage extends Plugin {
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get requires(): readonly [typeof TextPartLanguageEditing, typeof TextPartLanguageUI];
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ static get pluginName(): "TextPartLanguage";
35
+ }
@@ -1,39 +1,39 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module language/textpartlanguage
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import TextPartLanguageEditing from './textpartlanguageediting';
10
- import TextPartLanguageUI from './textpartlanguageui';
11
- /**
12
- * The text part language feature.
13
- *
14
- * This feature allows setting a language of the document's text part to support
15
- * [WCAG 3.1.2 Language of Parts](https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html) specification.
16
- *
17
- * To change the editor's UI language, refer to the {@glink features/ui-language Setting the UI language} guide.
18
- *
19
- * For more information about this feature, check the {@glink api/language package page} as well as the {@glink features/language
20
- * Text part language} feature guide.
21
- *
22
- * This is a "glue" plugin which loads the
23
- * {@link module:language/textpartlanguageediting~TextPartLanguageEditing text part language editing feature}
24
- * and the {@link module:language/textpartlanguageui~TextPartLanguageUI text part language UI feature}.
25
- */
26
- export default class TextPartLanguage extends Plugin {
27
- /**
28
- * @inheritDoc
29
- */
30
- static get requires() {
31
- return [TextPartLanguageEditing, TextPartLanguageUI];
32
- }
33
- /**
34
- * @inheritDoc
35
- */
36
- static get pluginName() {
37
- return 'TextPartLanguage';
38
- }
39
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module language/textpartlanguage
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import TextPartLanguageEditing from './textpartlanguageediting';
10
+ import TextPartLanguageUI from './textpartlanguageui';
11
+ /**
12
+ * The text part language feature.
13
+ *
14
+ * This feature allows setting a language of the document's text part to support
15
+ * [WCAG 3.1.2 Language of Parts](https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html) specification.
16
+ *
17
+ * To change the editor's UI language, refer to the {@glink features/ui-language Setting the UI language} guide.
18
+ *
19
+ * For more information about this feature, check the {@glink api/language package page} as well as the {@glink features/language
20
+ * Text part language} feature guide.
21
+ *
22
+ * This is a "glue" plugin which loads the
23
+ * {@link module:language/textpartlanguageediting~TextPartLanguageEditing text part language editing feature}
24
+ * and the {@link module:language/textpartlanguageui~TextPartLanguageUI text part language UI feature}.
25
+ */
26
+ export default class TextPartLanguage extends Plugin {
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get requires() {
31
+ return [TextPartLanguageEditing, TextPartLanguageUI];
32
+ }
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ static get pluginName() {
37
+ return 'TextPartLanguage';
38
+ }
39
+ }
@@ -1,70 +1,70 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module language/textpartlanguagecommand
7
- */
8
- import type { LanguageDirection } from 'ckeditor5/src/utils';
9
- import { Command } from 'ckeditor5/src/core';
10
- /**
11
- * The text part language command plugin.
12
- */
13
- export default class TextPartLanguageCommand extends Command {
14
- /**
15
- * If the selection starts in a language attribute, the value is set to
16
- * the value of that language in the following format:
17
- *
18
- * ```
19
- * <languageCode>:<textDirection>
20
- * ```
21
- *
22
- * * `languageCode` - The language code used for the `lang` attribute in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1)
23
- * format.
24
- * * `textDirection` - One of the following values: `rtl` or `ltr`, indicating the reading direction of the language.
25
- *
26
- * See the {@link module:core/editor/editorconfig~LanguageConfig#textPartLanguage text part language configuration}
27
- * for more information about language properties.
28
- *
29
- * It is set to `false` otherwise.
30
- *
31
- * @observable
32
- * @readonly
33
- */
34
- value: false | string;
35
- /**
36
- * @inheritDoc
37
- */
38
- refresh(): void;
39
- /**
40
- * Executes the command. Applies the attribute to the selection or removes it from the selection.
41
- *
42
- * If `languageCode` is set to `false` or a `null` value, it will remove attributes. Otherwise, it will set
43
- * the attribute in the `{@link #value value}` format.
44
- *
45
- * The execution result differs, depending on the {@link module:engine/model/document~Document#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~Schema 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~Document#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.languageCode The language code to be applied to the model.
57
- * @param options.textDirection The language text direction.
58
- */
59
- execute({ languageCode, textDirection }?: {
60
- languageCode?: string | false;
61
- textDirection?: LanguageDirection;
62
- }): void;
63
- /**
64
- * Returns the attribute value of the first node in the selection that allows the attribute.
65
- * For a collapsed selection it returns the selection attribute.
66
- *
67
- * @returns The attribute value.
68
- */
69
- private _getValueFromFirstAllowedNode;
70
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module language/textpartlanguagecommand
7
+ */
8
+ import type { LanguageDirection } from 'ckeditor5/src/utils';
9
+ import { Command } from 'ckeditor5/src/core';
10
+ /**
11
+ * The text part language command plugin.
12
+ */
13
+ export default class TextPartLanguageCommand extends Command {
14
+ /**
15
+ * If the selection starts in a language attribute, the value is set to
16
+ * the value of that language in the following format:
17
+ *
18
+ * ```
19
+ * <languageCode>:<textDirection>
20
+ * ```
21
+ *
22
+ * * `languageCode` - The language code used for the `lang` attribute in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1)
23
+ * format.
24
+ * * `textDirection` - One of the following values: `rtl` or `ltr`, indicating the reading direction of the language.
25
+ *
26
+ * See the {@link module:core/editor/editorconfig~LanguageConfig#textPartLanguage text part language configuration}
27
+ * for more information about language properties.
28
+ *
29
+ * It is set to `false` otherwise.
30
+ *
31
+ * @observable
32
+ * @readonly
33
+ */
34
+ value: false | string;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ refresh(): void;
39
+ /**
40
+ * Executes the command. Applies the attribute to the selection or removes it from the selection.
41
+ *
42
+ * If `languageCode` is set to `false` or a `null` value, it will remove attributes. Otherwise, it will set
43
+ * the attribute in the `{@link #value value}` format.
44
+ *
45
+ * The execution result differs, depending on the {@link module:engine/model/document~Document#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~Schema 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~Document#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.languageCode The language code to be applied to the model.
57
+ * @param options.textDirection The language text direction.
58
+ */
59
+ execute({ languageCode, textDirection }?: {
60
+ languageCode?: string | false;
61
+ textDirection?: LanguageDirection;
62
+ }): void;
63
+ /**
64
+ * Returns the attribute value of the first node in the selection that allows the attribute.
65
+ * For a collapsed selection it returns the selection attribute.
66
+ *
67
+ * @returns The attribute value.
68
+ */
69
+ private _getValueFromFirstAllowedNode;
70
+ }