@ckeditor/ckeditor5-media-embed 48.8.1-alpha.4 → 49.0.0-alpha.1
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/ckeditor5-metadata.json +108 -12
- package/dist/augmentation.d.ts +33 -23
- package/dist/automediaembed.d.ts +50 -50
- package/dist/converters.d.ts +37 -37
- package/dist/index-content.css +54 -6
- package/dist/index-content.css.map +1 -0
- package/dist/index-editor.css +145 -111
- package/dist/index-editor.css.map +1 -0
- package/dist/index.css +179 -101
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +31 -18
- package/dist/index.js +2645 -1087
- package/dist/index.js.map +1 -1
- package/dist/mediaembed.d.ts +32 -33
- package/dist/mediaembedcommand.d.ts +32 -32
- package/dist/mediaembedconfig.d.ts +574 -270
- package/dist/mediaembedediting.d.ts +29 -30
- package/dist/mediaembedresize/constants.d.ts +17 -0
- package/dist/mediaembedresize/mediaembedcustomresizeui.d.ts +64 -0
- package/dist/mediaembedresize/mediaembedresizebuttons.d.ts +54 -0
- package/dist/mediaembedresize/mediaembedresizeediting.d.ts +51 -0
- package/dist/mediaembedresize/mediaembedresizehandles.d.ts +42 -0
- package/dist/mediaembedresize/resizemediaembedcommand.d.ts +40 -0
- package/dist/mediaembedresize/ui/mediaembedcustomresizeformview.d.ts +117 -0
- package/dist/mediaembedresize/utils/getselectedmediaembededitornodes.d.ts +23 -0
- package/dist/mediaembedresize/utils/getselectedmediaembedpossibleresizerange.d.ts +25 -0
- package/dist/mediaembedresize/utils/getselectedmediaembedwidthinunits.d.ts +21 -0
- package/dist/mediaembedresize.d.ts +32 -0
- package/dist/mediaembedstyle/constants.d.ts +29 -0
- package/dist/mediaembedstyle/mediaembedstylecommand.d.ts +72 -0
- package/dist/mediaembedstyle/mediaembedstyleediting.d.ts +43 -0
- package/dist/mediaembedstyle/mediaembedstyleui.d.ts +81 -0
- package/dist/mediaembedstyle/utils.d.ts +23 -0
- package/dist/mediaembedstyle.d.ts +33 -0
- package/dist/mediaembedtoolbar.d.ts +28 -29
- package/dist/mediaembedui.d.ts +33 -33
- package/dist/mediaregistry.d.ts +59 -59
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +5 -3
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +5 -3
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +5 -3
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +5 -3
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +5 -3
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +5 -3
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +5 -3
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +5 -3
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +5 -3
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +5 -3
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +5 -3
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +5 -3
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +5 -3
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +5 -3
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +5 -3
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +5 -3
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +5 -3
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +5 -3
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +5 -3
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +5 -3
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +5 -3
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +5 -3
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +5 -3
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +5 -3
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +5 -3
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +5 -3
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +5 -3
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +5 -3
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +5 -3
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +5 -3
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +5 -3
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +5 -3
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +5 -3
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +5 -3
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +5 -3
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +5 -3
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +5 -3
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +5 -3
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +5 -3
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +5 -3
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +5 -3
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +5 -3
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +5 -3
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +5 -3
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +5 -3
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +5 -3
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +5 -3
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +5 -3
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +5 -3
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +5 -3
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +5 -3
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +5 -3
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +5 -3
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +5 -3
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +5 -3
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +5 -3
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +5 -3
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +5 -3
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +5 -3
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +5 -3
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +5 -3
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +5 -3
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +5 -3
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +5 -3
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +5 -3
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +5 -3
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +5 -3
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +5 -3
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +5 -3
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +5 -3
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +5 -3
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +5 -3
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +5 -3
- package/dist/ui/mediaformview.d.ts +82 -83
- package/dist/utils.d.ts +61 -61
- package/package.json +10 -10
|
@@ -1,35 +1,34 @@
|
|
|
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 Editor } from
|
|
9
|
-
import { MediaRegistry } from
|
|
10
|
-
import '../theme/mediaembedediting.css';
|
|
6
|
+
* @module media-embed/mediaembedediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { MediaRegistry } from "./mediaregistry.js";
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
* The media embed editing feature.
|
|
12
|
+
*/
|
|
14
13
|
export declare class MediaEmbedEditing extends Plugin {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get pluginName(): "MediaEmbedEditing";
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static override get isOfficialPlugin(): true;
|
|
22
|
+
/**
|
|
23
|
+
* The media registry managing the media providers in the editor.
|
|
24
|
+
*/
|
|
25
|
+
registry: MediaRegistry;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
constructor(editor: Editor);
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
init(): void;
|
|
35
34
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/constants
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The view class applied to a resized media embed figure.
|
|
10
|
+
*
|
|
11
|
+
* Shared between the editing plugin (which toggles it via downcast of `resizedWidth` and consumes
|
|
12
|
+
* it on upcast) and the handles plugin (which adds it during drag and strips it on commit), so
|
|
13
|
+
* both layers agree on the exact class name.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const RESIZED_MEDIA_CLASS = "media_resized";
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/mediaembedcustomresizeui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { ContextualBalloon } from "@ckeditor/ckeditor5-ui";
|
|
10
|
+
/**
|
|
11
|
+
* The custom resize media embed UI plugin.
|
|
12
|
+
*
|
|
13
|
+
* The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MediaEmbedCustomResizeUI extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* The contextual balloon plugin instance.
|
|
18
|
+
*/
|
|
19
|
+
private _balloon?;
|
|
20
|
+
/**
|
|
21
|
+
* A form used to set the custom resize width.
|
|
22
|
+
*/
|
|
23
|
+
private _form?;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get requires(): PluginDependenciesOf<[ContextualBalloon]>;
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get pluginName(): "MediaEmbedCustomResizeUI";
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static override get isOfficialPlugin(): true;
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
override destroy(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Creates the {@link module:media-embed/mediaembedresize/ui/mediaembedcustomresizeformview~MediaEmbedCustomResizeFormView} form.
|
|
42
|
+
*/
|
|
43
|
+
private _createForm;
|
|
44
|
+
/**
|
|
45
|
+
* Shows the {@link #_form} in the {@link #_balloon}.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
_showForm(unit: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Removes the {@link #_form} from the {@link #_balloon}.
|
|
52
|
+
*
|
|
53
|
+
* @param focusEditable Controls whether the editing view is focused afterwards.
|
|
54
|
+
*/
|
|
55
|
+
private _hideForm;
|
|
56
|
+
/**
|
|
57
|
+
* Returns `true` when the {@link #_form} is the visible view in the {@link #_balloon}.
|
|
58
|
+
*/
|
|
59
|
+
private get _isVisible();
|
|
60
|
+
/**
|
|
61
|
+
* Returns `true` when the {@link #_form} is in the {@link #_balloon}.
|
|
62
|
+
*/
|
|
63
|
+
private get _isInBalloon();
|
|
64
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/mediaembedresizebuttons
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { MediaEmbedResizeEditing } from "./mediaembedresizeediting.js";
|
|
10
|
+
/**
|
|
11
|
+
* The media embed resize buttons plugin.
|
|
12
|
+
*
|
|
13
|
+
* It adds a possibility to resize media embeds using the toolbar dropdown or individual buttons,
|
|
14
|
+
* depending on the plugin configuration.
|
|
15
|
+
*/
|
|
16
|
+
export declare class MediaEmbedResizeButtons extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get requires(): PluginDependenciesOf<[MediaEmbedResizeEditing]>;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName(): "MediaEmbedResizeButtons";
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static override get isOfficialPlugin(): true;
|
|
29
|
+
private readonly _resizeUnit;
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
constructor(editor: Editor);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
init(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a standalone button component for the given resize option.
|
|
40
|
+
*/
|
|
41
|
+
private _registerMediaEmbedResizeButton;
|
|
42
|
+
/**
|
|
43
|
+
* Creates the dropdown component containing all resize options.
|
|
44
|
+
*/
|
|
45
|
+
private _registerMediaEmbedResizeDropdown;
|
|
46
|
+
/**
|
|
47
|
+
* Returns a label for the given resize option.
|
|
48
|
+
*/
|
|
49
|
+
private _getOptionLabelValue;
|
|
50
|
+
/**
|
|
51
|
+
* Returns list item definitions for the resize dropdown.
|
|
52
|
+
*/
|
|
53
|
+
private _getResizeDropdownListItemDefinitions;
|
|
54
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { Plugin, type Editor, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
6
|
+
import { MediaEmbedEditing } from "../mediaembedediting.js";
|
|
7
|
+
/**
|
|
8
|
+
* The media embed resize editing feature.
|
|
9
|
+
*
|
|
10
|
+
* It adds the ability to resize each media embed using handles.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MediaEmbedResizeEditing extends Plugin {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
static get requires(): PluginDependenciesOf<[MediaEmbedEditing]>;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): "MediaEmbedResizeEditing";
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
static get licenseFeatureCode(): string;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static override get isOfficialPlugin(): true;
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
static override get isPremiumPlugin(): true;
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
constructor(editor: Editor);
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
init(): void;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
afterInit(): void;
|
|
46
|
+
private _registerSchema;
|
|
47
|
+
/**
|
|
48
|
+
* Registers media embed resize converters.
|
|
49
|
+
*/
|
|
50
|
+
private _registerConverters;
|
|
51
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
6
|
+
import { WidgetResize } from "@ckeditor/ckeditor5-widget";
|
|
7
|
+
/**
|
|
8
|
+
* The media embed resize by handles feature.
|
|
9
|
+
*
|
|
10
|
+
* It adds the ability to resize each media embed using handles.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MediaEmbedResizeHandles extends Plugin {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
static get requires(): PluginDependenciesOf<[WidgetResize]>;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get pluginName(): "MediaEmbedResizeHandles";
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static override get isOfficialPlugin(): true;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
init(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Attaches a resizer to every newly inserted media widget. Walks only the ranges
|
|
31
|
+
* reported by the differ — never the whole document — so unrelated inserts (e.g.
|
|
32
|
+
* pressing Enter to create a paragraph) cost only the differ check.
|
|
33
|
+
*
|
|
34
|
+
* Each resizer's `isEnabled` is bound to the plugin in {@link #_attachResizer},
|
|
35
|
+
* so it auto-tracks the resize command's state.
|
|
36
|
+
*/
|
|
37
|
+
private _setupResizerCreator;
|
|
38
|
+
/**
|
|
39
|
+
* Attaches a resizer to a single media widget.
|
|
40
|
+
*/
|
|
41
|
+
private _attachResizer;
|
|
42
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/resizemediaembedcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
/**
|
|
10
|
+
* The resize media embed command.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ResizeMediaEmbedCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* The current width of the selected media embed, or `null` if not resized.
|
|
15
|
+
*/
|
|
16
|
+
value: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
override refresh(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Executes the command.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* // Sets the width as a percentage of the parent width:
|
|
26
|
+
* editor.execute( 'resizeMediaEmbed', { width: '50%' } );
|
|
27
|
+
*
|
|
28
|
+
* // Removes the resize and restores the default width:
|
|
29
|
+
* editor.execute( 'resizeMediaEmbed', { width: null } );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param options
|
|
33
|
+
* @param options.width The new width of the media embed as a CSS `width` value
|
|
34
|
+
* (e.g. `'50%'`), or `null` to remove the resize.
|
|
35
|
+
* @fires execute
|
|
36
|
+
*/
|
|
37
|
+
override execute(options: {
|
|
38
|
+
width: string | null;
|
|
39
|
+
}): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/ui/mediaembedcustomresizeformview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, type FocusableView, type InputNumberView } from "@ckeditor/ckeditor5-ui";
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from "@ckeditor/ckeditor5-utils";
|
|
10
|
+
/**
|
|
11
|
+
* The MediaEmbedCustomResizeFormView class.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare class MediaEmbedCustomResizeFormView extends View {
|
|
16
|
+
/**
|
|
17
|
+
* Tracks information about the DOM focus in the form.
|
|
18
|
+
*/
|
|
19
|
+
readonly focusTracker: FocusTracker;
|
|
20
|
+
/**
|
|
21
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
22
|
+
*/
|
|
23
|
+
readonly keystrokes: KeystrokeHandler;
|
|
24
|
+
/**
|
|
25
|
+
* Resize unit shortcut.
|
|
26
|
+
*/
|
|
27
|
+
readonly unit: string;
|
|
28
|
+
/**
|
|
29
|
+
* The Back button view displayed in the header.
|
|
30
|
+
*/
|
|
31
|
+
backButtonView: ButtonView;
|
|
32
|
+
/**
|
|
33
|
+
* A button used to submit the form.
|
|
34
|
+
*/
|
|
35
|
+
saveButtonView: ButtonView;
|
|
36
|
+
/**
|
|
37
|
+
* An input with a label.
|
|
38
|
+
*/
|
|
39
|
+
labeledInput: LabeledFieldView<InputNumberView>;
|
|
40
|
+
/**
|
|
41
|
+
* A collection of child views.
|
|
42
|
+
*/
|
|
43
|
+
readonly children: ViewCollection;
|
|
44
|
+
/**
|
|
45
|
+
* A collection of views which can be focused in the form.
|
|
46
|
+
*/
|
|
47
|
+
protected readonly _focusables: ViewCollection<FocusableView>;
|
|
48
|
+
/**
|
|
49
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
50
|
+
*/
|
|
51
|
+
protected readonly _focusCycler: FocusCycler;
|
|
52
|
+
/**
|
|
53
|
+
* An array of form validators used by {@link #isValid}.
|
|
54
|
+
*/
|
|
55
|
+
private readonly _validators;
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
constructor(locale: Locale, unit: string, validators: Array<MediaEmbedCustomResizeFormValidatorCallback>);
|
|
60
|
+
/**
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
63
|
+
override render(): void;
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
override destroy(): void;
|
|
68
|
+
private _createBackButton;
|
|
69
|
+
private _createSaveButton;
|
|
70
|
+
private _createHeaderView;
|
|
71
|
+
private _createLabeledInputView;
|
|
72
|
+
/**
|
|
73
|
+
* Validates the form and returns `false` when some fields are invalid.
|
|
74
|
+
*/
|
|
75
|
+
isValid(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Cleans up error and information text of {@link #labeledInput}.
|
|
78
|
+
*/
|
|
79
|
+
resetFormStatus(): void;
|
|
80
|
+
/**
|
|
81
|
+
* The native DOM `value` of the input element of {@link #labeledInput}.
|
|
82
|
+
*/
|
|
83
|
+
get rawSize(): string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Get numeric value of size. Returns `null` if value is not a number.
|
|
86
|
+
*/
|
|
87
|
+
get parsedSize(): number | null;
|
|
88
|
+
/**
|
|
89
|
+
* Returns serialized media embed input size with unit.
|
|
90
|
+
* Returns `null` if value is not a number.
|
|
91
|
+
*/
|
|
92
|
+
get sizeWithUnits(): string | null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Callback used by {@link ~MediaEmbedCustomResizeFormView} to check if passed form value is valid.
|
|
96
|
+
*
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
export type MediaEmbedCustomResizeFormValidatorCallback = (form: MediaEmbedCustomResizeFormView) => string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Fired when the form view is submitted.
|
|
102
|
+
*
|
|
103
|
+
* @eventName ~MediaEmbedCustomResizeFormView#submit
|
|
104
|
+
*/
|
|
105
|
+
export type MediaEmbedCustomResizeFormViewSubmitEvent = {
|
|
106
|
+
name: "submit";
|
|
107
|
+
args: [];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Fired when the form view is canceled.
|
|
111
|
+
*
|
|
112
|
+
* @eventName ~MediaEmbedCustomResizeFormView#cancel
|
|
113
|
+
*/
|
|
114
|
+
export type MediaEmbedCustomResizeFormViewCancelEvent = {
|
|
115
|
+
name: "cancel";
|
|
116
|
+
args: [];
|
|
117
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/utils/getselectedmediaembededitornodes
|
|
7
|
+
*/
|
|
8
|
+
import type { ViewElement, ModelElement } from "@ckeditor/ckeditor5-engine";
|
|
9
|
+
import type { Editor } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
/**
|
|
11
|
+
* Finds model, view and DOM element for selected media embed element.
|
|
12
|
+
* Returns `null` if there is no media embed selected.
|
|
13
|
+
*
|
|
14
|
+
* @param editor Editor instance.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSelectedMediaEmbedEditorNodes(editor: Editor): MediaEmbedEditorNodes | null;
|
|
18
|
+
type MediaEmbedEditorNodes = {
|
|
19
|
+
model: ModelElement;
|
|
20
|
+
view: ViewElement;
|
|
21
|
+
dom: HTMLElement;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/utils/getselectedmediaembedpossibleresizerange
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
/**
|
|
10
|
+
* Returns the min and max resize values for the selected media embed in the specified unit.
|
|
11
|
+
*
|
|
12
|
+
* @param editor Editor instance.
|
|
13
|
+
* @param targetUnit Unit in which dimension will be returned.
|
|
14
|
+
* @returns Possible resize range in numeric form.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSelectedMediaEmbedPossibleResizeRange(editor: Editor, targetUnit: string): PossibleResizeMediaEmbedRange | null;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export type PossibleResizeMediaEmbedRange = {
|
|
22
|
+
unit: string;
|
|
23
|
+
lower: number;
|
|
24
|
+
upper: number;
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize/utils/getselectedmediaembedwidthinunits
|
|
7
|
+
*/
|
|
8
|
+
import { type _DimensionWithUnit } from "@ckeditor/ckeditor5-utils";
|
|
9
|
+
import type { Editor } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
/**
|
|
11
|
+
* Returns media embed width in specified units after resize.
|
|
12
|
+
*
|
|
13
|
+
* * If no media embed is selected or command is disabled, `null` will be returned.
|
|
14
|
+
* * If `targetUnit` percentage is passed then it will return width percentage relative to its ancestor.
|
|
15
|
+
*
|
|
16
|
+
* @param editor Editor instance.
|
|
17
|
+
* @param targetUnit Unit in which dimension will be returned.
|
|
18
|
+
* @returns Parsed media embed width after resize (with unit).
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSelectedMediaEmbedWidthInUnits(editor: Editor, targetUnit: string): _DimensionWithUnit | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedresize
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { MediaEmbedResizeEditing } from "./mediaembedresize/mediaembedresizeediting.js";
|
|
10
|
+
import { MediaEmbedResizeHandles } from "./mediaembedresize/mediaembedresizehandles.js";
|
|
11
|
+
import { MediaEmbedResizeButtons } from "./mediaembedresize/mediaembedresizebuttons.js";
|
|
12
|
+
import { MediaEmbedCustomResizeUI } from "./mediaembedresize/mediaembedcustomresizeui.js";
|
|
13
|
+
/**
|
|
14
|
+
* The media embed resize plugin.
|
|
15
|
+
*
|
|
16
|
+
* It adds a possibility to resize each media embed using handles, toolbar buttons,
|
|
17
|
+
* or a balloon-hosted custom-width input.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MediaEmbedResize extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires(): PluginDependenciesOf<[MediaEmbedResizeEditing, MediaEmbedResizeHandles, MediaEmbedCustomResizeUI, MediaEmbedResizeButtons]>;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName(): "MediaEmbedResize";
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static override get isOfficialPlugin(): true;
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { MediaStyleDropdownDefinition, NormalizedMediaStyleOption } from "../mediaembedconfig.js";
|
|
6
|
+
/**
|
|
7
|
+
* Built-in style options provided by the plugin. Integrators can refer to these by
|
|
8
|
+
* name in {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`}
|
|
9
|
+
* to opt out, override individual fields, or coexist with custom styles.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_OPTIONS: Record<string, NormalizedMediaStyleOption>;
|
|
14
|
+
/**
|
|
15
|
+
* Short icon-name aliases that can be used as the `icon` value in a media style
|
|
16
|
+
* option definition. Matches the alias set exposed by the image styles feature so
|
|
17
|
+
* the two APIs feel symmetrical.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_ICONS: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Built-in dropdown groupings. Each entry references built-in style component names. If any
|
|
24
|
+
* items are filtered out by configuration, the dropdown is rebuilt from the remaining names
|
|
25
|
+
* (or skipped entirely if fewer than two remain).
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_DROPDOWN_DEFINITIONS: Array<MediaStyleDropdownDefinition>;
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @module media-embed/mediaembedstyle/mediaembedstylecommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command, type Editor } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import type { NormalizedMediaStyleOption } from "../mediaembedconfig.js";
|
|
10
|
+
/**
|
|
11
|
+
* The media embed style command. It is used to apply a style option (e.g. an alignment) to a
|
|
12
|
+
* selected media embed.
|
|
13
|
+
*
|
|
14
|
+
* The set of accepted style values comes from the resolved
|
|
15
|
+
* {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`}
|
|
16
|
+
* options. Values not in that set are silently rejected by {@link #execute}.
|
|
17
|
+
*/
|
|
18
|
+
export declare class MediaEmbedStyleCommand extends Command {
|
|
19
|
+
/**
|
|
20
|
+
* The currently-applied style name. `false` when no style applies — either no media is
|
|
21
|
+
* selected, or the selected media has no `mediaStyle` attribute and no style in
|
|
22
|
+
* {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`}
|
|
23
|
+
* is marked `isDefault: true`.
|
|
24
|
+
*/
|
|
25
|
+
value: string | false;
|
|
26
|
+
/**
|
|
27
|
+
* Resolved styles indexed by `name`. Used to look up the `isDefault` flag at execute time
|
|
28
|
+
* (any default-marked style clears the attribute) and to validate that a requested style
|
|
29
|
+
* is part of the resolved options list.
|
|
30
|
+
*/
|
|
31
|
+
private readonly _styles;
|
|
32
|
+
/**
|
|
33
|
+
* The `name` of the first style with `isDefault: true` in the resolved options, or `null`
|
|
34
|
+
* when the integrator did not designate a default. Exposed via {@link #value} when the
|
|
35
|
+
* selected media has no `mediaStyle` attribute, so the default-state UI button can light up.
|
|
36
|
+
* Does not gate the "clear attribute" branch in {@link #execute} — that uses the per-style
|
|
37
|
+
* `isDefault` flag so multi-default configs behave consistently with the downcast.
|
|
38
|
+
*/
|
|
39
|
+
private readonly _defaultStyleName;
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of the media embed style command.
|
|
42
|
+
*
|
|
43
|
+
* @param editor The editor instance.
|
|
44
|
+
* @param styles The resolved list of style options that this command will accept.
|
|
45
|
+
*/
|
|
46
|
+
constructor(editor: Editor, styles: Array<NormalizedMediaStyleOption>);
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
override refresh(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Executes the command and applies the chosen style to the currently selected media embed.
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* editor.execute( 'mediaStyle', { value: 'alignLeft' } );
|
|
56
|
+
* editor.execute( 'mediaStyle', { value: 'alignCenter' } ); // removes the attribute — alignCenter is the built-in default
|
|
57
|
+
* editor.execute( 'mediaStyle', { value: null } ); // removes the attribute
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* The default style is encoded on the model as the absence of the `mediaStyle` attribute.
|
|
61
|
+
* Passing any `isDefault: true` style name (or `null`) therefore clears the attribute. Values
|
|
62
|
+
* that are neither falsy, an `isDefault` style, nor present in the resolved options list are
|
|
63
|
+
* silently rejected.
|
|
64
|
+
*
|
|
65
|
+
* @param options
|
|
66
|
+
* @param options.value The name of the style to apply, or `null` to clear the alignment.
|
|
67
|
+
* @fires execute
|
|
68
|
+
*/
|
|
69
|
+
override execute(options: {
|
|
70
|
+
value: string | null;
|
|
71
|
+
}): void;
|
|
72
|
+
}
|