1 | import { Plugin } from '@ckeditor/ckeditor5-core';
|
2 | import LinkEditing from './linkediting';
|
3 | import LinkUI from './linkui';
|
4 | import AutoLink from './autolink';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export default class Link extends Plugin {
|
13 | static readonly requires: [typeof LinkEditing, typeof LinkUI, typeof AutoLink];
|
14 | static readonly pluginName: 'Link';
|
15 | }
|
16 |
|
17 | export interface LinkDecoratorDefinition {
|
18 | mode: 'automatic' | 'manual';
|
19 | }
|
20 |
|
21 | export interface LinkDecoratorAutomaticDefinition extends LinkDecoratorDefinition {
|
22 | attributes?: Record<string, string>;
|
23 | callback(url: string): boolean;
|
24 | mode: 'automatic';
|
25 | classes?: string | string[];
|
26 | styles?: Record<string, string>;
|
27 | }
|
28 |
|
29 | export interface LinkDecoratorManualDefinition extends LinkDecoratorDefinition {
|
30 | attributes?: Record<string, string>;
|
31 | defaultValue?: boolean | undefined;
|
32 | label: string;
|
33 | mode: 'manual';
|
34 | styles?: Record<string, string>;
|
35 | classes?: string | string[];
|
36 | }
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | export interface LinkConfig {
|
44 | addTargetToExternalLinks?: boolean | undefined;
|
45 | decorators?: Record<string, LinkDecoratorManualDefinition | LinkDecoratorAutomaticDefinition> | undefined;
|
46 | defaultProtocol?: string | undefined;
|
47 | }
|
48 |
|
49 | declare module '@ckeditor/ckeditor5-core/src/plugincollection' {
|
50 | interface Plugins {
|
51 | Link: Link;
|
52 | }
|
53 | }
|
54 |
|
55 | declare module '@ckeditor/ckeditor5-core/src/editor/editorconfig' {
|
56 | interface EditorConfig {
|
57 | link?: LinkConfig | undefined;
|
58 | 'link.addTargetToExternalLinks'?: LinkConfig['addTargetToExternalLinks'];
|
59 | 'link.decorators'?: LinkConfig['decorators'];
|
60 | 'link.defaultProtocol'?: LinkConfig['defaultProtocol'];
|
61 | }
|
62 | }
|