@ckeditor/ckeditor5-link 44.3.0 → 45.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/LICENSE.md +1 -1
- package/build/link.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -0
- 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 -1
- 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/gu.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/hy.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/kk.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/oc.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/sl.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/ti.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/ckeditor5-metadata.json +2 -2
- package/dist/index-editor.css +87 -47
- package/dist/index.css +108 -58
- package/dist/index.css.map +1 -1
- package/dist/index.js +1161 -425
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/contexts.json +4 -3
- package/lang/translations/af.po +10 -6
- package/lang/translations/ar.po +11 -7
- package/lang/translations/ast.po +10 -6
- package/lang/translations/az.po +10 -6
- package/lang/translations/be.po +68 -0
- package/lang/translations/bg.po +11 -7
- package/lang/translations/bn.po +11 -7
- package/lang/translations/bs.po +10 -6
- package/lang/translations/ca.po +11 -7
- package/lang/translations/cs.po +11 -7
- package/lang/translations/da.po +11 -7
- package/lang/translations/de-ch.po +10 -6
- package/lang/translations/de.po +11 -7
- package/lang/translations/el.po +11 -7
- package/lang/translations/en-au.po +11 -7
- package/lang/translations/en-gb.po +11 -7
- package/lang/translations/en.po +11 -7
- package/lang/translations/eo.po +10 -6
- package/lang/translations/es-co.po +10 -6
- package/lang/translations/es.po +11 -7
- package/lang/translations/et.po +11 -7
- package/lang/translations/eu.po +10 -6
- package/lang/translations/fa.po +10 -6
- package/lang/translations/fi.po +11 -7
- package/lang/translations/fr.po +11 -7
- package/lang/translations/gl.po +10 -6
- package/lang/translations/gu.po +10 -6
- package/lang/translations/he.po +11 -7
- package/lang/translations/hi.po +11 -7
- package/lang/translations/hr.po +10 -6
- package/lang/translations/hu.po +11 -7
- package/lang/translations/hy.po +10 -6
- package/lang/translations/id.po +11 -7
- package/lang/translations/it.po +11 -7
- package/lang/translations/ja.po +11 -7
- package/lang/translations/jv.po +10 -6
- package/lang/translations/kk.po +10 -6
- package/lang/translations/km.po +10 -6
- package/lang/translations/kn.po +10 -6
- package/lang/translations/ko.po +11 -7
- package/lang/translations/ku.po +10 -6
- package/lang/translations/lt.po +11 -7
- package/lang/translations/lv.po +11 -7
- package/lang/translations/ms.po +11 -7
- package/lang/translations/nb.po +10 -6
- package/lang/translations/ne.po +10 -6
- package/lang/translations/nl.po +11 -7
- package/lang/translations/no.po +11 -7
- package/lang/translations/oc.po +10 -6
- package/lang/translations/pl.po +11 -7
- package/lang/translations/pt-br.po +11 -7
- package/lang/translations/pt.po +11 -7
- package/lang/translations/ro.po +11 -7
- package/lang/translations/ru.po +11 -7
- package/lang/translations/si.po +10 -6
- package/lang/translations/sk.po +11 -7
- package/lang/translations/sl.po +10 -6
- package/lang/translations/sq.po +10 -6
- package/lang/translations/sr-latn.po +10 -6
- package/lang/translations/sr.po +11 -7
- package/lang/translations/sv.po +11 -7
- package/lang/translations/th.po +11 -7
- package/lang/translations/ti.po +10 -6
- package/lang/translations/tk.po +10 -6
- package/lang/translations/tr.po +11 -7
- package/lang/translations/tt.po +10 -6
- package/lang/translations/ug.po +10 -6
- package/lang/translations/uk.po +11 -7
- package/lang/translations/ur.po +10 -6
- package/lang/translations/uz.po +10 -6
- package/lang/translations/vi.po +11 -7
- package/lang/translations/zh-cn.po +11 -7
- package/lang/translations/zh.po +11 -7
- package/package.json +12 -12
- package/src/autolink.js +3 -0
- package/src/index.d.ts +1 -2
- package/src/index.js +0 -1
- package/src/linkcommand.d.ts +17 -10
- package/src/linkcommand.js +212 -82
- package/src/linkconfig.d.ts +28 -0
- package/src/linkediting.d.ts +18 -0
- package/src/linkediting.js +19 -9
- package/src/linkimageui.d.ts +1 -1
- package/src/linkimageui.js +4 -4
- package/src/linkui.d.ts +215 -24
- package/src/linkui.js +517 -109
- package/src/ui/linkbuttonview.d.ts +31 -0
- package/src/ui/linkbuttonview.js +54 -0
- package/src/ui/linkformview.d.ts +34 -49
- package/src/ui/linkformview.js +163 -134
- package/src/ui/linkpreviewbuttonview.d.ts +35 -0
- package/src/ui/linkpreviewbuttonview.js +43 -0
- package/src/ui/linkpropertiesview.d.ts +88 -0
- package/src/ui/linkpropertiesview.js +170 -0
- package/src/ui/linkprovideritemsview.d.ts +114 -0
- package/src/ui/linkprovideritemsview.js +207 -0
- package/src/utils/automaticdecorators.js +5 -7
- package/src/utils/manualdecorator.js +27 -0
- package/src/utils.d.ts +5 -5
- package/src/utils.js +12 -32
- package/theme/linkform.css +11 -33
- package/theme/linkproperties.css +4 -0
- package/theme/linkprovideritems.css +18 -0
- package/theme/linktoolbar.css +12 -0
- package/src/ui/linkactionsview.d.ts +0 -117
- package/src/ui/linkactionsview.js +0 -173
- package/theme/icons/link.svg +0 -1
- package/theme/icons/unlink.svg +0 -1
- package/theme/linkactions.css +0 -32
package/src/linkui.d.ts
CHANGED
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* @module link/linkui
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { ContextualBalloon, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { ContextualBalloon, ToolbarView, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import LinkEditing from './linkediting.js';
|
|
10
11
|
import LinkFormView from './ui/linkformview.js';
|
|
11
|
-
import
|
|
12
|
+
import LinkProviderItemsView from './ui/linkprovideritemsview.js';
|
|
13
|
+
import LinkPropertiesView from './ui/linkpropertiesview.js';
|
|
14
|
+
import '../theme/linktoolbar.css';
|
|
12
15
|
/**
|
|
13
16
|
* The link UI plugin. It introduces the `'link'` and `'unlink'` buttons and support for the <kbd>Ctrl+K</kbd> keystroke.
|
|
14
17
|
*
|
|
@@ -17,21 +20,43 @@ import LinkActionsView from './ui/linkactionsview.js';
|
|
|
17
20
|
*/
|
|
18
21
|
export default class LinkUI extends Plugin {
|
|
19
22
|
/**
|
|
20
|
-
* The
|
|
23
|
+
* The toolbar view displayed inside of the balloon.
|
|
21
24
|
*/
|
|
22
|
-
|
|
25
|
+
toolbarView: ToolbarView | null;
|
|
23
26
|
/**
|
|
24
27
|
* The form view displayed inside the balloon.
|
|
25
28
|
*/
|
|
26
29
|
formView: LinkFormView & ViewWithCssTransitionDisabler | null;
|
|
30
|
+
/**
|
|
31
|
+
* The view displaying links list.
|
|
32
|
+
*/
|
|
33
|
+
linkProviderItemsView: LinkProviderItemsView | null;
|
|
34
|
+
/**
|
|
35
|
+
* The form view displaying properties link settings.
|
|
36
|
+
*/
|
|
37
|
+
propertiesView: LinkPropertiesView & ViewWithCssTransitionDisabler | null;
|
|
38
|
+
/**
|
|
39
|
+
* The selected text of the link or text that is selected and can become a link.
|
|
40
|
+
*
|
|
41
|
+
* Note: It is `undefined` when the current selection does not allow for text,
|
|
42
|
+
* for example any non text node is selected or multiple blocks are selected.
|
|
43
|
+
*
|
|
44
|
+
* @observable
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
selectedLinkableText: string | undefined;
|
|
27
48
|
/**
|
|
28
49
|
* The contextual balloon plugin instance.
|
|
29
50
|
*/
|
|
30
51
|
private _balloon;
|
|
52
|
+
/**
|
|
53
|
+
* The collection of the link providers.
|
|
54
|
+
*/
|
|
55
|
+
private _linksProviders;
|
|
31
56
|
/**
|
|
32
57
|
* @inheritDoc
|
|
33
58
|
*/
|
|
34
|
-
static get requires(): readonly [typeof ContextualBalloon];
|
|
59
|
+
static get requires(): readonly [typeof ContextualBalloon, typeof LinkEditing];
|
|
35
60
|
/**
|
|
36
61
|
* @inheritDoc
|
|
37
62
|
*/
|
|
@@ -48,23 +73,51 @@ export default class LinkUI extends Plugin {
|
|
|
48
73
|
* @inheritDoc
|
|
49
74
|
*/
|
|
50
75
|
destroy(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Registers list of buttons below the link form view that
|
|
78
|
+
* open a list of links provided by the clicked provider.
|
|
79
|
+
*/
|
|
80
|
+
registerLinksListProvider(provider: LinksProvider): void;
|
|
51
81
|
/**
|
|
52
82
|
* Creates views.
|
|
53
83
|
*/
|
|
54
84
|
private _createViews;
|
|
55
85
|
/**
|
|
56
|
-
* Creates the
|
|
86
|
+
* Creates the ToolbarView instance.
|
|
57
87
|
*/
|
|
58
|
-
private
|
|
88
|
+
private _createToolbarView;
|
|
59
89
|
/**
|
|
60
90
|
* Creates the {@link module:link/ui/linkformview~LinkFormView} instance.
|
|
61
91
|
*/
|
|
62
92
|
private _createFormView;
|
|
63
93
|
/**
|
|
64
|
-
* Creates a
|
|
65
|
-
* a {@link #_balloon} attached to the selection.
|
|
94
|
+
* Creates a sorted array of buttons with link names.
|
|
66
95
|
*/
|
|
67
|
-
private
|
|
96
|
+
private _createLinkProviderListView;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a view for links provider.
|
|
99
|
+
*/
|
|
100
|
+
private _createLinkProviderItemsView;
|
|
101
|
+
/**
|
|
102
|
+
* Creates the {@link module:link/ui/linkpropertiesview~LinkPropertiesView} instance.
|
|
103
|
+
*/
|
|
104
|
+
private _createPropertiesView;
|
|
105
|
+
/**
|
|
106
|
+
* Obtains the state of the manual decorators.
|
|
107
|
+
*/
|
|
108
|
+
private _getDecoratorSwitchesState;
|
|
109
|
+
/**
|
|
110
|
+
* Registers listeners used in editing plugin, used to open links.
|
|
111
|
+
*/
|
|
112
|
+
private _registerEditingOpeners;
|
|
113
|
+
/**
|
|
114
|
+
* Registers components in the ComponentFactory.
|
|
115
|
+
*/
|
|
116
|
+
private _registerComponents;
|
|
117
|
+
/**
|
|
118
|
+
* Creates a links button view.
|
|
119
|
+
*/
|
|
120
|
+
private _createLinksListProviderButton;
|
|
68
121
|
/**
|
|
69
122
|
* Creates a button for link command to use either in toolbar or in menu bar.
|
|
70
123
|
*/
|
|
@@ -80,29 +133,46 @@ export default class LinkUI extends Plugin {
|
|
|
80
133
|
*/
|
|
81
134
|
private _enableUserBalloonInteractions;
|
|
82
135
|
/**
|
|
83
|
-
* Adds the {@link #
|
|
136
|
+
* Adds the {@link #toolbarView} to the {@link #_balloon}.
|
|
84
137
|
*
|
|
85
138
|
* @internal
|
|
86
139
|
*/
|
|
87
|
-
|
|
140
|
+
_addToolbarView(): void;
|
|
88
141
|
/**
|
|
89
142
|
* Adds the {@link #formView} to the {@link #_balloon}.
|
|
90
143
|
*/
|
|
91
144
|
private _addFormView;
|
|
145
|
+
/**
|
|
146
|
+
* Adds the {@link #propertiesView} to the {@link #_balloon}.
|
|
147
|
+
*/
|
|
148
|
+
private _addPropertiesView;
|
|
149
|
+
/**
|
|
150
|
+
* Shows the view with links provided by the given provider.
|
|
151
|
+
*/
|
|
152
|
+
private _showLinksProviderView;
|
|
153
|
+
/**
|
|
154
|
+
* Adds the {@link #linkProviderItemsView} to the {@link #_balloon}.
|
|
155
|
+
*/
|
|
156
|
+
private _addLinkProviderItemsView;
|
|
92
157
|
/**
|
|
93
158
|
* Closes the form view. Decides whether the balloon should be hidden completely or if the action view should be shown. This is
|
|
94
159
|
* decided upon the link command value (which has a value if the document selection is in the link).
|
|
95
|
-
*
|
|
96
|
-
* Additionally, if any {@link module:link/linkconfig~LinkConfig#decorators} are defined in the editor configuration, the state of
|
|
97
|
-
* switch buttons responsible for manual decorator handling is restored.
|
|
98
160
|
*/
|
|
99
161
|
private _closeFormView;
|
|
162
|
+
/**
|
|
163
|
+
* Removes the {@link #propertiesView} from the {@link #_balloon}.
|
|
164
|
+
*/
|
|
165
|
+
private _removePropertiesView;
|
|
166
|
+
/**
|
|
167
|
+
* Removes the {@link #linkProviderItemsView} from the {@link #_balloon}.
|
|
168
|
+
*/
|
|
169
|
+
private _removeLinksProviderView;
|
|
100
170
|
/**
|
|
101
171
|
* Removes the {@link #formView} from the {@link #_balloon}.
|
|
102
172
|
*/
|
|
103
173
|
private _removeFormView;
|
|
104
174
|
/**
|
|
105
|
-
* Shows the correct UI type. It is either {@link #formView} or {@link #
|
|
175
|
+
* Shows the correct UI type. It is either {@link #formView} or {@link #toolbarView}.
|
|
106
176
|
*
|
|
107
177
|
* @internal
|
|
108
178
|
*/
|
|
@@ -110,7 +180,7 @@ export default class LinkUI extends Plugin {
|
|
|
110
180
|
/**
|
|
111
181
|
* Removes the {@link #formView} from the {@link #_balloon}.
|
|
112
182
|
*
|
|
113
|
-
* See {@link #_addFormView}, {@link #
|
|
183
|
+
* See {@link #_addFormView}, {@link #_addToolbarView}.
|
|
114
184
|
*/
|
|
115
185
|
private _hideUI;
|
|
116
186
|
/**
|
|
@@ -120,27 +190,46 @@ export default class LinkUI extends Plugin {
|
|
|
120
190
|
* See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
|
|
121
191
|
*/
|
|
122
192
|
private _startUpdatingUI;
|
|
193
|
+
/**
|
|
194
|
+
* Returns `true` when {@link #propertiesView} is in the {@link #_balloon}.
|
|
195
|
+
*/
|
|
196
|
+
private get _arePropertiesInPanel();
|
|
197
|
+
/**
|
|
198
|
+
* Returns `true` when {@link #linkProviderItemsView} is in the {@link #_balloon}.
|
|
199
|
+
*/
|
|
200
|
+
private get _isLinksListInPanel();
|
|
123
201
|
/**
|
|
124
202
|
* Returns `true` when {@link #formView} is in the {@link #_balloon}.
|
|
125
203
|
*/
|
|
126
204
|
private get _isFormInPanel();
|
|
127
205
|
/**
|
|
128
|
-
* Returns `true` when {@link #
|
|
206
|
+
* Returns `true` when {@link #toolbarView} is in the {@link #_balloon}.
|
|
129
207
|
*/
|
|
130
|
-
private get
|
|
208
|
+
private get _isToolbarInPanel();
|
|
131
209
|
/**
|
|
132
|
-
* Returns `true` when {@link #
|
|
210
|
+
* Returns `true` when {@link #propertiesView} is in the {@link #_balloon} and it is
|
|
133
211
|
* currently visible.
|
|
134
212
|
*/
|
|
135
|
-
private get
|
|
213
|
+
private get _isPropertiesVisible();
|
|
136
214
|
/**
|
|
137
|
-
* Returns `true` when {@link #
|
|
215
|
+
* Returns `true` when {@link #formView} is in the {@link #_balloon} and it is
|
|
216
|
+
* currently visible.
|
|
138
217
|
*/
|
|
139
|
-
private get
|
|
218
|
+
private get _isFormVisible();
|
|
140
219
|
/**
|
|
141
|
-
* Returns `true` when {@link #
|
|
220
|
+
* Returns `true` when {@link #toolbarView} is in the {@link #_balloon} and it is
|
|
142
221
|
* currently visible.
|
|
143
222
|
*/
|
|
223
|
+
private get _isToolbarVisible();
|
|
224
|
+
/**
|
|
225
|
+
* Returns `true` when {@link #propertiesView}, {@link #toolbarView}, {@link #linkProviderItemsView}
|
|
226
|
+
* or {@link #formView} is in the {@link #_balloon}.
|
|
227
|
+
*/
|
|
228
|
+
private get _isUIInPanel();
|
|
229
|
+
/**
|
|
230
|
+
* Returns `true` when {@link #propertiesView}, {@link #linkProviderItemsView}, {@link #toolbarView}
|
|
231
|
+
* or {@link #formView} is in the {@link #_balloon} and it is currently visible.
|
|
232
|
+
*/
|
|
144
233
|
private get _isUIVisible();
|
|
145
234
|
/**
|
|
146
235
|
* Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached
|
|
@@ -160,6 +249,19 @@ export default class LinkUI extends Plugin {
|
|
|
160
249
|
* a linked widget is selected.
|
|
161
250
|
*/
|
|
162
251
|
private _getSelectedLinkElement;
|
|
252
|
+
/**
|
|
253
|
+
* Returns selected link text content.
|
|
254
|
+
* If link is not selected it returns the selected text.
|
|
255
|
+
* If selection or link includes non text node (inline object or block) then returns undefined.
|
|
256
|
+
*/
|
|
257
|
+
private _getSelectedLinkableText;
|
|
258
|
+
/**
|
|
259
|
+
* Returns a provider by its URL.
|
|
260
|
+
*
|
|
261
|
+
* @param href URL of the link.
|
|
262
|
+
* @returns Link provider and item or `null` if not found.
|
|
263
|
+
*/
|
|
264
|
+
private _getLinkProviderLinkByHref;
|
|
163
265
|
/**
|
|
164
266
|
* Displays a fake visual selection when the contextual balloon is displayed.
|
|
165
267
|
*
|
|
@@ -171,3 +273,92 @@ export default class LinkUI extends Plugin {
|
|
|
171
273
|
*/
|
|
172
274
|
private _hideFakeVisualSelection;
|
|
173
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Link list item that represents a single link in the provider's list.
|
|
278
|
+
* It's displayed after the user clicks the button that opens the list in the link form view.
|
|
279
|
+
*/
|
|
280
|
+
export type LinksProviderListItem = {
|
|
281
|
+
/**
|
|
282
|
+
* Unique identifier of the item. Avoids collection malfunction when there are links with the same labels.
|
|
283
|
+
*/
|
|
284
|
+
id: string;
|
|
285
|
+
/**
|
|
286
|
+
* URL of the link.
|
|
287
|
+
*/
|
|
288
|
+
href: string;
|
|
289
|
+
/**
|
|
290
|
+
* Label that is used as a text for the list item.
|
|
291
|
+
*/
|
|
292
|
+
label: string;
|
|
293
|
+
/**
|
|
294
|
+
* Optional icon displayed for the item.
|
|
295
|
+
*/
|
|
296
|
+
icon?: string;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Link list item with additional attributes that will be used when:
|
|
300
|
+
*
|
|
301
|
+
* * The item is selected and the preview of the item is displayed.
|
|
302
|
+
* * The user selects the item and the link is created.
|
|
303
|
+
* * The user navigates to the item using editing.
|
|
304
|
+
*
|
|
305
|
+
* It can be used to perform additional lookups in the database or to provide additional information about the link.
|
|
306
|
+
*/
|
|
307
|
+
export type LinksProviderDetailedItem = {
|
|
308
|
+
/**
|
|
309
|
+
* URL of the link.
|
|
310
|
+
*/
|
|
311
|
+
href: string;
|
|
312
|
+
/**
|
|
313
|
+
* Optional icon displayed when the user opens toolbar with the item preview.
|
|
314
|
+
*/
|
|
315
|
+
icon?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Optional label shown in the link preview. If not passed then the `href` is used as the label.
|
|
318
|
+
*/
|
|
319
|
+
label?: string;
|
|
320
|
+
/**
|
|
321
|
+
* Optional tooltip shown in the link preview.
|
|
322
|
+
*/
|
|
323
|
+
tooltip?: string;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Interface for a provider that provides a list of links to be displayed in the link form view.
|
|
327
|
+
*/
|
|
328
|
+
export type LinksProvider = {
|
|
329
|
+
/**
|
|
330
|
+
* Label that serves two purposes:
|
|
331
|
+
*
|
|
332
|
+
* * As a text for the button that opens this link list from within link form view.
|
|
333
|
+
* * As a text for the header when the list of links from this provider is displayed.
|
|
334
|
+
*/
|
|
335
|
+
label: string;
|
|
336
|
+
/**
|
|
337
|
+
* Message to be displayed when there are no items in the list.
|
|
338
|
+
* It's optional and if not provided, a default message will be displayed.
|
|
339
|
+
*/
|
|
340
|
+
emptyListPlaceholder?: string;
|
|
341
|
+
/**
|
|
342
|
+
* Weight used for ordering providers in the list. Higher weight means the provider will be displayed lower in the list.
|
|
343
|
+
*
|
|
344
|
+
* @default 0
|
|
345
|
+
*/
|
|
346
|
+
order?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Callback for retrieving an static array of items which is being called every time the list is displayed.
|
|
349
|
+
* It's not required to provide all links at once, it's possible to pass only slice of links.
|
|
350
|
+
*/
|
|
351
|
+
getListItems(): Array<LinksProviderListItem>;
|
|
352
|
+
/**
|
|
353
|
+
* Optional callback for retrieving an item by its URL.
|
|
354
|
+
* If not provided the item from the list will be used.
|
|
355
|
+
*/
|
|
356
|
+
getItem?(href: string): LinksProviderDetailedItem | null;
|
|
357
|
+
/**
|
|
358
|
+
* Callback called when user clicked the link in the list.
|
|
359
|
+
*
|
|
360
|
+
* @param item Item that was clicked.
|
|
361
|
+
* @returns `true` if the link was handled by the provider, `false` otherwise. It'll prevent the default action if `true`.
|
|
362
|
+
*/
|
|
363
|
+
navigate?(item: LinksProviderDetailedItem): boolean;
|
|
364
|
+
};
|