@ckeditor/ckeditor5-link 36.0.1 → 37.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/link.js +1 -1
- package/package.json +30 -25
- package/src/autolink.d.ts +64 -0
- package/src/autolink.js +192 -261
- package/src/index.d.ts +14 -0
- package/src/index.js +0 -2
- package/src/link.d.ts +30 -0
- package/src/link.js +13 -241
- package/src/linkcommand.d.ts +127 -0
- package/src/linkcommand.js +224 -273
- package/src/linkconfig.d.ts +261 -0
- package/src/linkconfig.js +5 -0
- package/src/linkediting.d.ts +110 -0
- package/src/linkediting.js +516 -664
- package/src/linkimage.d.ts +30 -0
- package/src/linkimage.js +12 -19
- package/src/linkimageediting.d.ts +43 -0
- package/src/linkimageediting.js +222 -275
- package/src/linkimageui.d.ts +43 -0
- package/src/linkimageui.js +75 -101
- package/src/linkui.d.ts +170 -0
- package/src/linkui.js +557 -729
- package/src/ui/linkactionsview.d.ts +101 -0
- package/src/ui/linkactionsview.js +134 -227
- package/src/ui/linkformview.d.ts +141 -0
- package/src/ui/linkformview.js +212 -342
- package/src/unlinkcommand.d.ts +36 -0
- package/src/unlinkcommand.js +51 -65
- package/src/utils/automaticdecorators.d.ts +44 -0
- package/src/utils/automaticdecorators.js +126 -148
- package/src/utils/manualdecorator.d.ts +72 -0
- package/src/utils/manualdecorator.js +35 -89
- package/src/utils.d.ts +80 -0
- package/src/utils.js +55 -121
|
@@ -0,0 +1,101 @@
|
|
|
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/ui/linkactionsview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, View } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type LocaleTranslate, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
11
|
+
import '../../theme/linkactions.css';
|
|
12
|
+
/**
|
|
13
|
+
* The link actions view class. This view displays the link preview, allows
|
|
14
|
+
* unlinking or editing the link.
|
|
15
|
+
*/
|
|
16
|
+
export default class LinkActionsView extends View {
|
|
17
|
+
/**
|
|
18
|
+
* Tracks information about DOM focus in the actions.
|
|
19
|
+
*/
|
|
20
|
+
readonly focusTracker: FocusTracker;
|
|
21
|
+
/**
|
|
22
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
23
|
+
*/
|
|
24
|
+
readonly keystrokes: KeystrokeHandler;
|
|
25
|
+
/**
|
|
26
|
+
* The href preview view.
|
|
27
|
+
*/
|
|
28
|
+
previewButtonView: View;
|
|
29
|
+
/**
|
|
30
|
+
* The unlink button view.
|
|
31
|
+
*/
|
|
32
|
+
unlinkButtonView: ButtonView;
|
|
33
|
+
/**
|
|
34
|
+
* The edit link button view.
|
|
35
|
+
*/
|
|
36
|
+
editButtonView: ButtonView;
|
|
37
|
+
/**
|
|
38
|
+
* The value of the "href" attribute of the link to use in the {@link #previewButtonView}.
|
|
39
|
+
*
|
|
40
|
+
* @observable
|
|
41
|
+
*/
|
|
42
|
+
href: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* A collection of views that can be focused in the view.
|
|
45
|
+
*/
|
|
46
|
+
private readonly _focusables;
|
|
47
|
+
/**
|
|
48
|
+
* Helps cycling over {@link #_focusables} in the view.
|
|
49
|
+
*/
|
|
50
|
+
private readonly _focusCycler;
|
|
51
|
+
t: LocaleTranslate;
|
|
52
|
+
/**
|
|
53
|
+
* @inheritDoc
|
|
54
|
+
*/
|
|
55
|
+
constructor(locale: Locale);
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
render(): void;
|
|
60
|
+
/**
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
63
|
+
destroy(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Focuses the fist {@link #_focusables} in the actions.
|
|
66
|
+
*/
|
|
67
|
+
focus(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a button view.
|
|
70
|
+
*
|
|
71
|
+
* @param label The button label.
|
|
72
|
+
* @param icon The button icon.
|
|
73
|
+
* @param eventName An event name that the `ButtonView#execute` event will be delegated to.
|
|
74
|
+
* @returns The button view instance.
|
|
75
|
+
*/
|
|
76
|
+
private _createButton;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a link href preview button.
|
|
79
|
+
*
|
|
80
|
+
* @returns The button view instance.
|
|
81
|
+
*/
|
|
82
|
+
private _createPreviewButton;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Fired when the {@link #editButtonView} is clicked.
|
|
86
|
+
*
|
|
87
|
+
* @eventName edit
|
|
88
|
+
*/
|
|
89
|
+
export type EditEvent = {
|
|
90
|
+
name: 'edit';
|
|
91
|
+
args: [];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Fired when the {@link #unlinkButtonView} is clicked.
|
|
95
|
+
*
|
|
96
|
+
* @eventName unlink
|
|
97
|
+
*/
|
|
98
|
+
export type UnlinkEvent = {
|
|
99
|
+
name: 'unlink';
|
|
100
|
+
args: [];
|
|
101
|
+
};
|
|
@@ -2,248 +2,155 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module link/ui/linkactionsview
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import { ButtonView, View, ViewCollection, FocusCycler } from 'ckeditor5/src/ui';
|
|
11
9
|
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
12
10
|
import { icons } from 'ckeditor5/src/core';
|
|
13
|
-
|
|
14
11
|
import { ensureSafeUrl } from '../utils';
|
|
15
|
-
|
|
16
12
|
// See: #8833.
|
|
17
13
|
// eslint-disable-next-line ckeditor5-rules/ckeditor-imports
|
|
18
14
|
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
19
15
|
import '../../theme/linkactions.css';
|
|
20
|
-
|
|
21
16
|
import unlinkIcon from '../../theme/icons/unlink.svg';
|
|
22
|
-
|
|
23
17
|
/**
|
|
24
18
|
* The link actions view class. This view displays the link preview, allows
|
|
25
19
|
* unlinking or editing the link.
|
|
26
|
-
*
|
|
27
|
-
* @extends module:ui/view~View
|
|
28
20
|
*/
|
|
29
21
|
export default class LinkActionsView extends View {
|
|
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
|
-
this.focusTracker.destroy();
|
|
165
|
-
this.keystrokes.destroy();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Focuses the fist {@link #_focusables} in the actions.
|
|
170
|
-
*/
|
|
171
|
-
focus() {
|
|
172
|
-
this._focusCycler.focusFirst();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Creates a button view.
|
|
177
|
-
*
|
|
178
|
-
* @private
|
|
179
|
-
* @param {String} label The button label.
|
|
180
|
-
* @param {String} icon The button icon.
|
|
181
|
-
* @param {String} [eventName] An event name that the `ButtonView#execute` event will be delegated to.
|
|
182
|
-
* @returns {module:ui/button/buttonview~ButtonView} The button view instance.
|
|
183
|
-
*/
|
|
184
|
-
_createButton( label, icon, eventName ) {
|
|
185
|
-
const button = new ButtonView( this.locale );
|
|
186
|
-
|
|
187
|
-
button.set( {
|
|
188
|
-
label,
|
|
189
|
-
icon,
|
|
190
|
-
tooltip: true
|
|
191
|
-
} );
|
|
192
|
-
|
|
193
|
-
button.delegate( 'execute' ).to( this, eventName );
|
|
194
|
-
|
|
195
|
-
return button;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Creates a link href preview button.
|
|
200
|
-
*
|
|
201
|
-
* @private
|
|
202
|
-
* @returns {module:ui/button/buttonview~ButtonView} The button view instance.
|
|
203
|
-
*/
|
|
204
|
-
_createPreviewButton() {
|
|
205
|
-
const button = new ButtonView( this.locale );
|
|
206
|
-
const bind = this.bindTemplate;
|
|
207
|
-
const t = this.t;
|
|
208
|
-
|
|
209
|
-
button.set( {
|
|
210
|
-
withText: true,
|
|
211
|
-
tooltip: t( 'Open link in new tab' )
|
|
212
|
-
} );
|
|
213
|
-
|
|
214
|
-
button.extendTemplate( {
|
|
215
|
-
attributes: {
|
|
216
|
-
class: [
|
|
217
|
-
'ck',
|
|
218
|
-
'ck-link-actions__preview'
|
|
219
|
-
],
|
|
220
|
-
href: bind.to( 'href', href => href && ensureSafeUrl( href ) ),
|
|
221
|
-
target: '_blank',
|
|
222
|
-
rel: 'noopener noreferrer'
|
|
223
|
-
}
|
|
224
|
-
} );
|
|
225
|
-
|
|
226
|
-
button.bind( 'label' ).to( this, 'href', href => {
|
|
227
|
-
return href || t( 'This link has no URL' );
|
|
228
|
-
} );
|
|
229
|
-
|
|
230
|
-
button.bind( 'isEnabled' ).to( this, 'href', href => !!href );
|
|
231
|
-
|
|
232
|
-
button.template.tag = 'a';
|
|
233
|
-
button.template.eventListeners = {};
|
|
234
|
-
|
|
235
|
-
return button;
|
|
236
|
-
}
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
constructor(locale) {
|
|
26
|
+
super(locale);
|
|
27
|
+
/**
|
|
28
|
+
* Tracks information about DOM focus in the actions.
|
|
29
|
+
*/
|
|
30
|
+
this.focusTracker = new FocusTracker();
|
|
31
|
+
/**
|
|
32
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
33
|
+
*/
|
|
34
|
+
this.keystrokes = new KeystrokeHandler();
|
|
35
|
+
/**
|
|
36
|
+
* A collection of views that can be focused in the view.
|
|
37
|
+
*/
|
|
38
|
+
this._focusables = new ViewCollection();
|
|
39
|
+
const t = locale.t;
|
|
40
|
+
this.previewButtonView = this._createPreviewButton();
|
|
41
|
+
this.unlinkButtonView = this._createButton(t('Unlink'), unlinkIcon, 'unlink');
|
|
42
|
+
this.editButtonView = this._createButton(t('Edit link'), icons.pencil, 'edit');
|
|
43
|
+
this.set('href', undefined);
|
|
44
|
+
this._focusCycler = new FocusCycler({
|
|
45
|
+
focusables: this._focusables,
|
|
46
|
+
focusTracker: this.focusTracker,
|
|
47
|
+
keystrokeHandler: this.keystrokes,
|
|
48
|
+
actions: {
|
|
49
|
+
// Navigate fields backwards using the Shift + Tab keystroke.
|
|
50
|
+
focusPrevious: 'shift + tab',
|
|
51
|
+
// Navigate fields forwards using the Tab key.
|
|
52
|
+
focusNext: 'tab'
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
this.setTemplate({
|
|
56
|
+
tag: 'div',
|
|
57
|
+
attributes: {
|
|
58
|
+
class: [
|
|
59
|
+
'ck',
|
|
60
|
+
'ck-link-actions',
|
|
61
|
+
'ck-responsive-form'
|
|
62
|
+
],
|
|
63
|
+
// https://github.com/ckeditor/ckeditor5-link/issues/90
|
|
64
|
+
tabindex: '-1'
|
|
65
|
+
},
|
|
66
|
+
children: [
|
|
67
|
+
this.previewButtonView,
|
|
68
|
+
this.editButtonView,
|
|
69
|
+
this.unlinkButtonView
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @inheritDoc
|
|
75
|
+
*/
|
|
76
|
+
render() {
|
|
77
|
+
super.render();
|
|
78
|
+
const childViews = [
|
|
79
|
+
this.previewButtonView,
|
|
80
|
+
this.editButtonView,
|
|
81
|
+
this.unlinkButtonView
|
|
82
|
+
];
|
|
83
|
+
childViews.forEach(v => {
|
|
84
|
+
// Register the view as focusable.
|
|
85
|
+
this._focusables.add(v);
|
|
86
|
+
// Register the view in the focus tracker.
|
|
87
|
+
this.focusTracker.add(v.element);
|
|
88
|
+
});
|
|
89
|
+
// Start listening for the keystrokes coming from #element.
|
|
90
|
+
this.keystrokes.listenTo(this.element);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @inheritDoc
|
|
94
|
+
*/
|
|
95
|
+
destroy() {
|
|
96
|
+
super.destroy();
|
|
97
|
+
this.focusTracker.destroy();
|
|
98
|
+
this.keystrokes.destroy();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Focuses the fist {@link #_focusables} in the actions.
|
|
102
|
+
*/
|
|
103
|
+
focus() {
|
|
104
|
+
this._focusCycler.focusFirst();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Creates a button view.
|
|
108
|
+
*
|
|
109
|
+
* @param label The button label.
|
|
110
|
+
* @param icon The button icon.
|
|
111
|
+
* @param eventName An event name that the `ButtonView#execute` event will be delegated to.
|
|
112
|
+
* @returns The button view instance.
|
|
113
|
+
*/
|
|
114
|
+
_createButton(label, icon, eventName) {
|
|
115
|
+
const button = new ButtonView(this.locale);
|
|
116
|
+
button.set({
|
|
117
|
+
label,
|
|
118
|
+
icon,
|
|
119
|
+
tooltip: true
|
|
120
|
+
});
|
|
121
|
+
button.delegate('execute').to(this, eventName);
|
|
122
|
+
return button;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates a link href preview button.
|
|
126
|
+
*
|
|
127
|
+
* @returns The button view instance.
|
|
128
|
+
*/
|
|
129
|
+
_createPreviewButton() {
|
|
130
|
+
const button = new ButtonView(this.locale);
|
|
131
|
+
const bind = this.bindTemplate;
|
|
132
|
+
const t = this.t;
|
|
133
|
+
button.set({
|
|
134
|
+
withText: true,
|
|
135
|
+
tooltip: t('Open link in new tab')
|
|
136
|
+
});
|
|
137
|
+
button.extendTemplate({
|
|
138
|
+
attributes: {
|
|
139
|
+
class: [
|
|
140
|
+
'ck',
|
|
141
|
+
'ck-link-actions__preview'
|
|
142
|
+
],
|
|
143
|
+
href: bind.to('href', href => href && ensureSafeUrl(href)),
|
|
144
|
+
target: '_blank',
|
|
145
|
+
rel: 'noopener noreferrer'
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
button.bind('label').to(this, 'href', href => {
|
|
149
|
+
return href || t('This link has no URL');
|
|
150
|
+
});
|
|
151
|
+
button.bind('isEnabled').to(this, 'href', href => !!href);
|
|
152
|
+
button.template.tag = 'a';
|
|
153
|
+
button.template.eventListeners = {};
|
|
154
|
+
return button;
|
|
155
|
+
}
|
|
237
156
|
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Fired when the {@link #editButtonView} is clicked.
|
|
241
|
-
*
|
|
242
|
-
* @event edit
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Fired when the {@link #unlinkButtonView} is clicked.
|
|
247
|
-
*
|
|
248
|
-
* @event unlink
|
|
249
|
-
*/
|
|
@@ -0,0 +1,141 @@
|
|
|
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/ui/linkformview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, LabeledFieldView, View, ViewCollection, type InputTextView } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import type LinkCommand from '../linkcommand';
|
|
11
|
+
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
12
|
+
import '../../theme/linkform.css';
|
|
13
|
+
/**
|
|
14
|
+
* The link form view controller class.
|
|
15
|
+
*
|
|
16
|
+
* See {@link module:link/ui/linkformview~LinkFormView}.
|
|
17
|
+
*/
|
|
18
|
+
export default class LinkFormView extends View {
|
|
19
|
+
/**
|
|
20
|
+
* Tracks information about DOM focus in the form.
|
|
21
|
+
*/
|
|
22
|
+
readonly focusTracker: FocusTracker;
|
|
23
|
+
/**
|
|
24
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
25
|
+
*/
|
|
26
|
+
readonly keystrokes: KeystrokeHandler;
|
|
27
|
+
/**
|
|
28
|
+
* The URL input view.
|
|
29
|
+
*/
|
|
30
|
+
urlInputView: LabeledFieldView<InputTextView>;
|
|
31
|
+
/**
|
|
32
|
+
* The Save button view.
|
|
33
|
+
*/
|
|
34
|
+
saveButtonView: ButtonView;
|
|
35
|
+
/**
|
|
36
|
+
* The Cancel button view.
|
|
37
|
+
*/
|
|
38
|
+
cancelButtonView: ButtonView;
|
|
39
|
+
/**
|
|
40
|
+
* A collection of {@link module:ui/button/switchbuttonview~SwitchButtonView},
|
|
41
|
+
* which corresponds to {@link module:link/linkcommand~LinkCommand#manualDecorators manual decorators}
|
|
42
|
+
* configured in the editor.
|
|
43
|
+
*/
|
|
44
|
+
private readonly _manualDecoratorSwitches;
|
|
45
|
+
/**
|
|
46
|
+
* A collection of child views in the form.
|
|
47
|
+
*/
|
|
48
|
+
readonly children: ViewCollection;
|
|
49
|
+
/**
|
|
50
|
+
* A collection of views that can be focused in the form.
|
|
51
|
+
*/
|
|
52
|
+
private readonly _focusables;
|
|
53
|
+
/**
|
|
54
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
55
|
+
*/
|
|
56
|
+
private readonly _focusCycler;
|
|
57
|
+
/**
|
|
58
|
+
* Creates an instance of the {@link module:link/ui/linkformview~LinkFormView} class.
|
|
59
|
+
*
|
|
60
|
+
* Also see {@link #render}.
|
|
61
|
+
*
|
|
62
|
+
* @param locale The localization services instance.
|
|
63
|
+
* @param linkCommand Reference to {@link module:link/linkcommand~LinkCommand}.
|
|
64
|
+
*/
|
|
65
|
+
constructor(locale: Locale, linkCommand: LinkCommand);
|
|
66
|
+
/**
|
|
67
|
+
* Obtains the state of the {@link module:ui/button/switchbuttonview~SwitchButtonView switch buttons} representing
|
|
68
|
+
* {@link module:link/linkcommand~LinkCommand#manualDecorators manual link decorators}
|
|
69
|
+
* in the {@link module:link/ui/linkformview~LinkFormView}.
|
|
70
|
+
*
|
|
71
|
+
* @returns Key-value pairs, where the key is the name of the decorator and the value is its state.
|
|
72
|
+
*/
|
|
73
|
+
getDecoratorSwitchesState(): Record<string, boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* @inheritDoc
|
|
76
|
+
*/
|
|
77
|
+
render(): void;
|
|
78
|
+
/**
|
|
79
|
+
* @inheritDoc
|
|
80
|
+
*/
|
|
81
|
+
destroy(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Focuses the fist {@link #_focusables} in the form.
|
|
84
|
+
*/
|
|
85
|
+
focus(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Creates a labeled input view.
|
|
88
|
+
*
|
|
89
|
+
* @returns Labeled field view instance.
|
|
90
|
+
*/
|
|
91
|
+
private _createUrlInput;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a button view.
|
|
94
|
+
*
|
|
95
|
+
* @param label The button label.
|
|
96
|
+
* @param icon The button icon.
|
|
97
|
+
* @param className The additional button CSS class name.
|
|
98
|
+
* @param eventName An event name that the `ButtonView#execute` event will be delegated to.
|
|
99
|
+
* @returns The button view instance.
|
|
100
|
+
*/
|
|
101
|
+
private _createButton;
|
|
102
|
+
/**
|
|
103
|
+
* Populates {@link module:ui/viewcollection~ViewCollection} of {@link module:ui/button/switchbuttonview~SwitchButtonView}
|
|
104
|
+
* made based on {@link module:link/linkcommand~LinkCommand#manualDecorators}.
|
|
105
|
+
*
|
|
106
|
+
* @param linkCommand A reference to the link command.
|
|
107
|
+
* @returns ViewCollection of switch buttons.
|
|
108
|
+
*/
|
|
109
|
+
private _createManualDecoratorSwitches;
|
|
110
|
+
/**
|
|
111
|
+
* Populates the {@link #children} collection of the form.
|
|
112
|
+
*
|
|
113
|
+
* If {@link module:link/linkcommand~LinkCommand#manualDecorators manual decorators} are configured in the editor, it creates an
|
|
114
|
+
* additional `View` wrapping all {@link #_manualDecoratorSwitches} switch buttons corresponding
|
|
115
|
+
* to these decorators.
|
|
116
|
+
*
|
|
117
|
+
* @param manualDecorators A reference to
|
|
118
|
+
* the collection of manual decorators stored in the link command.
|
|
119
|
+
* @returns The children of link form view.
|
|
120
|
+
*/
|
|
121
|
+
private _createFormChildren;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Fired when the form view is submitted (when one of the children triggered the submit event),
|
|
125
|
+
* for example with a click on {@link #saveButtonView}.
|
|
126
|
+
*
|
|
127
|
+
* @eventName submit
|
|
128
|
+
*/
|
|
129
|
+
export type SubmitEvent = {
|
|
130
|
+
name: 'submit';
|
|
131
|
+
args: [];
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Fired when the form view is canceled, for example with a click on {@link #cancelButtonView}.
|
|
135
|
+
*
|
|
136
|
+
* @eventName cancel
|
|
137
|
+
*/
|
|
138
|
+
export type CancelEvent = {
|
|
139
|
+
name: 'cancel';
|
|
140
|
+
args: [];
|
|
141
|
+
};
|