@ckeditor/ckeditor5-link 41.3.0-alpha.4 → 41.3.1

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 (150) hide show
  1. package/build/link.js +1 -1
  2. package/package.json +3 -4
  3. package/src/index.d.ts +1 -1
  4. package/src/linkui.d.ts +4 -0
  5. package/src/linkui.js +29 -14
  6. package/dist/content-index.css +0 -4
  7. package/dist/editor-index.css +0 -43
  8. package/dist/index.css +0 -147
  9. package/dist/index.css.map +0 -1
  10. package/dist/translations/ar.d.ts +0 -8
  11. package/dist/translations/ar.js +0 -5
  12. package/dist/translations/ast.d.ts +0 -8
  13. package/dist/translations/ast.js +0 -5
  14. package/dist/translations/az.d.ts +0 -8
  15. package/dist/translations/az.js +0 -5
  16. package/dist/translations/bg.d.ts +0 -8
  17. package/dist/translations/bg.js +0 -5
  18. package/dist/translations/bn.d.ts +0 -8
  19. package/dist/translations/bn.js +0 -5
  20. package/dist/translations/ca.d.ts +0 -8
  21. package/dist/translations/ca.js +0 -5
  22. package/dist/translations/cs.d.ts +0 -8
  23. package/dist/translations/cs.js +0 -5
  24. package/dist/translations/da.d.ts +0 -8
  25. package/dist/translations/da.js +0 -5
  26. package/dist/translations/de-ch.d.ts +0 -8
  27. package/dist/translations/de-ch.js +0 -5
  28. package/dist/translations/de.d.ts +0 -8
  29. package/dist/translations/de.js +0 -5
  30. package/dist/translations/el.d.ts +0 -8
  31. package/dist/translations/el.js +0 -5
  32. package/dist/translations/en-au.d.ts +0 -8
  33. package/dist/translations/en-au.js +0 -5
  34. package/dist/translations/en-gb.d.ts +0 -8
  35. package/dist/translations/en-gb.js +0 -5
  36. package/dist/translations/en.d.ts +0 -8
  37. package/dist/translations/en.js +0 -5
  38. package/dist/translations/eo.d.ts +0 -8
  39. package/dist/translations/eo.js +0 -5
  40. package/dist/translations/es.d.ts +0 -8
  41. package/dist/translations/es.js +0 -5
  42. package/dist/translations/et.d.ts +0 -8
  43. package/dist/translations/et.js +0 -5
  44. package/dist/translations/eu.d.ts +0 -8
  45. package/dist/translations/eu.js +0 -5
  46. package/dist/translations/fa.d.ts +0 -8
  47. package/dist/translations/fa.js +0 -5
  48. package/dist/translations/fi.d.ts +0 -8
  49. package/dist/translations/fi.js +0 -5
  50. package/dist/translations/fr.d.ts +0 -8
  51. package/dist/translations/fr.js +0 -5
  52. package/dist/translations/gl.d.ts +0 -8
  53. package/dist/translations/gl.js +0 -5
  54. package/dist/translations/he.d.ts +0 -8
  55. package/dist/translations/he.js +0 -5
  56. package/dist/translations/hi.d.ts +0 -8
  57. package/dist/translations/hi.js +0 -5
  58. package/dist/translations/hr.d.ts +0 -8
  59. package/dist/translations/hr.js +0 -5
  60. package/dist/translations/hu.d.ts +0 -8
  61. package/dist/translations/hu.js +0 -5
  62. package/dist/translations/hy.d.ts +0 -8
  63. package/dist/translations/hy.js +0 -5
  64. package/dist/translations/id.d.ts +0 -8
  65. package/dist/translations/id.js +0 -5
  66. package/dist/translations/it.d.ts +0 -8
  67. package/dist/translations/it.js +0 -5
  68. package/dist/translations/ja.d.ts +0 -8
  69. package/dist/translations/ja.js +0 -5
  70. package/dist/translations/km.d.ts +0 -8
  71. package/dist/translations/km.js +0 -5
  72. package/dist/translations/kn.d.ts +0 -8
  73. package/dist/translations/kn.js +0 -5
  74. package/dist/translations/ko.d.ts +0 -8
  75. package/dist/translations/ko.js +0 -5
  76. package/dist/translations/ku.d.ts +0 -8
  77. package/dist/translations/ku.js +0 -5
  78. package/dist/translations/lt.d.ts +0 -8
  79. package/dist/translations/lt.js +0 -5
  80. package/dist/translations/lv.d.ts +0 -8
  81. package/dist/translations/lv.js +0 -5
  82. package/dist/translations/ms.d.ts +0 -8
  83. package/dist/translations/ms.js +0 -5
  84. package/dist/translations/nb.d.ts +0 -8
  85. package/dist/translations/nb.js +0 -5
  86. package/dist/translations/ne.d.ts +0 -8
  87. package/dist/translations/ne.js +0 -5
  88. package/dist/translations/nl.d.ts +0 -8
  89. package/dist/translations/nl.js +0 -5
  90. package/dist/translations/no.d.ts +0 -8
  91. package/dist/translations/no.js +0 -5
  92. package/dist/translations/pl.d.ts +0 -8
  93. package/dist/translations/pl.js +0 -5
  94. package/dist/translations/pt-br.d.ts +0 -8
  95. package/dist/translations/pt-br.js +0 -5
  96. package/dist/translations/pt.d.ts +0 -8
  97. package/dist/translations/pt.js +0 -5
  98. package/dist/translations/ro.d.ts +0 -8
  99. package/dist/translations/ro.js +0 -5
  100. package/dist/translations/ru.d.ts +0 -8
  101. package/dist/translations/ru.js +0 -5
  102. package/dist/translations/sk.d.ts +0 -8
  103. package/dist/translations/sk.js +0 -5
  104. package/dist/translations/sq.d.ts +0 -8
  105. package/dist/translations/sq.js +0 -5
  106. package/dist/translations/sr-latn.d.ts +0 -8
  107. package/dist/translations/sr-latn.js +0 -5
  108. package/dist/translations/sr.d.ts +0 -8
  109. package/dist/translations/sr.js +0 -5
  110. package/dist/translations/sv.d.ts +0 -8
  111. package/dist/translations/sv.js +0 -5
  112. package/dist/translations/th.d.ts +0 -8
  113. package/dist/translations/th.js +0 -5
  114. package/dist/translations/tk.d.ts +0 -8
  115. package/dist/translations/tk.js +0 -5
  116. package/dist/translations/tr.d.ts +0 -8
  117. package/dist/translations/tr.js +0 -5
  118. package/dist/translations/tt.d.ts +0 -8
  119. package/dist/translations/tt.js +0 -5
  120. package/dist/translations/ug.d.ts +0 -8
  121. package/dist/translations/ug.js +0 -5
  122. package/dist/translations/uk.d.ts +0 -8
  123. package/dist/translations/uk.js +0 -5
  124. package/dist/translations/ur.d.ts +0 -8
  125. package/dist/translations/ur.js +0 -5
  126. package/dist/translations/uz.d.ts +0 -8
  127. package/dist/translations/uz.js +0 -5
  128. package/dist/translations/vi.d.ts +0 -8
  129. package/dist/translations/vi.js +0 -5
  130. package/dist/translations/zh-cn.d.ts +0 -8
  131. package/dist/translations/zh-cn.js +0 -5
  132. package/dist/translations/zh.d.ts +0 -8
  133. package/dist/translations/zh.js +0 -5
  134. package/dist/types/augmentation.d.ts +0 -34
  135. package/dist/types/autolink.d.ts +0 -79
  136. package/dist/types/index.d.ts +0 -22
  137. package/dist/types/link.d.ts +0 -31
  138. package/dist/types/linkcommand.d.ts +0 -136
  139. package/dist/types/linkconfig.d.ts +0 -294
  140. package/dist/types/linkediting.d.ts +0 -74
  141. package/dist/types/linkimage.d.ts +0 -31
  142. package/dist/types/linkimageediting.d.ts +0 -43
  143. package/dist/types/linkimageui.d.ts +0 -44
  144. package/dist/types/linkui.d.ts +0 -169
  145. package/dist/types/ui/linkactionsview.d.ts +0 -107
  146. package/dist/types/ui/linkformview.d.ts +0 -145
  147. package/dist/types/unlinkcommand.d.ts +0 -35
  148. package/dist/types/utils/automaticdecorators.d.ts +0 -49
  149. package/dist/types/utils/manualdecorator.d.ts +0 -76
  150. package/dist/types/utils.d.ts +0 -84
@@ -1,169 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/linkui
11
- */
12
- import { Plugin } from 'ckeditor5/src/core.js';
13
- import { ContextualBalloon, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
14
- import LinkFormView from './ui/linkformview.js';
15
- import LinkActionsView from './ui/linkactionsview.js';
16
- /**
17
- * The link UI plugin. It introduces the `'link'` and `'unlink'` buttons and support for the <kbd>Ctrl+K</kbd> keystroke.
18
- *
19
- * It uses the
20
- * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
21
- */
22
- export default class LinkUI extends Plugin {
23
- /**
24
- * The actions view displayed inside of the balloon.
25
- */
26
- actionsView: LinkActionsView | null;
27
- /**
28
- * The form view displayed inside the balloon.
29
- */
30
- formView: LinkFormView & ViewWithCssTransitionDisabler | null;
31
- /**
32
- * The contextual balloon plugin instance.
33
- */
34
- private _balloon;
35
- /**
36
- * @inheritDoc
37
- */
38
- static get requires(): readonly [typeof ContextualBalloon];
39
- /**
40
- * @inheritDoc
41
- */
42
- static get pluginName(): "LinkUI";
43
- /**
44
- * @inheritDoc
45
- */
46
- init(): void;
47
- /**
48
- * @inheritDoc
49
- */
50
- destroy(): void;
51
- /**
52
- * Creates views.
53
- */
54
- private _createViews;
55
- /**
56
- * Creates the {@link module:link/ui/linkactionsview~LinkActionsView} instance.
57
- */
58
- private _createActionsView;
59
- /**
60
- * Creates the {@link module:link/ui/linkformview~LinkFormView} instance.
61
- */
62
- private _createFormView;
63
- /**
64
- * Creates a toolbar Link button. Clicking this button will show
65
- * a {@link #_balloon} attached to the selection.
66
- */
67
- private _createToolbarLinkButton;
68
- /**
69
- * Attaches actions that control whether the balloon panel containing the
70
- * {@link #formView} should be displayed.
71
- */
72
- private _enableBalloonActivators;
73
- /**
74
- * Attaches actions that control whether the balloon panel containing the
75
- * {@link #formView} is visible or not.
76
- */
77
- private _enableUserBalloonInteractions;
78
- /**
79
- * Adds the {@link #actionsView} to the {@link #_balloon}.
80
- *
81
- * @internal
82
- */
83
- _addActionsView(): void;
84
- /**
85
- * Adds the {@link #formView} to the {@link #_balloon}.
86
- */
87
- private _addFormView;
88
- /**
89
- * Closes the form view. Decides whether the balloon should be hidden completely or if the action view should be shown. This is
90
- * decided upon the link command value (which has a value if the document selection is in the link).
91
- *
92
- * Additionally, if any {@link module:link/linkconfig~LinkConfig#decorators} are defined in the editor configuration, the state of
93
- * switch buttons responsible for manual decorator handling is restored.
94
- */
95
- private _closeFormView;
96
- /**
97
- * Removes the {@link #formView} from the {@link #_balloon}.
98
- */
99
- private _removeFormView;
100
- /**
101
- * Shows the correct UI type. It is either {@link #formView} or {@link #actionsView}.
102
- *
103
- * @internal
104
- */
105
- _showUI(forceVisible?: boolean): void;
106
- /**
107
- * Removes the {@link #formView} from the {@link #_balloon}.
108
- *
109
- * See {@link #_addFormView}, {@link #_addActionsView}.
110
- */
111
- private _hideUI;
112
- /**
113
- * Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to
114
- * reposition itself when the editor UI should be refreshed.
115
- *
116
- * See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
117
- */
118
- private _startUpdatingUI;
119
- /**
120
- * Returns `true` when {@link #formView} is in the {@link #_balloon}.
121
- */
122
- private get _isFormInPanel();
123
- /**
124
- * Returns `true` when {@link #actionsView} is in the {@link #_balloon}.
125
- */
126
- private get _areActionsInPanel();
127
- /**
128
- * Returns `true` when {@link #actionsView} is in the {@link #_balloon} and it is
129
- * currently visible.
130
- */
131
- private get _areActionsVisible();
132
- /**
133
- * Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon}.
134
- */
135
- private get _isUIInPanel();
136
- /**
137
- * Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon} and it is
138
- * currently visible.
139
- */
140
- private get _isUIVisible();
141
- /**
142
- * Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached
143
- * to the target element or selection.
144
- *
145
- * If the selection is collapsed and inside a link element, the panel will be attached to the
146
- * entire link element. Otherwise, it will be attached to the selection.
147
- */
148
- private _getBalloonPositionData;
149
- /**
150
- * Returns the link {@link module:engine/view/attributeelement~AttributeElement} under
151
- * the {@link module:engine/view/document~Document editing view's} selection or `null`
152
- * if there is none.
153
- *
154
- * **Note**: For a non–collapsed selection, the link element is returned when **fully**
155
- * selected and the **only** element within the selection boundaries, or when
156
- * a linked widget is selected.
157
- */
158
- private _getSelectedLinkElement;
159
- /**
160
- * Displays a fake visual selection when the contextual balloon is displayed.
161
- *
162
- * This adds a 'link-ui' marker into the document that is rendered as a highlight on selected text fragment.
163
- */
164
- private _showFakeVisualSelection;
165
- /**
166
- * Hides the fake visual selection created in {@link #_showFakeVisualSelection}.
167
- */
168
- private _hideFakeVisualSelection;
169
- }
@@ -1,107 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/ui/linkactionsview
11
- */
12
- import { ButtonView, View } from 'ckeditor5/src/ui.js';
13
- import { FocusTracker, KeystrokeHandler, type LocaleTranslate, type Locale } from 'ckeditor5/src/utils.js';
14
- import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
15
- import '../../theme/linkactions.css';
16
- import type { LinkConfig } from '../linkconfig.js';
17
- /**
18
- * The link actions view class. This view displays the link preview, allows
19
- * unlinking or editing the link.
20
- */
21
- export default class LinkActionsView extends View {
22
- /**
23
- * Tracks information about DOM focus in the actions.
24
- */
25
- readonly focusTracker: FocusTracker;
26
- /**
27
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
28
- */
29
- readonly keystrokes: KeystrokeHandler;
30
- /**
31
- * The href preview view.
32
- */
33
- previewButtonView: ButtonView;
34
- /**
35
- * The unlink button view.
36
- */
37
- unlinkButtonView: ButtonView;
38
- /**
39
- * The edit link button view.
40
- */
41
- editButtonView: ButtonView;
42
- /**
43
- * The value of the "href" attribute of the link to use in the {@link #previewButtonView}.
44
- *
45
- * @observable
46
- */
47
- href: string | undefined;
48
- /**
49
- * A collection of views that can be focused in the view.
50
- */
51
- private readonly _focusables;
52
- /**
53
- * Helps cycling over {@link #_focusables} in the view.
54
- */
55
- private readonly _focusCycler;
56
- private readonly _linkConfig;
57
- t: LocaleTranslate;
58
- /**
59
- * @inheritDoc
60
- */
61
- constructor(locale: Locale, linkConfig?: LinkConfig);
62
- /**
63
- * @inheritDoc
64
- */
65
- render(): void;
66
- /**
67
- * @inheritDoc
68
- */
69
- destroy(): void;
70
- /**
71
- * Focuses the fist {@link #_focusables} in the actions.
72
- */
73
- focus(): void;
74
- /**
75
- * Creates a button view.
76
- *
77
- * @param label The button label.
78
- * @param icon The button icon.
79
- * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
80
- * @returns The button view instance.
81
- */
82
- private _createButton;
83
- /**
84
- * Creates a link href preview button.
85
- *
86
- * @returns The button view instance.
87
- */
88
- private _createPreviewButton;
89
- }
90
- /**
91
- * Fired when the {@link ~LinkActionsView#editButtonView} is clicked.
92
- *
93
- * @eventName ~LinkActionsView#edit
94
- */
95
- export type EditEvent = {
96
- name: 'edit';
97
- args: [];
98
- };
99
- /**
100
- * Fired when the {@link ~LinkActionsView#unlinkButtonView} is clicked.
101
- *
102
- * @eventName ~LinkActionsView#unlink
103
- */
104
- export type UnlinkEvent = {
105
- name: 'unlink';
106
- args: [];
107
- };
@@ -1,145 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/ui/linkformview
11
- */
12
- import { ButtonView, LabeledFieldView, View, ViewCollection, type InputTextView } from 'ckeditor5/src/ui.js';
13
- import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
14
- import type LinkCommand from '../linkcommand.js';
15
- import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
16
- import '../../theme/linkform.css';
17
- /**
18
- * The link form view controller class.
19
- *
20
- * See {@link module:link/ui/linkformview~LinkFormView}.
21
- */
22
- export default class LinkFormView extends View {
23
- /**
24
- * Tracks information about DOM focus in the form.
25
- */
26
- readonly focusTracker: FocusTracker;
27
- /**
28
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
29
- */
30
- readonly keystrokes: KeystrokeHandler;
31
- /**
32
- * The URL input view.
33
- */
34
- urlInputView: LabeledFieldView<InputTextView>;
35
- /**
36
- * The Save button view.
37
- */
38
- saveButtonView: ButtonView;
39
- /**
40
- * The Cancel button view.
41
- */
42
- cancelButtonView: ButtonView;
43
- /**
44
- * A collection of {@link module:ui/button/switchbuttonview~SwitchButtonView},
45
- * which corresponds to {@link module:link/linkcommand~LinkCommand#manualDecorators manual decorators}
46
- * configured in the editor.
47
- */
48
- private readonly _manualDecoratorSwitches;
49
- /**
50
- * A collection of child views in the form.
51
- */
52
- readonly children: ViewCollection;
53
- /**
54
- * A collection of views that can be focused in the form.
55
- */
56
- private readonly _focusables;
57
- /**
58
- * Helps cycling over {@link #_focusables} in the form.
59
- */
60
- private readonly _focusCycler;
61
- /**
62
- * Creates an instance of the {@link module:link/ui/linkformview~LinkFormView} class.
63
- *
64
- * Also see {@link #render}.
65
- *
66
- * @param locale The localization services instance.
67
- * @param linkCommand Reference to {@link module:link/linkcommand~LinkCommand}.
68
- */
69
- constructor(locale: Locale, linkCommand: LinkCommand);
70
- /**
71
- * Obtains the state of the {@link module:ui/button/switchbuttonview~SwitchButtonView switch buttons} representing
72
- * {@link module:link/linkcommand~LinkCommand#manualDecorators manual link decorators}
73
- * in the {@link module:link/ui/linkformview~LinkFormView}.
74
- *
75
- * @returns Key-value pairs, where the key is the name of the decorator and the value is its state.
76
- */
77
- getDecoratorSwitchesState(): Record<string, boolean>;
78
- /**
79
- * @inheritDoc
80
- */
81
- render(): void;
82
- /**
83
- * @inheritDoc
84
- */
85
- destroy(): void;
86
- /**
87
- * Focuses the fist {@link #_focusables} in the form.
88
- */
89
- focus(): void;
90
- /**
91
- * Creates a labeled input view.
92
- *
93
- * @returns Labeled field view instance.
94
- */
95
- private _createUrlInput;
96
- /**
97
- * Creates a button view.
98
- *
99
- * @param label The button label.
100
- * @param icon The button icon.
101
- * @param className The additional button CSS class name.
102
- * @param eventName An event name that the `ButtonView#execute` event will be delegated to.
103
- * @returns The button view instance.
104
- */
105
- private _createButton;
106
- /**
107
- * Populates {@link module:ui/viewcollection~ViewCollection} of {@link module:ui/button/switchbuttonview~SwitchButtonView}
108
- * made based on {@link module:link/linkcommand~LinkCommand#manualDecorators}.
109
- *
110
- * @param linkCommand A reference to the link command.
111
- * @returns ViewCollection of switch buttons.
112
- */
113
- private _createManualDecoratorSwitches;
114
- /**
115
- * Populates the {@link #children} collection of the form.
116
- *
117
- * If {@link module:link/linkcommand~LinkCommand#manualDecorators manual decorators} are configured in the editor, it creates an
118
- * additional `View` wrapping all {@link #_manualDecoratorSwitches} switch buttons corresponding
119
- * to these decorators.
120
- *
121
- * @param manualDecorators A reference to
122
- * the collection of manual decorators stored in the link command.
123
- * @returns The children of link form view.
124
- */
125
- private _createFormChildren;
126
- }
127
- /**
128
- * Fired when the form view is submitted (when one of the children triggered the submit event),
129
- * for example with a click on {@link ~LinkFormView#saveButtonView}.
130
- *
131
- * @eventName ~LinkFormView#submit
132
- */
133
- export type SubmitEvent = {
134
- name: 'submit';
135
- args: [];
136
- };
137
- /**
138
- * Fired when the form view is canceled, for example with a click on {@link ~LinkFormView#cancelButtonView}.
139
- *
140
- * @eventName ~LinkFormView#cancel
141
- */
142
- export type CancelEvent = {
143
- name: 'cancel';
144
- args: [];
145
- };
@@ -1,35 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/unlinkcommand
11
- */
12
- import { Command } from 'ckeditor5/src/core.js';
13
- /**
14
- * The unlink command. It is used by the {@link module:link/link~Link link plugin}.
15
- */
16
- export default class UnlinkCommand extends Command {
17
- /**
18
- * @inheritDoc
19
- */
20
- refresh(): void;
21
- /**
22
- * Executes the command.
23
- *
24
- * When the selection is collapsed, it removes the `linkHref` attribute from each node with the same `linkHref` attribute value.
25
- * When the selection is non-collapsed, it removes the `linkHref` attribute from each node in selected ranges.
26
- *
27
- * # Decorators
28
- *
29
- * If {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} is specified,
30
- * all configured decorators are removed together with the `linkHref` attribute.
31
- *
32
- * @fires execute
33
- */
34
- execute(): void;
35
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/utils/automaticdecorators
11
- */
12
- import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
13
- import type { DowncastDispatcher } from 'ckeditor5/src/engine.js';
14
- import type { NormalizedLinkDecoratorAutomaticDefinition } from '../utils.js';
15
- /**
16
- * Helper class that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition} and provides
17
- * the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement downcast dispatchers} for them.
18
- */
19
- export default class AutomaticDecorators {
20
- /**
21
- * Stores the definition of {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}.
22
- * This data is used as a source for a downcast dispatcher to create a proper conversion to output data.
23
- */
24
- private _definitions;
25
- /**
26
- * Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~AutomaticDecorators}
27
- * instance.
28
- */
29
- get length(): number;
30
- /**
31
- * Adds automatic decorator objects or an array with them to be used during downcasting.
32
- *
33
- * @param item A configuration object of automatic rules for decorating links. It might also be an array of such objects.
34
- */
35
- add(item: ArrayOrItem<NormalizedLinkDecoratorAutomaticDefinition>): void;
36
- /**
37
- * Provides the conversion helper used in the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add} method.
38
- *
39
- * @returns A dispatcher function used as conversion helper in {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add}.
40
- */
41
- getDispatcher(): (dispatcher: DowncastDispatcher) => void;
42
- /**
43
- * Provides the conversion helper used in the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add} method
44
- * when linking images.
45
- *
46
- * @returns A dispatcher function used as conversion helper in {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add}.
47
- */
48
- getDispatcherForLinkedImage(): (dispatcher: DowncastDispatcher) => void;
49
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/utils/manualdecorator
11
- */
12
- import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
13
- import type { MatcherObjectPattern } from 'ckeditor5/src/engine.js';
14
- import type { NormalizedLinkDecoratorManualDefinition } from '../utils.js';
15
- declare const ManualDecorator_base: {
16
- new (): import("ckeditor5/src/utils.js").Observable;
17
- prototype: import("ckeditor5/src/utils.js").Observable;
18
- };
19
- /**
20
- * Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~ManualDecorator#value}
21
- * to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.
22
- * These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.
23
- */
24
- export default class ManualDecorator extends ManualDecorator_base {
25
- /**
26
- * An ID of a manual decorator which is the name of the attribute in the model, for example: 'linkManualDecorator0'.
27
- */
28
- id: string;
29
- /**
30
- * The value of the current manual decorator. It reflects its state from the UI.
31
- *
32
- * @observable
33
- */
34
- value: boolean | undefined;
35
- /**
36
- * The default value of manual decorator.
37
- */
38
- defaultValue?: boolean;
39
- /**
40
- * The label used in the user interface to toggle the manual decorator.
41
- */
42
- label: string;
43
- /**
44
- * A set of attributes added to downcasted data when the decorator is activated for a specific link.
45
- * Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
46
- */
47
- attributes?: Record<string, string>;
48
- /**
49
- * A set of classes added to downcasted data when the decorator is activated for a specific link.
50
- * Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
51
- */
52
- classes?: ArrayOrItem<string>;
53
- /**
54
- * A set of styles added to downcasted data when the decorator is activated for a specific link.
55
- * Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
56
- */
57
- styles?: Record<string, string>;
58
- /**
59
- * Creates a new instance of {@link module:link/utils/manualdecorator~ManualDecorator}.
60
- *
61
- * @param config.id The name of the attribute used in the model that represents a given manual decorator.
62
- * For example: `'linkIsExternal'`.
63
- * @param config.label The label used in the user interface to toggle the manual decorator.
64
- * @param config.attributes A set of attributes added to output data when the decorator is active for a specific link.
65
- * Attributes should keep the format of attributes defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
66
- * @param [config.defaultValue] Controls whether the decorator is "on" by default.
67
- */
68
- constructor({ id, label, attributes, classes, styles, defaultValue }: NormalizedLinkDecoratorManualDefinition);
69
- /**
70
- * Returns {@link module:engine/view/matcher~MatcherPattern} with decorator attributes.
71
- *
72
- * @internal
73
- */
74
- _createPattern(): MatcherObjectPattern;
75
- }
76
- export {};
@@ -1,84 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module link/utils
11
- */
12
- import type { DowncastConversionApi, Element, Schema, ViewAttributeElement, ViewNode, ViewDocumentFragment } from 'ckeditor5/src/engine.js';
13
- import type { LocaleTranslate } from 'ckeditor5/src/utils.js';
14
- import type { LinkDecoratorAutomaticDefinition, LinkDecoratorDefinition, LinkDecoratorManualDefinition } from './linkconfig.js';
15
- /**
16
- * A keystroke used by the {@link module:link/linkui~LinkUI link UI feature}.
17
- */
18
- export declare const LINK_KEYSTROKE = "Ctrl+K";
19
- /**
20
- * Returns `true` if a given view node is the link element.
21
- */
22
- export declare function isLinkElement(node: ViewNode | ViewDocumentFragment): boolean;
23
- /**
24
- * Creates a link {@link module:engine/view/attributeelement~AttributeElement} with the provided `href` attribute.
25
- */
26
- export declare function createLinkElement(href: string, { writer }: DowncastConversionApi): ViewAttributeElement;
27
- /**
28
- * Returns a safe URL based on a given value.
29
- *
30
- * A URL is considered safe if it is safe for the user (does not contain any malicious code).
31
- *
32
- * If a URL is considered unsafe, a simple `"#"` is returned.
33
- *
34
- * @internal
35
- */
36
- export declare function ensureSafeUrl(url: unknown, allowedProtocols?: Array<string>): string;
37
- /**
38
- * Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed
39
- * to respect the locale of the editor, i.e. to display the {@link module:link/linkconfig~LinkDecoratorManualDefinition label}
40
- * in the correct language.
41
- *
42
- * **Note**: Only the few most commonly used labels are translated automatically. Other labels should be manually
43
- * translated in the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration.
44
- *
45
- * @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.
46
- * @param decorators The decorator reference where the label values should be localized.
47
- */
48
- export declare function getLocalizedDecorators(t: LocaleTranslate, decorators: Array<NormalizedLinkDecoratorDefinition>): Array<NormalizedLinkDecoratorDefinition>;
49
- /**
50
- * Converts an object with defined decorators to a normalized array of decorators. The `id` key is added for each decorator and
51
- * is used as the attribute's name in the model.
52
- */
53
- export declare function normalizeDecorators(decorators?: Record<string, LinkDecoratorDefinition>): Array<NormalizedLinkDecoratorDefinition>;
54
- /**
55
- * Returns `true` if the specified `element` can be linked (the element allows the `linkHref` attribute).
56
- */
57
- export declare function isLinkableElement(element: Element | null, schema: Schema): element is Element;
58
- /**
59
- * Returns `true` if the specified `value` is an email.
60
- */
61
- export declare function isEmail(value: string): boolean;
62
- /**
63
- * Adds the protocol prefix to the specified `link` when:
64
- *
65
- * * it does not contain it already, and there is a {@link module:link/linkconfig~LinkConfig#defaultProtocol `defaultProtocol` }
66
- * configuration value provided,
67
- * * or the link is an email address.
68
- */
69
- export declare function addLinkProtocolIfApplicable(link: string, defaultProtocol?: string): string;
70
- /**
71
- * Checks if protocol is already included in the link.
72
- */
73
- export declare function linkHasProtocol(link: string): boolean;
74
- /**
75
- * Opens the link in a new browser tab.
76
- */
77
- export declare function openLink(link: string): void;
78
- export type NormalizedLinkDecoratorAutomaticDefinition = LinkDecoratorAutomaticDefinition & {
79
- id: string;
80
- };
81
- export type NormalizedLinkDecoratorManualDefinition = LinkDecoratorManualDefinition & {
82
- id: string;
83
- };
84
- export type NormalizedLinkDecoratorDefinition = NormalizedLinkDecoratorAutomaticDefinition | NormalizedLinkDecoratorManualDefinition;