@ckeditor/ckeditor5-link 39.0.1 → 40.0.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -3
  4. package/build/link.js.map +1 -0
  5. package/build/translations/de.js +1 -1
  6. package/build/translations/hy.js +1 -0
  7. package/build/translations/pt-br.js +1 -1
  8. package/lang/translations/ar.po +1 -0
  9. package/lang/translations/ast.po +1 -0
  10. package/lang/translations/az.po +1 -0
  11. package/lang/translations/bg.po +1 -0
  12. package/lang/translations/bn.po +1 -0
  13. package/lang/translations/ca.po +1 -0
  14. package/lang/translations/cs.po +1 -0
  15. package/lang/translations/da.po +1 -0
  16. package/lang/translations/de-ch.po +1 -0
  17. package/lang/translations/de.po +2 -1
  18. package/lang/translations/el.po +1 -0
  19. package/lang/translations/en-au.po +1 -0
  20. package/lang/translations/en-gb.po +1 -0
  21. package/lang/translations/en.po +1 -0
  22. package/lang/translations/eo.po +1 -0
  23. package/lang/translations/es.po +1 -0
  24. package/lang/translations/et.po +1 -0
  25. package/lang/translations/eu.po +1 -0
  26. package/lang/translations/fa.po +1 -0
  27. package/lang/translations/fi.po +1 -0
  28. package/lang/translations/fr.po +1 -0
  29. package/lang/translations/gl.po +1 -0
  30. package/lang/translations/he.po +1 -0
  31. package/lang/translations/hi.po +1 -0
  32. package/lang/translations/hr.po +1 -0
  33. package/lang/translations/hu.po +1 -0
  34. package/lang/translations/hy.po +54 -0
  35. package/lang/translations/id.po +1 -0
  36. package/lang/translations/it.po +1 -0
  37. package/lang/translations/ja.po +1 -0
  38. package/lang/translations/km.po +1 -0
  39. package/lang/translations/kn.po +1 -0
  40. package/lang/translations/ko.po +1 -0
  41. package/lang/translations/ku.po +1 -0
  42. package/lang/translations/lt.po +1 -0
  43. package/lang/translations/lv.po +1 -0
  44. package/lang/translations/ms.po +1 -0
  45. package/lang/translations/nb.po +1 -0
  46. package/lang/translations/ne.po +1 -0
  47. package/lang/translations/nl.po +1 -0
  48. package/lang/translations/no.po +1 -0
  49. package/lang/translations/pl.po +1 -0
  50. package/lang/translations/pt-br.po +3 -2
  51. package/lang/translations/pt.po +1 -0
  52. package/lang/translations/ro.po +1 -0
  53. package/lang/translations/ru.po +1 -0
  54. package/lang/translations/sk.po +1 -0
  55. package/lang/translations/sq.po +1 -0
  56. package/lang/translations/sr-latn.po +1 -0
  57. package/lang/translations/sr.po +1 -0
  58. package/lang/translations/sv.po +1 -0
  59. package/lang/translations/th.po +1 -0
  60. package/lang/translations/tk.po +1 -0
  61. package/lang/translations/tr.po +1 -0
  62. package/lang/translations/tt.po +1 -0
  63. package/lang/translations/ug.po +1 -0
  64. package/lang/translations/uk.po +1 -0
  65. package/lang/translations/ur.po +1 -0
  66. package/lang/translations/uz.po +1 -0
  67. package/lang/translations/vi.po +1 -0
  68. package/lang/translations/zh-cn.po +1 -0
  69. package/lang/translations/zh.po +1 -0
  70. package/package.json +3 -7
  71. package/src/augmentation.d.ts +30 -30
  72. package/src/augmentation.js +5 -5
  73. package/src/autolink.d.ts +60 -60
  74. package/src/autolink.js +216 -216
  75. package/src/index.d.ts +18 -18
  76. package/src/index.js +17 -17
  77. package/src/link.d.ts +27 -27
  78. package/src/link.js +31 -31
  79. package/src/linkcommand.d.ts +132 -132
  80. package/src/linkcommand.js +285 -285
  81. package/src/linkconfig.d.ts +251 -251
  82. package/src/linkconfig.js +5 -5
  83. package/src/linkediting.d.ts +106 -106
  84. package/src/linkediting.js +547 -547
  85. package/src/linkimage.d.ts +27 -27
  86. package/src/linkimage.js +31 -31
  87. package/src/linkimageediting.d.ts +39 -39
  88. package/src/linkimageediting.js +245 -245
  89. package/src/linkimageui.d.ts +40 -40
  90. package/src/linkimageui.js +96 -96
  91. package/src/linkui.d.ts +165 -165
  92. package/src/linkui.js +581 -581
  93. package/src/ui/linkactionsview.d.ts +101 -101
  94. package/src/ui/linkactionsview.js +156 -156
  95. package/src/ui/linkformview.d.ts +141 -141
  96. package/src/ui/linkformview.js +232 -232
  97. package/src/unlinkcommand.d.ts +31 -31
  98. package/src/unlinkcommand.js +66 -66
  99. package/src/utils/automaticdecorators.d.ts +45 -45
  100. package/src/utils/automaticdecorators.js +140 -140
  101. package/src/utils/manualdecorator.d.ts +72 -72
  102. package/src/utils/manualdecorator.js +47 -47
  103. package/src/utils.d.ts +80 -80
  104. package/src/utils.js +128 -128
@@ -1,251 +1,251 @@
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
- /**
6
- * @module link/linkconfig
7
- */
8
- import type { ArrayOrItem } from 'ckeditor5/src/utils';
9
- /**
10
- * The configuration of the {@link module:link/link~Link link feature}.
11
- *
12
- * ```ts
13
- * ClassicEditor
14
- * .create( editorElement, {
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
- export interface LinkConfig {
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( editorElement, {
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
- * When set to `true`, the `target="blank"` and `rel="noopener noreferrer"` attributes are automatically added to all external links
48
- * in the editor. "External links" are all links in the editor content starting with `http`, `https`, or `//`.
49
- *
50
- * ```ts
51
- * ClassicEditor
52
- * .create( editorElement, {
53
- * link: {
54
- * addTargetToExternalLinks: true
55
- * }
56
- * } )
57
- * .then( ... )
58
- * .catch( ... );
59
- * ```
60
- *
61
- * Internally, this option activates a predefined {@link module:link/linkconfig~LinkConfig#decorators automatic link decorator}
62
- * that extends all external links with the `target` and `rel` attributes.
63
- *
64
- * **Note**: To control the `target` and `rel` attributes of specific links in the edited content, a dedicated
65
- * {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} decorator must be defined in the
66
- * {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} array. In such scenario,
67
- * the `config.link.addTargetToExternalLinks` option should remain `undefined` or `false` to not interfere with the manual decorator.
68
- *
69
- * It is possible to add other {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic}
70
- * or {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} link decorators when this option is active.
71
- *
72
- * More information about decorators can be found in the {@link module:link/linkconfig~LinkConfig#decorators decorators configuration}
73
- * reference.
74
- *
75
- * @default false
76
- */
77
- addTargetToExternalLinks?: boolean;
78
- /**
79
- * Decorators provide an easy way to configure and manage additional link attributes in the editor content. There are
80
- * two types of link decorators:
81
- *
82
- * * {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition Automatic} – They match links against pre–defined rules and
83
- * manage their attributes based on the results.
84
- * * {@link module:link/linkconfig~LinkDecoratorManualDefinition Manual} – They allow users to control link attributes
85
- * individually, using the editor UI.
86
- *
87
- * Link decorators are defined as objects with key-value pairs, where the key is the name provided for a given decorator and the
88
- * value is the decorator definition.
89
- *
90
- * The name of the decorator also corresponds to the {@glink framework/architecture/editing-engine#text-attributes text
91
- * attribute} in the model. For instance, the `isExternal` decorator below is represented as a `linkIsExternal` attribute in the model.
92
- *
93
- * ```ts
94
- * ClassicEditor
95
- * .create( editorElement, {
96
- * link: {
97
- * decorators: {
98
- * isExternal: {
99
- * mode: 'automatic',
100
- * callback: url => url.startsWith( 'http://' ),
101
- * attributes: {
102
- * target: '_blank',
103
- * rel: 'noopener noreferrer'
104
- * }
105
- * },
106
- * isDownloadable: {
107
- * mode: 'manual',
108
- * label: 'Downloadable',
109
- * attributes: {
110
- * download: 'file.png',
111
- * }
112
- * },
113
- * // ...
114
- * }
115
- * }
116
- * } )
117
- * .then( ... )
118
- * .catch( ... );
119
- * ```
120
- *
121
- * To learn more about the configuration syntax, check out the {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic}
122
- * and {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} decorator option reference.
123
- *
124
- * **Warning:** Currently, link decorators work independently of one another and no conflict resolution mechanism exists.
125
- * For example, configuring the `target` attribute using both an automatic and a manual decorator at the same time could end up with
126
- * quirky results. The same applies if multiple manual or automatic decorators were defined for the same attribute.
127
- *
128
- * **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
129
- * dedicated for that purpose which can be enabled by turning a single option on. Check out the
130
- * {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
131
- * configuration description to learn more.
132
- *
133
- * See also the {@glink features/link#custom-link-attributes-decorators link feature guide} for more information.
134
- */
135
- decorators?: Record<string, LinkDecoratorDefinition>;
136
- }
137
- /**
138
- * A link decorator definition. Two types implement this definition:
139
- *
140
- * * {@link module:link/linkconfig~LinkDecoratorManualDefinition}
141
- * * {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
142
- *
143
- * Refer to their document for more information about available options or to the
144
- * {@glink features/link#custom-link-attributes-decorators link feature guide} for general information.
145
- */
146
- export type LinkDecoratorDefinition = LinkDecoratorAutomaticDefinition | LinkDecoratorManualDefinition;
147
- /**
148
- * Describes an automatic {@link module:link/linkconfig~LinkConfig#decorators link decorator}. This decorator type matches
149
- * all links in the editor content against a function that decides whether the link should receive a pre–defined set of attributes.
150
- *
151
- * 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
152
- * `href` (URL). When the callback returns `true`, attributes are applied to the link.
153
- *
154
- * For example, to add the `target="_blank"` attribute to all links in the editor starting with `http://`, the
155
- * configuration could look like this:
156
- *
157
- * ```ts
158
- * {
159
- * mode: 'automatic',
160
- * callback: url => url.startsWith( 'http://' ),
161
- * attributes: {
162
- * target: '_blank'
163
- * }
164
- * }
165
- * ```
166
- *
167
- * **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
168
- * dedicated for that purpose that can be enabled by turning a single option on. Check out the
169
- * {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
170
- * configuration description to learn more.
171
- */
172
- export interface LinkDecoratorAutomaticDefinition {
173
- /**
174
- * Link decorator type. It is `'automatic'` for all automatic decorators.
175
- */
176
- mode: 'automatic';
177
- /**
178
- * Takes a `url` as a parameter and returns `true` if the `attributes` should be applied to the link.
179
- */
180
- callback: (url: string | null) => boolean;
181
- /**
182
- * Key-value pairs used as link attributes added to the output during the
183
- * {@glink framework/architecture/editing-engine#conversion downcasting}.
184
- * Attributes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
185
- */
186
- attributes?: Record<string, string>;
187
- /**
188
- * Key-value pairs used as link styles added to the output during the
189
- * {@glink framework/architecture/editing-engine#conversion downcasting}.
190
- * Styles should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
191
- */
192
- styles?: Record<string, string>;
193
- /**
194
- * Class names used as link classes added to the output during the
195
- * {@glink framework/architecture/editing-engine#conversion downcasting}.
196
- * Classes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
197
- */
198
- classes?: ArrayOrItem<string>;
199
- }
200
- /**
201
- * Describes a manual {@link module:link/linkconfig~LinkConfig#decorators link decorator}. This decorator type is represented in
202
- * the link feature's {@link module:link/linkui user interface} as a switch that the user can use to control the presence
203
- * of a predefined set of attributes.
204
- *
205
- * For instance, to allow the users to manually control the presence of the `target="_blank"` and
206
- * `rel="noopener noreferrer"` attributes on specific links, the decorator could look as follows:
207
- *
208
- * ```ts
209
- * {
210
- * mode: 'manual',
211
- * label: 'Open in a new tab',
212
- * defaultValue: true,
213
- * attributes: {
214
- * target: '_blank',
215
- * rel: 'noopener noreferrer'
216
- * }
217
- * }
218
- * ```
219
- */
220
- export interface LinkDecoratorManualDefinition {
221
- /**
222
- * Link decorator type. It is `'manual'` for all manual decorators.
223
- */
224
- mode: 'manual';
225
- /**
226
- * The label of the UI button that the user can use to control the presence of link attributes.
227
- */
228
- label: string;
229
- /**
230
- * Key-value pairs used as link attributes added to the output during the
231
- * {@glink framework/architecture/editing-engine#conversion downcasting}.
232
- * Attributes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
233
- */
234
- attributes?: Record<string, string>;
235
- /**
236
- * Key-value pairs used as link styles added to the output during the
237
- * {@glink framework/architecture/editing-engine#conversion downcasting}.
238
- * Styles should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
239
- */
240
- styles?: Record<string, string>;
241
- /**
242
- * Class names used as link classes added to the output during the
243
- * {@glink framework/architecture/editing-engine#conversion downcasting}.
244
- * Classes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
245
- */
246
- classes?: ArrayOrItem<string>;
247
- /**
248
- * Controls whether the decorator is "on" by default.
249
- */
250
- defaultValue?: boolean;
251
- }
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
+ /**
6
+ * @module link/linkconfig
7
+ */
8
+ import type { ArrayOrItem } from 'ckeditor5/src/utils';
9
+ /**
10
+ * The configuration of the {@link module:link/link~Link link feature}.
11
+ *
12
+ * ```ts
13
+ * ClassicEditor
14
+ * .create( editorElement, {
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
+ export interface LinkConfig {
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( editorElement, {
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
+ * When set to `true`, the `target="blank"` and `rel="noopener noreferrer"` attributes are automatically added to all external links
48
+ * in the editor. "External links" are all links in the editor content starting with `http`, `https`, or `//`.
49
+ *
50
+ * ```ts
51
+ * ClassicEditor
52
+ * .create( editorElement, {
53
+ * link: {
54
+ * addTargetToExternalLinks: true
55
+ * }
56
+ * } )
57
+ * .then( ... )
58
+ * .catch( ... );
59
+ * ```
60
+ *
61
+ * Internally, this option activates a predefined {@link module:link/linkconfig~LinkConfig#decorators automatic link decorator}
62
+ * that extends all external links with the `target` and `rel` attributes.
63
+ *
64
+ * **Note**: To control the `target` and `rel` attributes of specific links in the edited content, a dedicated
65
+ * {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} decorator must be defined in the
66
+ * {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} array. In such scenario,
67
+ * the `config.link.addTargetToExternalLinks` option should remain `undefined` or `false` to not interfere with the manual decorator.
68
+ *
69
+ * It is possible to add other {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic}
70
+ * or {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} link decorators when this option is active.
71
+ *
72
+ * More information about decorators can be found in the {@link module:link/linkconfig~LinkConfig#decorators decorators configuration}
73
+ * reference.
74
+ *
75
+ * @default false
76
+ */
77
+ addTargetToExternalLinks?: boolean;
78
+ /**
79
+ * Decorators provide an easy way to configure and manage additional link attributes in the editor content. There are
80
+ * two types of link decorators:
81
+ *
82
+ * * {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition Automatic} &ndash; They match links against pre–defined rules and
83
+ * manage their attributes based on the results.
84
+ * * {@link module:link/linkconfig~LinkDecoratorManualDefinition Manual} &ndash; They allow users to control link attributes
85
+ * individually, using the editor UI.
86
+ *
87
+ * Link decorators are defined as objects with key-value pairs, where the key is the name provided for a given decorator and the
88
+ * value is the decorator definition.
89
+ *
90
+ * The name of the decorator also corresponds to the {@glink framework/architecture/editing-engine#text-attributes text
91
+ * attribute} in the model. For instance, the `isExternal` decorator below is represented as a `linkIsExternal` attribute in the model.
92
+ *
93
+ * ```ts
94
+ * ClassicEditor
95
+ * .create( editorElement, {
96
+ * link: {
97
+ * decorators: {
98
+ * isExternal: {
99
+ * mode: 'automatic',
100
+ * callback: url => url.startsWith( 'http://' ),
101
+ * attributes: {
102
+ * target: '_blank',
103
+ * rel: 'noopener noreferrer'
104
+ * }
105
+ * },
106
+ * isDownloadable: {
107
+ * mode: 'manual',
108
+ * label: 'Downloadable',
109
+ * attributes: {
110
+ * download: 'file.png',
111
+ * }
112
+ * },
113
+ * // ...
114
+ * }
115
+ * }
116
+ * } )
117
+ * .then( ... )
118
+ * .catch( ... );
119
+ * ```
120
+ *
121
+ * To learn more about the configuration syntax, check out the {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic}
122
+ * and {@link module:link/linkconfig~LinkDecoratorManualDefinition manual} decorator option reference.
123
+ *
124
+ * **Warning:** Currently, link decorators work independently of one another and no conflict resolution mechanism exists.
125
+ * For example, configuring the `target` attribute using both an automatic and a manual decorator at the same time could end up with
126
+ * quirky results. The same applies if multiple manual or automatic decorators were defined for the same attribute.
127
+ *
128
+ * **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
129
+ * dedicated for that purpose which can be enabled by turning a single option on. Check out the
130
+ * {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
131
+ * configuration description to learn more.
132
+ *
133
+ * See also the {@glink features/link#custom-link-attributes-decorators link feature guide} for more information.
134
+ */
135
+ decorators?: Record<string, LinkDecoratorDefinition>;
136
+ }
137
+ /**
138
+ * A link decorator definition. Two types implement this definition:
139
+ *
140
+ * * {@link module:link/linkconfig~LinkDecoratorManualDefinition}
141
+ * * {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
142
+ *
143
+ * Refer to their document for more information about available options or to the
144
+ * {@glink features/link#custom-link-attributes-decorators link feature guide} for general information.
145
+ */
146
+ export type LinkDecoratorDefinition = LinkDecoratorAutomaticDefinition | LinkDecoratorManualDefinition;
147
+ /**
148
+ * Describes an automatic {@link module:link/linkconfig~LinkConfig#decorators link decorator}. This decorator type matches
149
+ * all links in the editor content against a function that decides whether the link should receive a pre–defined set of attributes.
150
+ *
151
+ * 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
152
+ * `href` (URL). When the callback returns `true`, attributes are applied to the link.
153
+ *
154
+ * For example, to add the `target="_blank"` attribute to all links in the editor starting with `http://`, the
155
+ * configuration could look like this:
156
+ *
157
+ * ```ts
158
+ * {
159
+ * mode: 'automatic',
160
+ * callback: url => url.startsWith( 'http://' ),
161
+ * attributes: {
162
+ * target: '_blank'
163
+ * }
164
+ * }
165
+ * ```
166
+ *
167
+ * **Note**: Since the `target` attribute management for external links is a common use case, there is a predefined automatic decorator
168
+ * dedicated for that purpose that can be enabled by turning a single option on. Check out the
169
+ * {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}
170
+ * configuration description to learn more.
171
+ */
172
+ export interface LinkDecoratorAutomaticDefinition {
173
+ /**
174
+ * Link decorator type. It is `'automatic'` for all automatic decorators.
175
+ */
176
+ mode: 'automatic';
177
+ /**
178
+ * Takes a `url` as a parameter and returns `true` if the `attributes` should be applied to the link.
179
+ */
180
+ callback: (url: string | null) => boolean;
181
+ /**
182
+ * Key-value pairs used as link attributes added to the output during the
183
+ * {@glink framework/architecture/editing-engine#conversion downcasting}.
184
+ * Attributes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
185
+ */
186
+ attributes?: Record<string, string>;
187
+ /**
188
+ * Key-value pairs used as link styles added to the output during the
189
+ * {@glink framework/architecture/editing-engine#conversion downcasting}.
190
+ * Styles should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
191
+ */
192
+ styles?: Record<string, string>;
193
+ /**
194
+ * Class names used as link classes added to the output during the
195
+ * {@glink framework/architecture/editing-engine#conversion downcasting}.
196
+ * Classes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
197
+ */
198
+ classes?: ArrayOrItem<string>;
199
+ }
200
+ /**
201
+ * Describes a manual {@link module:link/linkconfig~LinkConfig#decorators link decorator}. This decorator type is represented in
202
+ * the link feature's {@link module:link/linkui user interface} as a switch that the user can use to control the presence
203
+ * of a predefined set of attributes.
204
+ *
205
+ * For instance, to allow the users to manually control the presence of the `target="_blank"` and
206
+ * `rel="noopener noreferrer"` attributes on specific links, the decorator could look as follows:
207
+ *
208
+ * ```ts
209
+ * {
210
+ * mode: 'manual',
211
+ * label: 'Open in a new tab',
212
+ * defaultValue: true,
213
+ * attributes: {
214
+ * target: '_blank',
215
+ * rel: 'noopener noreferrer'
216
+ * }
217
+ * }
218
+ * ```
219
+ */
220
+ export interface LinkDecoratorManualDefinition {
221
+ /**
222
+ * Link decorator type. It is `'manual'` for all manual decorators.
223
+ */
224
+ mode: 'manual';
225
+ /**
226
+ * The label of the UI button that the user can use to control the presence of link attributes.
227
+ */
228
+ label: string;
229
+ /**
230
+ * Key-value pairs used as link attributes added to the output during the
231
+ * {@glink framework/architecture/editing-engine#conversion downcasting}.
232
+ * Attributes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
233
+ */
234
+ attributes?: Record<string, string>;
235
+ /**
236
+ * Key-value pairs used as link styles added to the output during the
237
+ * {@glink framework/architecture/editing-engine#conversion downcasting}.
238
+ * Styles should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
239
+ */
240
+ styles?: Record<string, string>;
241
+ /**
242
+ * Class names used as link classes added to the output during the
243
+ * {@glink framework/architecture/editing-engine#conversion downcasting}.
244
+ * Classes should follow the {@link module:engine/view/elementdefinition~ElementDefinition} syntax.
245
+ */
246
+ classes?: ArrayOrItem<string>;
247
+ /**
248
+ * Controls whether the decorator is "on" by default.
249
+ */
250
+ defaultValue?: boolean;
251
+ }
package/src/linkconfig.js CHANGED
@@ -1,5 +1,5 @@
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
- export {};
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
+ export {};