@ckeditor/ckeditor5-widget 48.2.0 → 48.3.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.
- package/dist/augmentation.d.ts +11 -11
- package/dist/highlightstack.d.ts +65 -64
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +2565 -3052
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +189 -189
- package/dist/verticalnavigation.d.ts +11 -11
- package/dist/widget.d.ts +113 -113
- package/dist/widgetresize/resizer.d.ts +166 -169
- package/dist/widgetresize/resizerstate.d.ts +122 -121
- package/dist/widgetresize/sizeview.d.ts +52 -52
- package/dist/widgetresize.d.ts +121 -121
- package/dist/widgettoolbarrepository.d.ts +96 -96
- package/dist/widgettypearound/utils.d.ts +35 -35
- package/dist/widgettypearound/widgettypearound.d.ts +226 -226
- package/package.json +8 -8
|
@@ -1,101 +1,101 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
import { Plugin, type ToolbarConfigItem } from
|
|
9
|
-
import type { ViewDocumentSelection, ViewElement } from
|
|
10
|
-
import { ContextualBalloon } from
|
|
11
|
-
import { type PositioningFunction } from
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { ModelDocumentSelection, ViewDomConverter, ModelElement, ModelSchema, ModelSelection, ViewElement } from
|
|
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
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export declare function getTypeAroundButtonPosition(domElement: HTMLElement):
|
|
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
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export declare function getTypeAroundFakeCaretPosition(selection: ModelSelection | ModelDocumentSelection):
|
|
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;
|