@ckeditor/ckeditor5-image 45.2.1-alpha.9 → 46.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.
- package/build/image.js +1 -1
- package/dist/index-content.css +18 -17
- package/dist/index-editor.css +96 -96
- package/dist/index.css +164 -163
- package/dist/index.css.map +1 -1
- package/dist/index.js +89 -44
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/autoimage.d.ts +2 -2
- package/src/autoimage.js +8 -8
- package/src/image/converters.d.ts +1 -1
- package/src/image/imageblockediting.d.ts +5 -5
- package/src/image/imageblockediting.js +8 -8
- package/src/image/imageediting.d.ts +2 -2
- package/src/image/imageediting.js +5 -5
- package/src/image/imageinlineediting.d.ts +5 -5
- package/src/image/imageinlineediting.js +8 -8
- package/src/image/imageloadobserver.d.ts +7 -7
- package/src/image/imageloadobserver.js +6 -6
- package/src/image/imageplaceholder.d.ts +2 -2
- package/src/image/imageplaceholder.js +3 -3
- package/src/image/imagetypecommand.d.ts +4 -4
- package/src/image/imagetypecommand.js +1 -1
- package/src/image/insertimagecommand.d.ts +1 -1
- package/src/image/insertimagecommand.js +1 -1
- package/src/image/replaceimagesourcecommand.d.ts +3 -3
- package/src/image/replaceimagesourcecommand.js +1 -1
- package/src/image/ui/utils.d.ts +4 -2
- package/src/image/ui/utils.js +2 -0
- package/src/image/utils.d.ts +8 -4
- package/src/image/utils.js +4 -0
- package/src/image.d.ts +3 -3
- package/src/image.js +3 -3
- package/src/imageblock.d.ts +4 -4
- package/src/imageblock.js +4 -4
- package/src/imagecaption/imagecaptionediting.d.ts +8 -8
- package/src/imagecaption/imagecaptionediting.js +9 -9
- package/src/imagecaption/imagecaptionui.d.ts +2 -2
- package/src/imagecaption/imagecaptionui.js +2 -2
- package/src/imagecaption/imagecaptionutils.d.ts +5 -5
- package/src/imagecaption/imagecaptionutils.js +2 -2
- package/src/imagecaption/toggleimagecaptioncommand.d.ts +1 -1
- package/src/imagecaption/toggleimagecaptioncommand.js +2 -2
- package/src/imagecaption.d.ts +3 -3
- package/src/imagecaption.js +3 -3
- package/src/imageinline.d.ts +4 -4
- package/src/imageinline.js +4 -4
- package/src/imageinsert/imageinsertui.d.ts +2 -2
- package/src/imageinsert/imageinsertui.js +3 -3
- package/src/imageinsert/imageinsertviaurlui.d.ts +2 -2
- package/src/imageinsert/imageinsertviaurlui.js +3 -3
- package/src/imageinsert/ui/imageinsertformview.d.ts +3 -1
- package/src/imageinsert/ui/imageinsertformview.js +3 -1
- package/src/imageinsert/ui/imageinserturlview.d.ts +3 -1
- package/src/imageinsert/ui/imageinserturlview.js +3 -1
- package/src/imageinsert.d.ts +4 -4
- package/src/imageinsert.js +4 -4
- package/src/imageinsertviaurl.d.ts +3 -3
- package/src/imageinsertviaurl.js +3 -3
- package/src/imageresize/imagecustomresizeui.d.ts +1 -1
- package/src/imageresize/imagecustomresizeui.js +2 -2
- package/src/imageresize/imageresizebuttons.d.ts +2 -2
- package/src/imageresize/imageresizebuttons.js +5 -5
- package/src/imageresize/imageresizeediting.d.ts +2 -2
- package/src/imageresize/imageresizeediting.js +10 -5
- package/src/imageresize/imageresizehandles.d.ts +2 -2
- package/src/imageresize/imageresizehandles.js +3 -3
- package/src/imageresize/resizeimagecommand.d.ts +1 -1
- package/src/imageresize/resizeimagecommand.js +1 -1
- package/src/imageresize/ui/imagecustomresizeformview.d.ts +5 -1
- package/src/imageresize/ui/imagecustomresizeformview.js +3 -1
- package/src/imageresize/utils/getselectedimageeditornodes.d.ts +3 -2
- package/src/imageresize/utils/getselectedimageeditornodes.js +1 -0
- package/src/imageresize/utils/getselectedimagepossibleresizerange.d.ts +1 -0
- package/src/imageresize/utils/getselectedimagepossibleresizerange.js +1 -0
- package/src/imageresize/utils/getselectedimagewidthinunits.d.ts +1 -0
- package/src/imageresize/utils/getselectedimagewidthinunits.js +1 -0
- package/src/imageresize/utils/tryparsedimensionwithunit.d.ts +2 -0
- package/src/imageresize/utils/tryparsedimensionwithunit.js +2 -0
- package/src/imageresize.d.ts +5 -5
- package/src/imageresize.js +5 -5
- package/src/imagesizeattributes.d.ts +2 -2
- package/src/imagesizeattributes.js +5 -4
- package/src/imagestyle/converters.d.ts +2 -0
- package/src/imagestyle/converters.js +2 -0
- package/src/imagestyle/imagestylecommand.d.ts +3 -3
- package/src/imagestyle/imagestylecommand.js +1 -1
- package/src/imagestyle/imagestyleediting.d.ts +2 -2
- package/src/imagestyle/imagestyleediting.js +8 -7
- package/src/imagestyle/imagestyleui.d.ts +2 -2
- package/src/imagestyle/imagestyleui.js +3 -3
- package/src/imagestyle/utils.d.ts +8 -5
- package/src/imagestyle/utils.js +8 -5
- package/src/imagestyle.d.ts +3 -3
- package/src/imagestyle.js +3 -3
- package/src/imagetextalternative/imagetextalternativecommand.d.ts +1 -1
- package/src/imagetextalternative/imagetextalternativecommand.js +1 -1
- package/src/imagetextalternative/imagetextalternativeediting.d.ts +2 -2
- package/src/imagetextalternative/imagetextalternativeediting.js +3 -3
- package/src/imagetextalternative/imagetextalternativeui.d.ts +1 -1
- package/src/imagetextalternative/imagetextalternativeui.js +2 -2
- package/src/imagetextalternative/ui/textalternativeformview.d.ts +5 -1
- package/src/imagetextalternative/ui/textalternativeformview.js +3 -1
- package/src/imagetextalternative.d.ts +3 -3
- package/src/imagetextalternative.js +3 -3
- package/src/imagetoolbar.d.ts +2 -2
- package/src/imagetoolbar.js +2 -2
- package/src/imageupload/imageuploadediting.d.ts +9 -9
- package/src/imageupload/imageuploadediting.js +8 -8
- package/src/imageupload/imageuploadprogress.d.ts +1 -1
- package/src/imageupload/imageuploadprogress.js +5 -5
- package/src/imageupload/imageuploadui.d.ts +1 -1
- package/src/imageupload/imageuploadui.js +1 -1
- package/src/imageupload/uploadimagecommand.d.ts +1 -1
- package/src/imageupload/uploadimagecommand.js +1 -1
- package/src/imageupload/utils.d.ts +3 -1
- package/src/imageupload/utils.js +2 -0
- package/src/imageupload.d.ts +4 -4
- package/src/imageupload.js +4 -4
- package/src/imageutils.d.ts +13 -13
- package/src/imageutils.js +4 -4
- package/src/index.d.ts +63 -42
- package/src/index.js +58 -32
- package/src/pictureediting.d.ts +3 -3
- package/src/pictureediting.js +3 -3
- package/theme/imagecaption.css +7 -6
- package/theme/imagestyle.css +12 -12
package/src/imagestyle.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module image/imagestyle
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageStyleEditing from './imagestyle/imagestyleediting.js';
|
|
10
|
-
import ImageStyleUI from './imagestyle/imagestyleui.js';
|
|
9
|
+
import { ImageStyleEditing } from './imagestyle/imagestyleediting.js';
|
|
10
|
+
import { ImageStyleUI } from './imagestyle/imagestyleui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The image style plugin.
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@ import ImageStyleUI from './imagestyle/imagestyleui.js';
|
|
|
20
20
|
* It provides a default configuration, which can be extended or overwritten.
|
|
21
21
|
* Read more about the {@link module:image/imageconfig~ImageConfig#styles image styles configuration}.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export declare class ImageStyle extends Plugin {
|
|
24
24
|
/**
|
|
25
25
|
* @inheritDoc
|
|
26
26
|
*/
|
package/src/imagestyle.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module image/imagestyle
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageStyleEditing from './imagestyle/imagestyleediting.js';
|
|
10
|
-
import ImageStyleUI from './imagestyle/imagestyleui.js';
|
|
9
|
+
import { ImageStyleEditing } from './imagestyle/imagestyleediting.js';
|
|
10
|
+
import { ImageStyleUI } from './imagestyle/imagestyleui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The image style plugin.
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@ import ImageStyleUI from './imagestyle/imagestyleui.js';
|
|
|
20
20
|
* It provides a default configuration, which can be extended or overwritten.
|
|
21
21
|
* Read more about the {@link module:image/imageconfig~ImageConfig#styles image styles configuration}.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export class ImageStyle extends Plugin {
|
|
24
24
|
/**
|
|
25
25
|
* @inheritDoc
|
|
26
26
|
*/
|
|
@@ -9,7 +9,7 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* The image text alternative command. It is used to change the `alt` attribute of `<imageBlock>` and `<imageInline>` model elements.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare class ImageTextAlternativeCommand extends Command {
|
|
13
13
|
/**
|
|
14
14
|
* The command value: `false` if there is no `alt` attribute, otherwise the value of the `alt` attribute.
|
|
15
15
|
*
|
|
@@ -9,7 +9,7 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* The image text alternative command. It is used to change the `alt` attribute of `<imageBlock>` and `<imageInline>` model elements.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export class ImageTextAlternativeCommand extends Command {
|
|
13
13
|
/**
|
|
14
14
|
* @inheritDoc
|
|
15
15
|
*/
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @module image/imagetextalternative/imagetextalternativeediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageUtils from '../imageutils.js';
|
|
9
|
+
import { ImageUtils } from '../imageutils.js';
|
|
10
10
|
/**
|
|
11
11
|
* The image text alternative editing plugin.
|
|
12
12
|
*
|
|
13
13
|
* Registers the `'imageTextAlternative'` command.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class ImageTextAlternativeEditing extends Plugin {
|
|
16
16
|
/**
|
|
17
17
|
* @inheritDoc
|
|
18
18
|
*/
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @module image/imagetextalternative/imagetextalternativeediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageTextAlternativeCommand from './imagetextalternativecommand.js';
|
|
10
|
-
import ImageUtils from '../imageutils.js';
|
|
9
|
+
import { ImageTextAlternativeCommand } from './imagetextalternativecommand.js';
|
|
10
|
+
import { ImageUtils } from '../imageutils.js';
|
|
11
11
|
/**
|
|
12
12
|
* The image text alternative editing plugin.
|
|
13
13
|
*
|
|
14
14
|
* Registers the `'imageTextAlternative'` command.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export class ImageTextAlternativeEditing extends Plugin {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -12,7 +12,7 @@ import { ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
|
12
12
|
*
|
|
13
13
|
* The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class ImageTextAlternativeUI extends Plugin {
|
|
16
16
|
/**
|
|
17
17
|
* The contextual balloon plugin instance.
|
|
18
18
|
*/
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ButtonView, ContextualBalloon, clickOutsideHandler, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';
|
|
10
10
|
import { IconTextAlternative } from 'ckeditor5/src/icons.js';
|
|
11
|
-
import TextAlternativeFormView from './ui/textalternativeformview.js';
|
|
11
|
+
import { TextAlternativeFormView } from './ui/textalternativeformview.js';
|
|
12
12
|
import { repositionContextualBalloon, getBalloonPositionData } from '../image/ui/utils.js';
|
|
13
13
|
/**
|
|
14
14
|
* The image text alternative UI plugin.
|
|
15
15
|
*
|
|
16
16
|
* The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class ImageTextAlternativeUI extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* The contextual balloon plugin instance.
|
|
21
21
|
*/
|
|
@@ -12,8 +12,10 @@ import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.c
|
|
|
12
12
|
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
13
13
|
/**
|
|
14
14
|
* The TextAlternativeFormView class.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
15
17
|
*/
|
|
16
|
-
export
|
|
18
|
+
export declare class TextAlternativeFormView extends View {
|
|
17
19
|
/**
|
|
18
20
|
* Tracks information about the DOM focus in the form.
|
|
19
21
|
*/
|
|
@@ -81,6 +83,7 @@ export default class TextAlternativeFormView extends View {
|
|
|
81
83
|
* Fired when the form view is submitted.
|
|
82
84
|
*
|
|
83
85
|
* @eventName ~TextAlternativeFormView#submit
|
|
86
|
+
* @internal
|
|
84
87
|
*/
|
|
85
88
|
export type TextAlternativeFormViewSubmitEvent = {
|
|
86
89
|
name: 'submit';
|
|
@@ -90,6 +93,7 @@ export type TextAlternativeFormViewSubmitEvent = {
|
|
|
90
93
|
* Fired when the form view is canceled.
|
|
91
94
|
*
|
|
92
95
|
* @eventName ~TextAlternativeFormView#cancel
|
|
96
|
+
* @internal
|
|
93
97
|
*/
|
|
94
98
|
export type TextAlternativeFormViewCancelEvent = {
|
|
95
99
|
name: 'cancel';
|
|
@@ -16,8 +16,10 @@ import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.c
|
|
|
16
16
|
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
17
17
|
/**
|
|
18
18
|
* The TextAlternativeFormView class.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
19
21
|
*/
|
|
20
|
-
export
|
|
22
|
+
export class TextAlternativeFormView extends View {
|
|
21
23
|
/**
|
|
22
24
|
* Tracks information about the DOM focus in the form.
|
|
23
25
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module image/imagetextalternative
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageTextAlternativeEditing from './imagetextalternative/imagetextalternativeediting.js';
|
|
10
|
-
import ImageTextAlternativeUI from './imagetextalternative/imagetextalternativeui.js';
|
|
9
|
+
import { ImageTextAlternativeEditing } from './imagetextalternative/imagetextalternativeediting.js';
|
|
10
|
+
import { ImageTextAlternativeUI } from './imagetextalternative/imagetextalternativeui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The image text alternative plugin.
|
|
13
13
|
*
|
|
@@ -17,7 +17,7 @@ import ImageTextAlternativeUI from './imagetextalternative/imagetextalternativeu
|
|
|
17
17
|
* {@link module:image/imagetextalternative/imagetextalternativeediting~ImageTextAlternativeEditing}
|
|
18
18
|
* and {@link module:image/imagetextalternative/imagetextalternativeui~ImageTextAlternativeUI} plugins.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class ImageTextAlternative extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module image/imagetextalternative
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageTextAlternativeEditing from './imagetextalternative/imagetextalternativeediting.js';
|
|
10
|
-
import ImageTextAlternativeUI from './imagetextalternative/imagetextalternativeui.js';
|
|
9
|
+
import { ImageTextAlternativeEditing } from './imagetextalternative/imagetextalternativeediting.js';
|
|
10
|
+
import { ImageTextAlternativeUI } from './imagetextalternative/imagetextalternativeui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The image text alternative plugin.
|
|
13
13
|
*
|
|
@@ -17,7 +17,7 @@ import ImageTextAlternativeUI from './imagetextalternative/imagetextalternativeu
|
|
|
17
17
|
* {@link module:image/imagetextalternative/imagetextalternativeediting~ImageTextAlternativeEditing}
|
|
18
18
|
* and {@link module:image/imagetextalternative/imagetextalternativeui~ImageTextAlternativeUI} plugins.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class ImageTextAlternative extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
package/src/imagetoolbar.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
|
|
10
|
-
import ImageUtils from './imageutils.js';
|
|
10
|
+
import { ImageUtils } from './imageutils.js';
|
|
11
11
|
/**
|
|
12
12
|
* The image toolbar plugin. It creates and manages the image toolbar (the toolbar displayed when an image is selected).
|
|
13
13
|
*
|
|
@@ -19,7 +19,7 @@ import ImageUtils from './imageutils.js';
|
|
|
19
19
|
*
|
|
20
20
|
* The toolbar uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export declare class ImageToolbar extends Plugin {
|
|
23
23
|
/**
|
|
24
24
|
* @inheritDoc
|
|
25
25
|
*/
|
package/src/imagetoolbar.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
|
|
10
|
-
import ImageUtils from './imageutils.js';
|
|
10
|
+
import { ImageUtils } from './imageutils.js';
|
|
11
11
|
import { isObject } from 'es-toolkit/compat';
|
|
12
12
|
/**
|
|
13
13
|
* The image toolbar plugin. It creates and manages the image toolbar (the toolbar displayed when an image is selected).
|
|
@@ -20,7 +20,7 @@ import { isObject } from 'es-toolkit/compat';
|
|
|
20
20
|
*
|
|
21
21
|
* The toolbar uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export class ImageToolbar extends Plugin {
|
|
24
24
|
/**
|
|
25
25
|
* @inheritDoc
|
|
26
26
|
*/
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* @module image/imageupload/imageuploadediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { type
|
|
9
|
+
import { type ModelElement, type ModelWriter, type ViewDataTransfer } from 'ckeditor5/src/engine.js';
|
|
10
10
|
import { Notification } from 'ckeditor5/src/ui.js';
|
|
11
11
|
import { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';
|
|
12
12
|
import { FileRepository, type UploadResponse, type FileLoader } from 'ckeditor5/src/upload.js';
|
|
13
|
-
import ImageUtils from '../imageutils.js';
|
|
13
|
+
import { ImageUtils } from '../imageutils.js';
|
|
14
14
|
/**
|
|
15
15
|
* The editing part of the image upload feature. It registers the `'uploadImage'` command
|
|
16
16
|
* and the `imageUpload` command as an aliased name.
|
|
17
17
|
*
|
|
18
18
|
* When an image is uploaded, it fires the {@link ~ImageUploadEditing#event:uploadComplete `uploadComplete`} event
|
|
19
|
-
* that allows adding custom attributes to the {@link module:engine/model/element~
|
|
19
|
+
* that allows adding custom attributes to the {@link module:engine/model/element~ModelElement image element}.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class ImageUploadEditing extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* @inheritDoc
|
|
24
24
|
*/
|
|
@@ -71,7 +71,7 @@ export default class ImageUploadEditing extends Plugin {
|
|
|
71
71
|
* @param data Data object from which `srcset` will be created.
|
|
72
72
|
* @param image The image element on which the `srcset` attribute will be set.
|
|
73
73
|
*/
|
|
74
|
-
protected _parseAndSetSrcsetAttributeOnImage(data: Record<string, unknown>, image:
|
|
74
|
+
protected _parseAndSetSrcsetAttributeOnImage(data: Record<string, unknown>, image: ModelElement, writer: ModelWriter): void;
|
|
75
75
|
/**
|
|
76
76
|
* Registers image upload converters.
|
|
77
77
|
*
|
|
@@ -82,10 +82,10 @@ export default class ImageUploadEditing extends Plugin {
|
|
|
82
82
|
/**
|
|
83
83
|
* Returns `true` if non-empty `text/html` is included in the data transfer.
|
|
84
84
|
*/
|
|
85
|
-
export declare function
|
|
85
|
+
export declare function isHtmlInDataTransfer(dataTransfer: ViewDataTransfer): boolean;
|
|
86
86
|
/**
|
|
87
87
|
* An event fired when an image is uploaded. You can hook into this event to provide
|
|
88
|
-
* custom attributes to the {@link module:engine/model/element~
|
|
88
|
+
* custom attributes to the {@link module:engine/model/element~ModelElement image element} based on the data from
|
|
89
89
|
* the server.
|
|
90
90
|
*
|
|
91
91
|
* ```ts
|
|
@@ -122,7 +122,7 @@ export type ImageUploadCompleteData = {
|
|
|
122
122
|
*/
|
|
123
123
|
data: UploadResponse;
|
|
124
124
|
/**
|
|
125
|
-
* The model {@link module:engine/model/element~
|
|
125
|
+
* The model {@link module:engine/model/element~ModelElement image element} that can be customized.
|
|
126
126
|
*/
|
|
127
|
-
imageElement:
|
|
127
|
+
imageElement: ModelElement;
|
|
128
128
|
};
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @module image/imageupload/imageuploadediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import {
|
|
9
|
+
import { ViewUpcastWriter } from 'ckeditor5/src/engine.js';
|
|
10
10
|
import { Notification } from 'ckeditor5/src/ui.js';
|
|
11
11
|
import { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';
|
|
12
12
|
import { FileRepository } from 'ckeditor5/src/upload.js';
|
|
13
13
|
import { env } from 'ckeditor5/src/utils.js';
|
|
14
|
-
import ImageUtils from '../imageutils.js';
|
|
15
|
-
import UploadImageCommand from './uploadimagecommand.js';
|
|
14
|
+
import { ImageUtils } from '../imageutils.js';
|
|
15
|
+
import { UploadImageCommand } from './uploadimagecommand.js';
|
|
16
16
|
import { fetchLocalImage, isLocalImage } from '../../src/imageupload/utils.js';
|
|
17
17
|
import { createImageTypeRegExp } from './utils.js';
|
|
18
18
|
/**
|
|
@@ -20,9 +20,9 @@ import { createImageTypeRegExp } from './utils.js';
|
|
|
20
20
|
* and the `imageUpload` command as an aliased name.
|
|
21
21
|
*
|
|
22
22
|
* When an image is uploaded, it fires the {@link ~ImageUploadEditing#event:uploadComplete `uploadComplete`} event
|
|
23
|
-
* that allows adding custom attributes to the {@link module:engine/model/element~
|
|
23
|
+
* that allows adding custom attributes to the {@link module:engine/model/element~ModelElement image element}.
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export class ImageUploadEditing extends Plugin {
|
|
26
26
|
/**
|
|
27
27
|
* @inheritDoc
|
|
28
28
|
*/
|
|
@@ -121,7 +121,7 @@ export default class ImageUploadEditing extends Plugin {
|
|
|
121
121
|
this.listenTo(editor.editing.view.document, 'clipboardInput', (evt, data) => {
|
|
122
122
|
// Skip if non empty HTML data is included.
|
|
123
123
|
// https://github.com/ckeditor/ckeditor5-upload/issues/68
|
|
124
|
-
if (
|
|
124
|
+
if (isHtmlInDataTransfer(data.dataTransfer)) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
const images = Array.from(data.dataTransfer.files).filter(file => {
|
|
@@ -164,7 +164,7 @@ export default class ImageUploadEditing extends Plugin {
|
|
|
164
164
|
if (!fetchableImages.length) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
const writer = new
|
|
167
|
+
const writer = new ViewUpcastWriter(editor.editing.view.document);
|
|
168
168
|
for (const fetchableImage of fetchableImages) {
|
|
169
169
|
// Set attribute marking that the image was processed already.
|
|
170
170
|
writer.setAttribute('uploadProcessed', true, fetchableImage.imageElement);
|
|
@@ -464,7 +464,7 @@ export default class ImageUploadEditing extends Plugin {
|
|
|
464
464
|
/**
|
|
465
465
|
* Returns `true` if non-empty `text/html` is included in the data transfer.
|
|
466
466
|
*/
|
|
467
|
-
export function
|
|
467
|
+
export function isHtmlInDataTransfer(dataTransfer) {
|
|
468
468
|
return Array.from(dataTransfer.types).includes('text/html') && dataTransfer.getData('text/html') !== '';
|
|
469
469
|
}
|
|
470
470
|
function getImagesFromChangeItem(editor, item) {
|
|
@@ -13,7 +13,7 @@ import '../../theme/imageuploadloader.css';
|
|
|
13
13
|
* The image upload progress plugin.
|
|
14
14
|
* It shows a placeholder when the image is read from the disk and a progress bar while the image is uploading.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class ImageUploadProgress extends Plugin {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -14,7 +14,7 @@ import '../../theme/imageuploadloader.css';
|
|
|
14
14
|
* The image upload progress plugin.
|
|
15
15
|
* It shows a placeholder when the image is read from the disk and a progress bar while the image is uploading.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class ImageUploadProgress extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
|
@@ -176,7 +176,7 @@ function _showCompleteIcon(viewFigure, writer, view) {
|
|
|
176
176
|
}, 3000);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
* Create progress bar element using {@link module:engine/view/uielement~
|
|
179
|
+
* Create progress bar element using {@link module:engine/view/uielement~ViewUIElement}.
|
|
180
180
|
*/
|
|
181
181
|
function _createProgressBar(writer) {
|
|
182
182
|
const progressBar = writer.createUIElement('div', { class: 'ck-progress-bar' });
|
|
@@ -184,7 +184,7 @@ function _createProgressBar(writer) {
|
|
|
184
184
|
return progressBar;
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
|
-
* Create placeholder element using {@link module:engine/view/uielement~
|
|
187
|
+
* Create placeholder element using {@link module:engine/view/uielement~ViewUIElement}.
|
|
188
188
|
*/
|
|
189
189
|
function _createPlaceholder(writer) {
|
|
190
190
|
const placeholder = writer.createUIElement('div', { class: 'ck-upload-placeholder-loader' });
|
|
@@ -192,7 +192,7 @@ function _createPlaceholder(writer) {
|
|
|
192
192
|
return placeholder;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
* Returns {@link module:engine/view/uielement~
|
|
195
|
+
* Returns {@link module:engine/view/uielement~ViewUIElement} of given unique property from image figure element.
|
|
196
196
|
* Returns `undefined` if element is not found.
|
|
197
197
|
*/
|
|
198
198
|
function _getUIElement(imageFigure, uniqueProperty) {
|
|
@@ -203,7 +203,7 @@ function _getUIElement(imageFigure, uniqueProperty) {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
|
-
* Removes {@link module:engine/view/uielement~
|
|
206
|
+
* Removes {@link module:engine/view/uielement~ViewUIElement} of given unique property from image figure element.
|
|
207
207
|
*/
|
|
208
208
|
function _removeUIElement(viewFigure, writer, uniqueProperty) {
|
|
209
209
|
const element = _getUIElement(viewFigure, uniqueProperty);
|
|
@@ -19,7 +19,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
19
19
|
* It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are the default components
|
|
20
20
|
* through which image upload is available.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export declare class ImageUploadUI extends Plugin {
|
|
23
23
|
/**
|
|
24
24
|
* @inheritDoc
|
|
25
25
|
*/
|
|
@@ -22,7 +22,7 @@ import { createImageTypeRegExp } from './utils.js';
|
|
|
22
22
|
* It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are the default components
|
|
23
23
|
* through which image upload is available.
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export class ImageUploadUI extends Plugin {
|
|
26
26
|
/**
|
|
27
27
|
* @inheritDoc
|
|
28
28
|
*/
|
|
@@ -38,7 +38,7 @@ import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
|
38
38
|
* } );
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export declare class UploadImageCommand extends Command {
|
|
42
42
|
/**
|
|
43
43
|
* The command property: `false` if there is no permission on image upload, otherwise `true`.
|
|
44
44
|
*
|
|
@@ -39,7 +39,7 @@ import { toArray } from 'ckeditor5/src/utils.js';
|
|
|
39
39
|
* } );
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export class UploadImageCommand extends Command {
|
|
43
43
|
/**
|
|
44
44
|
* Creates an instance of the `imageUlpoad` command. When executed, the command upload one of
|
|
45
45
|
* the currently selected image from computer.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module image/imageupload/utils
|
|
7
7
|
*/
|
|
8
8
|
import type { ViewElement } from 'ckeditor5/src/engine.js';
|
|
9
|
-
import type ImageUtils from '../imageutils.js';
|
|
9
|
+
import { type ImageUtils } from '../imageutils.js';
|
|
10
10
|
/**
|
|
11
11
|
* Creates a regular expression used to test for image files.
|
|
12
12
|
*
|
|
@@ -20,6 +20,7 @@ export declare function createImageTypeRegExp(types: Array<string>): RegExp;
|
|
|
20
20
|
/**
|
|
21
21
|
* Creates a promise that fetches the image local source (Base64 or blob) and resolves with a `File` object.
|
|
22
22
|
*
|
|
23
|
+
* @internal
|
|
23
24
|
* @param image Image whose source to fetch.
|
|
24
25
|
* @returns A promise which resolves when an image source is fetched and converted to a `File` instance.
|
|
25
26
|
* It resolves with a `File` object. If there were any errors during file processing, the promise will be rejected.
|
|
@@ -29,5 +30,6 @@ export declare function fetchLocalImage(image: ViewElement): Promise<File>;
|
|
|
29
30
|
* Checks whether a given node is an image element with a local source (Base64 or blob).
|
|
30
31
|
*
|
|
31
32
|
* @param node The node to check.
|
|
33
|
+
* @internal
|
|
32
34
|
*/
|
|
33
35
|
export declare function isLocalImage(imageUtils: ImageUtils, node: ViewElement): boolean;
|
package/src/imageupload/utils.js
CHANGED
|
@@ -20,6 +20,7 @@ export function createImageTypeRegExp(types) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Creates a promise that fetches the image local source (Base64 or blob) and resolves with a `File` object.
|
|
22
22
|
*
|
|
23
|
+
* @internal
|
|
23
24
|
* @param image Image whose source to fetch.
|
|
24
25
|
* @returns A promise which resolves when an image source is fetched and converted to a `File` instance.
|
|
25
26
|
* It resolves with a `File` object. If there were any errors during file processing, the promise will be rejected.
|
|
@@ -51,6 +52,7 @@ export function fetchLocalImage(image) {
|
|
|
51
52
|
* Checks whether a given node is an image element with a local source (Base64 or blob).
|
|
52
53
|
*
|
|
53
54
|
* @param node The node to check.
|
|
55
|
+
* @internal
|
|
54
56
|
*/
|
|
55
57
|
export function isLocalImage(imageUtils, node) {
|
|
56
58
|
if (!imageUtils.isInlineImageView(node) || !node.getAttribute('src')) {
|
package/src/imageupload.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @module image/imageupload
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageUploadUI from './imageupload/imageuploadui.js';
|
|
10
|
-
import ImageUploadProgress from './imageupload/imageuploadprogress.js';
|
|
11
|
-
import ImageUploadEditing from './imageupload/imageuploadediting.js';
|
|
9
|
+
import { ImageUploadUI } from './imageupload/imageuploadui.js';
|
|
10
|
+
import { ImageUploadProgress } from './imageupload/imageuploadprogress.js';
|
|
11
|
+
import { ImageUploadEditing } from './imageupload/imageuploadediting.js';
|
|
12
12
|
/**
|
|
13
13
|
* The image upload plugin.
|
|
14
14
|
*
|
|
@@ -20,7 +20,7 @@ import ImageUploadEditing from './imageupload/imageuploadediting.js';
|
|
|
20
20
|
* * {@link module:image/imageupload/imageuploadui~ImageUploadUI},
|
|
21
21
|
* * {@link module:image/imageupload/imageuploadprogress~ImageUploadProgress}.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export declare class ImageUpload extends Plugin {
|
|
24
24
|
/**
|
|
25
25
|
* @inheritDoc
|
|
26
26
|
*/
|
package/src/imageupload.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @module image/imageupload
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ImageUploadUI from './imageupload/imageuploadui.js';
|
|
10
|
-
import ImageUploadProgress from './imageupload/imageuploadprogress.js';
|
|
11
|
-
import ImageUploadEditing from './imageupload/imageuploadediting.js';
|
|
9
|
+
import { ImageUploadUI } from './imageupload/imageuploadui.js';
|
|
10
|
+
import { ImageUploadProgress } from './imageupload/imageuploadprogress.js';
|
|
11
|
+
import { ImageUploadEditing } from './imageupload/imageuploadediting.js';
|
|
12
12
|
/**
|
|
13
13
|
* The image upload plugin.
|
|
14
14
|
*
|
|
@@ -20,7 +20,7 @@ import ImageUploadEditing from './imageupload/imageuploadediting.js';
|
|
|
20
20
|
* * {@link module:image/imageupload/imageuploadui~ImageUploadUI},
|
|
21
21
|
* * {@link module:image/imageupload/imageuploadprogress~ImageUploadProgress}.
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export class ImageUpload extends Plugin {
|
|
24
24
|
/**
|
|
25
25
|
* @inheritDoc
|
|
26
26
|
*/
|
package/src/imageutils.d.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module image/imageutils
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ModelElement, ViewElement, ModelDocumentSelection, ViewDocumentSelection, ModelSelection, ViewSelection, ViewDowncastWriter, ModelPosition, ViewContainerElement } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
10
|
/**
|
|
11
11
|
* A set of helpers related to images.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export declare class ImageUtils extends Plugin {
|
|
14
14
|
/**
|
|
15
15
|
* DOM Emitter.
|
|
16
16
|
*/
|
|
@@ -26,7 +26,7 @@ export default class ImageUtils extends Plugin {
|
|
|
26
26
|
/**
|
|
27
27
|
* Checks if the provided model element is an `image` or `imageInline`.
|
|
28
28
|
*/
|
|
29
|
-
isImage(modelElement?:
|
|
29
|
+
isImage(modelElement?: ModelElement | null): modelElement is ModelElement & {
|
|
30
30
|
name: 'imageInline' | 'imageBlock';
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
@@ -52,7 +52,7 @@ export default class ImageUtils extends Plugin {
|
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
54
|
* @param attributes Attributes of the inserted image.
|
|
55
|
-
* This method filters out the attributes which are disallowed by the {@link module:engine/model/schema~
|
|
55
|
+
* This method filters out the attributes which are disallowed by the {@link module:engine/model/schema~ModelSchema}.
|
|
56
56
|
* @param selectable Place to insert the image. If not specified,
|
|
57
57
|
* the {@link module:widget/utils~findOptimalInsertionRange} logic will be applied for the block images
|
|
58
58
|
* and `model.document.selection` for the inline images.
|
|
@@ -66,16 +66,16 @@ export default class ImageUtils extends Plugin {
|
|
|
66
66
|
* The default is `true`.
|
|
67
67
|
* @return The inserted model image element.
|
|
68
68
|
*/
|
|
69
|
-
insertImage(attributes?: Record<string, unknown>, selectable?:
|
|
69
|
+
insertImage(attributes?: Record<string, unknown>, selectable?: ModelSelection | ModelPosition | null, imageType?: ('imageBlock' | 'imageInline' | null), options?: {
|
|
70
70
|
setImageSizes?: boolean;
|
|
71
|
-
}):
|
|
71
|
+
}): ModelElement | null;
|
|
72
72
|
/**
|
|
73
73
|
* Reads original image sizes and sets them as `width` and `height`.
|
|
74
74
|
*
|
|
75
75
|
* The `src` attribute may not be available if the user is using an upload adapter. In such a case,
|
|
76
76
|
* this method is called again after the upload process is complete and the `src` attribute is available.
|
|
77
77
|
*/
|
|
78
|
-
setImageNaturalSizeAttributes(imageElement:
|
|
78
|
+
setImageNaturalSizeAttributes(imageElement: ModelElement): void;
|
|
79
79
|
/**
|
|
80
80
|
* Returns an image widget editing view element if one is selected or is among the selection's ancestors.
|
|
81
81
|
*/
|
|
@@ -83,7 +83,7 @@ export default class ImageUtils extends Plugin {
|
|
|
83
83
|
/**
|
|
84
84
|
* Returns a image model element if one is selected or is among the selection's ancestors.
|
|
85
85
|
*/
|
|
86
|
-
getClosestSelectedImageElement(selection:
|
|
86
|
+
getClosestSelectedImageElement(selection: ModelSelection | ModelDocumentSelection): ModelElement | null;
|
|
87
87
|
/**
|
|
88
88
|
* Returns an image widget editing view based on the passed image view.
|
|
89
89
|
*/
|
|
@@ -95,15 +95,15 @@ export default class ImageUtils extends Plugin {
|
|
|
95
95
|
*/
|
|
96
96
|
isImageAllowed(): boolean;
|
|
97
97
|
/**
|
|
98
|
-
* Converts a given {@link module:engine/view/element~
|
|
99
|
-
* * Adds a {@link module:engine/view/element~
|
|
98
|
+
* Converts a given {@link module:engine/view/element~ViewElement} to an image widget:
|
|
99
|
+
* * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property} allowing to recognize the image widget
|
|
100
100
|
* element.
|
|
101
101
|
* * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
|
|
102
102
|
*
|
|
103
103
|
* @param writer An instance of the view writer.
|
|
104
104
|
* @param label The element's label. It will be concatenated with the image `alt` attribute if one is present.
|
|
105
105
|
*/
|
|
106
|
-
toImageWidget(viewElement: ViewElement, writer:
|
|
106
|
+
toImageWidget(viewElement: ViewElement, writer: ViewDowncastWriter, label: string): ViewElement;
|
|
107
107
|
/**
|
|
108
108
|
* Checks if a given view element is an image widget.
|
|
109
109
|
*/
|
|
@@ -111,11 +111,11 @@ export default class ImageUtils extends Plugin {
|
|
|
111
111
|
/**
|
|
112
112
|
* Checks if the provided model element is an `image`.
|
|
113
113
|
*/
|
|
114
|
-
isBlockImage(modelElement?:
|
|
114
|
+
isBlockImage(modelElement?: ModelElement | null): boolean;
|
|
115
115
|
/**
|
|
116
116
|
* Checks if the provided model element is an `imageInline`.
|
|
117
117
|
*/
|
|
118
|
-
isInlineImage(modelElement?:
|
|
118
|
+
isInlineImage(modelElement?: ModelElement | null): boolean;
|
|
119
119
|
/**
|
|
120
120
|
* Get the view `<img>` from another view element, e.g. a widget (`<figure class="image">`), a link (`<a>`).
|
|
121
121
|
*
|