@ckeditor/ckeditor5-ckbox 40.0.0 → 40.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +6 -2
- package/build/ckbox.js +2 -2
- package/build/translations/ar.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/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.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/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.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/ko.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/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/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/tr.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/ckeditor5-metadata.json +17 -0
- package/lang/contexts.json +6 -2
- package/lang/translations/ar.po +18 -2
- package/lang/translations/az.po +18 -2
- package/lang/translations/bg.po +18 -2
- package/lang/translations/bn.po +18 -2
- package/lang/translations/ca.po +18 -2
- package/lang/translations/cs.po +18 -2
- package/lang/translations/da.po +18 -2
- package/lang/translations/de.po +18 -2
- package/lang/translations/el.po +18 -2
- package/lang/translations/en-au.po +18 -2
- package/lang/translations/en.po +18 -2
- package/lang/translations/es-co.po +18 -2
- package/lang/translations/es.po +18 -2
- package/lang/translations/et.po +18 -2
- package/lang/translations/fa.po +18 -2
- package/lang/translations/fi.po +18 -2
- package/lang/translations/fr.po +18 -2
- package/lang/translations/gl.po +18 -2
- package/lang/translations/he.po +18 -2
- package/lang/translations/hi.po +18 -2
- package/lang/translations/hr.po +18 -2
- package/lang/translations/hu.po +18 -2
- package/lang/translations/id.po +18 -2
- package/lang/translations/it.po +18 -2
- package/lang/translations/ja.po +18 -2
- package/lang/translations/ko.po +18 -2
- package/lang/translations/lt.po +18 -2
- package/lang/translations/lv.po +18 -2
- package/lang/translations/ms.po +18 -2
- package/lang/translations/nl.po +18 -2
- package/lang/translations/no.po +18 -2
- package/lang/translations/pl.po +18 -2
- package/lang/translations/pt-br.po +18 -2
- package/lang/translations/pt.po +18 -2
- package/lang/translations/ro.po +18 -2
- package/lang/translations/ru.po +18 -2
- package/lang/translations/sk.po +18 -2
- package/lang/translations/sq.po +18 -2
- package/lang/translations/sr-latn.po +18 -2
- package/lang/translations/sr.po +18 -2
- package/lang/translations/sv.po +18 -2
- package/lang/translations/th.po +18 -2
- package/lang/translations/tr.po +18 -2
- package/lang/translations/ug.po +18 -2
- package/lang/translations/uk.po +18 -2
- package/lang/translations/ur.po +18 -2
- package/lang/translations/uz.po +18 -2
- package/lang/translations/vi.po +18 -2
- package/lang/translations/zh-cn.po +18 -2
- package/lang/translations/zh.po +18 -2
- package/package.json +4 -2
- package/src/augmentation.d.ts +32 -22
- package/src/augmentation.js +5 -5
- package/src/ckbox.d.ts +33 -33
- package/src/ckbox.js +37 -37
- package/src/ckboxcommand.d.ts +114 -110
- package/src/ckboxcommand.js +332 -302
- package/src/ckboxconfig.d.ts +325 -283
- package/src/ckboxconfig.js +5 -5
- package/src/ckboxediting.d.ts +45 -52
- package/src/ckboxediting.js +321 -362
- package/src/ckboximageedit/ckboximageeditcommand.d.ts +97 -0
- package/src/ckboximageedit/ckboximageeditcommand.js +298 -0
- package/src/ckboximageedit/ckboximageeditediting.d.ts +28 -0
- package/src/ckboximageedit/ckboximageeditediting.js +36 -0
- package/src/ckboximageedit/ckboximageeditui.d.ts +24 -0
- package/src/ckboximageedit/ckboximageeditui.js +48 -0
- package/src/ckboximageedit/utils.d.ts +10 -0
- package/src/ckboximageedit/utils.js +48 -0
- package/src/ckboximageedit.d.ts +24 -0
- package/src/ckboximageedit.js +28 -0
- package/src/ckboxui.d.ts +21 -21
- package/src/ckboxui.js +74 -47
- package/src/ckboxuploadadapter.d.ts +33 -38
- package/src/ckboxuploadadapter.js +130 -275
- package/src/ckboxutils.d.ts +50 -0
- package/src/ckboxutils.js +183 -0
- package/src/index.d.ts +17 -13
- package/src/index.js +14 -11
- package/src/utils.d.ts +63 -28
- package/src/utils.js +175 -49
- package/theme/ckboximageedit.css +53 -0
- package/theme/icons/ckbox-image-edit.svg +1 -0
- package/build/ckbox.js.map +0 -1
package/src/ckboxcommand.d.ts
CHANGED
@@ -1,110 +1,114 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
import { Command, type Editor } from 'ckeditor5/src/core';
|
6
|
-
import type { CKBoxAssetDefinition } from './ckboxconfig';
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
36
|
-
*
|
37
|
-
*
|
38
|
-
*
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
*
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
*
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
*
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
*
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
* -
|
78
|
-
* -
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
*
|
83
|
-
*/
|
84
|
-
private
|
85
|
-
/**
|
86
|
-
*
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
*
|
91
|
-
*
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
*
|
105
|
-
*
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
6
|
+
import type { CKBoxAssetDefinition, CKBoxAssetImageAttributesDefinition, CKBoxRawAssetDefinition } from './ckboxconfig';
|
7
|
+
/**
|
8
|
+
* The CKBox command. It is used by the {@link module:ckbox/ckboxediting~CKBoxEditing CKBox editing feature} to open the CKBox file manager.
|
9
|
+
* The file manager allows inserting an image or a link to a file into the editor content.
|
10
|
+
*
|
11
|
+
* ```ts
|
12
|
+
* editor.execute( 'ckbox' );
|
13
|
+
* ```
|
14
|
+
*
|
15
|
+
* **Note:** This command uses other features to perform the following tasks:
|
16
|
+
* - To insert images it uses the {@link module:image/image/insertimagecommand~InsertImageCommand 'insertImage'} command from the
|
17
|
+
* {@link module:image/image~Image Image feature}.
|
18
|
+
* - To insert links to other files it uses the {@link module:link/linkcommand~LinkCommand 'link'} command from the
|
19
|
+
* {@link module:link/link~Link Link feature}.
|
20
|
+
*/
|
21
|
+
export default class CKBoxCommand extends Command {
|
22
|
+
value: boolean;
|
23
|
+
/**
|
24
|
+
* A set of all chosen assets. They are stored temporarily and they are automatically removed 1 second after being chosen.
|
25
|
+
* Chosen assets have to be "remembered" for a while to be able to map the given asset with the element inserted into the model.
|
26
|
+
* This association map is then used to set the ID on the model element.
|
27
|
+
*
|
28
|
+
* All chosen assets are automatically removed after the timeout, because (theoretically) it may happen that they will never be
|
29
|
+
* inserted into the model, even if the {@link module:link/linkcommand~LinkCommand `'link'`} command or the
|
30
|
+
* {@link module:image/image/insertimagecommand~InsertImageCommand `'insertImage'`} command is enabled. Such a case may arise when
|
31
|
+
* another plugin blocks the command execution. Then, in order not to keep the chosen (but not inserted) assets forever, we delete
|
32
|
+
* them automatically to prevent memory leakage. The 1 second timeout is enough to insert the asset into the model and extract the
|
33
|
+
* ID from the chosen asset.
|
34
|
+
*
|
35
|
+
* The assets are stored only if
|
36
|
+
* the {@link module:ckbox/ckboxconfig~CKBoxConfig#ignoreDataId `config.ckbox.ignoreDataId`} option is set to `false` (by default).
|
37
|
+
*
|
38
|
+
* @internal
|
39
|
+
*/
|
40
|
+
readonly _chosenAssets: Set<CKBoxAssetDefinition>;
|
41
|
+
/**
|
42
|
+
* The DOM element that acts as a mounting point for the CKBox dialog.
|
43
|
+
*/
|
44
|
+
private _wrapper;
|
45
|
+
/**
|
46
|
+
* @inheritDoc
|
47
|
+
*/
|
48
|
+
constructor(editor: Editor);
|
49
|
+
/**
|
50
|
+
* @inheritDoc
|
51
|
+
*/
|
52
|
+
refresh(): void;
|
53
|
+
/**
|
54
|
+
* @inheritDoc
|
55
|
+
*/
|
56
|
+
execute(): void;
|
57
|
+
/**
|
58
|
+
* Indicates if the CKBox dialog is already opened.
|
59
|
+
*
|
60
|
+
* @protected
|
61
|
+
* @returns {Boolean}
|
62
|
+
*/
|
63
|
+
private _getValue;
|
64
|
+
/**
|
65
|
+
* Checks whether the command can be enabled in the current context.
|
66
|
+
*/
|
67
|
+
private _checkEnabled;
|
68
|
+
/**
|
69
|
+
* Creates the options object for the CKBox dialog.
|
70
|
+
*
|
71
|
+
* @returns The object with properties:
|
72
|
+
* - theme The theme for CKBox dialog.
|
73
|
+
* - language The language for CKBox dialog.
|
74
|
+
* - tokenUrl The token endpoint URL.
|
75
|
+
* - serviceOrigin The base URL of the API service.
|
76
|
+
* - forceDemoLabel Whether to force "Powered by CKBox" link.
|
77
|
+
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
78
|
+
* - assets.onChoose The callback function invoked after choosing the assets.
|
79
|
+
*/
|
80
|
+
private _prepareOptions;
|
81
|
+
/**
|
82
|
+
* Initializes various event listeners for the `ckbox:*` events, because all functionality of the `ckbox` command is event-based.
|
83
|
+
*/
|
84
|
+
private _initListeners;
|
85
|
+
/**
|
86
|
+
* Inserts the asset into the model.
|
87
|
+
*
|
88
|
+
* @param asset The asset to be inserted.
|
89
|
+
* @param isLastAsset Indicates if the current asset is the last one from the chosen set.
|
90
|
+
* @param writer An instance of the model writer.
|
91
|
+
* @param isSingleAsset It's true when only one asset is processed.
|
92
|
+
*/
|
93
|
+
private _insertAsset;
|
94
|
+
/**
|
95
|
+
* Inserts the image by calling the `insertImage` command.
|
96
|
+
*
|
97
|
+
* @param asset The asset to be inserted.
|
98
|
+
*/
|
99
|
+
private _insertImage;
|
100
|
+
/**
|
101
|
+
* Inserts the link to the asset by calling the `link` command.
|
102
|
+
*
|
103
|
+
* @param asset The asset to be inserted.
|
104
|
+
* @param writer An instance of the model writer.
|
105
|
+
* @param isSingleAsset It's true when only one asset is processed.
|
106
|
+
*/
|
107
|
+
private _insertLink;
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* Parses the assets attributes into the internal data format.
|
111
|
+
*
|
112
|
+
* @internal
|
113
|
+
*/
|
114
|
+
export declare function prepareImageAssetAttributes(asset: CKBoxRawAssetDefinition): CKBoxAssetImageAttributesDefinition;
|