@ckeditor/ckeditor5-link 48.2.0-alpha.7 → 48.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/augmentation.d.ts +28 -28
- package/dist/autolink.d.ts +74 -74
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.js +3014 -3524
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +26 -26
- package/dist/linkcommand.d.ts +134 -134
- package/dist/linkconfig.d.ts +313 -313
- package/dist/linkediting.d.ts +88 -88
- package/dist/linkimage.d.ts +26 -26
- package/dist/linkimageediting.d.ts +39 -39
- package/dist/linkimageui.d.ts +41 -41
- package/dist/linkui.d.ts +350 -350
- package/dist/ui/linkbuttonview.d.ts +27 -27
- package/dist/ui/linkformview.d.ts +141 -141
- package/dist/ui/linkpreviewbuttonview.d.ts +27 -27
- package/dist/ui/linkpropertiesview.d.ts +80 -80
- package/dist/ui/linkprovideritemsview.d.ts +106 -106
- package/dist/unlinkcommand.d.ts +26 -26
- package/dist/utils/automaticdecorators.d.ts +54 -54
- package/dist/utils/conflictingdecorators.d.ts +32 -32
- package/dist/utils/manualdecorator.d.ts +59 -62
- package/dist/utils.d.ts +62 -62
- package/package.json +11 -11
package/dist/linkconfig.d.ts
CHANGED
|
@@ -1,326 +1,326 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { ArrayOrItem } from
|
|
6
|
+
* @module link/linkconfig
|
|
7
|
+
*/
|
|
8
|
+
import type { ArrayOrItem } from "@ckeditor/ckeditor5-utils";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
* The configuration of the {@link module:link/link~Link link feature}.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* ClassicEditor
|
|
14
|
+
* .create( {
|
|
15
|
+
* link: ... // Link feature configuration.
|
|
16
|
+
* } )
|
|
17
|
+
* .then( ... )
|
|
18
|
+
* .catch( ... );
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
22
|
+
*/
|
|
23
23
|
export interface LinkConfig {
|
|
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
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
24
|
+
/**
|
|
25
|
+
* When set, the editor will add the given protocol to the link when the user creates a link without one.
|
|
26
|
+
* For example, when the user is creating a link and types `ckeditor.com` in the link form input, during link submission
|
|
27
|
+
* the editor will automatically add the `http://` protocol, so the link will look as follows: `http://ckeditor.com`.
|
|
28
|
+
*
|
|
29
|
+
* The feature also provides email address auto-detection. When you submit `hello@example.com`,
|
|
30
|
+
* the plugin will automatically change it to `mailto:hello@example.com`.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* ClassicEditor
|
|
34
|
+
* .create( {
|
|
35
|
+
* link: {
|
|
36
|
+
* defaultProtocol: 'http://'
|
|
37
|
+
* }
|
|
38
|
+
* } )
|
|
39
|
+
* .then( ... )
|
|
40
|
+
* .catch( ... );
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* **NOTE:** If no configuration is provided, the editor will not auto-fix the links.
|
|
44
|
+
*/
|
|
45
|
+
defaultProtocol?: string;
|
|
46
|
+
/**
|
|
47
|
+
* This is a protocols whitelist that can be used in links, defined as an array of strings.
|
|
48
|
+
* When not set, the editor will use a default list of allowed protocols.
|
|
49
|
+
*
|
|
50
|
+
* **Note:** Use this with caution and at your own risk - adding unsafe protocols like `javascript:`
|
|
51
|
+
* can result in serious security vulnerabilities!
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* ClassicEditor
|
|
55
|
+
* .create( {
|
|
56
|
+
* link: {
|
|
57
|
+
* allowedProtocols: [ 'http', 'https', 'ftp', 'tel', 'mailto', 'ssh' ]
|
|
58
|
+
* }
|
|
59
|
+
* } )
|
|
60
|
+
* .then( ... )
|
|
61
|
+
* .catch( ... );
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
allowedProtocols?: Array<string>;
|
|
66
|
+
/**
|
|
67
|
+
* When set to `true`, the form will accept an empty value in the URL field, creating a link with an empty `href` (`<a href="">`).
|
|
68
|
+
*
|
|
69
|
+
* ```ts
|
|
70
|
+
* ClassicEditor
|
|
71
|
+
* .create( {
|
|
72
|
+
* link: {
|
|
73
|
+
* allowCreatingEmptyLinks: true
|
|
74
|
+
* }
|
|
75
|
+
* } )
|
|
76
|
+
* .then( ... )
|
|
77
|
+
* .catch( ... );
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* **NOTE:** This option only adds form validation. If a link with an empty `href` is loaded into the editor, it will be left as-is.
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
allowCreatingEmptyLinks?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* When set to `true`, the `target="blank"` and `rel="noopener noreferrer"` attributes are automatically added to all external links
|
|
87
|
+
* in the editor. "External links" are all links in the editor content starting with `http`, `https`, or `//`.
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* ClassicEditor
|
|
91
|
+
* .create( {
|
|
92
|
+
* link: {
|
|
93
|
+
* addTargetToExternalLinks: true
|
|
94
|
+
* }
|
|
95
|
+
* } )
|
|
96
|
+
* .then( ... )
|
|
97
|
+
* .catch( ... );
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* Internally, this option activates a predefined {@link module:link/linkconfig~LinkConfig#decorators automatic link decorator}
|
|
101
|
+
* that extends all external links with the `target` and `rel` attributes.
|
|
102
|
+
*
|
|
103
|
+
* **Note**: To control the `target` and `rel` attributes of specific links in the edited content, a dedicated
|
|
104
|
+
* {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} decorator must be defined in the
|
|
105
|
+
* {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} array. In such scenario,
|
|
106
|
+
* the `config.link.addTargetToExternalLinks` option should remain `undefined` or `false` to not interfere with the manual decorator.
|
|
107
|
+
*
|
|
108
|
+
* **Note**: If a manual decorator that handles the `target` attribute is already defined in the
|
|
109
|
+
* {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} array, the automatic decorator
|
|
110
|
+
* will be overridden by the manual decorator, but only when the manual decorator is activated for the given link.
|
|
111
|
+
*
|
|
112
|
+
* It is possible to add other {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic}
|
|
113
|
+
* or {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} link decorators when this option is active.
|
|
114
|
+
*
|
|
115
|
+
* More information about decorators can be found in the {@link module:link/linkconfig~LinkConfig#decorators decorators configuration}
|
|
116
|
+
* reference.
|
|
117
|
+
*
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
addTargetToExternalLinks?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Decorators provide an easy way to configure and manage additional link attributes in the editor content. There are
|
|
123
|
+
* two types of link decorators:
|
|
124
|
+
*
|
|
125
|
+
* * {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition Automatic} – They match links against pre–defined rules and
|
|
126
|
+
* manage their attributes based on the results.
|
|
127
|
+
* * {@link module:link/linkconfig~LinkDecoratorManualDefinition Manual} – They allow users to control link attributes
|
|
128
|
+
* individually, using the editor UI.
|
|
129
|
+
*
|
|
130
|
+
* Link decorators are defined as objects with key-value pairs, where the key is the name provided for a given decorator and the
|
|
131
|
+
* value is the decorator definition.
|
|
132
|
+
*
|
|
133
|
+
* The name of the decorator also corresponds to the {@glink framework/architecture/editing-engine#text-attributes text
|
|
134
|
+
* attribute} in the model. For instance, the `isExternal` decorator below is represented as a `linkIsExternal` attribute in the model.
|
|
135
|
+
*
|
|
136
|
+
* ```ts
|
|
137
|
+
* ClassicEditor
|
|
138
|
+
* .create( {
|
|
139
|
+
* link: {
|
|
140
|
+
* decorators: {
|
|
141
|
+
* isExternal: {
|
|
142
|
+
* mode: 'automatic',
|
|
143
|
+
* callback: url => url.startsWith( 'http://' ),
|
|
144
|
+
* attributes: {
|
|
145
|
+
* target: '_blank',
|
|
146
|
+
* rel: 'noopener noreferrer'
|
|
147
|
+
* }
|
|
148
|
+
* },
|
|
149
|
+
* isDownloadable: {
|
|
150
|
+
* mode: 'manual',
|
|
151
|
+
* label: 'Downloadable',
|
|
152
|
+
* attributes: {
|
|
153
|
+
* download: 'file.png',
|
|
154
|
+
* }
|
|
155
|
+
* },
|
|
156
|
+
* // ...
|
|
157
|
+
* }
|
|
158
|
+
* }
|
|
159
|
+
* } )
|
|
160
|
+
* .then( ... )
|
|
161
|
+
* .catch( ... );
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* To learn more about the configuration syntax, check out the {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic}
|
|
165
|
+
* and {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} decorator option reference.
|
|
166
|
+
*
|
|
167
|
+
* **Warning:** Currently, link decorators work independently of one another and no conflict resolution mechanism exists.
|
|
168
|
+
* For example, configuring the `target` attribute using both an automatic and a manual decorator at the same time could end up with
|
|
169
|
+
* quirky results. The same applies if multiple manual or automatic decorators were defined for the same attribute.
|
|
170
|
+
*
|
|
171
|
+
* **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
|
|
172
|
+
* dedicated for that purpose which can be enabled by turning a single option on. Check out the
|
|
173
|
+
* {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
|
|
174
|
+
* configuration description to learn more.
|
|
175
|
+
*
|
|
176
|
+
* See also the {@glink features/link#custom-link-attributes-decorators link feature guide} for more information.
|
|
177
|
+
*/
|
|
178
|
+
decorators?: Record<string, LinkDecoratorDefinition>;
|
|
179
|
+
/**
|
|
180
|
+
* Items to be placed in the link contextual toolbar.
|
|
181
|
+
*
|
|
182
|
+
* Assuming that you use the {@link module:link/linkui~LinkUI} feature, the following toolbar items will be available
|
|
183
|
+
* in {@link module:ui/componentfactory~ComponentFactory}:
|
|
184
|
+
*
|
|
185
|
+
* * `'linkPreview'`,
|
|
186
|
+
* * `'editLink'`,
|
|
187
|
+
* * `'linkProperties'`
|
|
188
|
+
* * `'unlink'`.
|
|
189
|
+
*
|
|
190
|
+
* The default configuration for link toolbar is:
|
|
191
|
+
*
|
|
192
|
+
* ```ts
|
|
193
|
+
* const linkConfig = {
|
|
194
|
+
* toolbar: [ 'linkPreview', '|', 'editLink', 'linkProperties', 'unlink' ]
|
|
195
|
+
* };
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* The `linkProperties` toolbar item is only available when at least one manual decorator is defined in the
|
|
199
|
+
* {@link module:link/linkconfig~LinkConfig#decorators decorators configuration}.
|
|
200
|
+
*
|
|
201
|
+
* Of course, the same buttons can also be used in the
|
|
202
|
+
* {@link module:core/editor/editorconfig~EditorConfig#toolbar main editor toolbar}.
|
|
203
|
+
*
|
|
204
|
+
* Read more about configuring the toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
|
|
205
|
+
*/
|
|
206
|
+
toolbar?: Array<string>;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
209
|
+
* A link decorator definition. Two types implement this definition:
|
|
210
|
+
*
|
|
211
|
+
* * {@link module:link/linkconfig~LinkDecoratorManualDefinition}
|
|
212
|
+
* * {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
|
|
213
|
+
*
|
|
214
|
+
* Refer to their document for more information about available options or to the
|
|
215
|
+
* {@glink features/link#custom-link-attributes-decorators link feature guide} for general information.
|
|
216
|
+
*/
|
|
217
217
|
export type LinkDecoratorDefinition = LinkDecoratorAutomaticDefinition | LinkDecoratorManualDefinition;
|
|
218
218
|
/**
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
219
|
+
* Describes an automatic {@link module:link/linkconfig~LinkConfig#decorators link decorator}. This decorator type matches
|
|
220
|
+
* all links in the editor content against a function that decides whether the link should receive a pre–defined set of attributes.
|
|
221
|
+
*
|
|
222
|
+
* It takes an object with key-value pairs of attributes and a callback function that must return a Boolean value based on the link's
|
|
223
|
+
* `href` (URL). When the callback returns `true`, attributes are applied to the link.
|
|
224
|
+
*
|
|
225
|
+
* For example, to add the `target="_blank"` attribute to all links in the editor starting with `http://`, the
|
|
226
|
+
* configuration could look like this:
|
|
227
|
+
*
|
|
228
|
+
* ```ts
|
|
229
|
+
* {
|
|
230
|
+
* mode: 'automatic',
|
|
231
|
+
* callback: url => url.startsWith( 'http://' ),
|
|
232
|
+
* attributes: {
|
|
233
|
+
* target: '_blank'
|
|
234
|
+
* }
|
|
235
|
+
* }
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* **Note**: If there is a conflict between the active manual decorator and automatic decorator
|
|
239
|
+
* (e.g. both try to manage the same attribute), the manual decorator takes precedence and the automatic
|
|
240
|
+
* one is ignored. It's also highly discouraged to have multiple automatic decorators managing the same attribute.
|
|
241
|
+
*
|
|
242
|
+
* **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
|
|
243
|
+
* dedicated for that purpose that can be enabled by turning a single option on. Check out the
|
|
244
|
+
* {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
|
|
245
|
+
* configuration description to learn more.
|
|
246
|
+
*/
|
|
247
247
|
export interface LinkDecoratorAutomaticDefinition {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Link decorator type. It is `'automatic'` for all automatic decorators.
|
|
250
|
+
*/
|
|
251
|
+
mode: "automatic";
|
|
252
|
+
/**
|
|
253
|
+
* Takes a `url` as a parameter and returns `true` if the `attributes` should be applied to the link.
|
|
254
|
+
*/
|
|
255
|
+
callback: (url: string | null) => boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Key-value pairs used as link attributes added to the output during the
|
|
258
|
+
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
259
|
+
* Attributes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
260
|
+
*/
|
|
261
|
+
attributes?: Record<string, string>;
|
|
262
|
+
/**
|
|
263
|
+
* Key-value pairs used as link styles added to the output during the
|
|
264
|
+
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
265
|
+
* Styles should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
266
|
+
*/
|
|
267
|
+
styles?: Record<string, string>;
|
|
268
|
+
/**
|
|
269
|
+
* Class names used as link classes added to the output during the
|
|
270
|
+
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
271
|
+
* Classes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
272
|
+
*/
|
|
273
|
+
classes?: ArrayOrItem<string>;
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
276
|
+
* Describes a manual {@link module:link/linkconfig~LinkConfig#decorators link decorator}. This decorator type is represented in
|
|
277
|
+
* the link feature's {@link module:link/linkui user interface} as a switch that the user can use to control the presence
|
|
278
|
+
* of a predefined set of attributes.
|
|
279
|
+
*
|
|
280
|
+
* For instance, to allow the users to manually control the presence of the `target="_blank"` and
|
|
281
|
+
* `rel="noopener noreferrer"` attributes on specific links, the decorator could look as follows:
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* {
|
|
285
|
+
* mode: 'manual',
|
|
286
|
+
* label: 'Open in a new tab',
|
|
287
|
+
* defaultValue: true,
|
|
288
|
+
* attributes: {
|
|
289
|
+
* target: '_blank',
|
|
290
|
+
* rel: 'noopener noreferrer'
|
|
291
|
+
* }
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
295
|
export interface LinkDecoratorManualDefinition {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Link decorator type. It is `'manual'` for all manual decorators.
|
|
298
|
+
*/
|
|
299
|
+
mode: "manual";
|
|
300
|
+
/**
|
|
301
|
+
* The label of the UI button that the user can use to control the presence of link attributes.
|
|
302
|
+
*/
|
|
303
|
+
label: string;
|
|
304
|
+
/**
|
|
305
|
+
* Key-value pairs used as link attributes added to the output during the
|
|
306
|
+
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
307
|
+
* Attributes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
308
|
+
*/
|
|
309
|
+
attributes?: Record<string, string>;
|
|
310
|
+
/**
|
|
311
|
+
* Key-value pairs used as link styles added to the output during the
|
|
312
|
+
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
313
|
+
* Styles should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
314
|
+
*/
|
|
315
|
+
styles?: Record<string, string>;
|
|
316
|
+
/**
|
|
317
|
+
* Class names used as link classes added to the output during the
|
|
318
|
+
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
319
|
+
* Classes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
320
|
+
*/
|
|
321
|
+
classes?: ArrayOrItem<string>;
|
|
322
|
+
/**
|
|
323
|
+
* Controls whether the decorator is "on" by default.
|
|
324
|
+
*/
|
|
325
|
+
defaultValue?: boolean;
|
|
326
326
|
}
|