@ckeditor/ckeditor5-horizontal-line 39.0.1 → 40.0.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.
Files changed (71) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -3
  3. package/build/horizontal-line.js.map +1 -0
  4. package/lang/translations/ar.po +1 -0
  5. package/lang/translations/az.po +1 -0
  6. package/lang/translations/bg.po +1 -0
  7. package/lang/translations/bn.po +1 -0
  8. package/lang/translations/bs.po +1 -0
  9. package/lang/translations/ca.po +1 -0
  10. package/lang/translations/cs.po +1 -0
  11. package/lang/translations/da.po +1 -0
  12. package/lang/translations/de-ch.po +1 -0
  13. package/lang/translations/de.po +1 -0
  14. package/lang/translations/el.po +1 -0
  15. package/lang/translations/en-au.po +1 -0
  16. package/lang/translations/en.po +1 -0
  17. package/lang/translations/es.po +1 -0
  18. package/lang/translations/et.po +1 -0
  19. package/lang/translations/fa.po +1 -0
  20. package/lang/translations/fi.po +1 -0
  21. package/lang/translations/fr.po +1 -0
  22. package/lang/translations/gl.po +1 -0
  23. package/lang/translations/he.po +1 -0
  24. package/lang/translations/hi.po +1 -0
  25. package/lang/translations/hr.po +1 -0
  26. package/lang/translations/hu.po +1 -0
  27. package/lang/translations/id.po +1 -0
  28. package/lang/translations/it.po +1 -0
  29. package/lang/translations/ja.po +1 -0
  30. package/lang/translations/jv.po +1 -0
  31. package/lang/translations/ko.po +1 -0
  32. package/lang/translations/ku.po +1 -0
  33. package/lang/translations/lt.po +1 -0
  34. package/lang/translations/lv.po +1 -0
  35. package/lang/translations/ms.po +1 -0
  36. package/lang/translations/nl.po +1 -0
  37. package/lang/translations/no.po +1 -0
  38. package/lang/translations/pl.po +1 -0
  39. package/lang/translations/pt-br.po +1 -0
  40. package/lang/translations/pt.po +1 -0
  41. package/lang/translations/ro.po +1 -0
  42. package/lang/translations/ru.po +1 -0
  43. package/lang/translations/sk.po +1 -0
  44. package/lang/translations/sl.po +1 -0
  45. package/lang/translations/sq.po +1 -0
  46. package/lang/translations/sr-latn.po +1 -0
  47. package/lang/translations/sr.po +1 -0
  48. package/lang/translations/sv.po +1 -0
  49. package/lang/translations/th.po +1 -0
  50. package/lang/translations/tk.po +1 -0
  51. package/lang/translations/tr.po +1 -0
  52. package/lang/translations/ug.po +1 -0
  53. package/lang/translations/uk.po +1 -0
  54. package/lang/translations/ur.po +1 -0
  55. package/lang/translations/uz.po +1 -0
  56. package/lang/translations/vi.po +1 -0
  57. package/lang/translations/zh-cn.po +1 -0
  58. package/lang/translations/zh.po +1 -0
  59. package/package.json +2 -6
  60. package/src/augmentation.d.ts +15 -15
  61. package/src/augmentation.js +5 -5
  62. package/src/horizontalline.d.ts +28 -28
  63. package/src/horizontalline.js +32 -32
  64. package/src/horizontallinecommand.d.ts +28 -28
  65. package/src/horizontallinecommand.js +63 -63
  66. package/src/horizontallineediting.d.ts +22 -22
  67. package/src/horizontallineediting.js +64 -64
  68. package/src/horizontallineui.d.ts +21 -21
  69. package/src/horizontallineui.js +45 -45
  70. package/src/index.d.ts +12 -12
  71. package/src/index.js +11 -11
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
16
16
  "Language: zh_TW\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Horizontal line"
20
21
  msgid "Horizontal line"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-horizontal-line",
3
- "version": "39.0.1",
3
+ "version": "40.0.0",
4
4
  "description": "Horizontal line feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,11 +12,7 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "39.0.1"
16
- },
17
- "engines": {
18
- "node": ">=16.0.0",
19
- "npm": ">=5.7.1"
15
+ "ckeditor5": "40.0.0"
20
16
  },
21
17
  "author": "CKSource (http://cksource.com/)",
22
18
  "license": "GPL-2.0-or-later",
@@ -1,15 +1,15 @@
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 { HorizontalLine, HorizontalLineCommand, HorizontalLineEditing, HorizontalLineUI } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [HorizontalLine.pluginName]: HorizontalLine;
9
- [HorizontalLineEditing.pluginName]: HorizontalLineEditing;
10
- [HorizontalLineUI.pluginName]: HorizontalLineUI;
11
- }
12
- interface CommandsMap {
13
- horizontalLine: HorizontalLineCommand;
14
- }
15
- }
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 { HorizontalLine, HorizontalLineCommand, HorizontalLineEditing, HorizontalLineUI } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [HorizontalLine.pluginName]: HorizontalLine;
9
+ [HorizontalLineEditing.pluginName]: HorizontalLineEditing;
10
+ [HorizontalLineUI.pluginName]: HorizontalLineUI;
11
+ }
12
+ interface CommandsMap {
13
+ horizontalLine: HorizontalLineCommand;
14
+ }
15
+ }
@@ -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 {};
@@ -1,28 +1,28 @@
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 horizontal-line/horizontalline
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { Widget } from 'ckeditor5/src/widget';
10
- import HorizontalLineEditing from './horizontallineediting';
11
- import HorizontalLineUI from './horizontallineui';
12
- /**
13
- * The horizontal line feature.
14
- *
15
- * It provides the possibility to insert a horizontal line into the rich-text editor.
16
- *
17
- * For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
18
- */
19
- export default class HorizontalLine extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires(): readonly [typeof HorizontalLineEditing, typeof HorizontalLineUI, typeof Widget];
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName(): "HorizontalLine";
28
- }
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 horizontal-line/horizontalline
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { Widget } from 'ckeditor5/src/widget';
10
+ import HorizontalLineEditing from './horizontallineediting';
11
+ import HorizontalLineUI from './horizontallineui';
12
+ /**
13
+ * The horizontal line feature.
14
+ *
15
+ * It provides the possibility to insert a horizontal line into the rich-text editor.
16
+ *
17
+ * For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
18
+ */
19
+ export default class HorizontalLine extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires(): readonly [typeof HorizontalLineEditing, typeof HorizontalLineUI, typeof Widget];
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "HorizontalLine";
28
+ }
@@ -1,32 +1,32 @@
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 horizontal-line/horizontalline
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { Widget } from 'ckeditor5/src/widget';
10
- import HorizontalLineEditing from './horizontallineediting';
11
- import HorizontalLineUI from './horizontallineui';
12
- /**
13
- * The horizontal line feature.
14
- *
15
- * It provides the possibility to insert a horizontal line into the rich-text editor.
16
- *
17
- * For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
18
- */
19
- export default class HorizontalLine extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires() {
24
- return [HorizontalLineEditing, HorizontalLineUI, Widget];
25
- }
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName() {
30
- return 'HorizontalLine';
31
- }
32
- }
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 horizontal-line/horizontalline
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { Widget } from 'ckeditor5/src/widget';
10
+ import HorizontalLineEditing from './horizontallineediting';
11
+ import HorizontalLineUI from './horizontallineui';
12
+ /**
13
+ * The horizontal line feature.
14
+ *
15
+ * It provides the possibility to insert a horizontal line into the rich-text editor.
16
+ *
17
+ * For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
18
+ */
19
+ export default class HorizontalLine extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires() {
24
+ return [HorizontalLineEditing, HorizontalLineUI, Widget];
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName() {
30
+ return 'HorizontalLine';
31
+ }
32
+ }
@@ -1,28 +1,28 @@
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 { Command } from 'ckeditor5/src/core';
6
- /**
7
- * The horizontal line command.
8
- *
9
- * The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
10
- *
11
- * To insert a horizontal line at the current selection, execute the command:
12
- *
13
- * ```ts
14
- * editor.execute( 'horizontalLine' );
15
- * ```
16
- */
17
- export default class HorizontalLineCommand extends Command {
18
- /**
19
- * @inheritDoc
20
- */
21
- refresh(): void;
22
- /**
23
- * Executes the command.
24
- *
25
- * @fires execute
26
- */
27
- execute(): void;
28
- }
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 { Command } from 'ckeditor5/src/core';
6
+ /**
7
+ * The horizontal line command.
8
+ *
9
+ * The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
10
+ *
11
+ * To insert a horizontal line at the current selection, execute the command:
12
+ *
13
+ * ```ts
14
+ * editor.execute( 'horizontalLine' );
15
+ * ```
16
+ */
17
+ export default class HorizontalLineCommand extends Command {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ refresh(): void;
22
+ /**
23
+ * Executes the command.
24
+ *
25
+ * @fires execute
26
+ */
27
+ execute(): void;
28
+ }
@@ -1,63 +1,63 @@
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 { Command } from 'ckeditor5/src/core';
6
- import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
7
- /**
8
- * The horizontal line command.
9
- *
10
- * The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
11
- *
12
- * To insert a horizontal line at the current selection, execute the command:
13
- *
14
- * ```ts
15
- * editor.execute( 'horizontalLine' );
16
- * ```
17
- */
18
- export default class HorizontalLineCommand extends Command {
19
- /**
20
- * @inheritDoc
21
- */
22
- refresh() {
23
- const model = this.editor.model;
24
- const schema = model.schema;
25
- const selection = model.document.selection;
26
- this.isEnabled = isHorizontalLineAllowedInParent(selection, schema, model);
27
- }
28
- /**
29
- * Executes the command.
30
- *
31
- * @fires execute
32
- */
33
- execute() {
34
- const model = this.editor.model;
35
- model.change(writer => {
36
- const horizontalElement = writer.createElement('horizontalLine');
37
- model.insertObject(horizontalElement, null, null, { setSelection: 'after' });
38
- });
39
- }
40
- }
41
- /**
42
- * Checks if a horizontal line is allowed by the schema in the optimal insertion parent.
43
- *
44
- * @param model Model instance.
45
- */
46
- function isHorizontalLineAllowedInParent(selection, schema, model) {
47
- const parent = getInsertHorizontalLineParent(selection, model);
48
- return schema.checkChild(parent, 'horizontalLine');
49
- }
50
- /**
51
- * Returns a node that will be used to insert a horizontal line with `model.insertContent` to check if the horizontal line can be
52
- * placed there.
53
- *
54
- * @param model Model instance.
55
- */
56
- function getInsertHorizontalLineParent(selection, model) {
57
- const insertionRange = findOptimalInsertionRange(selection, model);
58
- const parent = insertionRange.start.parent;
59
- if (parent.isEmpty && !parent.is('element', '$root')) {
60
- return parent.parent;
61
- }
62
- return parent;
63
- }
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 { Command } from 'ckeditor5/src/core';
6
+ import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
7
+ /**
8
+ * The horizontal line command.
9
+ *
10
+ * The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
11
+ *
12
+ * To insert a horizontal line at the current selection, execute the command:
13
+ *
14
+ * ```ts
15
+ * editor.execute( 'horizontalLine' );
16
+ * ```
17
+ */
18
+ export default class HorizontalLineCommand extends Command {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ refresh() {
23
+ const model = this.editor.model;
24
+ const schema = model.schema;
25
+ const selection = model.document.selection;
26
+ this.isEnabled = isHorizontalLineAllowedInParent(selection, schema, model);
27
+ }
28
+ /**
29
+ * Executes the command.
30
+ *
31
+ * @fires execute
32
+ */
33
+ execute() {
34
+ const model = this.editor.model;
35
+ model.change(writer => {
36
+ const horizontalElement = writer.createElement('horizontalLine');
37
+ model.insertObject(horizontalElement, null, null, { setSelection: 'after' });
38
+ });
39
+ }
40
+ }
41
+ /**
42
+ * Checks if a horizontal line is allowed by the schema in the optimal insertion parent.
43
+ *
44
+ * @param model Model instance.
45
+ */
46
+ function isHorizontalLineAllowedInParent(selection, schema, model) {
47
+ const parent = getInsertHorizontalLineParent(selection, model);
48
+ return schema.checkChild(parent, 'horizontalLine');
49
+ }
50
+ /**
51
+ * Returns a node that will be used to insert a horizontal line with `model.insertContent` to check if the horizontal line can be
52
+ * placed there.
53
+ *
54
+ * @param model Model instance.
55
+ */
56
+ function getInsertHorizontalLineParent(selection, model) {
57
+ const insertionRange = findOptimalInsertionRange(selection, model);
58
+ const parent = insertionRange.start.parent;
59
+ if (parent.isEmpty && !parent.is('element', '$root')) {
60
+ return parent.parent;
61
+ }
62
+ return parent;
63
+ }
@@ -1,22 +1,22 @@
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 horizontal-line/horizontallineediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import '../theme/horizontalline.css';
10
- /**
11
- * The horizontal line editing feature.
12
- */
13
- export default class HorizontalLineEditing extends Plugin {
14
- /**
15
- * @inheritDoc
16
- */
17
- static get pluginName(): "HorizontalLineEditing";
18
- /**
19
- * @inheritDoc
20
- */
21
- init(): void;
22
- }
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 horizontal-line/horizontallineediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import '../theme/horizontalline.css';
10
+ /**
11
+ * The horizontal line editing feature.
12
+ */
13
+ export default class HorizontalLineEditing extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "HorizontalLineEditing";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ init(): void;
22
+ }
@@ -1,64 +1,64 @@
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 horizontal-line/horizontallineediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { toWidget } from 'ckeditor5/src/widget';
10
- import HorizontalLineCommand from './horizontallinecommand';
11
- import '../theme/horizontalline.css';
12
- /**
13
- * The horizontal line editing feature.
14
- */
15
- export default class HorizontalLineEditing extends Plugin {
16
- /**
17
- * @inheritDoc
18
- */
19
- static get pluginName() {
20
- return 'HorizontalLineEditing';
21
- }
22
- /**
23
- * @inheritDoc
24
- */
25
- init() {
26
- const editor = this.editor;
27
- const schema = editor.model.schema;
28
- const t = editor.t;
29
- const conversion = editor.conversion;
30
- schema.register('horizontalLine', {
31
- inheritAllFrom: '$blockObject'
32
- });
33
- conversion.for('dataDowncast').elementToElement({
34
- model: 'horizontalLine',
35
- view: (modelElement, { writer }) => {
36
- return writer.createEmptyElement('hr');
37
- }
38
- });
39
- conversion.for('editingDowncast').elementToStructure({
40
- model: 'horizontalLine',
41
- view: (modelElement, { writer }) => {
42
- const label = t('Horizontal line');
43
- const viewWrapper = writer.createContainerElement('div', null, writer.createEmptyElement('hr'));
44
- writer.addClass('ck-horizontal-line', viewWrapper);
45
- writer.setCustomProperty('hr', true, viewWrapper);
46
- return toHorizontalLineWidget(viewWrapper, writer, label);
47
- }
48
- });
49
- conversion.for('upcast').elementToElement({ view: 'hr', model: 'horizontalLine' });
50
- editor.commands.add('horizontalLine', new HorizontalLineCommand(editor));
51
- }
52
- }
53
- /**
54
- * Converts a given {@link module:engine/view/element~Element} to a horizontal line widget:
55
- * * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to
56
- * recognize the horizontal line widget element.
57
- * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
58
- *
59
- * @param writer An instance of the view writer.
60
- */
61
- function toHorizontalLineWidget(viewElement, writer, label) {
62
- writer.setCustomProperty('horizontalLine', true, viewElement);
63
- return toWidget(viewElement, writer, { label });
64
- }
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 horizontal-line/horizontallineediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { toWidget } from 'ckeditor5/src/widget';
10
+ import HorizontalLineCommand from './horizontallinecommand';
11
+ import '../theme/horizontalline.css';
12
+ /**
13
+ * The horizontal line editing feature.
14
+ */
15
+ export default class HorizontalLineEditing extends Plugin {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName() {
20
+ return 'HorizontalLineEditing';
21
+ }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init() {
26
+ const editor = this.editor;
27
+ const schema = editor.model.schema;
28
+ const t = editor.t;
29
+ const conversion = editor.conversion;
30
+ schema.register('horizontalLine', {
31
+ inheritAllFrom: '$blockObject'
32
+ });
33
+ conversion.for('dataDowncast').elementToElement({
34
+ model: 'horizontalLine',
35
+ view: (modelElement, { writer }) => {
36
+ return writer.createEmptyElement('hr');
37
+ }
38
+ });
39
+ conversion.for('editingDowncast').elementToStructure({
40
+ model: 'horizontalLine',
41
+ view: (modelElement, { writer }) => {
42
+ const label = t('Horizontal line');
43
+ const viewWrapper = writer.createContainerElement('div', null, writer.createEmptyElement('hr'));
44
+ writer.addClass('ck-horizontal-line', viewWrapper);
45
+ writer.setCustomProperty('hr', true, viewWrapper);
46
+ return toHorizontalLineWidget(viewWrapper, writer, label);
47
+ }
48
+ });
49
+ conversion.for('upcast').elementToElement({ view: 'hr', model: 'horizontalLine' });
50
+ editor.commands.add('horizontalLine', new HorizontalLineCommand(editor));
51
+ }
52
+ }
53
+ /**
54
+ * Converts a given {@link module:engine/view/element~Element} to a horizontal line widget:
55
+ * * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to
56
+ * recognize the horizontal line widget element.
57
+ * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
58
+ *
59
+ * @param writer An instance of the view writer.
60
+ */
61
+ function toHorizontalLineWidget(viewElement, writer, label) {
62
+ writer.setCustomProperty('horizontalLine', true, viewElement);
63
+ return toWidget(viewElement, writer, { label });
64
+ }
@@ -1,21 +1,21 @@
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 horizontal-line/horizontallineui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- /**
10
- * The horizontal line UI plugin.
11
- */
12
- export default class HorizontalLineUI extends Plugin {
13
- /**
14
- * @inheritDoc
15
- */
16
- static get pluginName(): "HorizontalLineUI";
17
- /**
18
- * @inheritDoc
19
- */
20
- init(): void;
21
- }
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 horizontal-line/horizontallineui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ /**
10
+ * The horizontal line UI plugin.
11
+ */
12
+ export default class HorizontalLineUI extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get pluginName(): "HorizontalLineUI";
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ init(): void;
21
+ }