@ckeditor/ckeditor5-widget 48.8.1-alpha.4 → 49.0.0-alpha.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 (169) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/augmentation.d.ts +11 -11
  3. package/dist/highlightstack.d.ts +65 -64
  4. package/dist/index-content.css +3 -0
  5. package/dist/index-content.css.map +1 -0
  6. package/dist/index-editor.css +433 -426
  7. package/dist/index-editor.css.map +1 -0
  8. package/dist/index.css +331 -328
  9. package/dist/index.css.map +1 -1
  10. package/dist/index.d.ts +19 -17
  11. package/dist/index.js +2647 -3053
  12. package/dist/index.js.map +1 -1
  13. package/dist/translations/af.js +1 -1
  14. package/dist/translations/af.umd.js +5 -3
  15. package/dist/translations/ar.js +1 -1
  16. package/dist/translations/ar.umd.js +5 -3
  17. package/dist/translations/ast.js +1 -1
  18. package/dist/translations/ast.umd.js +5 -3
  19. package/dist/translations/az.js +1 -1
  20. package/dist/translations/az.umd.js +5 -3
  21. package/dist/translations/be.js +1 -1
  22. package/dist/translations/be.umd.js +5 -3
  23. package/dist/translations/bg.js +1 -1
  24. package/dist/translations/bg.umd.js +5 -3
  25. package/dist/translations/bn.js +1 -1
  26. package/dist/translations/bn.umd.js +5 -3
  27. package/dist/translations/bs.js +1 -1
  28. package/dist/translations/bs.umd.js +5 -3
  29. package/dist/translations/ca.js +1 -1
  30. package/dist/translations/ca.umd.js +5 -3
  31. package/dist/translations/cs.js +1 -1
  32. package/dist/translations/cs.umd.js +5 -3
  33. package/dist/translations/da.js +1 -1
  34. package/dist/translations/da.umd.js +5 -3
  35. package/dist/translations/de-ch.js +1 -1
  36. package/dist/translations/de-ch.umd.js +5 -3
  37. package/dist/translations/de.js +1 -1
  38. package/dist/translations/de.umd.js +5 -3
  39. package/dist/translations/el.js +1 -1
  40. package/dist/translations/el.umd.js +5 -3
  41. package/dist/translations/en-au.js +1 -1
  42. package/dist/translations/en-au.umd.js +5 -3
  43. package/dist/translations/en-gb.js +1 -1
  44. package/dist/translations/en-gb.umd.js +5 -3
  45. package/dist/translations/en.js +1 -1
  46. package/dist/translations/en.umd.js +5 -3
  47. package/dist/translations/eo.js +1 -1
  48. package/dist/translations/eo.umd.js +5 -3
  49. package/dist/translations/es-co.js +1 -1
  50. package/dist/translations/es-co.umd.js +5 -3
  51. package/dist/translations/es.js +1 -1
  52. package/dist/translations/es.umd.js +5 -3
  53. package/dist/translations/et.js +1 -1
  54. package/dist/translations/et.umd.js +5 -3
  55. package/dist/translations/eu.js +1 -1
  56. package/dist/translations/eu.umd.js +5 -3
  57. package/dist/translations/fa.js +1 -1
  58. package/dist/translations/fa.umd.js +5 -3
  59. package/dist/translations/fi.js +1 -1
  60. package/dist/translations/fi.umd.js +5 -3
  61. package/dist/translations/fr.js +1 -1
  62. package/dist/translations/fr.umd.js +5 -3
  63. package/dist/translations/gl.js +1 -1
  64. package/dist/translations/gl.umd.js +5 -3
  65. package/dist/translations/gu.js +1 -1
  66. package/dist/translations/gu.umd.js +5 -3
  67. package/dist/translations/he.js +1 -1
  68. package/dist/translations/he.umd.js +5 -3
  69. package/dist/translations/hi.js +1 -1
  70. package/dist/translations/hi.umd.js +5 -3
  71. package/dist/translations/hr.js +1 -1
  72. package/dist/translations/hr.umd.js +5 -3
  73. package/dist/translations/hu.js +1 -1
  74. package/dist/translations/hu.umd.js +5 -3
  75. package/dist/translations/hy.js +1 -1
  76. package/dist/translations/hy.umd.js +5 -3
  77. package/dist/translations/id.js +1 -1
  78. package/dist/translations/id.umd.js +5 -3
  79. package/dist/translations/it.js +1 -1
  80. package/dist/translations/it.umd.js +5 -3
  81. package/dist/translations/ja.js +1 -1
  82. package/dist/translations/ja.umd.js +5 -3
  83. package/dist/translations/jv.js +1 -1
  84. package/dist/translations/jv.umd.js +5 -3
  85. package/dist/translations/kk.js +1 -1
  86. package/dist/translations/kk.umd.js +5 -3
  87. package/dist/translations/km.js +1 -1
  88. package/dist/translations/km.umd.js +5 -3
  89. package/dist/translations/kn.js +1 -1
  90. package/dist/translations/kn.umd.js +5 -3
  91. package/dist/translations/ko.js +1 -1
  92. package/dist/translations/ko.umd.js +5 -3
  93. package/dist/translations/ku.js +1 -1
  94. package/dist/translations/ku.umd.js +5 -3
  95. package/dist/translations/lt.js +1 -1
  96. package/dist/translations/lt.umd.js +5 -3
  97. package/dist/translations/lv.js +1 -1
  98. package/dist/translations/lv.umd.js +5 -3
  99. package/dist/translations/ms.js +1 -1
  100. package/dist/translations/ms.umd.js +5 -3
  101. package/dist/translations/nb.js +1 -1
  102. package/dist/translations/nb.umd.js +5 -3
  103. package/dist/translations/ne.js +1 -1
  104. package/dist/translations/ne.umd.js +5 -3
  105. package/dist/translations/nl.js +1 -1
  106. package/dist/translations/nl.umd.js +5 -3
  107. package/dist/translations/no.js +1 -1
  108. package/dist/translations/no.umd.js +5 -3
  109. package/dist/translations/oc.js +1 -1
  110. package/dist/translations/oc.umd.js +5 -3
  111. package/dist/translations/pl.js +1 -1
  112. package/dist/translations/pl.umd.js +5 -3
  113. package/dist/translations/pt-br.js +1 -1
  114. package/dist/translations/pt-br.umd.js +5 -3
  115. package/dist/translations/pt.js +1 -1
  116. package/dist/translations/pt.umd.js +5 -3
  117. package/dist/translations/ro.js +1 -1
  118. package/dist/translations/ro.umd.js +5 -3
  119. package/dist/translations/ru.js +1 -1
  120. package/dist/translations/ru.umd.js +5 -3
  121. package/dist/translations/si.js +1 -1
  122. package/dist/translations/si.umd.js +5 -3
  123. package/dist/translations/sk.js +1 -1
  124. package/dist/translations/sk.umd.js +5 -3
  125. package/dist/translations/sl.js +1 -1
  126. package/dist/translations/sl.umd.js +5 -3
  127. package/dist/translations/sq.js +1 -1
  128. package/dist/translations/sq.umd.js +5 -3
  129. package/dist/translations/sr-latn.js +1 -1
  130. package/dist/translations/sr-latn.umd.js +5 -3
  131. package/dist/translations/sr.js +1 -1
  132. package/dist/translations/sr.umd.js +5 -3
  133. package/dist/translations/sv.js +1 -1
  134. package/dist/translations/sv.umd.js +5 -3
  135. package/dist/translations/th.js +1 -1
  136. package/dist/translations/th.umd.js +5 -3
  137. package/dist/translations/ti.js +1 -1
  138. package/dist/translations/ti.umd.js +5 -3
  139. package/dist/translations/tk.js +1 -1
  140. package/dist/translations/tk.umd.js +5 -3
  141. package/dist/translations/tr.js +1 -1
  142. package/dist/translations/tr.umd.js +5 -3
  143. package/dist/translations/tt.js +1 -1
  144. package/dist/translations/tt.umd.js +5 -3
  145. package/dist/translations/ug.js +1 -1
  146. package/dist/translations/ug.umd.js +5 -3
  147. package/dist/translations/uk.js +1 -1
  148. package/dist/translations/uk.umd.js +5 -3
  149. package/dist/translations/ur.js +1 -1
  150. package/dist/translations/ur.umd.js +5 -3
  151. package/dist/translations/uz.js +1 -1
  152. package/dist/translations/uz.umd.js +5 -3
  153. package/dist/translations/vi.js +1 -1
  154. package/dist/translations/vi.umd.js +5 -3
  155. package/dist/translations/zh-cn.js +1 -1
  156. package/dist/translations/zh-cn.umd.js +5 -3
  157. package/dist/translations/zh.js +1 -1
  158. package/dist/translations/zh.umd.js +5 -3
  159. package/dist/utils.d.ts +192 -189
  160. package/dist/verticalnavigation.d.ts +11 -11
  161. package/dist/widget.d.ts +112 -113
  162. package/dist/widgetresize/resizer.d.ts +166 -169
  163. package/dist/widgetresize/resizerstate.d.ts +122 -121
  164. package/dist/widgetresize/sizeview.d.ts +52 -52
  165. package/dist/widgetresize.d.ts +120 -121
  166. package/dist/widgettoolbarrepository.d.ts +96 -96
  167. package/dist/widgettypearound/utils.d.ts +70 -37
  168. package/dist/widgettypearound/widgettypearound.d.ts +225 -226
  169. package/package.json +9 -9
@@ -1,101 +1,101 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, 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
5
  /**
6
- * @module widget/widgettoolbarrepository
7
- */
8
- import { Plugin, type ToolbarConfigItem } from '@ckeditor/ckeditor5-core';
9
- import type { ViewDocumentSelection, ViewElement } from '@ckeditor/ckeditor5-engine';
10
- import { ContextualBalloon } from '@ckeditor/ckeditor5-ui';
11
- import { type PositioningFunction } from '@ckeditor/ckeditor5-utils';
6
+ * @module widget/widgettoolbarrepository
7
+ */
8
+ import { Plugin, type ToolbarConfigItem, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import type { ViewDocumentSelection, ViewElement } from "@ckeditor/ckeditor5-engine";
10
+ import { ContextualBalloon } from "@ckeditor/ckeditor5-ui";
11
+ import { type PositioningFunction } from "@ckeditor/ckeditor5-utils";
12
12
  /**
13
- * Widget toolbar repository plugin. A central point for registering widget toolbars. This plugin handles the whole
14
- * toolbar rendering process and exposes a concise API.
15
- *
16
- * To add a toolbar for your widget use the {@link ~WidgetToolbarRepository#register `WidgetToolbarRepository#register()`} method.
17
- *
18
- * The following example comes from the {@link module:image/imagetoolbar~ImageToolbar} plugin:
19
- *
20
- * ```ts
21
- * class ImageToolbar extends Plugin {
22
- * static get requires() {
23
- * return [ WidgetToolbarRepository ];
24
- * }
25
- *
26
- * afterInit() {
27
- * const editor = this.editor;
28
- * const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository );
29
- *
30
- * widgetToolbarRepository.register( 'image', {
31
- * items: editor.config.get( 'image.toolbar' ),
32
- * getRelatedElement: getClosestSelectedImageWidget
33
- * } );
34
- * }
35
- * }
36
- * ```
37
- */
13
+ * Widget toolbar repository plugin. A central point for registering widget toolbars. This plugin handles the whole
14
+ * toolbar rendering process and exposes a concise API.
15
+ *
16
+ * To add a toolbar for your widget use the {@link ~WidgetToolbarRepository#register `WidgetToolbarRepository#register()`} method.
17
+ *
18
+ * The following example comes from the {@link module:image/imagetoolbar~ImageToolbar} plugin:
19
+ *
20
+ * ```ts
21
+ * class ImageToolbar extends Plugin {
22
+ * static get requires(): PluginDependenciesOf<[ WidgetToolbarRepository ]> {
23
+ * return [ WidgetToolbarRepository ];
24
+ * }
25
+ *
26
+ * afterInit() {
27
+ * const editor = this.editor;
28
+ * const widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository );
29
+ *
30
+ * widgetToolbarRepository.register( 'image', {
31
+ * items: editor.config.get( 'image.toolbar' ),
32
+ * getRelatedElement: getClosestSelectedImageWidget
33
+ * } );
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
38
  export declare class WidgetToolbarRepository extends Plugin {
39
- /**
40
- * A map of toolbar definitions.
41
- */
42
- private _toolbarDefinitions;
43
- private _balloon;
44
- /**
45
- * @inheritDoc
46
- */
47
- static get requires(): readonly [typeof ContextualBalloon];
48
- /**
49
- * @inheritDoc
50
- */
51
- static get pluginName(): "WidgetToolbarRepository";
52
- /**
53
- * @inheritDoc
54
- */
55
- static get isOfficialPlugin(): true;
56
- /**
57
- * @inheritDoc
58
- */
59
- init(): void;
60
- destroy(): void;
61
- /**
62
- * Registers toolbar in the WidgetToolbarRepository. It renders it in the `ContextualBalloon` based on the value of the invoked
63
- * `getRelatedElement` function. Toolbar items are gathered from `items` array.
64
- * The balloon's CSS class is by default `ck-toolbar-container` and may be override with the `balloonClassName` option.
65
- *
66
- * Note: This method should be called in the {@link module:core/plugin~PluginInterface#afterInit `Plugin#afterInit()`}
67
- * callback (or later) to make sure that the given toolbar items were already registered by other plugins.
68
- *
69
- * @param toolbarId An id for the toolbar. Used to
70
- * @param options Detailed options
71
- * @param options.ariaLabel Label used by assistive technologies to describe this toolbar element.
72
- * @param options.items Array of toolbar items.
73
- * @param options.getRelatedElement Callback which returns an element the toolbar should be attached to.
74
- * @param options.balloonClassName CSS class for the widget balloon.
75
- */
76
- register(toolbarId: string, { ariaLabel, items, getRelatedElement, balloonClassName, positions }: {
77
- ariaLabel?: string;
78
- items: Array<ToolbarConfigItem>;
79
- getRelatedElement: (selection: ViewDocumentSelection) => (ViewElement | null);
80
- balloonClassName?: string;
81
- positions?: ReadonlyArray<PositioningFunction>;
82
- }): void;
83
- /**
84
- * Iterates over stored toolbars and makes them visible or hidden.
85
- */
86
- private _updateToolbarsVisibility;
87
- /**
88
- * Hides the given toolbar.
89
- */
90
- private _hideToolbar;
91
- /**
92
- * Shows up the toolbar if the toolbar is not visible.
93
- * Otherwise, repositions the toolbar's balloon when toolbar's view is the most top view in balloon stack.
94
- *
95
- * It might happen here that the toolbar's view is under another view. Then do nothing as the other toolbar view
96
- * should be still visible after the {@link module:ui/editorui/editorui~EditorUI#event:update}.
97
- */
98
- private _showToolbar;
99
- private _isToolbarVisible;
100
- private _isToolbarInBalloon;
39
+ /**
40
+ * A map of toolbar definitions.
41
+ */
42
+ private _toolbarDefinitions;
43
+ private _balloon;
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ static get requires(): PluginDependenciesOf<[ContextualBalloon]>;
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ static get pluginName(): "WidgetToolbarRepository";
52
+ /**
53
+ * @inheritDoc
54
+ */
55
+ static override get isOfficialPlugin(): true;
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ init(): void;
60
+ override destroy(): void;
61
+ /**
62
+ * Registers toolbar in the WidgetToolbarRepository. It renders it in the `ContextualBalloon` based on the value of the invoked
63
+ * `getRelatedElement` function. Toolbar items are gathered from `items` array.
64
+ * The balloon's CSS class is by default `ck-toolbar-container` and may be override with the `balloonClassName` option.
65
+ *
66
+ * Note: This method should be called in the {@link module:core/plugin~PluginInterface#afterInit `Plugin#afterInit()`}
67
+ * callback (or later) to make sure that the given toolbar items were already registered by other plugins.
68
+ *
69
+ * @param toolbarId An id for the toolbar. Used to
70
+ * @param options Detailed options
71
+ * @param options.ariaLabel Label used by assistive technologies to describe this toolbar element.
72
+ * @param options.items Array of toolbar items.
73
+ * @param options.getRelatedElement Callback which returns an element the toolbar should be attached to.
74
+ * @param options.balloonClassName CSS class for the widget balloon.
75
+ */
76
+ register(toolbarId: string, { ariaLabel, items, getRelatedElement, balloonClassName, positions }: {
77
+ ariaLabel?: string;
78
+ items: Array<ToolbarConfigItem>;
79
+ getRelatedElement: (selection: ViewDocumentSelection) => (ViewElement | null);
80
+ balloonClassName?: string;
81
+ positions?: ReadonlyArray<PositioningFunction>;
82
+ }): void;
83
+ /**
84
+ * Iterates over stored toolbars and makes them visible or hidden.
85
+ */
86
+ private _updateToolbarsVisibility;
87
+ /**
88
+ * Hides the given toolbar.
89
+ */
90
+ private _hideToolbar;
91
+ /**
92
+ * Shows up the toolbar if the toolbar is not visible.
93
+ * Otherwise, repositions the toolbar's balloon when toolbar's view is the most top view in balloon stack.
94
+ *
95
+ * It might happen here that the toolbar's view is under another view. Then do nothing as the other toolbar view
96
+ * should be still visible after the {@link module:ui/editorui/editorui~EditorUI#event:update}.
97
+ */
98
+ private _showToolbar;
99
+ private _isToolbarVisible;
100
+ private _isToolbarInBalloon;
101
101
  }
@@ -1,46 +1,79 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, 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
- import type { ModelDocumentSelection, ViewDomConverter, ModelElement, ModelSchema, ModelSelection, ViewElement } from '@ckeditor/ckeditor5-engine';
6
- /**
7
- * The name of the type around model selection attribute responsible for
8
- * displaying a fake caret next to a selected widget.
9
- *
10
- * @internal
11
- */
2
+ * @license Copyright (c) 2003-2026, 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
+ import { ModelDocumentSelection, type ViewDomConverter, type ModelElement, type ModelSchema, type ModelSelection, type ViewElement } from "@ckeditor/ckeditor5-engine";
6
+ /**
7
+ * The name of the type around model selection attribute responsible for
8
+ * displaying a fake caret next to a selected widget.
9
+ *
10
+ * @internal
11
+ */
12
12
  export declare const TYPE_AROUND_SELECTION_ATTRIBUTE = "widget-type-around";
13
13
  /**
14
- * Checks if an element is a widget that qualifies to get the widget type around UI.
15
- */
14
+ * Checks if an element is a widget that qualifies to get the widget type around UI.
15
+ */
16
16
  export declare function isTypeAroundWidget(viewElement: ViewElement | undefined, modelElement: ModelElement, schema: ModelSchema): boolean;
17
17
  /**
18
- * For the passed HTML element, this helper finds the closest widget type around button ancestor.
19
- *
20
- * @internal
21
- */
18
+ * For the passed HTML element, this helper finds the closest widget type around button ancestor.
19
+ *
20
+ * @internal
21
+ */
22
22
  export declare function getClosestTypeAroundDomButton(domElement: HTMLElement): HTMLElement | null;
23
23
  /**
24
- * For the passed widget type around button element, this helper determines at which position
25
- * the paragraph would be inserted into the content if, for instance, the button was
26
- * clicked by the user.
27
- *
28
- * @internal
29
- * @returns The position of the button.
30
- */
31
- export declare function getTypeAroundButtonPosition(domElement: HTMLElement): 'before' | 'after';
32
- /**
33
- * For the passed HTML element, this helper returns the closest view widget ancestor.
34
- *
35
- * @internal
36
- */
24
+ * For the passed widget type around button element, this helper determines at which position
25
+ * the paragraph would be inserted into the content if, for instance, the button was
26
+ * clicked by the user.
27
+ *
28
+ * @internal
29
+ * @returns The position of the button.
30
+ */
31
+ export declare function getTypeAroundButtonPosition(domElement: HTMLElement): "before" | "after";
32
+ /**
33
+ * For the passed HTML element, this helper returns the closest view widget ancestor.
34
+ *
35
+ * @internal
36
+ */
37
37
  export declare function getClosestWidgetViewElement(domElement: HTMLElement, domConverter: ViewDomConverter): ViewElement;
38
38
  /**
39
- * For the passed selection instance, it returns the position of the fake caret displayed next to a widget.
40
- *
41
- * **Note**: If the fake caret is not currently displayed, `null` is returned.
42
- *
43
- * @internal
44
- * @returns The position of the fake caret or `null` when none is present.
45
- */
46
- export declare function getTypeAroundFakeCaretPosition(selection: ModelSelection | ModelDocumentSelection): 'before' | 'after' | null;
39
+ * For the passed selection instance, it returns the position of the fake caret displayed next to a widget.
40
+ *
41
+ * **Note**: If the fake caret is not currently displayed, `null` is returned.
42
+ *
43
+ * @internal
44
+ * @returns The position of the fake caret or `null` when none is present.
45
+ */
46
+ export declare function getTypeAroundFakeCaretPosition(selection: ModelSelection | ModelDocumentSelection): "before" | "after" | null;
47
+ /**
48
+ * Looks for the `copyOnEnter` text formatting attributes (e.g. bold, font color) carried by the last piece
49
+ * of inline content on the sibling that directly precedes a run of one or more consecutive block widgets.
50
+ *
51
+ * Used when the user inserts a new paragraph next to a widget (e.g. an image or a table) via the type-around
52
+ * UI: the new, empty paragraph should continue whatever formatting was active right before the widget,
53
+ * instead of starting unformatted:
54
+ *
55
+ * ```
56
+ * <paragraph><$text bold="true">Bar</$text></paragraph><imageBlock></imageBlock>
57
+ * ```
58
+ *
59
+ * Only the attributes carried by the *last* inline child of that sibling are considered - whatever precedes
60
+ * it doesn't matter, because it's the last piece of content that reflects what the user was typing right
61
+ * before reaching the widget:
62
+ *
63
+ * ```
64
+ * // "bold" IS recovered here: "Bar", the last child, is bold. "Foo" not being bold is irrelevant.
65
+ * <paragraph>Foo<$text bold="true">Bar</$text></paragraph><imageBlock></imageBlock>
66
+ * ```
67
+ *
68
+ * If there is more than one widget in a row, the search continues past all of them until a sibling with
69
+ * actual content (or the boundary of the parent) is found:
70
+ *
71
+ * ```
72
+ * <paragraph><$text bold="true">Bar</$text></paragraph><imageBlock></imageBlock><imageBlock></imageBlock>
73
+ * ```
74
+ *
75
+ * @param schema Model's schema.
76
+ * @param widgetElement The widget model element.
77
+ * @internal
78
+ */
79
+ export declare function getCopyOnEnterTextAttributesBeforeWidgets(schema: ModelSchema, widgetElement: ModelElement): Array<[string, unknown]>;