@ckeditor/ckeditor5-highlight 48.2.0 → 48.3.0-alpha.1
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 +21 -21
- package/dist/highlight.d.ts +27 -27
- package/dist/highlightcommand.d.ts +40 -40
- package/dist/highlightconfig.d.ts +163 -163
- package/dist/highlightediting.d.ts +27 -27
- package/dist/highlightui.d.ts +76 -76
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +470 -472
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/augmentation.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { Highlight, HighlightCommand, HighlightConfig, HighlightEditing, HighlightUI } from
|
|
6
|
-
declare module
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
import type { Highlight, HighlightCommand, HighlightConfig, HighlightEditing, HighlightUI } from "./index.js";
|
|
6
|
+
declare module "@ckeditor/ckeditor5-core" {
|
|
7
|
+
interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of the {@link module:highlight/highlight~Highlight} feature.
|
|
10
|
+
*
|
|
11
|
+
* Read more in {@link module:highlight/highlightconfig~HighlightConfig}.
|
|
12
|
+
*/
|
|
13
|
+
highlight?: HighlightConfig;
|
|
14
|
+
}
|
|
15
|
+
interface PluginsMap {
|
|
16
|
+
[Highlight.pluginName]: Highlight;
|
|
17
|
+
[HighlightEditing.pluginName]: HighlightEditing;
|
|
18
|
+
[HighlightUI.pluginName]: HighlightUI;
|
|
19
|
+
}
|
|
20
|
+
interface CommandsMap {
|
|
21
|
+
highlight: HighlightCommand;
|
|
22
|
+
}
|
|
23
23
|
}
|
package/dist/highlight.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
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 { HighlightEditing } from
|
|
10
|
-
import { HighlightUI } from
|
|
6
|
+
* @module highlight/highlight
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { HighlightEditing } from "./highlightediting.js";
|
|
10
|
+
import { HighlightUI } from "./highlightui.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
* The highlight plugin.
|
|
13
|
+
*
|
|
14
|
+
* For a detailed overview, check the {@glink features/highlight Highlight feature} documentation.
|
|
15
|
+
*
|
|
16
|
+
* This is a "glue" plugin which loads the {@link module:highlight/highlightediting~HighlightEditing} and
|
|
17
|
+
* {@link module:highlight/highlightui~HighlightUI} plugins.
|
|
18
|
+
*/
|
|
19
19
|
export declare class Highlight extends Plugin {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires(): PluginDependenciesOf<[HighlightEditing, HighlightUI]>;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName(): "Highlight";
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static override get isOfficialPlugin(): true;
|
|
32
32
|
}
|
|
@@ -1,45 +1,45 @@
|
|
|
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
|
|
6
|
+
* @module highlight/highlightcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "@ckeditor/ckeditor5-core";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
* The highlight command. It is used by the {@link module:highlight/highlightediting~HighlightEditing highlight feature}
|
|
11
|
+
* to apply the text highlighting.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* editor.execute( 'highlight', { value: 'greenMarker' } );
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* **Note**: Executing the command without a value removes the attribute from the model. If the selection is collapsed
|
|
18
|
+
* inside a text with the highlight attribute, the command will remove the attribute from the entire range
|
|
19
|
+
* of that text.
|
|
20
|
+
*/
|
|
21
21
|
export declare class HighlightCommand extends Command {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A value indicating whether the command is active. If the selection has some highlight attribute,
|
|
24
|
+
* it corresponds to the value of that attribute.
|
|
25
|
+
*
|
|
26
|
+
* @observable
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
value: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
override refresh(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Executes the command.
|
|
36
|
+
*
|
|
37
|
+
* @param options Options for the executed command.
|
|
38
|
+
* @param options.value The value to apply.
|
|
39
|
+
*
|
|
40
|
+
* @fires execute
|
|
41
|
+
*/
|
|
42
|
+
override execute(options?: {
|
|
43
|
+
value?: string | null;
|
|
44
|
+
}): void;
|
|
45
45
|
}
|
|
@@ -1,171 +1,171 @@
|
|
|
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
|
-
|
|
6
|
+
* @module highlight/highlightconfig
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
* The highlight option descriptor. See {@link module:highlight/highlightconfig~HighlightConfig} to learn more.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* {
|
|
13
|
+
* model: 'pinkMarker',
|
|
14
|
+
* class: 'marker-pink',
|
|
15
|
+
* title: 'Pink Marker',
|
|
16
|
+
* color: 'var(--ck-content-highlight-marker-pink)',
|
|
17
|
+
* type: 'marker'
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
21
|
export interface HighlightOption {
|
|
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
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The user-readable title of the option.
|
|
24
|
+
*/
|
|
25
|
+
title: string;
|
|
26
|
+
/**
|
|
27
|
+
* The unique attribute value in the model.
|
|
28
|
+
*/
|
|
29
|
+
model: string;
|
|
30
|
+
/**
|
|
31
|
+
* The CSS `var()` used for the highlighter. The color is used in the user interface to represent the highlighter.
|
|
32
|
+
* There is a possibility to use the default color format like rgb, hex or hsl, but you need to care about the color of `<mark>`
|
|
33
|
+
* by adding CSS classes definition.
|
|
34
|
+
*/
|
|
35
|
+
color: string;
|
|
36
|
+
/**
|
|
37
|
+
* The CSS class used on the `<mark>` element in the view. It should match the `color` setting.
|
|
38
|
+
*/
|
|
39
|
+
class: string;
|
|
40
|
+
/**
|
|
41
|
+
* The type of highlighter:
|
|
42
|
+
*
|
|
43
|
+
* * `'marker'` – Uses the `color` as the `background-color` style,
|
|
44
|
+
* * `'pen'` – Uses the `color` as the font `color` style.
|
|
45
|
+
*/
|
|
46
|
+
type: "marker" | "pen";
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
* The configuration of the {@link module:highlight/highlight~Highlight highlight feature}.
|
|
50
|
+
* ```ts
|
|
51
|
+
* ClassicEditor
|
|
52
|
+
* .create( {
|
|
53
|
+
* highlight: ... // Highlight feature configuration.
|
|
54
|
+
* } )
|
|
55
|
+
* .then( ... )
|
|
56
|
+
* .catch( ... );
|
|
57
|
+
* ```
|
|
58
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
59
|
+
*/
|
|
60
60
|
export interface HighlightConfig {
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The available highlight options. The default value is:
|
|
63
|
+
* ```ts
|
|
64
|
+
* options: [
|
|
65
|
+
* {
|
|
66
|
+
* model: 'yellowMarker',
|
|
67
|
+
* class: 'marker-yellow',
|
|
68
|
+
* title: 'Yellow marker',
|
|
69
|
+
* color: 'var(--ck-content-highlight-marker-yellow)',
|
|
70
|
+
* type: 'marker'
|
|
71
|
+
* },
|
|
72
|
+
* {
|
|
73
|
+
* model: 'greenMarker',
|
|
74
|
+
* class: 'marker-green',
|
|
75
|
+
* title: 'Green marker',
|
|
76
|
+
* color: 'var(--ck-content-highlight-marker-green)',
|
|
77
|
+
* type: 'marker'
|
|
78
|
+
* },
|
|
79
|
+
* {
|
|
80
|
+
* model: 'pinkMarker',
|
|
81
|
+
* class: 'marker-pink',
|
|
82
|
+
* title: 'Pink marker',
|
|
83
|
+
* color: 'var(--ck-content-highlight-marker-pink)',
|
|
84
|
+
* type: 'marker'
|
|
85
|
+
* },
|
|
86
|
+
* {
|
|
87
|
+
* model: 'blueMarker',
|
|
88
|
+
* class: 'marker-blue',
|
|
89
|
+
* title: 'Blue marker',
|
|
90
|
+
* color: 'var(--ck-content-highlight-marker-blue)',
|
|
91
|
+
* type: 'marker'
|
|
92
|
+
* },
|
|
93
|
+
* {
|
|
94
|
+
* model: 'redPen',
|
|
95
|
+
* class: 'pen-red',
|
|
96
|
+
* title: 'Red pen',
|
|
97
|
+
* color: 'var(--ck-content-highlight-pen-red)',
|
|
98
|
+
* type: 'pen'
|
|
99
|
+
* },
|
|
100
|
+
* {
|
|
101
|
+
* model: 'greenPen',
|
|
102
|
+
* class: 'pen-green',
|
|
103
|
+
* title: 'Green pen',
|
|
104
|
+
* color: 'var(--ck-content-highlight-pen-green)',
|
|
105
|
+
* type: 'pen'
|
|
106
|
+
* }
|
|
107
|
+
* ]
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* There are two types of highlighters available:
|
|
111
|
+
*
|
|
112
|
+
* * `'marker'` – Rendered as a `<mark>` element, styled with the `background-color`.
|
|
113
|
+
* * `'pen'` – Rendered as a `<mark>` element, styled with the font `color`.
|
|
114
|
+
*
|
|
115
|
+
* **Note**: The highlight feature provides a stylesheet with the CSS classes and corresponding colors defined
|
|
116
|
+
* as CSS variables.
|
|
117
|
+
*
|
|
118
|
+
* ```css
|
|
119
|
+
* :root {
|
|
120
|
+
* --ck-content-highlight-marker-yellow: #fdfd77;
|
|
121
|
+
* --ck-content-highlight-marker-green: #63f963;
|
|
122
|
+
* --ck-content-highlight-marker-pink: #fc7999;
|
|
123
|
+
* --ck-content-highlight-marker-blue: #72cdfd;
|
|
124
|
+
* --ck-content-highlight-pen-red: #e91313;
|
|
125
|
+
* --ck-content-highlight-pen-green: #118800;
|
|
126
|
+
* }
|
|
127
|
+
*
|
|
128
|
+
* .marker-yellow { ... }
|
|
129
|
+
* .marker-green { ... }
|
|
130
|
+
* .marker-pink { ... }
|
|
131
|
+
* .marker-blue { ... }
|
|
132
|
+
* .pen-red { ... }
|
|
133
|
+
* .pen-green { ... }
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* It is possible to define the `color` property directly as `rgba(R, G, B, A)`,
|
|
137
|
+
* `#RRGGBB[AA]` or `hsla(H, S, L, A)`. In such situation, the color will **only** apply to the UI of
|
|
138
|
+
* the editor and the `<mark>` elements in the content must be styled by custom classes provided by
|
|
139
|
+
* a dedicated stylesheet.
|
|
140
|
+
*
|
|
141
|
+
* **Note**: It is recommended for the `color` property to correspond to the class in the content
|
|
142
|
+
* stylesheet because it represents the highlighter in the user interface of the editor.
|
|
143
|
+
*
|
|
144
|
+
* ```ts
|
|
145
|
+
* ClassicEditor
|
|
146
|
+
* .create( {
|
|
147
|
+
* highlight: {
|
|
148
|
+
* options: [
|
|
149
|
+
* {
|
|
150
|
+
* model: 'pinkMarker',
|
|
151
|
+
* class: 'marker-pink',
|
|
152
|
+
* title: 'Pink Marker',
|
|
153
|
+
* color: 'var(--ck-content-highlight-marker-pink)',
|
|
154
|
+
* type: 'marker'
|
|
155
|
+
* },
|
|
156
|
+
* {
|
|
157
|
+
* model: 'redPen',
|
|
158
|
+
* class: 'pen-red',
|
|
159
|
+
* title: 'Red Pen',
|
|
160
|
+
* color: 'var(--ck-content-highlight-pen-red)',
|
|
161
|
+
* type: 'pen'
|
|
162
|
+
* },
|
|
163
|
+
* ]
|
|
164
|
+
* }
|
|
165
|
+
* } )
|
|
166
|
+
* .then( ... )
|
|
167
|
+
* .catch( ... );
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
options: Array<HighlightOption>;
|
|
171
171
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
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, type Editor } from
|
|
6
|
+
* @module highlight/highlightediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from "@ckeditor/ckeditor5-core";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* The highlight editing feature. It introduces the {@link module:highlight/highlightcommand~HighlightCommand command} and the `highlight`
|
|
11
|
+
* attribute in the {@link module:engine/model/model~Model model} which renders in the {@link module:engine/view/view view}
|
|
12
|
+
* as a `<mark>` element with a `class` attribute (`<mark class="marker-green">...</mark>`) depending
|
|
13
|
+
* on the {@link module:highlight/highlightconfig~HighlightConfig configuration}.
|
|
14
|
+
*/
|
|
15
15
|
export declare class HighlightEditing extends Plugin {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get pluginName(): "HighlightEditing";
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static override get isOfficialPlugin(): true;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
constructor(editor: Editor);
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
init(): void;
|
|
32
32
|
}
|