@ckeditor/ckeditor5-image 41.3.0-alpha.4 → 41.3.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 +2 -2
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -0
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/lang/contexts.json +2 -1
- package/lang/translations/ar.po +4 -0
- package/lang/translations/ast.po +4 -0
- package/lang/translations/az.po +4 -0
- package/lang/translations/bg.po +4 -0
- package/lang/translations/bn.po +4 -0
- package/lang/translations/bs.po +4 -0
- package/lang/translations/ca.po +4 -0
- package/lang/translations/cs.po +4 -0
- package/lang/translations/da.po +4 -0
- package/lang/translations/de-ch.po +4 -0
- package/lang/translations/de.po +4 -0
- package/lang/translations/el.po +4 -0
- package/lang/translations/en-au.po +4 -0
- package/lang/translations/en-gb.po +4 -0
- package/lang/translations/en.po +4 -0
- package/lang/translations/eo.po +4 -0
- package/lang/translations/es-co.po +146 -0
- package/lang/translations/es.po +4 -0
- package/lang/translations/et.po +4 -0
- package/lang/translations/eu.po +4 -0
- package/lang/translations/fa.po +4 -0
- package/lang/translations/fi.po +4 -0
- package/lang/translations/fr.po +4 -0
- package/lang/translations/gl.po +4 -0
- package/lang/translations/he.po +4 -0
- package/lang/translations/hi.po +4 -0
- package/lang/translations/hr.po +4 -0
- package/lang/translations/hu.po +4 -0
- package/lang/translations/id.po +4 -0
- package/lang/translations/it.po +4 -0
- package/lang/translations/ja.po +4 -0
- package/lang/translations/jv.po +4 -0
- package/lang/translations/km.po +4 -0
- package/lang/translations/kn.po +4 -0
- package/lang/translations/ko.po +4 -0
- package/lang/translations/ku.po +4 -0
- package/lang/translations/lt.po +4 -0
- package/lang/translations/lv.po +4 -0
- package/lang/translations/ms.po +4 -0
- package/lang/translations/nb.po +4 -0
- package/lang/translations/ne.po +4 -0
- package/lang/translations/nl.po +4 -0
- package/lang/translations/no.po +4 -0
- package/lang/translations/pl.po +4 -0
- package/lang/translations/pt-br.po +4 -0
- package/lang/translations/pt.po +4 -0
- package/lang/translations/ro.po +4 -0
- package/lang/translations/ru.po +4 -0
- package/lang/translations/si.po +4 -0
- package/lang/translations/sk.po +4 -0
- package/lang/translations/sq.po +4 -0
- package/lang/translations/sr-latn.po +4 -0
- package/lang/translations/sr.po +4 -0
- package/lang/translations/sv.po +4 -0
- package/lang/translations/th.po +4 -0
- package/lang/translations/tk.po +4 -0
- package/lang/translations/tr.po +4 -0
- package/lang/translations/tt.po +4 -0
- package/lang/translations/ug.po +4 -0
- package/lang/translations/uk.po +4 -0
- package/lang/translations/ur.po +4 -0
- package/lang/translations/uz.po +4 -0
- package/lang/translations/vi.po +4 -0
- package/lang/translations/zh-cn.po +4 -0
- package/lang/translations/zh.po +4 -0
- package/package.json +3 -4
- package/src/imageupload/imageuploadui.d.ts +7 -0
- package/src/imageupload/imageuploadui.js +42 -21
- package/dist/content-index.css +0 -105
- package/dist/editor-index.css +0 -120
- package/dist/index.css +0 -502
- package/dist/index.css.map +0 -1
- package/dist/translations/ar.d.ts +0 -8
- package/dist/translations/ar.js +0 -5
- package/dist/translations/ast.d.ts +0 -8
- package/dist/translations/ast.js +0 -5
- package/dist/translations/az.d.ts +0 -8
- package/dist/translations/az.js +0 -5
- package/dist/translations/bg.d.ts +0 -8
- package/dist/translations/bg.js +0 -5
- package/dist/translations/bn.d.ts +0 -8
- package/dist/translations/bn.js +0 -5
- package/dist/translations/bs.d.ts +0 -8
- package/dist/translations/bs.js +0 -5
- package/dist/translations/ca.d.ts +0 -8
- package/dist/translations/ca.js +0 -5
- package/dist/translations/cs.d.ts +0 -8
- package/dist/translations/cs.js +0 -5
- package/dist/translations/da.d.ts +0 -8
- package/dist/translations/da.js +0 -5
- package/dist/translations/de-ch.d.ts +0 -8
- package/dist/translations/de-ch.js +0 -5
- package/dist/translations/de.d.ts +0 -8
- package/dist/translations/de.js +0 -5
- package/dist/translations/el.d.ts +0 -8
- package/dist/translations/el.js +0 -5
- package/dist/translations/en-au.d.ts +0 -8
- package/dist/translations/en-au.js +0 -5
- package/dist/translations/en-gb.d.ts +0 -8
- package/dist/translations/en-gb.js +0 -5
- package/dist/translations/en.d.ts +0 -8
- package/dist/translations/en.js +0 -5
- package/dist/translations/eo.d.ts +0 -8
- package/dist/translations/eo.js +0 -5
- package/dist/translations/es.d.ts +0 -8
- package/dist/translations/es.js +0 -5
- package/dist/translations/et.d.ts +0 -8
- package/dist/translations/et.js +0 -5
- package/dist/translations/eu.d.ts +0 -8
- package/dist/translations/eu.js +0 -5
- package/dist/translations/fa.d.ts +0 -8
- package/dist/translations/fa.js +0 -5
- package/dist/translations/fi.d.ts +0 -8
- package/dist/translations/fi.js +0 -5
- package/dist/translations/fr.d.ts +0 -8
- package/dist/translations/fr.js +0 -5
- package/dist/translations/gl.d.ts +0 -8
- package/dist/translations/gl.js +0 -5
- package/dist/translations/he.d.ts +0 -8
- package/dist/translations/he.js +0 -5
- package/dist/translations/hi.d.ts +0 -8
- package/dist/translations/hi.js +0 -5
- package/dist/translations/hr.d.ts +0 -8
- package/dist/translations/hr.js +0 -5
- package/dist/translations/hu.d.ts +0 -8
- package/dist/translations/hu.js +0 -5
- package/dist/translations/id.d.ts +0 -8
- package/dist/translations/id.js +0 -5
- package/dist/translations/it.d.ts +0 -8
- package/dist/translations/it.js +0 -5
- package/dist/translations/ja.d.ts +0 -8
- package/dist/translations/ja.js +0 -5
- package/dist/translations/jv.d.ts +0 -8
- package/dist/translations/jv.js +0 -5
- package/dist/translations/km.d.ts +0 -8
- package/dist/translations/km.js +0 -5
- package/dist/translations/kn.d.ts +0 -8
- package/dist/translations/kn.js +0 -5
- package/dist/translations/ko.d.ts +0 -8
- package/dist/translations/ko.js +0 -5
- package/dist/translations/ku.d.ts +0 -8
- package/dist/translations/ku.js +0 -5
- package/dist/translations/lt.d.ts +0 -8
- package/dist/translations/lt.js +0 -5
- package/dist/translations/lv.d.ts +0 -8
- package/dist/translations/lv.js +0 -5
- package/dist/translations/ms.d.ts +0 -8
- package/dist/translations/ms.js +0 -5
- package/dist/translations/nb.d.ts +0 -8
- package/dist/translations/nb.js +0 -5
- package/dist/translations/ne.d.ts +0 -8
- package/dist/translations/ne.js +0 -5
- package/dist/translations/nl.d.ts +0 -8
- package/dist/translations/nl.js +0 -5
- package/dist/translations/no.d.ts +0 -8
- package/dist/translations/no.js +0 -5
- package/dist/translations/pl.d.ts +0 -8
- package/dist/translations/pl.js +0 -5
- package/dist/translations/pt-br.d.ts +0 -8
- package/dist/translations/pt-br.js +0 -5
- package/dist/translations/pt.d.ts +0 -8
- package/dist/translations/pt.js +0 -5
- package/dist/translations/ro.d.ts +0 -8
- package/dist/translations/ro.js +0 -5
- package/dist/translations/ru.d.ts +0 -8
- package/dist/translations/ru.js +0 -5
- package/dist/translations/si.d.ts +0 -8
- package/dist/translations/si.js +0 -5
- package/dist/translations/sk.d.ts +0 -8
- package/dist/translations/sk.js +0 -5
- package/dist/translations/sq.d.ts +0 -8
- package/dist/translations/sq.js +0 -5
- package/dist/translations/sr-latn.d.ts +0 -8
- package/dist/translations/sr-latn.js +0 -5
- package/dist/translations/sr.d.ts +0 -8
- package/dist/translations/sr.js +0 -5
- package/dist/translations/sv.d.ts +0 -8
- package/dist/translations/sv.js +0 -5
- package/dist/translations/th.d.ts +0 -8
- package/dist/translations/th.js +0 -5
- package/dist/translations/tk.d.ts +0 -8
- package/dist/translations/tk.js +0 -5
- package/dist/translations/tr.d.ts +0 -8
- package/dist/translations/tr.js +0 -5
- package/dist/translations/tt.d.ts +0 -8
- package/dist/translations/tt.js +0 -5
- package/dist/translations/ug.d.ts +0 -8
- package/dist/translations/ug.js +0 -5
- package/dist/translations/uk.d.ts +0 -8
- package/dist/translations/uk.js +0 -5
- package/dist/translations/ur.d.ts +0 -8
- package/dist/translations/ur.js +0 -5
- package/dist/translations/uz.d.ts +0 -8
- package/dist/translations/uz.js +0 -5
- package/dist/translations/vi.d.ts +0 -8
- package/dist/translations/vi.js +0 -5
- package/dist/translations/zh-cn.d.ts +0 -8
- package/dist/translations/zh-cn.js +0 -5
- package/dist/translations/zh.d.ts +0 -8
- package/dist/translations/zh.js +0 -5
- package/dist/types/augmentation.d.ts +0 -60
- package/dist/types/autoimage.d.ts +0 -56
- package/dist/types/image/converters.d.ts +0 -70
- package/dist/types/image/imageblockediting.d.ts +0 -63
- package/dist/types/image/imageediting.d.ts +0 -34
- package/dist/types/image/imageinlineediting.d.ts +0 -64
- package/dist/types/image/imageloadobserver.d.ts +0 -52
- package/dist/types/image/imageplaceholder.d.ts +0 -43
- package/dist/types/image/imagetypecommand.d.ts +0 -48
- package/dist/types/image/insertimagecommand.d.ts +0 -70
- package/dist/types/image/replaceimagesourcecommand.d.ts +0 -55
- package/dist/types/image/ui/utils.d.ts +0 -29
- package/dist/types/image/utils.d.ts +0 -68
- package/dist/types/image.d.ts +0 -38
- package/dist/types/imageblock.d.ts +0 -38
- package/dist/types/imagecaption/imagecaptionediting.d.ts +0 -93
- package/dist/types/imagecaption/imagecaptionui.d.ts +0 -30
- package/dist/types/imagecaption/imagecaptionutils.d.ts +0 -42
- package/dist/types/imagecaption/toggleimagecaptioncommand.d.ts +0 -70
- package/dist/types/imagecaption.d.ts +0 -30
- package/dist/types/imageconfig.d.ts +0 -716
- package/dist/types/imageinline.d.ts +0 -38
- package/dist/types/imageinsert/imageinsertui.d.ts +0 -78
- package/dist/types/imageinsert/imageinsertviaurlui.d.ts +0 -48
- package/dist/types/imageinsert/ui/imageinsertformview.d.ts +0 -60
- package/dist/types/imageinsert/ui/imageinserturlview.d.ts +0 -111
- package/dist/types/imageinsert.d.ts +0 -37
- package/dist/types/imageinsertviaurl.d.ts +0 -35
- package/dist/types/imageresize/imageresizebuttons.d.ts +0 -71
- package/dist/types/imageresize/imageresizeediting.d.ts +0 -45
- package/dist/types/imageresize/imageresizehandles.d.ts +0 -35
- package/dist/types/imageresize/resizeimagecommand.d.ts +0 -46
- package/dist/types/imageresize.d.ts +0 -31
- package/dist/types/imagesizeattributes.d.ts +0 -38
- package/dist/types/imagestyle/converters.d.ts +0 -28
- package/dist/types/imagestyle/imagestylecommand.d.ts +0 -72
- package/dist/types/imagestyle/imagestyleediting.d.ts +0 -54
- package/dist/types/imagestyle/imagestyleui.d.ts +0 -60
- package/dist/types/imagestyle/utils.d.ts +0 -105
- package/dist/types/imagestyle.d.ts +0 -36
- package/dist/types/imagetextalternative/imagetextalternativecommand.d.ts +0 -38
- package/dist/types/imagetextalternative/imagetextalternativeediting.d.ts +0 -32
- package/dist/types/imagetextalternative/imagetextalternativeui.d.ts +0 -72
- package/dist/types/imagetextalternative/ui/textalternativeformview.d.ts +0 -94
- package/dist/types/imagetextalternative.d.ts +0 -33
- package/dist/types/imagetoolbar.d.ts +0 -39
- package/dist/types/imageupload/imageuploadediting.d.ts +0 -115
- package/dist/types/imageupload/imageuploadprogress.d.ts +0 -46
- package/dist/types/imageupload/imageuploadui.d.ts +0 -27
- package/dist/types/imageupload/uploadimagecommand.d.ts +0 -64
- package/dist/types/imageupload/utils.d.ts +0 -37
- package/dist/types/imageupload.d.ts +0 -36
- package/dist/types/imageutils.d.ts +0 -129
- package/dist/types/index.d.ts +0 -52
- package/dist/types/pictureediting.d.ts +0 -92
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image/imageupload/imageuploadediting
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
13
|
-
import { type Element, type Writer, type DataTransfer } from 'ckeditor5/src/engine.js';
|
|
14
|
-
import { Notification } from 'ckeditor5/src/ui.js';
|
|
15
|
-
import { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';
|
|
16
|
-
import { FileRepository, type UploadResponse, type FileLoader } from 'ckeditor5/src/upload.js';
|
|
17
|
-
import ImageUtils from '../imageutils.js';
|
|
18
|
-
/**
|
|
19
|
-
* The editing part of the image upload feature. It registers the `'uploadImage'` command
|
|
20
|
-
* and the `imageUpload` command as an aliased name.
|
|
21
|
-
*
|
|
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~Element image element}.
|
|
24
|
-
*/
|
|
25
|
-
export default class ImageUploadEditing extends Plugin {
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get requires(): readonly [typeof FileRepository, typeof Notification, typeof ClipboardPipeline, typeof ImageUtils];
|
|
30
|
-
static get pluginName(): "ImageUploadEditing";
|
|
31
|
-
/**
|
|
32
|
-
* An internal mapping of {@link module:upload/filerepository~FileLoader#id file loader UIDs} and
|
|
33
|
-
* model elements during the upload.
|
|
34
|
-
*
|
|
35
|
-
* Model element of the uploaded image can change, for instance, when {@link module:image/image/imagetypecommand~ImageTypeCommand}
|
|
36
|
-
* is executed as a result of adding caption or changing image style. As a result, the upload logic must keep track of the model
|
|
37
|
-
* element (reference) and resolve the upload for the correct model element (instead of the one that landed in the `$graveyard`
|
|
38
|
-
* after image type changed).
|
|
39
|
-
*/
|
|
40
|
-
private readonly _uploadImageElements;
|
|
41
|
-
/**
|
|
42
|
-
* @inheritDoc
|
|
43
|
-
*/
|
|
44
|
-
constructor(editor: Editor);
|
|
45
|
-
/**
|
|
46
|
-
* @inheritDoc
|
|
47
|
-
*/
|
|
48
|
-
init(): void;
|
|
49
|
-
/**
|
|
50
|
-
* @inheritDoc
|
|
51
|
-
*/
|
|
52
|
-
afterInit(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Reads and uploads an image.
|
|
55
|
-
*
|
|
56
|
-
* The image is read from the disk and as a Base64-encoded string it is set temporarily to
|
|
57
|
-
* `image[src]`. When the image is successfully uploaded, the temporary data is replaced with the target
|
|
58
|
-
* image's URL (the URL to the uploaded image on the server).
|
|
59
|
-
*/
|
|
60
|
-
protected _readAndUpload(loader: FileLoader): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Creates the `srcset` attribute based on a given file upload response and sets it as an attribute to a specific image element.
|
|
63
|
-
*
|
|
64
|
-
* @param data Data object from which `srcset` will be created.
|
|
65
|
-
* @param image The image element on which the `srcset` attribute will be set.
|
|
66
|
-
*/
|
|
67
|
-
protected _parseAndSetSrcsetAttributeOnImage(data: Record<string, unknown>, image: Element, writer: Writer): void;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Returns `true` if non-empty `text/html` is included in the data transfer.
|
|
71
|
-
*/
|
|
72
|
-
export declare function isHtmlIncluded(dataTransfer: DataTransfer): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* An event fired when an image is uploaded. You can hook into this event to provide
|
|
75
|
-
* custom attributes to the {@link module:engine/model/element~Element image element} based on the data from
|
|
76
|
-
* the server.
|
|
77
|
-
*
|
|
78
|
-
* ```ts
|
|
79
|
-
* const imageUploadEditing = editor.plugins.get( 'ImageUploadEditing' );
|
|
80
|
-
*
|
|
81
|
-
* imageUploadEditing.on( 'uploadComplete', ( evt, { data, imageElement } ) => {
|
|
82
|
-
* editor.model.change( writer => {
|
|
83
|
-
* writer.setAttribute( 'someAttribute', 'foo', imageElement );
|
|
84
|
-
* } );
|
|
85
|
-
* } );
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* You can also stop the default handler that sets the `src` and `srcset` attributes
|
|
89
|
-
* if you want to provide custom values for these attributes.
|
|
90
|
-
*
|
|
91
|
-
* ```ts
|
|
92
|
-
* imageUploadEditing.on( 'uploadComplete', ( evt, { data, imageElement } ) => {
|
|
93
|
-
* evt.stop();
|
|
94
|
-
* } );
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* **Note**: This event is fired by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin.
|
|
98
|
-
*
|
|
99
|
-
* @eventName ~ImageUploadEditing#uploadComplete
|
|
100
|
-
* @param data The `uploadComplete` event data.
|
|
101
|
-
*/
|
|
102
|
-
export type ImageUploadCompleteEvent = {
|
|
103
|
-
name: 'uploadComplete';
|
|
104
|
-
args: [data: ImageUploadCompleteData];
|
|
105
|
-
};
|
|
106
|
-
export type ImageUploadCompleteData = {
|
|
107
|
-
/**
|
|
108
|
-
* The data coming from the upload adapter.
|
|
109
|
-
*/
|
|
110
|
-
data: UploadResponse;
|
|
111
|
-
/**
|
|
112
|
-
* The model {@link module:engine/model/element~Element image element} that can be customized.
|
|
113
|
-
*/
|
|
114
|
-
imageElement: Element;
|
|
115
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image/imageupload/imageuploadprogress
|
|
11
|
-
*/
|
|
12
|
-
import { type Editor, Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import '../../theme/imageuploadprogress.css';
|
|
14
|
-
import '../../theme/imageuploadicon.css';
|
|
15
|
-
import '../../theme/imageuploadloader.css';
|
|
16
|
-
/**
|
|
17
|
-
* The image upload progress plugin.
|
|
18
|
-
* It shows a placeholder when the image is read from the disk and a progress bar while the image is uploading.
|
|
19
|
-
*/
|
|
20
|
-
export default class ImageUploadProgress extends Plugin {
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get pluginName(): "ImageUploadProgress";
|
|
25
|
-
/**
|
|
26
|
-
* The image placeholder that is displayed before real image data can be accessed.
|
|
27
|
-
*
|
|
28
|
-
* For the record, this image is a 1x1 px GIF with an aspect ratio set by CSS.
|
|
29
|
-
*/
|
|
30
|
-
private placeholder;
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
constructor(editor: Editor);
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
init(): void;
|
|
39
|
-
/**
|
|
40
|
-
* This method is called each time the image `uploadStatus` attribute is changed.
|
|
41
|
-
*
|
|
42
|
-
* @param evt An object containing information about the fired event.
|
|
43
|
-
* @param data Additional information about the change.
|
|
44
|
-
*/
|
|
45
|
-
private uploadStatusChange;
|
|
46
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
-
/**
|
|
11
|
-
* The image upload button plugin.
|
|
12
|
-
*
|
|
13
|
-
* For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature} documentation.
|
|
14
|
-
*
|
|
15
|
-
* Adds the `'uploadImage'` button to the {@link module:ui/componentfactory~ComponentFactory UI component factory}
|
|
16
|
-
* and also the `imageUpload` button as an alias for backward compatibility.
|
|
17
|
-
*/
|
|
18
|
-
export default class ImageUploadUI extends Plugin {
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
static get pluginName(): "ImageUploadUI";
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
init(): void;
|
|
27
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
10
|
-
import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
11
|
-
/**
|
|
12
|
-
* @module image/imageupload/uploadimagecommand
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* The upload image command.
|
|
16
|
-
*
|
|
17
|
-
* The command is registered by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin as `uploadImage`
|
|
18
|
-
* and it is also available via aliased `imageUpload` name.
|
|
19
|
-
*
|
|
20
|
-
* In order to upload an image at the current selection position
|
|
21
|
-
* (according to the {@link module:widget/utils~findOptimalInsertionRange} algorithm),
|
|
22
|
-
* execute the command and pass the native image file instance:
|
|
23
|
-
*
|
|
24
|
-
* ```ts
|
|
25
|
-
* this.listenTo( editor.editing.view.document, 'clipboardInput', ( evt, data ) => {
|
|
26
|
-
* // Assuming that only images were pasted:
|
|
27
|
-
* const images = Array.from( data.dataTransfer.files );
|
|
28
|
-
*
|
|
29
|
-
* // Upload the first image:
|
|
30
|
-
* editor.execute( 'uploadImage', { file: images[ 0 ] } );
|
|
31
|
-
* } );
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* It is also possible to insert multiple images at once:
|
|
35
|
-
*
|
|
36
|
-
* ```ts
|
|
37
|
-
* editor.execute( 'uploadImage', {
|
|
38
|
-
* file: [
|
|
39
|
-
* file1,
|
|
40
|
-
* file2
|
|
41
|
-
* ]
|
|
42
|
-
* } );
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export default class UploadImageCommand extends Command {
|
|
46
|
-
/**
|
|
47
|
-
* @inheritDoc
|
|
48
|
-
*/
|
|
49
|
-
refresh(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Executes the command.
|
|
52
|
-
*
|
|
53
|
-
* @fires execute
|
|
54
|
-
* @param options Options for the executed command.
|
|
55
|
-
* @param options.file The image file or an array of image files to upload.
|
|
56
|
-
*/
|
|
57
|
-
execute(options: {
|
|
58
|
-
file: ArrayOrItem<File>;
|
|
59
|
-
}): void;
|
|
60
|
-
/**
|
|
61
|
-
* Handles uploading single file.
|
|
62
|
-
*/
|
|
63
|
-
private _uploadImage;
|
|
64
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image/imageupload/utils
|
|
11
|
-
*/
|
|
12
|
-
import type { ViewElement } from 'ckeditor5/src/engine.js';
|
|
13
|
-
import type ImageUtils from '../imageutils.js';
|
|
14
|
-
/**
|
|
15
|
-
* Creates a regular expression used to test for image files.
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* const imageType = createImageTypeRegExp( [ 'png', 'jpeg', 'svg+xml', 'vnd.microsoft.icon' ] );
|
|
19
|
-
*
|
|
20
|
-
* console.log( 'is supported image', imageType.test( file.type ) );
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function createImageTypeRegExp(types: Array<string>): RegExp;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a promise that fetches the image local source (Base64 or blob) and resolves with a `File` object.
|
|
26
|
-
*
|
|
27
|
-
* @param image Image whose source to fetch.
|
|
28
|
-
* @returns A promise which resolves when an image source is fetched and converted to a `File` instance.
|
|
29
|
-
* It resolves with a `File` object. If there were any errors during file processing, the promise will be rejected.
|
|
30
|
-
*/
|
|
31
|
-
export declare function fetchLocalImage(image: ViewElement): Promise<File>;
|
|
32
|
-
/**
|
|
33
|
-
* Checks whether a given node is an image element with a local source (Base64 or blob).
|
|
34
|
-
*
|
|
35
|
-
* @param node The node to check.
|
|
36
|
-
*/
|
|
37
|
-
export declare function isLocalImage(imageUtils: ImageUtils, node: ViewElement): boolean;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image/imageupload
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import ImageUploadUI from './imageupload/imageuploadui.js';
|
|
14
|
-
import ImageUploadProgress from './imageupload/imageuploadprogress.js';
|
|
15
|
-
import ImageUploadEditing from './imageupload/imageuploadediting.js';
|
|
16
|
-
/**
|
|
17
|
-
* The image upload plugin.
|
|
18
|
-
*
|
|
19
|
-
* For a detailed overview, check the {@glink features/images/image-upload/image-upload image upload feature} documentation.
|
|
20
|
-
*
|
|
21
|
-
* This plugin does not do anything directly, but it loads a set of specific plugins to enable image uploading:
|
|
22
|
-
*
|
|
23
|
-
* * {@link module:image/imageupload/imageuploadediting~ImageUploadEditing},
|
|
24
|
-
* * {@link module:image/imageupload/imageuploadui~ImageUploadUI},
|
|
25
|
-
* * {@link module:image/imageupload/imageuploadprogress~ImageUploadProgress}.
|
|
26
|
-
*/
|
|
27
|
-
export default class ImageUpload extends Plugin {
|
|
28
|
-
/**
|
|
29
|
-
* @inheritDoc
|
|
30
|
-
*/
|
|
31
|
-
static get pluginName(): "ImageUpload";
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get requires(): readonly [typeof ImageUploadEditing, typeof ImageUploadUI, typeof ImageUploadProgress];
|
|
36
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image/imageutils
|
|
11
|
-
*/
|
|
12
|
-
import type { Element, ViewElement, DocumentSelection, ViewDocumentSelection, Selection, ViewSelection, DowncastWriter, Position, ViewContainerElement } from 'ckeditor5/src/engine.js';
|
|
13
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
14
|
-
/**
|
|
15
|
-
* A set of helpers related to images.
|
|
16
|
-
*/
|
|
17
|
-
export default class ImageUtils extends Plugin {
|
|
18
|
-
/**
|
|
19
|
-
* DOM Emitter.
|
|
20
|
-
*/
|
|
21
|
-
private _domEmitter;
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
static get pluginName(): "ImageUtils";
|
|
26
|
-
/**
|
|
27
|
-
* Checks if the provided model element is an `image` or `imageInline`.
|
|
28
|
-
*/
|
|
29
|
-
isImage(modelElement?: Element | null): modelElement is Element & {
|
|
30
|
-
name: 'imageInline' | 'imageBlock';
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Checks if the provided view element represents an inline image.
|
|
34
|
-
*
|
|
35
|
-
* Also, see {@link module:image/imageutils~ImageUtils#isImageWidget}.
|
|
36
|
-
*/
|
|
37
|
-
isInlineImageView(element?: ViewElement | null): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Checks if the provided view element represents a block image.
|
|
40
|
-
*
|
|
41
|
-
* Also, see {@link module:image/imageutils~ImageUtils#isImageWidget}.
|
|
42
|
-
*/
|
|
43
|
-
isBlockImageView(element?: ViewElement | null): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Handles inserting single file. This method unifies image insertion using {@link module:widget/utils~findOptimalInsertionRange}
|
|
46
|
-
* method.
|
|
47
|
-
*
|
|
48
|
-
* ```ts
|
|
49
|
-
* const imageUtils = editor.plugins.get( 'ImageUtils' );
|
|
50
|
-
*
|
|
51
|
-
* imageUtils.insertImage( { src: 'path/to/image.jpg' } );
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
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~Schema}.
|
|
56
|
-
* @param selectable Place to insert the image. If not specified,
|
|
57
|
-
* the {@link module:widget/utils~findOptimalInsertionRange} logic will be applied for the block images
|
|
58
|
-
* and `model.document.selection` for the inline images.
|
|
59
|
-
*
|
|
60
|
-
* **Note**: If `selectable` is passed, this helper will not be able to set selection attributes (such as `linkHref`)
|
|
61
|
-
* and apply them to the new image. In this case, make sure all selection attributes are passed in `attributes`.
|
|
62
|
-
*
|
|
63
|
-
* @param imageType Image type of inserted image. If not specified,
|
|
64
|
-
* it will be determined automatically depending of editor config or place of the insertion.
|
|
65
|
-
* @param options.setImageSizes Specifies whether the image `width` and `height` attributes should be set automatically.
|
|
66
|
-
* The default is `true`.
|
|
67
|
-
* @return The inserted model image element.
|
|
68
|
-
*/
|
|
69
|
-
insertImage(attributes?: Record<string, unknown>, selectable?: Selection | Position | null, imageType?: ('imageBlock' | 'imageInline' | null), options?: {
|
|
70
|
-
setImageSizes?: boolean;
|
|
71
|
-
}): Element | null;
|
|
72
|
-
/**
|
|
73
|
-
* Reads original image sizes and sets them as `width` and `height`.
|
|
74
|
-
*
|
|
75
|
-
* The `src` attribute may not be available if the user is using an upload adapter. In such a case,
|
|
76
|
-
* this method is called again after the upload process is complete and the `src` attribute is available.
|
|
77
|
-
*/
|
|
78
|
-
setImageNaturalSizeAttributes(imageElement: Element): void;
|
|
79
|
-
/**
|
|
80
|
-
* Returns an image widget editing view element if one is selected or is among the selection's ancestors.
|
|
81
|
-
*/
|
|
82
|
-
getClosestSelectedImageWidget(selection: ViewSelection | ViewDocumentSelection): ViewElement | null;
|
|
83
|
-
/**
|
|
84
|
-
* Returns a image model element if one is selected or is among the selection's ancestors.
|
|
85
|
-
*/
|
|
86
|
-
getClosestSelectedImageElement(selection: Selection | DocumentSelection): Element | null;
|
|
87
|
-
/**
|
|
88
|
-
* Returns an image widget editing view based on the passed image view.
|
|
89
|
-
*/
|
|
90
|
-
getImageWidgetFromImageView(imageView: ViewElement): ViewContainerElement | null;
|
|
91
|
-
/**
|
|
92
|
-
* Checks if image can be inserted at current model selection.
|
|
93
|
-
*
|
|
94
|
-
* @internal
|
|
95
|
-
*/
|
|
96
|
-
isImageAllowed(): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Converts a given {@link module:engine/view/element~Element} to an image widget:
|
|
99
|
-
* * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to recognize the image widget
|
|
100
|
-
* element.
|
|
101
|
-
* * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
|
|
102
|
-
*
|
|
103
|
-
* @param writer An instance of the view writer.
|
|
104
|
-
* @param label The element's label. It will be concatenated with the image `alt` attribute if one is present.
|
|
105
|
-
*/
|
|
106
|
-
toImageWidget(viewElement: ViewElement, writer: DowncastWriter, label: string): ViewElement;
|
|
107
|
-
/**
|
|
108
|
-
* Checks if a given view element is an image widget.
|
|
109
|
-
*/
|
|
110
|
-
protected isImageWidget(viewElement: ViewElement): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Checks if the provided model element is an `image`.
|
|
113
|
-
*/
|
|
114
|
-
isBlockImage(modelElement?: Element | null): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Checks if the provided model element is an `imageInline`.
|
|
117
|
-
*/
|
|
118
|
-
isInlineImage(modelElement?: Element | null): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Get the view `<img>` from another view element, e.g. a widget (`<figure class="image">`), a link (`<a>`).
|
|
121
|
-
*
|
|
122
|
-
* The `<img>` can be located deep in other elements, so this helper performs a deep tree search.
|
|
123
|
-
*/
|
|
124
|
-
findViewImgElement(figureView: ViewElement): ViewElement | undefined;
|
|
125
|
-
/**
|
|
126
|
-
* @inheritDoc
|
|
127
|
-
*/
|
|
128
|
-
destroy(): void;
|
|
129
|
-
}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image
|
|
11
|
-
*/
|
|
12
|
-
export { default as AutoImage } from './autoimage.js';
|
|
13
|
-
export { default as Image } from './image.js';
|
|
14
|
-
export { default as ImageEditing } from './image/imageediting.js';
|
|
15
|
-
export { default as ImageCaptionUtils } from './imagecaption/imagecaptionutils.js';
|
|
16
|
-
export { default as ImageCaption } from './imagecaption.js';
|
|
17
|
-
export { default as ImageCaptionEditing } from './imagecaption/imagecaptionediting.js';
|
|
18
|
-
export { default as ImageInsert } from './imageinsert.js';
|
|
19
|
-
export { default as ImageInsertUI } from './imageinsert/imageinsertui.js';
|
|
20
|
-
export { default as ImageResize } from './imageresize.js';
|
|
21
|
-
export { default as ImageResizeButtons } from './imageresize/imageresizebuttons.js';
|
|
22
|
-
export { default as ImageResizeEditing } from './imageresize/imageresizeediting.js';
|
|
23
|
-
export { default as ImageResizeHandles } from './imageresize/imageresizehandles.js';
|
|
24
|
-
export { default as ImageSizeAttributes } from './imagesizeattributes.js';
|
|
25
|
-
export { default as ImageStyle } from './imagestyle.js';
|
|
26
|
-
export { default as ImageStyleEditing } from './imagestyle/imagestyleediting.js';
|
|
27
|
-
export { default as ImageStyleUI } from './imagestyle/imagestyleui.js';
|
|
28
|
-
export { default as ImageTextAlternative } from './imagetextalternative.js';
|
|
29
|
-
export { default as ImageTextAlternativeEditing } from './imagetextalternative/imagetextalternativeediting.js';
|
|
30
|
-
export { default as ImageTextAlternativeUI } from './imagetextalternative/imagetextalternativeui.js';
|
|
31
|
-
export { default as ImageToolbar } from './imagetoolbar.js';
|
|
32
|
-
export { default as ImageUpload } from './imageupload.js';
|
|
33
|
-
export { default as ImageUploadEditing, type ImageUploadCompleteEvent } from './imageupload/imageuploadediting.js';
|
|
34
|
-
export { default as ImageUploadProgress } from './imageupload/imageuploadprogress.js';
|
|
35
|
-
export { default as ImageUploadUI } from './imageupload/imageuploadui.js';
|
|
36
|
-
export { default as PictureEditing } from './pictureediting.js';
|
|
37
|
-
export { default as ImageBlock } from './imageblock.js';
|
|
38
|
-
export { default as ImageInline } from './imageinline.js';
|
|
39
|
-
export { default as ImageInsertViaUrl } from './imageinsertviaurl.js';
|
|
40
|
-
export { default as ImageUtils } from './imageutils.js';
|
|
41
|
-
export { default as ImageBlockEditing } from './image/imageblockediting.js';
|
|
42
|
-
export { default as ImageCaptionUI } from './imagecaption/imagecaptionui.js';
|
|
43
|
-
export type { ImageConfig } from './imageconfig.js';
|
|
44
|
-
export type { default as ImageTypeCommand } from './image/imagetypecommand.js';
|
|
45
|
-
export type { default as InsertImageCommand } from './image/insertimagecommand.js';
|
|
46
|
-
export type { default as ReplaceImageSourceCommand } from './image/replaceimagesourcecommand.js';
|
|
47
|
-
export type { default as ToggleImageCaptionCommand } from './imagecaption/toggleimagecaptioncommand.js';
|
|
48
|
-
export type { default as ResizeImageCommand } from './imageresize/resizeimagecommand.js';
|
|
49
|
-
export type { default as ImageStyleCommand } from './imagestyle/imagestylecommand.js';
|
|
50
|
-
export type { default as ImageTextAlternativeCommand } from './imagetextalternative/imagetextalternativecommand.js';
|
|
51
|
-
export type { default as UploadImageCommand } from './imageupload/uploadimagecommand.js';
|
|
52
|
-
import './augmentation.js';
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module image/pictureediting
|
|
11
|
-
*/
|
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import ImageEditing from './image/imageediting.js';
|
|
14
|
-
import ImageUtils from './imageutils.js';
|
|
15
|
-
/**
|
|
16
|
-
* This plugin enables the [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture) element support in the editor.
|
|
17
|
-
*
|
|
18
|
-
* * It enables the `sources` model attribute on `imageBlock` and `imageInline` model elements
|
|
19
|
-
* (brought by {@link module:image/imageblock~ImageBlock} and {@link module:image/imageinline~ImageInline}, respectively).
|
|
20
|
-
* * It translates the `sources` model element to the view (also: data) structure that may look as follows:
|
|
21
|
-
*
|
|
22
|
-
* ```html
|
|
23
|
-
* <p>Inline image using picture:
|
|
24
|
-
* <picture>
|
|
25
|
-
* <source media="(min-width: 800px)" srcset="image-large.webp" type="image/webp">
|
|
26
|
-
* <source media="(max-width: 800px)" srcset="image-small.webp" type="image/webp">
|
|
27
|
-
* <!-- Other sources as specified in the "sources" model attribute... -->
|
|
28
|
-
* <img src="image.png" alt="An image using picture" />
|
|
29
|
-
* </picture>
|
|
30
|
-
* </p>
|
|
31
|
-
*
|
|
32
|
-
* <p>Block image using picture:</p>
|
|
33
|
-
* <figure class="image">
|
|
34
|
-
* <picture>
|
|
35
|
-
* <source media="(min-width: 800px)" srcset="image-large.webp" type="image/webp">
|
|
36
|
-
* <source media="(max-width: 800px)" srcset="image-small.webp" type="image/webp">
|
|
37
|
-
* <!-- Other sources as specified in the "sources" model attribute... -->
|
|
38
|
-
* <img src="image.png" alt="An image using picture" />
|
|
39
|
-
* </picture>
|
|
40
|
-
* <figcaption>Caption of the image</figcaption>
|
|
41
|
-
* </figure>
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* **Note:** The value of the `sources` {@glink framework/architecture/editing-engine#changing-the-model model attribute}
|
|
45
|
-
* in both examples equals:
|
|
46
|
-
*
|
|
47
|
-
* ```css
|
|
48
|
-
* [
|
|
49
|
-
* {
|
|
50
|
-
* media: '(min-width: 800px)',
|
|
51
|
-
* srcset: 'image-large.webp',
|
|
52
|
-
* type: 'image/webp'
|
|
53
|
-
* },
|
|
54
|
-
* {
|
|
55
|
-
* media: '(max-width: 800px)',
|
|
56
|
-
* srcset: 'image-small.webp',
|
|
57
|
-
* type: 'image/webp'
|
|
58
|
-
* }
|
|
59
|
-
* ]
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* * It integrates with the {@link module:image/imageupload~ImageUpload} plugin so images uploaded in the editor
|
|
63
|
-
* automatically render using `<picture>` if the {@glink features/images/image-upload/image-upload upload adapter}
|
|
64
|
-
* supports image sources and provides neccessary data.
|
|
65
|
-
*
|
|
66
|
-
* @private
|
|
67
|
-
*/
|
|
68
|
-
export default class PictureEditing extends Plugin {
|
|
69
|
-
/**
|
|
70
|
-
* @inheritDoc
|
|
71
|
-
*/
|
|
72
|
-
static get requires(): readonly [typeof ImageEditing, typeof ImageUtils];
|
|
73
|
-
/**
|
|
74
|
-
* @inheritDoc
|
|
75
|
-
*/
|
|
76
|
-
static get pluginName(): "PictureEditing";
|
|
77
|
-
/**
|
|
78
|
-
* @inheritDoc
|
|
79
|
-
*/
|
|
80
|
-
afterInit(): void;
|
|
81
|
-
/**
|
|
82
|
-
* Configures conversion pipelines to support upcasting and downcasting images using the `<picture>` view element
|
|
83
|
-
* and the model `sources` attribute.
|
|
84
|
-
*/
|
|
85
|
-
private _setupConversion;
|
|
86
|
-
/**
|
|
87
|
-
* Makes it possible for uploaded images to get the `sources` model attribute and the `<picture>...</picture>`
|
|
88
|
-
* view structure out-of-the-box if relevant data is provided along the
|
|
89
|
-
* {@link module:image/imageupload/imageuploadediting~ImageUploadEditing#event:uploadComplete} event.
|
|
90
|
-
*/
|
|
91
|
-
private _setupImageUploadEditingIntegration;
|
|
92
|
-
}
|