@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-link",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "46.0.0-alpha.0",
|
|
4
4
|
"description": "Link feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-clipboard": "
|
|
17
|
-
"@ckeditor/ckeditor5-core": "
|
|
18
|
-
"@ckeditor/ckeditor5-engine": "
|
|
19
|
-
"@ckeditor/ckeditor5-icons": "
|
|
20
|
-
"@ckeditor/ckeditor5-image": "
|
|
21
|
-
"@ckeditor/ckeditor5-typing": "
|
|
22
|
-
"@ckeditor/ckeditor5-ui": "
|
|
23
|
-
"@ckeditor/ckeditor5-utils": "
|
|
24
|
-
"@ckeditor/ckeditor5-widget": "
|
|
25
|
-
"ckeditor5": "
|
|
26
|
-
"es-toolkit": "1.
|
|
16
|
+
"@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.0",
|
|
17
|
+
"@ckeditor/ckeditor5-core": "46.0.0-alpha.0",
|
|
18
|
+
"@ckeditor/ckeditor5-engine": "46.0.0-alpha.0",
|
|
19
|
+
"@ckeditor/ckeditor5-icons": "46.0.0-alpha.0",
|
|
20
|
+
"@ckeditor/ckeditor5-image": "46.0.0-alpha.0",
|
|
21
|
+
"@ckeditor/ckeditor5-typing": "46.0.0-alpha.0",
|
|
22
|
+
"@ckeditor/ckeditor5-ui": "46.0.0-alpha.0",
|
|
23
|
+
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.0",
|
|
24
|
+
"@ckeditor/ckeditor5-widget": "46.0.0-alpha.0",
|
|
25
|
+
"ckeditor5": "46.0.0-alpha.0",
|
|
26
|
+
"es-toolkit": "1.39.5"
|
|
27
27
|
},
|
|
28
28
|
"author": "CKSource (http://cksource.com/)",
|
|
29
29
|
"license": "SEE LICENSE IN LICENSE.md",
|
package/src/autolink.d.ts
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Delete } from 'ckeditor5/src/typing.js';
|
|
10
|
-
import LinkEditing from './linkediting.js';
|
|
10
|
+
import { LinkEditing } from './linkediting.js';
|
|
11
11
|
/**
|
|
12
12
|
* The autolink plugin.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export declare class AutoLink extends Plugin {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
package/src/autolink.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Delete, TextWatcher, getLastTextLine, findAttributeRange } from 'ckeditor5/src/typing.js';
|
|
10
10
|
import { addLinkProtocolIfApplicable, linkHasProtocol } from './utils.js';
|
|
11
|
-
import LinkEditing from './linkediting.js';
|
|
11
|
+
import { LinkEditing } from './linkediting.js';
|
|
12
12
|
const MIN_LINK_LENGTH_WITH_SPACE_AT_END = 4; // Ie: "t.co " (length 5).
|
|
13
13
|
// This was a tweak from https://gist.github.com/dperini/729294.
|
|
14
14
|
const URL_REG_EXP = new RegExp(
|
|
@@ -63,7 +63,7 @@ const URL_GROUP_IN_MATCH = 2;
|
|
|
63
63
|
/**
|
|
64
64
|
* The autolink plugin.
|
|
65
65
|
*/
|
|
66
|
-
export
|
|
66
|
+
export class AutoLink extends Plugin {
|
|
67
67
|
/**
|
|
68
68
|
* @inheritDoc
|
|
69
69
|
*/
|
package/src/index.d.ts
CHANGED
|
@@ -5,16 +5,27 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module link
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export
|
|
8
|
+
export { Link } from './link.js';
|
|
9
|
+
export { LinkEditing } from './linkediting.js';
|
|
10
|
+
export { LinkUI, type LinksProviderListItem, type LinksProvider, type LinksProviderDetailedItem } from './linkui.js';
|
|
11
|
+
export { LinkImage } from './linkimage.js';
|
|
12
|
+
export { LinkImageEditing } from './linkimageediting.js';
|
|
13
|
+
export { LinkImageUI } from './linkimageui.js';
|
|
14
|
+
export { AutoLink } from './autolink.js';
|
|
15
|
+
export { LinkFormView } from './ui/linkformview.js';
|
|
16
|
+
export { LinkCommand } from './linkcommand.js';
|
|
17
|
+
export { UnlinkCommand } from './unlinkcommand.js';
|
|
18
|
+
export { LinkButtonView as _LinkButtonView } from './ui/linkbuttonview.js';
|
|
19
|
+
export { LinkPreviewButtonView as _LinkPreviewButtonView } from './ui/linkpreviewbuttonview.js';
|
|
20
|
+
export { LinkPropertiesView } from './ui/linkpropertiesview.js';
|
|
21
|
+
export { LinkProviderItemsView } from './ui/linkprovideritemsview.js';
|
|
22
|
+
export type { LinkPreviewButtonNavigateEvent } from './ui/linkpreviewbuttonview.js';
|
|
23
|
+
export type { LinkPropertiesBackEvent } from './ui/linkpropertiesview.js';
|
|
24
|
+
export type { LinkProvidersCancelEvent } from './ui/linkprovideritemsview.js';
|
|
25
|
+
export type { LinkFormValidatorCallback, LinkFormSubmitEvent, LinkFormCancelEvent } from './ui/linkformview.js';
|
|
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
|
+
export type { NormalizedLinkDecoratorAutomaticDefinition, NormalizedLinkDecoratorManualDefinition, NormalizedLinkDecoratorDefinition } from './utils.js';
|
|
28
|
+
export { AutomaticDecorators } from './utils/automaticdecorators.js';
|
|
29
|
+
export { LinkManualDecorator } from './utils/manualdecorator.js';
|
|
30
|
+
export type { LinkConfig, LinkDecoratorDefinition, LinkDecoratorAutomaticDefinition, LinkDecoratorManualDefinition } from './linkconfig.js';
|
|
20
31
|
import './augmentation.js';
|
package/src/index.js
CHANGED
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module link
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
8
|
+
export { Link } from './link.js';
|
|
9
|
+
export { LinkEditing } from './linkediting.js';
|
|
10
|
+
export { LinkUI } from './linkui.js';
|
|
11
|
+
export { LinkImage } from './linkimage.js';
|
|
12
|
+
export { LinkImageEditing } from './linkimageediting.js';
|
|
13
|
+
export { LinkImageUI } from './linkimageui.js';
|
|
14
|
+
export { AutoLink } from './autolink.js';
|
|
15
|
+
export { LinkFormView } from './ui/linkformview.js';
|
|
16
|
+
export { LinkCommand } from './linkcommand.js';
|
|
17
|
+
export { UnlinkCommand } from './unlinkcommand.js';
|
|
18
|
+
export { LinkButtonView as _LinkButtonView } from './ui/linkbuttonview.js';
|
|
19
|
+
export { LinkPreviewButtonView as _LinkPreviewButtonView } from './ui/linkpreviewbuttonview.js';
|
|
20
|
+
export { LinkPropertiesView } from './ui/linkpropertiesview.js';
|
|
21
|
+
export { LinkProviderItemsView } from './ui/linkprovideritemsview.js';
|
|
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 { AutomaticDecorators } from './utils/automaticdecorators.js';
|
|
24
|
+
export { LinkManualDecorator } from './utils/manualdecorator.js';
|
|
19
25
|
import './augmentation.js';
|
package/src/link.d.ts
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
* @module link/link
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import LinkEditing from './linkediting.js';
|
|
10
|
-
import LinkUI from './linkui.js';
|
|
11
|
-
import AutoLink from './autolink.js';
|
|
9
|
+
import { LinkEditing } from './linkediting.js';
|
|
10
|
+
import { LinkUI } from './linkui.js';
|
|
11
|
+
import { AutoLink } from './autolink.js';
|
|
12
12
|
/**
|
|
13
13
|
* The link plugin.
|
|
14
14
|
*
|
|
15
15
|
* This is a "glue" plugin that loads the {@link module:link/linkediting~LinkEditing link editing feature}
|
|
16
16
|
* and {@link module:link/linkui~LinkUI link UI feature}.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export declare class Link extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
package/src/link.js
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
* @module link/link
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import LinkEditing from './linkediting.js';
|
|
10
|
-
import LinkUI from './linkui.js';
|
|
11
|
-
import AutoLink from './autolink.js';
|
|
9
|
+
import { LinkEditing } from './linkediting.js';
|
|
10
|
+
import { LinkUI } from './linkui.js';
|
|
11
|
+
import { AutoLink } from './autolink.js';
|
|
12
12
|
/**
|
|
13
13
|
* The link plugin.
|
|
14
14
|
*
|
|
15
15
|
* This is a "glue" plugin that loads the {@link module:link/linkediting~LinkEditing link editing feature}
|
|
16
16
|
* and {@link module:link/linkui~LinkUI link UI feature}.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class Link extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
package/src/linkcommand.d.ts
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Command } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Collection } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import AutomaticDecorators from './utils/automaticdecorators.js';
|
|
11
|
-
import type
|
|
10
|
+
import { AutomaticDecorators } from './utils/automaticdecorators.js';
|
|
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}.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class LinkCommand extends Command {
|
|
16
16
|
/**
|
|
17
17
|
* The value of the `'linkHref'` attribute if the start of the selection is located in a node with this attribute.
|
|
18
18
|
*
|
|
@@ -21,12 +21,12 @@ export default class LinkCommand extends Command {
|
|
|
21
21
|
*/
|
|
22
22
|
value: string | undefined;
|
|
23
23
|
/**
|
|
24
|
-
* A collection of {@link module:link/utils/manualdecorator~
|
|
24
|
+
* A collection of {@link module:link/utils/manualdecorator~LinkManualDecorator manual decorators}
|
|
25
25
|
* corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.
|
|
26
26
|
*
|
|
27
27
|
* You can consider it a model with states of manual decorators added to the currently selected link.
|
|
28
28
|
*/
|
|
29
|
-
readonly manualDecorators: Collection<
|
|
29
|
+
readonly manualDecorators: Collection<LinkManualDecorator>;
|
|
30
30
|
/**
|
|
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.
|
|
@@ -47,7 +47,7 @@ export default class LinkCommand extends Command {
|
|
|
47
47
|
* those nodes where the `linkHref` attribute is allowed (disallowed nodes will be omitted).
|
|
48
48
|
*
|
|
49
49
|
* When the selection is collapsed and is not inside the text with the `linkHref` attribute, a
|
|
50
|
-
* new {@link module:engine/model/text~
|
|
50
|
+
* new {@link module:engine/model/text~ModelText text node} with the `linkHref` attribute will be inserted in place of the caret, but
|
|
51
51
|
* only if such element is allowed in this place. The `_data` of the inserted text will equal the `href` parameter.
|
|
52
52
|
* The selection will be updated to wrap the just inserted text node.
|
|
53
53
|
*
|
|
@@ -57,7 +57,7 @@ export default class LinkCommand extends Command {
|
|
|
57
57
|
*
|
|
58
58
|
* There is an optional argument to this command that applies or removes model
|
|
59
59
|
* {@glink framework/architecture/editing-engine#text-attributes text attributes} brought by
|
|
60
|
-
* {@link module:link/utils/manualdecorator~
|
|
60
|
+
* {@link module:link/utils/manualdecorator~LinkManualDecorator manual link decorators}.
|
|
61
61
|
*
|
|
62
62
|
* Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators
|
|
63
63
|
* configuration}.
|
package/src/linkcommand.js
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
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
|
-
import {
|
|
12
|
-
import AutomaticDecorators from './utils/automaticdecorators.js';
|
|
11
|
+
import { ModelLivePosition } from 'ckeditor5/src/engine.js';
|
|
12
|
+
import { AutomaticDecorators } 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}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class LinkCommand extends Command {
|
|
18
18
|
/**
|
|
19
|
-
* A collection of {@link module:link/utils/manualdecorator~
|
|
19
|
+
* A collection of {@link module:link/utils/manualdecorator~LinkManualDecorator manual decorators}
|
|
20
20
|
* corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.
|
|
21
21
|
*
|
|
22
22
|
* You can consider it a model with states of manual decorators added to the currently selected link.
|
|
@@ -63,7 +63,7 @@ export default class LinkCommand extends Command {
|
|
|
63
63
|
* those nodes where the `linkHref` attribute is allowed (disallowed nodes will be omitted).
|
|
64
64
|
*
|
|
65
65
|
* When the selection is collapsed and is not inside the text with the `linkHref` attribute, a
|
|
66
|
-
* new {@link module:engine/model/text~
|
|
66
|
+
* new {@link module:engine/model/text~ModelText text node} with the `linkHref` attribute will be inserted in place of the caret, but
|
|
67
67
|
* only if such element is allowed in this place. The `_data` of the inserted text will equal the `href` parameter.
|
|
68
68
|
* The selection will be updated to wrap the just inserted text node.
|
|
69
69
|
*
|
|
@@ -73,7 +73,7 @@ export default class LinkCommand extends Command {
|
|
|
73
73
|
*
|
|
74
74
|
* There is an optional argument to this command that applies or removes model
|
|
75
75
|
* {@glink framework/architecture/editing-engine#text-attributes text attributes} brought by
|
|
76
|
-
* {@link module:link/utils/manualdecorator~
|
|
76
|
+
* {@link module:link/utils/manualdecorator~LinkManualDecorator manual link decorators}.
|
|
77
77
|
*
|
|
78
78
|
* Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators
|
|
79
79
|
* configuration}.
|
|
@@ -268,8 +268,8 @@ export default class LinkCommand extends Command {
|
|
|
268
268
|
}
|
|
269
269
|
// Store the selection ranges in a pseudo live range array (stickiness to the outside of the range).
|
|
270
270
|
const stickyPseudoRanges = selectionRanges.map(range => ({
|
|
271
|
-
start:
|
|
272
|
-
end:
|
|
271
|
+
start: ModelLivePosition.fromPosition(range.start, 'toPrevious'),
|
|
272
|
+
end: ModelLivePosition.fromPosition(range.end, 'toNext')
|
|
273
273
|
}));
|
|
274
274
|
// Update or set links (including text update if needed).
|
|
275
275
|
for (let range of rangesToUpdate) {
|
package/src/linkconfig.d.ts
CHANGED
|
@@ -248,19 +248,19 @@ export interface LinkDecoratorAutomaticDefinition {
|
|
|
248
248
|
/**
|
|
249
249
|
* Key-value pairs used as link attributes added to the output during the
|
|
250
250
|
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
251
|
-
* Attributes should follow the {@link module:engine/view/elementdefinition~
|
|
251
|
+
* Attributes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
252
252
|
*/
|
|
253
253
|
attributes?: Record<string, string>;
|
|
254
254
|
/**
|
|
255
255
|
* Key-value pairs used as link styles added to the output during the
|
|
256
256
|
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
257
|
-
* Styles should follow the {@link module:engine/view/elementdefinition~
|
|
257
|
+
* Styles should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
258
258
|
*/
|
|
259
259
|
styles?: Record<string, string>;
|
|
260
260
|
/**
|
|
261
261
|
* Class names used as link classes added to the output during the
|
|
262
262
|
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
263
|
-
* Classes should follow the {@link module:engine/view/elementdefinition~
|
|
263
|
+
* Classes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
264
264
|
*/
|
|
265
265
|
classes?: ArrayOrItem<string>;
|
|
266
266
|
}
|
|
@@ -296,19 +296,19 @@ export interface LinkDecoratorManualDefinition {
|
|
|
296
296
|
/**
|
|
297
297
|
* Key-value pairs used as link attributes added to the output during the
|
|
298
298
|
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
299
|
-
* Attributes should follow the {@link module:engine/view/elementdefinition~
|
|
299
|
+
* Attributes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
300
300
|
*/
|
|
301
301
|
attributes?: Record<string, string>;
|
|
302
302
|
/**
|
|
303
303
|
* Key-value pairs used as link styles added to the output during the
|
|
304
304
|
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
305
|
-
* Styles should follow the {@link module:engine/view/elementdefinition~
|
|
305
|
+
* Styles should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
306
306
|
*/
|
|
307
307
|
styles?: Record<string, string>;
|
|
308
308
|
/**
|
|
309
309
|
* Class names used as link classes added to the output during the
|
|
310
310
|
* {@glink framework/architecture/editing-engine#conversion downcasting}.
|
|
311
|
-
* Classes should follow the {@link module:engine/view/elementdefinition~
|
|
311
|
+
* Classes should follow the {@link module:engine/view/elementdefinition~ViewElementDefinition} syntax.
|
|
312
312
|
*/
|
|
313
313
|
classes?: ArrayOrItem<string>;
|
|
314
314
|
/**
|
package/src/linkediting.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import '../theme/link.css';
|
|
|
15
15
|
* It introduces the `linkHref="url"` attribute in the model which renders to the view as a `<a href="url">` element
|
|
16
16
|
* as well as `'link'` and `'unlink'` commands.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export declare class LinkEditing extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* A list of functions that handles opening links. If any of them returns `true`, the link is considered to be opened.
|
|
21
21
|
*/
|
|
@@ -59,21 +59,21 @@ export default class LinkEditing extends Plugin {
|
|
|
59
59
|
private _enableAutomaticDecorators;
|
|
60
60
|
/**
|
|
61
61
|
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorManualDefinition manual decorators},
|
|
62
|
-
* transforms them into {@link module:link/utils/manualdecorator~
|
|
62
|
+
* transforms them into {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and stores them in the
|
|
63
63
|
* {@link module:link/linkcommand~LinkCommand#manualDecorators} collection (a model for manual decorators state).
|
|
64
64
|
*
|
|
65
65
|
* Also registers an {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attribute-to-element}
|
|
66
|
-
* converter for each manual decorator and extends the {@link module:engine/model/schema~
|
|
66
|
+
* converter for each manual decorator and extends the {@link module:engine/model/schema~ModelSchema model's schema}
|
|
67
67
|
* with adequate model attributes.
|
|
68
68
|
*/
|
|
69
69
|
private _enableManualDecorators;
|
|
70
70
|
/**
|
|
71
|
-
* Attaches handlers for {@link module:engine/view/document~
|
|
72
|
-
* {@link module:engine/view/document~
|
|
71
|
+
* Attaches handlers for {@link module:engine/view/document~ViewDocument#event:enter} and
|
|
72
|
+
* {@link module:engine/view/document~ViewDocument#event:click} to enable link following.
|
|
73
73
|
*/
|
|
74
74
|
private _enableLinkOpen;
|
|
75
75
|
/**
|
|
76
|
-
* Watches the
|
|
76
|
+
* Watches the ModelDocumentSelection attribute changes and removes link decorator attributes when the linkHref attribute is removed.
|
|
77
77
|
*
|
|
78
78
|
* This is to ensure that there is no left-over link decorator attributes on the document selection that is no longer in a link.
|
|
79
79
|
*/
|
package/src/linkediting.js
CHANGED
|
@@ -9,9 +9,9 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
9
9
|
import { Input, TwoStepCaretMovement, inlineHighlight } from 'ckeditor5/src/typing.js';
|
|
10
10
|
import { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';
|
|
11
11
|
import { keyCodes, env } from 'ckeditor5/src/utils.js';
|
|
12
|
-
import LinkCommand from './linkcommand.js';
|
|
13
|
-
import UnlinkCommand from './unlinkcommand.js';
|
|
14
|
-
import
|
|
12
|
+
import { LinkCommand } from './linkcommand.js';
|
|
13
|
+
import { UnlinkCommand } from './unlinkcommand.js';
|
|
14
|
+
import { LinkManualDecorator } from './utils/manualdecorator.js';
|
|
15
15
|
import { createLinkElement, ensureSafeUrl, getLocalizedDecorators, normalizeDecorators, addLinkProtocolIfApplicable, openLink } from './utils.js';
|
|
16
16
|
import '../theme/link.css';
|
|
17
17
|
const HIGHLIGHT_CLASS = 'ck-link_selected';
|
|
@@ -24,7 +24,7 @@ const EXTERNAL_LINKS_REGEXP = /^(https?:)?\/\//;
|
|
|
24
24
|
* It introduces the `linkHref="url"` attribute in the model which renders to the view as a `<a href="url">` element
|
|
25
25
|
* as well as `'link'` and `'unlink'` commands.
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export class LinkEditing extends Plugin {
|
|
28
28
|
/**
|
|
29
29
|
* A list of functions that handles opening links. If any of them returns `true`, the link is considered to be opened.
|
|
30
30
|
*/
|
|
@@ -101,7 +101,7 @@ export default class LinkEditing extends Plugin {
|
|
|
101
101
|
inlineHighlight(editor, 'linkHref', 'a', HIGHLIGHT_CLASS);
|
|
102
102
|
// Handle link following by CTRL+click or ALT+ENTER
|
|
103
103
|
this._enableLinkOpen();
|
|
104
|
-
// Clears the
|
|
104
|
+
// Clears the ModelDocumentSelection decorator attributes if the selection is no longer in a link (for example while using 2-SCM).
|
|
105
105
|
this._enableSelectionAttributesFixer();
|
|
106
106
|
// Handle adding default protocol to pasted links.
|
|
107
107
|
this._enableClipboardIntegration();
|
|
@@ -149,11 +149,11 @@ export default class LinkEditing extends Plugin {
|
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorManualDefinition manual decorators},
|
|
152
|
-
* transforms them into {@link module:link/utils/manualdecorator~
|
|
152
|
+
* transforms them into {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and stores them in the
|
|
153
153
|
* {@link module:link/linkcommand~LinkCommand#manualDecorators} collection (a model for manual decorators state).
|
|
154
154
|
*
|
|
155
155
|
* Also registers an {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attribute-to-element}
|
|
156
|
-
* converter for each manual decorator and extends the {@link module:engine/model/schema~
|
|
156
|
+
* converter for each manual decorator and extends the {@link module:engine/model/schema~ModelSchema model's schema}
|
|
157
157
|
* with adequate model attributes.
|
|
158
158
|
*/
|
|
159
159
|
_enableManualDecorators(manualDecoratorDefinitions) {
|
|
@@ -166,7 +166,7 @@ export default class LinkEditing extends Plugin {
|
|
|
166
166
|
manualDecoratorDefinitions.forEach(decoratorDefinition => {
|
|
167
167
|
editor.model.schema.extend('$text', { allowAttributes: decoratorDefinition.id });
|
|
168
168
|
// Keeps reference to manual decorator to decode its name to attributes during downcast.
|
|
169
|
-
const decorator = new
|
|
169
|
+
const decorator = new LinkManualDecorator(decoratorDefinition);
|
|
170
170
|
manualDecorators.add(decorator);
|
|
171
171
|
editor.conversion.for('downcast').attributeToElement({
|
|
172
172
|
model: decorator.id,
|
|
@@ -200,8 +200,8 @@ export default class LinkEditing extends Plugin {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
/**
|
|
203
|
-
* Attaches handlers for {@link module:engine/view/document~
|
|
204
|
-
* {@link module:engine/view/document~
|
|
203
|
+
* Attaches handlers for {@link module:engine/view/document~ViewDocument#event:enter} and
|
|
204
|
+
* {@link module:engine/view/document~ViewDocument#event:click} to enable link following.
|
|
205
205
|
*/
|
|
206
206
|
_enableLinkOpen() {
|
|
207
207
|
const editor = this.editor;
|
|
@@ -245,7 +245,7 @@ export default class LinkEditing extends Plugin {
|
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
|
-
* Watches the
|
|
248
|
+
* Watches the ModelDocumentSelection attribute changes and removes link decorator attributes when the linkHref attribute is removed.
|
|
249
249
|
*
|
|
250
250
|
* This is to ensure that there is no left-over link decorator attributes on the document selection that is no longer in a link.
|
|
251
251
|
*/
|
package/src/linkimage.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module link/linkimage
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import LinkImageEditing from './linkimageediting.js';
|
|
10
|
-
import LinkImageUI from './linkimageui.js';
|
|
9
|
+
import { LinkImageEditing } from './linkimageediting.js';
|
|
10
|
+
import { LinkImageUI } from './linkimageui.js';
|
|
11
11
|
import '../theme/linkimage.css';
|
|
12
12
|
/**
|
|
13
13
|
* The `LinkImage` plugin.
|
|
@@ -15,7 +15,7 @@ import '../theme/linkimage.css';
|
|
|
15
15
|
* This is a "glue" plugin that loads the {@link module:link/linkimageediting~LinkImageEditing link image editing feature}
|
|
16
16
|
* and {@link module:link/linkimageui~LinkImageUI link image UI feature}.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export declare class LinkImage extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
package/src/linkimage.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module link/linkimage
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import LinkImageEditing from './linkimageediting.js';
|
|
10
|
-
import LinkImageUI from './linkimageui.js';
|
|
9
|
+
import { LinkImageEditing } from './linkimageediting.js';
|
|
10
|
+
import { LinkImageUI } from './linkimageui.js';
|
|
11
11
|
import '../theme/linkimage.css';
|
|
12
12
|
/**
|
|
13
13
|
* The `LinkImage` plugin.
|
|
@@ -15,7 +15,7 @@ import '../theme/linkimage.css';
|
|
|
15
15
|
* This is a "glue" plugin that loads the {@link module:link/linkimageediting~LinkImageEditing link image editing feature}
|
|
16
16
|
* and {@link module:link/linkimageui~LinkImageUI link image UI feature}.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class LinkImage extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @module link/linkimageediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import LinkEditing from './linkediting.js';
|
|
9
|
+
import { LinkEditing } from './linkediting.js';
|
|
10
10
|
/**
|
|
11
11
|
* The link image engine feature.
|
|
12
12
|
*
|
|
13
13
|
* It accepts the `linkHref="url"` attribute in the model for the {@link module:image/image~Image `<imageBlock>`} element
|
|
14
14
|
* which allows linking images.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class LinkImageEditing extends Plugin {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -36,7 +36,7 @@ export default class LinkImageEditing extends Plugin {
|
|
|
36
36
|
*/
|
|
37
37
|
private _enableAutomaticDecorators;
|
|
38
38
|
/**
|
|
39
|
-
* Processes transformed {@link module:link/utils/manualdecorator~
|
|
39
|
+
* Processes transformed {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and attaches proper converters
|
|
40
40
|
* that will work when linking an image.
|
|
41
41
|
*/
|
|
42
42
|
private _enableManualDecorators;
|
package/src/linkimageediting.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { Matcher } from 'ckeditor5/src/engine.js';
|
|
10
10
|
import { toMap } from 'ckeditor5/src/utils.js';
|
|
11
|
-
import LinkEditing from './linkediting.js';
|
|
11
|
+
import { LinkEditing } from './linkediting.js';
|
|
12
12
|
/**
|
|
13
13
|
* The link image engine feature.
|
|
14
14
|
*
|
|
15
15
|
* It accepts the `linkHref="url"` attribute in the model for the {@link module:image/image~Image `<imageBlock>`} element
|
|
16
16
|
* which allows linking images.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class LinkImageEditing extends Plugin {
|
|
19
19
|
/**
|
|
20
20
|
* @inheritDoc
|
|
21
21
|
*/
|
|
@@ -62,7 +62,7 @@ export default class LinkImageEditing extends Plugin {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Processes transformed {@link module:link/utils/manualdecorator~
|
|
65
|
+
* Processes transformed {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and attaches proper converters
|
|
66
66
|
* that will work when linking an image.
|
|
67
67
|
*/
|
|
68
68
|
_enableManualDecorators() {
|
package/src/linkimageui.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
-
import LinkUI from './linkui.js';
|
|
7
|
-
import LinkEditing from './linkediting.js';
|
|
6
|
+
import { LinkUI } from './linkui.js';
|
|
7
|
+
import { LinkEditing } from './linkediting.js';
|
|
8
8
|
/**
|
|
9
9
|
* The link image UI plugin.
|
|
10
10
|
*
|
|
11
11
|
* This plugin provides the `'linkImage'` button that can be displayed in the {@link module:image/imagetoolbar~ImageToolbar}.
|
|
12
12
|
* It can be used to wrap images in links.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export declare class LinkImageUI extends Plugin {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritDoc
|
|
17
17
|
*/
|
package/src/linkimageui.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { ButtonView } from 'ckeditor5/src/ui.js';
|
|
9
9
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
10
|
import { IconLink } from 'ckeditor5/src/icons.js';
|
|
11
|
-
import LinkUI from './linkui.js';
|
|
12
|
-
import LinkEditing from './linkediting.js';
|
|
11
|
+
import { LinkUI } from './linkui.js';
|
|
12
|
+
import { LinkEditing } from './linkediting.js';
|
|
13
13
|
import { LINK_KEYSTROKE } from './utils.js';
|
|
14
14
|
/**
|
|
15
15
|
* The link image UI plugin.
|
|
@@ -17,7 +17,7 @@ import { LINK_KEYSTROKE } from './utils.js';
|
|
|
17
17
|
* This plugin provides the `'linkImage'` button that can be displayed in the {@link module:image/imagetoolbar~ImageToolbar}.
|
|
18
18
|
* It can be used to wrap images in links.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class LinkImageUI extends Plugin {
|
|
21
21
|
/**
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
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**
|