1 | /**
|
2 | * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3 | * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4 | */
|
5 | /**
|
6 | * @module link/autolink
|
7 | */
|
8 | import { Plugin } from 'ckeditor5/src/core';
|
9 | import { Delete } from 'ckeditor5/src/typing';
|
10 | /**
|
11 | * The autolink plugin.
|
12 | */
|
13 | export default class AutoLink extends Plugin {
|
14 | /**
|
15 | * @inheritDoc
|
16 | */
|
17 | static get requires(): readonly [typeof Delete];
|
18 | /**
|
19 | * @inheritDoc
|
20 | */
|
21 | static get pluginName(): "AutoLink";
|
22 | /**
|
23 | * @inheritDoc
|
24 | */
|
25 | init(): void;
|
26 | /**
|
27 | * @inheritDoc
|
28 | */
|
29 | afterInit(): void;
|
30 | /**
|
31 | * Enables autolinking on typing.
|
32 | */
|
33 | private _enableTypingHandling;
|
34 | /**
|
35 | * Enables autolinking on the <kbd>Enter</kbd> key.
|
36 | */
|
37 | private _enableEnterHandling;
|
38 | /**
|
39 | * Enables autolinking on the <kbd>Shift</kbd>+<kbd>Enter</kbd> keyboard shortcut.
|
40 | */
|
41 | private _enableShiftEnterHandling;
|
42 | /**
|
43 | * Checks if the passed range contains a linkable text.
|
44 | */
|
45 | private _checkAndApplyAutoLinkOnRange;
|
46 | /**
|
47 | * Applies a link on a given range if the link should be applied.
|
48 | *
|
49 | * @param url The URL to link.
|
50 | * @param range The text range to apply the link attribute to.
|
51 | */
|
52 | private _applyAutoLink;
|
53 | /**
|
54 | * Enqueues autolink changes in the model.
|
55 | *
|
56 | * @param url The URL to link.
|
57 | * @param range The text range to apply the link attribute to.
|
58 | */
|
59 | private _persistAutoLink;
|
60 | }
|