@ckeditor/ckeditor5-link 46.0.0-alpha.0 → 46.0.0-alpha.2
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.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/linkcommand.d.ts +2 -2
- package/src/linkcommand.js +2 -2
- package/src/linkediting.d.ts +1 -1
- package/src/linkediting.js +1 -1
- package/src/utils/automaticdecorators.d.ts +2 -2
- package/src/utils/automaticdecorators.js +2 -2
- package/src/utils.d.ts +7 -0
- package/src/utils.js +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-link",
|
|
3
|
-
"version": "46.0.0-alpha.
|
|
3
|
+
"version": "46.0.0-alpha.2",
|
|
4
4
|
"description": "Link feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.
|
|
17
|
-
"@ckeditor/ckeditor5-core": "46.0.0-alpha.
|
|
18
|
-
"@ckeditor/ckeditor5-engine": "46.0.0-alpha.
|
|
19
|
-
"@ckeditor/ckeditor5-icons": "46.0.0-alpha.
|
|
20
|
-
"@ckeditor/ckeditor5-image": "46.0.0-alpha.
|
|
21
|
-
"@ckeditor/ckeditor5-typing": "46.0.0-alpha.
|
|
22
|
-
"@ckeditor/ckeditor5-ui": "46.0.0-alpha.
|
|
23
|
-
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.
|
|
24
|
-
"@ckeditor/ckeditor5-widget": "46.0.0-alpha.
|
|
25
|
-
"ckeditor5": "46.0.0-alpha.
|
|
16
|
+
"@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.2",
|
|
17
|
+
"@ckeditor/ckeditor5-core": "46.0.0-alpha.2",
|
|
18
|
+
"@ckeditor/ckeditor5-engine": "46.0.0-alpha.2",
|
|
19
|
+
"@ckeditor/ckeditor5-icons": "46.0.0-alpha.2",
|
|
20
|
+
"@ckeditor/ckeditor5-image": "46.0.0-alpha.2",
|
|
21
|
+
"@ckeditor/ckeditor5-typing": "46.0.0-alpha.2",
|
|
22
|
+
"@ckeditor/ckeditor5-ui": "46.0.0-alpha.2",
|
|
23
|
+
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.2",
|
|
24
|
+
"@ckeditor/ckeditor5-widget": "46.0.0-alpha.2",
|
|
25
|
+
"ckeditor5": "46.0.0-alpha.2",
|
|
26
26
|
"es-toolkit": "1.39.5"
|
|
27
27
|
},
|
|
28
28
|
"author": "CKSource (http://cksource.com/)",
|
package/src/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type { LinkProvidersCancelEvent } from './ui/linkprovideritemsview.js';
|
|
|
25
25
|
export type { LinkFormValidatorCallback, LinkFormSubmitEvent, LinkFormCancelEvent } from './ui/linkformview.js';
|
|
26
26
|
export { addLinkProtocolIfApplicable, ensureSafeUrl, ensureSafeUrl as _ensureSafeLinkUrl, isLinkableElement, isLinkElement, LINK_KEYSTROKE as _LINK_KEYSTROKE, createLinkElement as _createLinkElement, getLocalizedDecorators as _getLocalizedLinkDecorators, normalizeDecorators as _normalizeLinkDecorators, isEmail as _isEmailLink, linkHasProtocol as _hasLinkProtocol, openLink as _openLink, extractTextFromLinkRange as _extractTextFromLinkRange } from './utils.js';
|
|
27
27
|
export type { NormalizedLinkDecoratorAutomaticDefinition, NormalizedLinkDecoratorManualDefinition, NormalizedLinkDecoratorDefinition } from './utils.js';
|
|
28
|
-
export {
|
|
28
|
+
export { AutomaticLinkDecorators } from './utils/automaticdecorators.js';
|
|
29
29
|
export { LinkManualDecorator } from './utils/manualdecorator.js';
|
|
30
30
|
export type { LinkConfig, LinkDecoratorDefinition, LinkDecoratorAutomaticDefinition, LinkDecoratorManualDefinition } from './linkconfig.js';
|
|
31
31
|
import './augmentation.js';
|
package/src/index.js
CHANGED
|
@@ -20,6 +20,6 @@ export { LinkPreviewButtonView as _LinkPreviewButtonView } from './ui/linkprevie
|
|
|
20
20
|
export { LinkPropertiesView } from './ui/linkpropertiesview.js';
|
|
21
21
|
export { LinkProviderItemsView } from './ui/linkprovideritemsview.js';
|
|
22
22
|
export { addLinkProtocolIfApplicable, ensureSafeUrl, ensureSafeUrl as _ensureSafeLinkUrl, isLinkableElement, isLinkElement, LINK_KEYSTROKE as _LINK_KEYSTROKE, createLinkElement as _createLinkElement, getLocalizedDecorators as _getLocalizedLinkDecorators, normalizeDecorators as _normalizeLinkDecorators, isEmail as _isEmailLink, linkHasProtocol as _hasLinkProtocol, openLink as _openLink, extractTextFromLinkRange as _extractTextFromLinkRange } from './utils.js';
|
|
23
|
-
export {
|
|
23
|
+
export { AutomaticLinkDecorators } from './utils/automaticdecorators.js';
|
|
24
24
|
export { LinkManualDecorator } from './utils/manualdecorator.js';
|
|
25
25
|
import './augmentation.js';
|
package/src/linkcommand.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Command } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import {
|
|
10
|
+
import { AutomaticLinkDecorators } from './utils/automaticdecorators.js';
|
|
11
11
|
import { type LinkManualDecorator } from './utils/manualdecorator.js';
|
|
12
12
|
/**
|
|
13
13
|
* The link command. It is used by the {@link module:link/link~Link link feature}.
|
|
@@ -31,7 +31,7 @@ export declare class LinkCommand extends Command {
|
|
|
31
31
|
* An instance of the helper that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
|
|
32
32
|
* that are used by the {@glink features/link link} and the {@glink features/images/images-linking linking images} features.
|
|
33
33
|
*/
|
|
34
|
-
readonly automaticDecorators:
|
|
34
|
+
readonly automaticDecorators: AutomaticLinkDecorators;
|
|
35
35
|
/**
|
|
36
36
|
* Synchronizes the state of {@link #manualDecorators} with the currently present elements in the model.
|
|
37
37
|
*/
|
package/src/linkcommand.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
import { findAttributeRange } from 'ckeditor5/src/typing.js';
|
|
10
10
|
import { Collection, diff, first, toMap } from 'ckeditor5/src/utils.js';
|
|
11
11
|
import { ModelLivePosition } from 'ckeditor5/src/engine.js';
|
|
12
|
-
import {
|
|
12
|
+
import { AutomaticLinkDecorators } from './utils/automaticdecorators.js';
|
|
13
13
|
import { extractTextFromLinkRange, isLinkableElement } from './utils.js';
|
|
14
14
|
/**
|
|
15
15
|
* The link command. It is used by the {@link module:link/link~Link link feature}.
|
|
@@ -26,7 +26,7 @@ export class LinkCommand extends Command {
|
|
|
26
26
|
* An instance of the helper that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
|
|
27
27
|
* that are used by the {@glink features/link link} and the {@glink features/images/images-linking linking images} features.
|
|
28
28
|
*/
|
|
29
|
-
automaticDecorators = new
|
|
29
|
+
automaticDecorators = new AutomaticLinkDecorators();
|
|
30
30
|
/**
|
|
31
31
|
* Synchronizes the state of {@link #manualDecorators} with the currently present elements in the model.
|
|
32
32
|
*/
|
package/src/linkediting.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class LinkEditing extends Plugin {
|
|
|
51
51
|
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}
|
|
52
52
|
* and registers a {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast dispatcher}
|
|
53
53
|
* for each one of them. Downcast dispatchers are obtained using the
|
|
54
|
-
* {@link module:link/utils/automaticdecorators~
|
|
54
|
+
* {@link module:link/utils/automaticdecorators~AutomaticLinkDecorators#getDispatcher} method.
|
|
55
55
|
*
|
|
56
56
|
* **Note**: This method also activates the automatic external link decorator if enabled with
|
|
57
57
|
* {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}.
|
package/src/linkediting.js
CHANGED
|
@@ -119,7 +119,7 @@ export class LinkEditing extends Plugin {
|
|
|
119
119
|
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}
|
|
120
120
|
* and registers a {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast dispatcher}
|
|
121
121
|
* for each one of them. Downcast dispatchers are obtained using the
|
|
122
|
-
* {@link module:link/utils/automaticdecorators~
|
|
122
|
+
* {@link module:link/utils/automaticdecorators~AutomaticLinkDecorators#getDispatcher} method.
|
|
123
123
|
*
|
|
124
124
|
* **Note**: This method also activates the automatic external link decorator if enabled with
|
|
125
125
|
* {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}.
|
|
@@ -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 declare class
|
|
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 class
|
|
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() {
|
package/src/utils.d.ts
CHANGED
|
@@ -40,11 +40,14 @@ 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
|
/**
|
|
@@ -53,6 +56,8 @@ export declare function normalizeDecorators(decorators?: Record<string, LinkDeco
|
|
|
53
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
|
/**
|
package/src/utils.js
CHANGED
|
@@ -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);
|