@ckeditor/ckeditor5-link 48.2.0-alpha.7 → 48.3.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/dist/augmentation.d.ts +28 -28
- package/dist/autolink.d.ts +74 -74
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.js +3014 -3524
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +26 -26
- package/dist/linkcommand.d.ts +134 -134
- package/dist/linkconfig.d.ts +313 -313
- package/dist/linkediting.d.ts +88 -88
- package/dist/linkimage.d.ts +26 -26
- package/dist/linkimageediting.d.ts +39 -39
- package/dist/linkimageui.d.ts +41 -41
- package/dist/linkui.d.ts +350 -350
- package/dist/ui/linkbuttonview.d.ts +27 -27
- package/dist/ui/linkformview.d.ts +141 -141
- package/dist/ui/linkpreviewbuttonview.d.ts +27 -27
- package/dist/ui/linkpropertiesview.d.ts +80 -80
- package/dist/ui/linkprovideritemsview.d.ts +106 -106
- package/dist/unlinkcommand.d.ts +26 -26
- package/dist/utils/automaticdecorators.d.ts +54 -54
- package/dist/utils/conflictingdecorators.d.ts +32 -32
- package/dist/utils/manualdecorator.d.ts +59 -62
- package/dist/utils.d.ts +62 -62
- package/package.json +11 -11
package/dist/link.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { Plugin } from
|
|
9
|
-
import { LinkEditing } from
|
|
10
|
-
import { LinkUI } from
|
|
11
|
-
import { AutoLink } from
|
|
6
|
+
* @module link/link
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { LinkEditing } from "./linkediting.js";
|
|
10
|
+
import { LinkUI } from "./linkui.js";
|
|
11
|
+
import { AutoLink } from "./autolink.js";
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
* The link plugin.
|
|
14
|
+
*
|
|
15
|
+
* This is a "glue" plugin that loads the {@link module:link/linkediting~LinkEditing link editing feature}
|
|
16
|
+
* and {@link module:link/linkui~LinkUI link UI feature}.
|
|
17
|
+
*/
|
|
18
18
|
export declare class Link extends Plugin {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get requires(): PluginDependenciesOf<[LinkEditing, LinkUI, AutoLink]>;
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get pluginName(): "Link";
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static override get isOfficialPlugin(): true;
|
|
31
31
|
}
|
package/dist/linkcommand.d.ts
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { Command } from
|
|
9
|
-
import { Collection } from
|
|
10
|
-
import { AutomaticLinkDecorators } from
|
|
11
|
-
import { type LinkManualDecorator } from
|
|
6
|
+
* @module link/linkcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { Collection } from "@ckeditor/ckeditor5-utils";
|
|
10
|
+
import { AutomaticLinkDecorators } from "./utils/automaticdecorators.js";
|
|
11
|
+
import { type LinkManualDecorator } from "./utils/manualdecorator.js";
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* The link command. It is used by the {@link module:link/link~Link link feature}.
|
|
14
|
+
*/
|
|
15
15
|
export declare class LinkCommand extends Command {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The value of the `'linkHref'` attribute if the start of the selection is located in a node with this attribute.
|
|
18
|
+
*
|
|
19
|
+
* @observable
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
value: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* A collection of {@link module:link/utils/manualdecorator~LinkManualDecorator manual decorators}
|
|
25
|
+
* corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.
|
|
26
|
+
*
|
|
27
|
+
* You can consider it a model with states of manual decorators added to the currently selected link.
|
|
28
|
+
*/
|
|
29
|
+
readonly manualDecorators: Collection<LinkManualDecorator>;
|
|
30
|
+
/**
|
|
31
|
+
* An instance of the helper that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
|
|
32
|
+
* that are used by the {@glink features/link link} and the {@glink features/images/images-linking linking images} features.
|
|
33
|
+
*/
|
|
34
|
+
readonly automaticDecorators: AutomaticLinkDecorators;
|
|
35
|
+
/**
|
|
36
|
+
* Synchronizes the state of {@link #manualDecorators} with the currently present elements in the model.
|
|
37
|
+
*/
|
|
38
|
+
restoreManualDecoratorStates(): void;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
override refresh(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Executes the command.
|
|
45
|
+
*
|
|
46
|
+
* When the selection is non-collapsed, the `linkHref` attribute will be applied to nodes inside the selection, but only to
|
|
47
|
+
* those nodes where the `linkHref` attribute is allowed (disallowed nodes will be omitted).
|
|
48
|
+
*
|
|
49
|
+
* When the selection is collapsed and is not inside the text with the `linkHref` attribute, a
|
|
50
|
+
* new {@link module:engine/model/text~ModelText text node} with the `linkHref` attribute will be inserted in place of the caret, but
|
|
51
|
+
* only if such element is allowed in this place. The `_data` of the inserted text will equal the `href` parameter.
|
|
52
|
+
* The selection will be updated to wrap the just inserted text node.
|
|
53
|
+
*
|
|
54
|
+
* When the selection is collapsed and inside the text with the `linkHref` attribute, the attribute value will be updated.
|
|
55
|
+
*
|
|
56
|
+
* # Decorators and model attribute management
|
|
57
|
+
*
|
|
58
|
+
* There is an optional argument to this command that applies or removes model
|
|
59
|
+
* {@glink framework/architecture/editing-engine#text-attributes text attributes} brought by
|
|
60
|
+
* {@link module:link/utils/manualdecorator~LinkManualDecorator manual link decorators}.
|
|
61
|
+
*
|
|
62
|
+
* Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators
|
|
63
|
+
* configuration}.
|
|
64
|
+
* For every decorator configured, a model text attribute exists with the "link" prefix. For example, a `'linkMyDecorator'` attribute
|
|
65
|
+
* corresponds to `'myDecorator'` in the configuration.
|
|
66
|
+
*
|
|
67
|
+
* To learn more about link decorators, check out the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`}
|
|
68
|
+
* documentation.
|
|
69
|
+
*
|
|
70
|
+
* Here is how to manage decorator attributes with the link command:
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* const linkCommand = editor.commands.get( 'link' );
|
|
74
|
+
*
|
|
75
|
+
* // Adding a new decorator attribute.
|
|
76
|
+
* linkCommand.execute( 'http://example.com', {
|
|
77
|
+
* linkIsExternal: true
|
|
78
|
+
* } );
|
|
79
|
+
*
|
|
80
|
+
* // Removing a decorator attribute from the selection.
|
|
81
|
+
* linkCommand.execute( 'http://example.com', {
|
|
82
|
+
* linkIsExternal: false
|
|
83
|
+
* } );
|
|
84
|
+
*
|
|
85
|
+
* // Adding multiple decorator attributes at the same time.
|
|
86
|
+
* linkCommand.execute( 'http://example.com', {
|
|
87
|
+
* linkIsExternal: true,
|
|
88
|
+
* linkIsDownloadable: true,
|
|
89
|
+
* } );
|
|
90
|
+
*
|
|
91
|
+
* // Removing and adding decorator attributes at the same time.
|
|
92
|
+
* linkCommand.execute( 'http://example.com', {
|
|
93
|
+
* linkIsExternal: false,
|
|
94
|
+
* linkFoo: true,
|
|
95
|
+
* linkIsDownloadable: false,
|
|
96
|
+
* } );
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* **Note**: If the decorator attribute name is not specified, its state remains untouched.
|
|
100
|
+
*
|
|
101
|
+
* **Note**: {@link module:link/unlinkcommand~UnlinkCommand#execute `UnlinkCommand#execute()`} removes all
|
|
102
|
+
* decorator attributes.
|
|
103
|
+
*
|
|
104
|
+
* An optional parameter called `displayedText` is to add or update text of the link that represents the `href`. For example:
|
|
105
|
+
*
|
|
106
|
+
* ```ts
|
|
107
|
+
* const linkCommand = editor.commands.get( 'link' );
|
|
108
|
+
*
|
|
109
|
+
* // Adding a new link with `displayedText` attribute.
|
|
110
|
+
* linkCommand.execute( 'http://example.com', {}, 'Example' );
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* The above code will create an anchor like this:
|
|
114
|
+
*
|
|
115
|
+
* ```html
|
|
116
|
+
* <a href="http://example.com">Example</a>
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* @fires execute
|
|
120
|
+
* @param href Link destination.
|
|
121
|
+
* @param manualDecoratorIds The information about manual decorator attributes to be applied or removed upon execution.
|
|
122
|
+
* @param displayedText Text of the link.
|
|
123
|
+
*/
|
|
124
|
+
override execute(href: string, manualDecoratorIds?: Record<string, boolean>, displayedText?: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Provides information whether a decorator with a given name is present in the currently processed selection.
|
|
127
|
+
*
|
|
128
|
+
* @param decoratorName The name of the manual decorator used in the model
|
|
129
|
+
* @returns The information whether a given decorator is currently present in the selection.
|
|
130
|
+
*/
|
|
131
|
+
private _getDecoratorStateFromModel;
|
|
132
|
+
/**
|
|
133
|
+
* Checks whether specified `range` is inside an element that accepts the `linkHref` attribute.
|
|
134
|
+
*
|
|
135
|
+
* @param range A range to check.
|
|
136
|
+
* @param allowedRanges An array of ranges created on elements where the attribute is accepted.
|
|
137
|
+
*/
|
|
138
|
+
private _isRangeToUpdate;
|
|
139
139
|
}
|