@ckeditor/ckeditor5-link 45.2.1-alpha.9 → 46.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/dist/index-editor.css +11 -11
- package/dist/index.css +15 -15
- package/dist/index.css.map +1 -1
- package/dist/index.js +24 -24
- 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 +7 -7
- package/src/linkcommand.js +8 -8
- package/src/linkconfig.d.ts +6 -6
- package/src/linkediting.d.ts +6 -6
- package/src/linkediting.js +11 -11
- 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 +1 -1
- package/src/utils/automaticdecorators.js +1 -1
- package/src/utils/manualdecorator.d.ts +7 -7
- package/src/utils/manualdecorator.js +6 -6
- package/src/utils.d.ts +4 -4
- package/src/utils.js +1 -1
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,7 +12,7 @@ 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 AutomaticDecorators {
|
|
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.
|
|
@@ -10,7 +10,7 @@ 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 AutomaticDecorators {
|
|
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.
|
|
@@ -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
|
/**
|
|
@@ -50,7 +50,7 @@ export declare function normalizeDecorators(decorators?: Record<string, LinkDeco
|
|
|
50
50
|
/**
|
|
51
51
|
* Returns `true` if the specified `element` can be linked (the element allows the `linkHref` attribute).
|
|
52
52
|
*/
|
|
53
|
-
export declare function isLinkableElement(element:
|
|
53
|
+
export declare function isLinkableElement(element: ModelElement | null, schema: ModelSchema): element is ModelElement;
|
|
54
54
|
/**
|
|
55
55
|
* Returns `true` if the specified `value` is an email.
|
|
56
56
|
*/
|
|
@@ -76,7 +76,7 @@ export declare function openLink(link: string): void;
|
|
|
76
76
|
*
|
|
77
77
|
* If the returned value is `undefined`, the range contains elements other than text nodes.
|
|
78
78
|
*/
|
|
79
|
-
export declare function extractTextFromLinkRange(range:
|
|
79
|
+
export declare function extractTextFromLinkRange(range: ModelRange): string | undefined;
|
|
80
80
|
export type NormalizedLinkDecoratorAutomaticDefinition = LinkDecoratorAutomaticDefinition & {
|
|
81
81
|
id: string;
|
|
82
82
|
};
|
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.
|