@ckeditor/ckeditor5-link 45.2.1 → 46.0.0-alpha.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.
- package/build/link.js +1 -1
- package/dist/index-editor.css +11 -11
- package/dist/index.css +15 -15
- package/dist/index.css.map +1 -1
- package/dist/index.js +35 -28
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/autolink.d.ts +2 -2
- package/src/autolink.js +2 -2
- package/src/index.d.ts +23 -12
- package/src/index.js +17 -11
- package/src/link.d.ts +4 -4
- package/src/link.js +4 -4
- package/src/linkcommand.d.ts +8 -8
- package/src/linkcommand.js +9 -9
- package/src/linkconfig.d.ts +6 -6
- package/src/linkediting.d.ts +7 -7
- package/src/linkediting.js +12 -12
- package/src/linkimage.d.ts +3 -3
- package/src/linkimage.js +3 -3
- package/src/linkimageediting.d.ts +3 -3
- package/src/linkimageediting.js +3 -3
- package/src/linkimageui.d.ts +3 -3
- package/src/linkimageui.js +3 -3
- package/src/linkui.d.ts +7 -7
- package/src/linkui.js +9 -9
- package/src/ui/linkbuttonview.d.ts +1 -1
- package/src/ui/linkbuttonview.js +1 -1
- package/src/ui/linkformview.d.ts +3 -3
- package/src/ui/linkformview.js +1 -1
- package/src/ui/linkpreviewbuttonview.d.ts +1 -1
- package/src/ui/linkpreviewbuttonview.js +1 -1
- package/src/ui/linkpropertiesview.d.ts +2 -2
- package/src/ui/linkpropertiesview.js +1 -1
- package/src/ui/linkprovideritemsview.d.ts +2 -2
- package/src/ui/linkprovideritemsview.js +1 -1
- package/src/unlinkcommand.d.ts +1 -1
- package/src/unlinkcommand.js +1 -1
- package/src/utils/automaticdecorators.d.ts +2 -2
- package/src/utils/automaticdecorators.js +2 -2
- package/src/utils/manualdecorator.d.ts +7 -7
- package/src/utils/manualdecorator.js +6 -6
- package/src/utils.d.ts +11 -4
- package/src/utils.js +8 -1
package/src/linkui.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ContextualBalloon, ToolbarView, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
|
|
10
|
-
import LinkEditing from './linkediting.js';
|
|
11
|
-
import LinkFormView from './ui/linkformview.js';
|
|
12
|
-
import LinkProviderItemsView from './ui/linkprovideritemsview.js';
|
|
13
|
-
import LinkPropertiesView from './ui/linkpropertiesview.js';
|
|
10
|
+
import { LinkEditing } from './linkediting.js';
|
|
11
|
+
import { LinkFormView } from './ui/linkformview.js';
|
|
12
|
+
import { LinkProviderItemsView } from './ui/linkprovideritemsview.js';
|
|
13
|
+
import { LinkPropertiesView } from './ui/linkpropertiesview.js';
|
|
14
14
|
import '../theme/linktoolbar.css';
|
|
15
15
|
/**
|
|
16
16
|
* The link UI plugin. It introduces the `'link'` and `'unlink'` buttons and support for the <kbd>Ctrl+K</kbd> keystroke.
|
|
@@ -18,7 +18,7 @@ import '../theme/linktoolbar.css';
|
|
|
18
18
|
* It uses the
|
|
19
19
|
* {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export declare class LinkUI extends Plugin {
|
|
22
22
|
/**
|
|
23
23
|
* The toolbar view displayed inside of the balloon.
|
|
24
24
|
*/
|
|
@@ -240,8 +240,8 @@ export default class LinkUI extends Plugin {
|
|
|
240
240
|
*/
|
|
241
241
|
private _getBalloonPositionData;
|
|
242
242
|
/**
|
|
243
|
-
* Returns the link {@link module:engine/view/attributeelement~
|
|
244
|
-
* the {@link module:engine/view/document~
|
|
243
|
+
* Returns the link {@link module:engine/view/attributeelement~ViewAttributeElement} under
|
|
244
|
+
* the {@link module:engine/view/document~ViewDocument editing view's} selection or `null`
|
|
245
245
|
* if there is none.
|
|
246
246
|
*
|
|
247
247
|
* **Note**: For a non–collapsed selection, the link element is returned when **fully**
|
package/src/linkui.js
CHANGED
|
@@ -11,12 +11,12 @@ import { ClickObserver } from 'ckeditor5/src/engine.js';
|
|
|
11
11
|
import { ButtonView, SwitchButtonView, ContextualBalloon, clickOutsideHandler, CssTransitionDisablerMixin, MenuBarMenuListItemButtonView, ToolbarView } from 'ckeditor5/src/ui.js';
|
|
12
12
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
13
13
|
import { isWidget } from 'ckeditor5/src/widget.js';
|
|
14
|
-
import LinkEditing from './linkediting.js';
|
|
15
|
-
import LinkPreviewButtonView from './ui/linkpreviewbuttonview.js';
|
|
16
|
-
import LinkFormView from './ui/linkformview.js';
|
|
17
|
-
import LinkProviderItemsView from './ui/linkprovideritemsview.js';
|
|
18
|
-
import LinkPropertiesView from './ui/linkpropertiesview.js';
|
|
19
|
-
import LinkButtonView from './ui/linkbuttonview.js';
|
|
14
|
+
import { LinkEditing } from './linkediting.js';
|
|
15
|
+
import { LinkPreviewButtonView } from './ui/linkpreviewbuttonview.js';
|
|
16
|
+
import { LinkFormView } from './ui/linkformview.js';
|
|
17
|
+
import { LinkProviderItemsView } from './ui/linkprovideritemsview.js';
|
|
18
|
+
import { LinkPropertiesView } from './ui/linkpropertiesview.js';
|
|
19
|
+
import { LinkButtonView } from './ui/linkbuttonview.js';
|
|
20
20
|
import { addLinkProtocolIfApplicable, ensureSafeUrl, isLinkElement, extractTextFromLinkRange, LINK_KEYSTROKE } from './utils.js';
|
|
21
21
|
import '../theme/linktoolbar.css';
|
|
22
22
|
const VISUAL_SELECTION_MARKER_NAME = 'link-ui';
|
|
@@ -26,7 +26,7 @@ const VISUAL_SELECTION_MARKER_NAME = 'link-ui';
|
|
|
26
26
|
* It uses the
|
|
27
27
|
* {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export class LinkUI extends Plugin {
|
|
30
30
|
/**
|
|
31
31
|
* The toolbar view displayed inside of the balloon.
|
|
32
32
|
*/
|
|
@@ -930,8 +930,8 @@ export default class LinkUI extends Plugin {
|
|
|
930
930
|
};
|
|
931
931
|
}
|
|
932
932
|
/**
|
|
933
|
-
* Returns the link {@link module:engine/view/attributeelement~
|
|
934
|
-
* the {@link module:engine/view/document~
|
|
933
|
+
* Returns the link {@link module:engine/view/attributeelement~ViewAttributeElement} under
|
|
934
|
+
* the {@link module:engine/view/document~ViewDocument editing view's} selection or `null`
|
|
935
935
|
* if there is none.
|
|
936
936
|
*
|
|
937
937
|
* **Note**: For a non–collapsed selection, the link element is returned when **fully**
|
|
@@ -7,7 +7,7 @@ import type { Locale } from 'ckeditor5/src/utils.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents a view for a dropdown menu button.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare class LinkButtonView extends ButtonView {
|
|
11
11
|
/**
|
|
12
12
|
* An icon that displays an arrow to indicate a direction of the menu.
|
|
13
13
|
*/
|
package/src/ui/linkbuttonview.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ButtonView, IconView } from 'ckeditor5/src/ui.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents a view for a dropdown menu button.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export class LinkButtonView extends ButtonView {
|
|
14
14
|
/**
|
|
15
15
|
* An icon that displays an arrow to indicate a direction of the menu.
|
|
16
16
|
*/
|
package/src/ui/linkformview.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import '../../theme/linkform.css';
|
|
|
13
13
|
/**
|
|
14
14
|
* The link form view.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class LinkFormView extends View {
|
|
17
17
|
/**
|
|
18
18
|
* Tracks information about DOM focus in the form.
|
|
19
19
|
*/
|
|
@@ -141,7 +141,7 @@ export type LinkFormValidatorCallback = (form: LinkFormView) => string | undefin
|
|
|
141
141
|
*
|
|
142
142
|
* @eventName ~LinkFormView#submit
|
|
143
143
|
*/
|
|
144
|
-
export type
|
|
144
|
+
export type LinkFormSubmitEvent = {
|
|
145
145
|
name: 'submit';
|
|
146
146
|
args: [];
|
|
147
147
|
};
|
|
@@ -150,7 +150,7 @@ export type SubmitEvent = {
|
|
|
150
150
|
*
|
|
151
151
|
* @eventName ~LinkFormView#cancel
|
|
152
152
|
*/
|
|
153
|
-
export type
|
|
153
|
+
export type LinkFormCancelEvent = {
|
|
154
154
|
name: 'cancel';
|
|
155
155
|
args: [];
|
|
156
156
|
};
|
package/src/ui/linkformview.js
CHANGED
|
@@ -12,7 +12,7 @@ import type { Locale } from 'ckeditor5/src/utils.js';
|
|
|
12
12
|
*
|
|
13
13
|
* Provides a custom `navigate` cancelable event.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class LinkPreviewButtonView extends ButtonView {
|
|
16
16
|
/**
|
|
17
17
|
* The value of the "href" attribute of the link.
|
|
18
18
|
*
|
|
@@ -11,7 +11,7 @@ import { ButtonView } from 'ckeditor5/src/ui.js';
|
|
|
11
11
|
*
|
|
12
12
|
* Provides a custom `navigate` cancelable event.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class LinkPreviewButtonView extends ButtonView {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
|
@@ -13,7 +13,7 @@ import '../../theme/linkproperties.css';
|
|
|
13
13
|
*
|
|
14
14
|
* See {@link module:link/ui/linkpropertiesview~LinkPropertiesView}.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class LinkPropertiesView extends View {
|
|
17
17
|
/**
|
|
18
18
|
* Tracks information about DOM focus in the form.
|
|
19
19
|
*/
|
|
@@ -82,7 +82,7 @@ export default class LinkPropertiesView extends View {
|
|
|
82
82
|
*
|
|
83
83
|
* @eventName ~LinkPropertiesView#back
|
|
84
84
|
*/
|
|
85
|
-
export type
|
|
85
|
+
export type LinkPropertiesBackEvent = {
|
|
86
86
|
name: 'back';
|
|
87
87
|
args: [];
|
|
88
88
|
};
|
|
@@ -14,7 +14,7 @@ import '../../theme/linkproperties.css';
|
|
|
14
14
|
*
|
|
15
15
|
* See {@link module:link/ui/linkpropertiesview~LinkPropertiesView}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class LinkPropertiesView extends View {
|
|
18
18
|
/**
|
|
19
19
|
* Tracks information about DOM focus in the form.
|
|
20
20
|
*/
|
|
@@ -11,7 +11,7 @@ import '../../theme/linkprovideritems.css';
|
|
|
11
11
|
/**
|
|
12
12
|
* The link provider items view.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export declare class LinkProviderItemsView extends View {
|
|
15
15
|
/**
|
|
16
16
|
* Tracks information about the list of links.
|
|
17
17
|
*
|
|
@@ -108,7 +108,7 @@ export default class LinkProviderItemsView extends View {
|
|
|
108
108
|
*
|
|
109
109
|
* @eventName ~LinkProviderItemsView#cancel
|
|
110
110
|
*/
|
|
111
|
-
export type
|
|
111
|
+
export type LinkProvidersCancelEvent = {
|
|
112
112
|
name: 'cancel';
|
|
113
113
|
args: [];
|
|
114
114
|
};
|
|
@@ -12,7 +12,7 @@ import '../../theme/linkprovideritems.css';
|
|
|
12
12
|
/**
|
|
13
13
|
* The link provider items view.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export class LinkProviderItemsView extends View {
|
|
16
16
|
/**
|
|
17
17
|
* Tracks information about DOM focus in the form.
|
|
18
18
|
*/
|
package/src/unlinkcommand.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* The unlink command. It is used by the {@link module:link/link~Link link plugin}.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare class UnlinkCommand extends Command {
|
|
13
13
|
/**
|
|
14
14
|
* @inheritDoc
|
|
15
15
|
*/
|
package/src/unlinkcommand.js
CHANGED
|
@@ -11,7 +11,7 @@ import { isLinkableElement } from './utils.js';
|
|
|
11
11
|
/**
|
|
12
12
|
* The unlink command. It is used by the {@link module:link/link~Link link plugin}.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class UnlinkCommand extends Command {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
|
@@ -12,14 +12,14 @@ import type { NormalizedLinkDecoratorAutomaticDefinition } from '../utils.js';
|
|
|
12
12
|
* Helper class that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition} and provides
|
|
13
13
|
* the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement downcast dispatchers} for them.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class AutomaticLinkDecorators {
|
|
16
16
|
/**
|
|
17
17
|
* Stores the definition of {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}.
|
|
18
18
|
* This data is used as a source for a downcast dispatcher to create a proper conversion to output data.
|
|
19
19
|
*/
|
|
20
20
|
private _definitions;
|
|
21
21
|
/**
|
|
22
|
-
* Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~
|
|
22
|
+
* Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~AutomaticLinkDecorators}
|
|
23
23
|
* instance.
|
|
24
24
|
*/
|
|
25
25
|
get length(): number;
|
|
@@ -10,14 +10,14 @@ import { toMap } from 'ckeditor5/src/utils.js';
|
|
|
10
10
|
* Helper class that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition} and provides
|
|
11
11
|
* the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement downcast dispatchers} for them.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export class AutomaticLinkDecorators {
|
|
14
14
|
/**
|
|
15
15
|
* Stores the definition of {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}.
|
|
16
16
|
* This data is used as a source for a downcast dispatcher to create a proper conversion to output data.
|
|
17
17
|
*/
|
|
18
18
|
_definitions = new Set();
|
|
19
19
|
/**
|
|
20
|
-
* Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~
|
|
20
|
+
* Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~AutomaticLinkDecorators}
|
|
21
21
|
* instance.
|
|
22
22
|
*/
|
|
23
23
|
get length() {
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
9
9
|
import type { MatcherObjectPattern } from 'ckeditor5/src/engine.js';
|
|
10
10
|
import type { NormalizedLinkDecoratorManualDefinition } from '../utils.js';
|
|
11
|
-
declare const
|
|
11
|
+
declare const LinkManualDecorator_base: {
|
|
12
12
|
new (): import("ckeditor5/src/utils.js").Observable;
|
|
13
13
|
prototype: import("ckeditor5/src/utils.js").Observable;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~
|
|
16
|
+
* Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~LinkManualDecorator#value}
|
|
17
17
|
* to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.
|
|
18
18
|
* These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare class LinkManualDecorator extends /* #__PURE__ */ LinkManualDecorator_base {
|
|
21
21
|
/**
|
|
22
22
|
* An ID of a manual decorator which is the name of the attribute in the model, for example: 'linkManualDecorator0'.
|
|
23
23
|
*/
|
|
@@ -38,21 +38,21 @@ export default class ManualDecorator extends /* #__PURE__ */ ManualDecorator_bas
|
|
|
38
38
|
label: string;
|
|
39
39
|
/**
|
|
40
40
|
* A set of attributes added to downcasted data when the decorator is activated for a specific link.
|
|
41
|
-
* Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~
|
|
41
|
+
* Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
|
|
42
42
|
*/
|
|
43
43
|
attributes?: Record<string, string>;
|
|
44
44
|
/**
|
|
45
45
|
* A set of classes added to downcasted data when the decorator is activated for a specific link.
|
|
46
|
-
* Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~
|
|
46
|
+
* Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
|
|
47
47
|
*/
|
|
48
48
|
classes?: ArrayOrItem<string>;
|
|
49
49
|
/**
|
|
50
50
|
* A set of styles added to downcasted data when the decorator is activated for a specific link.
|
|
51
|
-
* Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~
|
|
51
|
+
* Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
|
|
52
52
|
*/
|
|
53
53
|
styles?: Record<string, string>;
|
|
54
54
|
/**
|
|
55
|
-
* Creates a new instance of {@link module:link/utils/manualdecorator~
|
|
55
|
+
* Creates a new instance of {@link module:link/utils/manualdecorator~LinkManualDecorator}.
|
|
56
56
|
*
|
|
57
57
|
* @param options The configuration object.
|
|
58
58
|
*/
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ObservableMixin } from 'ckeditor5/src/utils.js';
|
|
9
9
|
/**
|
|
10
|
-
* Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~
|
|
10
|
+
* Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~LinkManualDecorator#value}
|
|
11
11
|
* to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.
|
|
12
12
|
* These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class LinkManualDecorator extends /* #__PURE__ */ ObservableMixin() {
|
|
15
15
|
/**
|
|
16
16
|
* An ID of a manual decorator which is the name of the attribute in the model, for example: 'linkManualDecorator0'.
|
|
17
17
|
*/
|
|
@@ -26,21 +26,21 @@ export default class ManualDecorator extends /* #__PURE__ */ ObservableMixin() {
|
|
|
26
26
|
label;
|
|
27
27
|
/**
|
|
28
28
|
* A set of attributes added to downcasted data when the decorator is activated for a specific link.
|
|
29
|
-
* Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~
|
|
29
|
+
* Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
|
|
30
30
|
*/
|
|
31
31
|
attributes;
|
|
32
32
|
/**
|
|
33
33
|
* A set of classes added to downcasted data when the decorator is activated for a specific link.
|
|
34
|
-
* Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~
|
|
34
|
+
* Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
|
|
35
35
|
*/
|
|
36
36
|
classes;
|
|
37
37
|
/**
|
|
38
38
|
* A set of styles added to downcasted data when the decorator is activated for a specific link.
|
|
39
|
-
* Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~
|
|
39
|
+
* Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
|
|
40
40
|
*/
|
|
41
41
|
styles;
|
|
42
42
|
/**
|
|
43
|
-
* Creates a new instance of {@link module:link/utils/manualdecorator~
|
|
43
|
+
* Creates a new instance of {@link module:link/utils/manualdecorator~LinkManualDecorator}.
|
|
44
44
|
*
|
|
45
45
|
* @param options The configuration object.
|
|
46
46
|
*/
|
package/src/utils.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module link/utils
|
|
7
7
|
*/
|
|
8
|
-
import type { DowncastConversionApi,
|
|
8
|
+
import type { DowncastConversionApi, ModelElement, ModelSchema, ViewAttributeElement, ViewNode, ViewDocumentFragment, ModelRange } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import type { LocaleTranslate } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import type { LinkDecoratorAutomaticDefinition, LinkDecoratorDefinition, LinkDecoratorManualDefinition } from './linkconfig.js';
|
|
11
11
|
/**
|
|
@@ -17,7 +17,7 @@ export declare const LINK_KEYSTROKE = "Ctrl+K";
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function isLinkElement(node: ViewNode | ViewDocumentFragment): boolean;
|
|
19
19
|
/**
|
|
20
|
-
* Creates a link {@link module:engine/view/attributeelement~
|
|
20
|
+
* Creates a link {@link module:engine/view/attributeelement~ViewAttributeElement} with the provided `href` attribute.
|
|
21
21
|
*/
|
|
22
22
|
export declare function createLinkElement(href: string, { writer }: DowncastConversionApi): ViewAttributeElement;
|
|
23
23
|
/**
|
|
@@ -40,19 +40,24 @@ export declare function ensureSafeUrl(url: unknown, allowedProtocols?: Array<str
|
|
|
40
40
|
*
|
|
41
41
|
* @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.
|
|
42
42
|
* @param decorators The decorator reference where the label values should be localized.
|
|
43
|
+
* @internal
|
|
43
44
|
*/
|
|
44
45
|
export declare function getLocalizedDecorators(t: LocaleTranslate, decorators: Array<NormalizedLinkDecoratorDefinition>): Array<NormalizedLinkDecoratorDefinition>;
|
|
45
46
|
/**
|
|
46
47
|
* Converts an object with defined decorators to a normalized array of decorators. The `id` key is added for each decorator and
|
|
47
48
|
* is used as the attribute's name in the model.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
48
51
|
*/
|
|
49
52
|
export declare function normalizeDecorators(decorators?: Record<string, LinkDecoratorDefinition>): Array<NormalizedLinkDecoratorDefinition>;
|
|
50
53
|
/**
|
|
51
54
|
* Returns `true` if the specified `element` can be linked (the element allows the `linkHref` attribute).
|
|
52
55
|
*/
|
|
53
|
-
export declare function isLinkableElement(element:
|
|
56
|
+
export declare function isLinkableElement(element: ModelElement | null, schema: ModelSchema): element is ModelElement;
|
|
54
57
|
/**
|
|
55
58
|
* Returns `true` if the specified `value` is an email.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
56
61
|
*/
|
|
57
62
|
export declare function isEmail(value: string): boolean;
|
|
58
63
|
/**
|
|
@@ -65,6 +70,8 @@ export declare function isEmail(value: string): boolean;
|
|
|
65
70
|
export declare function addLinkProtocolIfApplicable(link: string, defaultProtocol?: string): string;
|
|
66
71
|
/**
|
|
67
72
|
* Checks if protocol is already included in the link.
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
68
75
|
*/
|
|
69
76
|
export declare function linkHasProtocol(link: string): boolean;
|
|
70
77
|
/**
|
|
@@ -76,7 +83,7 @@ export declare function openLink(link: string): void;
|
|
|
76
83
|
*
|
|
77
84
|
* If the returned value is `undefined`, the range contains elements other than text nodes.
|
|
78
85
|
*/
|
|
79
|
-
export declare function extractTextFromLinkRange(range:
|
|
86
|
+
export declare function extractTextFromLinkRange(range: ModelRange): string | undefined;
|
|
80
87
|
export type NormalizedLinkDecoratorAutomaticDefinition = LinkDecoratorAutomaticDefinition & {
|
|
81
88
|
id: string;
|
|
82
89
|
};
|
package/src/utils.js
CHANGED
|
@@ -26,7 +26,7 @@ export function isLinkElement(node) {
|
|
|
26
26
|
return node.is('attributeElement') && !!node.getCustomProperty('link');
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Creates a link {@link module:engine/view/attributeelement~
|
|
29
|
+
* Creates a link {@link module:engine/view/attributeelement~ViewAttributeElement} with the provided `href` attribute.
|
|
30
30
|
*/
|
|
31
31
|
export function createLinkElement(href, { writer }) {
|
|
32
32
|
// Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121.
|
|
@@ -66,6 +66,7 @@ function isSafeUrl(url, customRegexp) {
|
|
|
66
66
|
*
|
|
67
67
|
* @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.
|
|
68
68
|
* @param decorators The decorator reference where the label values should be localized.
|
|
69
|
+
* @internal
|
|
69
70
|
*/
|
|
70
71
|
export function getLocalizedDecorators(t, decorators) {
|
|
71
72
|
const localizedDecoratorsLabels = {
|
|
@@ -83,6 +84,8 @@ export function getLocalizedDecorators(t, decorators) {
|
|
|
83
84
|
/**
|
|
84
85
|
* Converts an object with defined decorators to a normalized array of decorators. The `id` key is added for each decorator and
|
|
85
86
|
* is used as the attribute's name in the model.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
86
89
|
*/
|
|
87
90
|
export function normalizeDecorators(decorators) {
|
|
88
91
|
const retArray = [];
|
|
@@ -105,6 +108,8 @@ export function isLinkableElement(element, schema) {
|
|
|
105
108
|
}
|
|
106
109
|
/**
|
|
107
110
|
* Returns `true` if the specified `value` is an email.
|
|
111
|
+
*
|
|
112
|
+
* @internal
|
|
108
113
|
*/
|
|
109
114
|
export function isEmail(value) {
|
|
110
115
|
return EMAIL_REG_EXP.test(value);
|
|
@@ -123,6 +128,8 @@ export function addLinkProtocolIfApplicable(link, defaultProtocol) {
|
|
|
123
128
|
}
|
|
124
129
|
/**
|
|
125
130
|
* Checks if protocol is already included in the link.
|
|
131
|
+
*
|
|
132
|
+
* @internal
|
|
126
133
|
*/
|
|
127
134
|
export function linkHasProtocol(link) {
|
|
128
135
|
return PROTOCOL_REG_EXP.test(link);
|