@editora/toast 1.0.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.
Files changed (37) hide show
  1. package/README.md +14 -0
  2. package/dist/index.d.ts +18 -0
  3. package/dist/index.js +70 -0
  4. package/dist/packages/core/src/Editor.d.ts +15 -0
  5. package/dist/packages/core/src/Editor.js +37 -0
  6. package/dist/packages/core/src/EditorState.d.ts +13 -0
  7. package/dist/packages/core/src/EditorState.js +14 -0
  8. package/dist/packages/core/src/Selection.d.ts +126 -0
  9. package/dist/packages/core/src/Selection.js +232 -0
  10. package/dist/packages/core/src/commands/CommandManager.d.ts +56 -0
  11. package/dist/packages/core/src/commands/CommandManager.js +166 -0
  12. package/dist/packages/core/src/index.d.ts +7 -0
  13. package/dist/packages/core/src/index.js +4 -0
  14. package/dist/packages/core/src/model/Fragment.d.ts +80 -0
  15. package/dist/packages/core/src/model/Fragment.js +172 -0
  16. package/dist/packages/core/src/model/Mark.d.ts +108 -0
  17. package/dist/packages/core/src/model/Mark.js +138 -0
  18. package/dist/packages/core/src/model/Node.d.ts +172 -0
  19. package/dist/packages/core/src/model/Node.js +458 -0
  20. package/dist/packages/core/src/model/types.d.ts +29 -0
  21. package/dist/packages/core/src/model/types.js +1 -0
  22. package/dist/packages/core/src/plugins/Plugin.d.ts +37 -0
  23. package/dist/packages/core/src/plugins/Plugin.js +31 -0
  24. package/dist/packages/core/src/plugins/PluginManager.d.ts +75 -0
  25. package/dist/packages/core/src/plugins/PluginManager.js +185 -0
  26. package/dist/packages/core/src/schema/Node.d.ts +26 -0
  27. package/dist/packages/core/src/schema/Node.js +12 -0
  28. package/dist/packages/core/src/schema/Schema.d.ts +52 -0
  29. package/dist/packages/core/src/schema/Schema.js +296 -0
  30. package/dist/packages/core/src/security/Sanitizer.d.ts +81 -0
  31. package/dist/packages/core/src/security/Sanitizer.js +200 -0
  32. package/dist/packages/editora-toast/src/index.d.ts +18 -0
  33. package/dist/packages/editora-toast/src/index.js +70 -0
  34. package/dist/toast.css +42 -0
  35. package/package.json +27 -0
  36. package/src/index.ts +83 -0
  37. package/src/toast.css +42 -0
@@ -0,0 +1,31 @@
1
+ import { Schema } from '../schema/Node';
2
+ export class PluginManager {
3
+ constructor() {
4
+ this.plugins = [];
5
+ }
6
+ register(plugin) {
7
+ this.plugins.push(plugin);
8
+ }
9
+ buildSchema() {
10
+ const nodes = {};
11
+ const marks = {};
12
+ this.plugins.forEach(plugin => {
13
+ if (plugin.nodes)
14
+ Object.assign(nodes, plugin.nodes);
15
+ if (plugin.marks)
16
+ Object.assign(marks, plugin.marks);
17
+ });
18
+ return new Schema(nodes, marks);
19
+ }
20
+ getCommands() {
21
+ const commands = {};
22
+ this.plugins.forEach(plugin => {
23
+ if (plugin.commands)
24
+ Object.assign(commands, plugin.commands);
25
+ });
26
+ return commands;
27
+ }
28
+ getToolbarItems() {
29
+ return this.plugins.flatMap(p => p.toolbar || []);
30
+ }
31
+ }
@@ -0,0 +1,75 @@
1
+ import { Plugin, PluginContext } from './Plugin';
2
+ import { Schema } from '../schema/Schema';
3
+ /**
4
+ * Plugin manager handles plugin lifecycle and coordination.
5
+ */
6
+ export declare class PluginManager {
7
+ private plugins;
8
+ private initialized;
9
+ /**
10
+ * Register a plugin.
11
+ */
12
+ register(plugin: Plugin): void;
13
+ /**
14
+ * Unregister a plugin.
15
+ */
16
+ unregister(name: string): boolean;
17
+ /**
18
+ * Get a plugin by name.
19
+ */
20
+ get(name: string): Plugin | undefined;
21
+ /**
22
+ * Get all registered plugins.
23
+ */
24
+ getAll(): Plugin[];
25
+ /**
26
+ * Check if a plugin is registered.
27
+ */
28
+ has(name: string): boolean;
29
+ /**
30
+ * Initialize all plugins.
31
+ */
32
+ initialize(context: PluginContext): void;
33
+ /**
34
+ * Destroy all plugins.
35
+ */
36
+ destroy(context: PluginContext): void;
37
+ /**
38
+ * Handle transaction for all plugins.
39
+ */
40
+ onTransaction(tr: any, context: PluginContext): void;
41
+ /**
42
+ * Handle selection change for all plugins.
43
+ */
44
+ onSelectionChange(selection: any, context: PluginContext): void;
45
+ /**
46
+ * Merge schemas from all plugins.
47
+ */
48
+ mergeSchemas(baseSchema: Schema): Schema;
49
+ /**
50
+ * Get all commands from plugins.
51
+ */
52
+ getCommands(): Record<string, any>;
53
+ /**
54
+ * Get all toolbar items from plugins.
55
+ */
56
+ getToolbarItems(): any[];
57
+ /**
58
+ * Get all key bindings from plugins.
59
+ */
60
+ getKeyBindings(): Record<string, string>;
61
+ private initializePlugin;
62
+ private destroyPlugin;
63
+ /**
64
+ * Clear all plugins.
65
+ */
66
+ clear(): void;
67
+ /**
68
+ * Get plugin count.
69
+ */
70
+ get size(): number;
71
+ }
72
+ /**
73
+ * Create a plugin manager instance.
74
+ */
75
+ export declare function createPluginManager(): PluginManager;
@@ -0,0 +1,185 @@
1
+ import { Schema } from '../schema/Schema';
2
+ /**
3
+ * Plugin manager handles plugin lifecycle and coordination.
4
+ */
5
+ export class PluginManager {
6
+ constructor() {
7
+ this.plugins = new Map();
8
+ this.initialized = false;
9
+ }
10
+ /**
11
+ * Register a plugin.
12
+ */
13
+ register(plugin) {
14
+ if (this.plugins.has(plugin.name)) {
15
+ console.warn(`Plugin "${plugin.name}" is already registered`);
16
+ return;
17
+ }
18
+ this.plugins.set(plugin.name, plugin);
19
+ if (this.initialized) {
20
+ // Initialize immediately if manager is already initialized
21
+ this.initializePlugin(plugin);
22
+ }
23
+ }
24
+ /**
25
+ * Unregister a plugin.
26
+ */
27
+ unregister(name) {
28
+ const plugin = this.plugins.get(name);
29
+ if (!plugin)
30
+ return false;
31
+ if (this.initialized) {
32
+ this.destroyPlugin(plugin);
33
+ }
34
+ return this.plugins.delete(name);
35
+ }
36
+ /**
37
+ * Get a plugin by name.
38
+ */
39
+ get(name) {
40
+ return this.plugins.get(name);
41
+ }
42
+ /**
43
+ * Get all registered plugins.
44
+ */
45
+ getAll() {
46
+ return Array.from(this.plugins.values());
47
+ }
48
+ /**
49
+ * Check if a plugin is registered.
50
+ */
51
+ has(name) {
52
+ return this.plugins.has(name);
53
+ }
54
+ /**
55
+ * Initialize all plugins.
56
+ */
57
+ initialize(context) {
58
+ this.initialized = true;
59
+ for (const plugin of this.plugins.values()) {
60
+ this.initializePlugin(plugin, context);
61
+ }
62
+ }
63
+ /**
64
+ * Destroy all plugins.
65
+ */
66
+ destroy(context) {
67
+ for (const plugin of this.plugins.values()) {
68
+ this.destroyPlugin(plugin, context);
69
+ }
70
+ this.initialized = false;
71
+ }
72
+ /**
73
+ * Handle transaction for all plugins.
74
+ */
75
+ onTransaction(tr, context) {
76
+ for (const plugin of this.plugins.values()) {
77
+ plugin.onTransaction(tr, context);
78
+ }
79
+ }
80
+ /**
81
+ * Handle selection change for all plugins.
82
+ */
83
+ onSelectionChange(selection, context) {
84
+ for (const plugin of this.plugins.values()) {
85
+ plugin.onSelectionChange(selection, context);
86
+ }
87
+ }
88
+ /**
89
+ * Merge schemas from all plugins.
90
+ */
91
+ mergeSchemas(baseSchema) {
92
+ const nodeSpecs = Object.assign({}, baseSchema.spec.nodes);
93
+ const markSpecs = Object.assign({}, baseSchema.spec.marks);
94
+ for (const plugin of this.plugins.values()) {
95
+ const schemaExt = plugin.getSchemaExtensions();
96
+ if (schemaExt) {
97
+ if (schemaExt.nodes) {
98
+ Object.assign(nodeSpecs, schemaExt.nodes);
99
+ }
100
+ if (schemaExt.marks) {
101
+ Object.assign(markSpecs, schemaExt.marks);
102
+ }
103
+ }
104
+ }
105
+ return new Schema({
106
+ nodes: nodeSpecs,
107
+ marks: markSpecs,
108
+ topNode: baseSchema.spec.topNode
109
+ });
110
+ }
111
+ /**
112
+ * Get all commands from plugins.
113
+ */
114
+ getCommands() {
115
+ const commands = {};
116
+ for (const plugin of this.plugins.values()) {
117
+ const pluginCommands = plugin.getCommands();
118
+ Object.assign(commands, pluginCommands);
119
+ }
120
+ return commands;
121
+ }
122
+ /**
123
+ * Get all toolbar items from plugins.
124
+ */
125
+ getToolbarItems() {
126
+ const items = [];
127
+ for (const plugin of this.plugins.values()) {
128
+ const toolbarConfig = plugin.getToolbarConfig();
129
+ if (toolbarConfig === null || toolbarConfig === void 0 ? void 0 : toolbarConfig.items) {
130
+ items.push(...toolbarConfig.items);
131
+ }
132
+ }
133
+ return items;
134
+ }
135
+ /**
136
+ * Get all key bindings from plugins.
137
+ */
138
+ getKeyBindings() {
139
+ const bindings = {};
140
+ for (const plugin of this.plugins.values()) {
141
+ const pluginBindings = plugin.getKeyBindings();
142
+ Object.assign(bindings, pluginBindings);
143
+ }
144
+ return bindings;
145
+ }
146
+ initializePlugin(plugin, context) {
147
+ try {
148
+ if (context) {
149
+ plugin.init(context);
150
+ }
151
+ }
152
+ catch (error) {
153
+ console.error(`Failed to initialize plugin "${plugin.name}":`, error);
154
+ }
155
+ }
156
+ destroyPlugin(plugin, context) {
157
+ try {
158
+ if (context) {
159
+ plugin.destroy(context);
160
+ }
161
+ }
162
+ catch (error) {
163
+ console.error(`Failed to destroy plugin "${plugin.name}":`, error);
164
+ }
165
+ }
166
+ /**
167
+ * Clear all plugins.
168
+ */
169
+ clear() {
170
+ this.plugins.clear();
171
+ this.initialized = false;
172
+ }
173
+ /**
174
+ * Get plugin count.
175
+ */
176
+ get size() {
177
+ return this.plugins.size;
178
+ }
179
+ }
180
+ /**
181
+ * Create a plugin manager instance.
182
+ */
183
+ export function createPluginManager() {
184
+ return new PluginManager();
185
+ }
@@ -0,0 +1,26 @@
1
+ export interface NodeSpec {
2
+ content?: string;
3
+ marks?: string;
4
+ group?: string;
5
+ inline?: boolean;
6
+ attrs?: Record<string, any>;
7
+ toDOM?: (node: Node) => [string, Record<string, any>?, ...any[]];
8
+ parseDOM?: Array<{
9
+ tag: string;
10
+ getAttrs?: (dom: HTMLElement) => Record<string, any> | null;
11
+ }>;
12
+ }
13
+ export interface Node {
14
+ type: string;
15
+ content?: Node[];
16
+ text?: string;
17
+ marks?: string[];
18
+ attrs?: Record<string, any>;
19
+ }
20
+ export declare class Schema {
21
+ nodes: Map<string, NodeSpec>;
22
+ marks: Map<string, NodeSpec>;
23
+ constructor(nodes: Record<string, NodeSpec>, marks: Record<string, NodeSpec>);
24
+ node(type: string, attrs?: Record<string, any>, content?: Node[]): Node;
25
+ text(text: string, marks?: string[]): Node;
26
+ }
@@ -0,0 +1,12 @@
1
+ export class Schema {
2
+ constructor(nodes, marks) {
3
+ this.nodes = new Map(Object.entries(nodes));
4
+ this.marks = new Map(Object.entries(marks));
5
+ }
6
+ node(type, attrs, content) {
7
+ return { type, attrs, content };
8
+ }
9
+ text(text, marks) {
10
+ return { type: 'text', text, marks };
11
+ }
12
+ }
@@ -0,0 +1,52 @@
1
+ import { NodeType, NodeSpec } from '../model/Node';
2
+ import { MarkType, MarkSpec } from '../model/Mark';
3
+ /**
4
+ * Schema defines the structure and types allowed in a document.
5
+ * It contains specifications for all node and mark types.
6
+ */
7
+ export declare class Schema {
8
+ readonly nodes: Record<string, NodeType>;
9
+ readonly marks: Record<string, MarkType>;
10
+ readonly spec: SchemaSpec;
11
+ constructor(spec: SchemaSpec);
12
+ /**
13
+ * Create node types from specifications.
14
+ */
15
+ private createNodeTypes;
16
+ /**
17
+ * Create mark types from specifications.
18
+ */
19
+ private createMarkTypes;
20
+ /**
21
+ * Check if a node type is allowed as a child of another node type.
22
+ */
23
+ allowsNodeType(parentType: NodeType, childType: NodeType): boolean;
24
+ /**
25
+ * Get the text node type.
26
+ */
27
+ get text(): NodeType;
28
+ /**
29
+ * Get the document node type.
30
+ */
31
+ get doc(): NodeType;
32
+ /**
33
+ * Get the paragraph node type.
34
+ */
35
+ get paragraph(): NodeType;
36
+ /**
37
+ * Convert to JSON representation.
38
+ */
39
+ toJSON(): SchemaSpec;
40
+ }
41
+ /**
42
+ * Specification for a complete schema.
43
+ */
44
+ export interface SchemaSpec {
45
+ nodes: Record<string, NodeSpec>;
46
+ marks: Record<string, MarkSpec>;
47
+ topNode?: string;
48
+ }
49
+ /**
50
+ * Enhanced default schema with comprehensive node and mark types.
51
+ */
52
+ export declare const defaultSchema: Schema;
@@ -0,0 +1,296 @@
1
+ import { NodeType } from '../model/Node';
2
+ import { MarkType } from '../model/Mark';
3
+ /**
4
+ * Schema defines the structure and types allowed in a document.
5
+ * It contains specifications for all node and mark types.
6
+ */
7
+ export class Schema {
8
+ constructor(spec) {
9
+ this.spec = spec;
10
+ this.nodes = this.createNodeTypes(spec.nodes);
11
+ this.marks = this.createMarkTypes(spec.marks, this);
12
+ }
13
+ /**
14
+ * Create node types from specifications.
15
+ */
16
+ createNodeTypes(nodeSpecs) {
17
+ const nodes = {};
18
+ for (const [name, spec] of Object.entries(nodeSpecs)) {
19
+ nodes[name] = new NodeType(name, spec, this);
20
+ }
21
+ return nodes;
22
+ }
23
+ /**
24
+ * Create mark types from specifications.
25
+ */
26
+ createMarkTypes(markSpecs, schema) {
27
+ const marks = {};
28
+ for (const [name, spec] of Object.entries(markSpecs)) {
29
+ marks[name] = new MarkType(name, spec, schema);
30
+ }
31
+ return marks;
32
+ }
33
+ /**
34
+ * Check if a node type is allowed as a child of another node type.
35
+ */
36
+ allowsNodeType(parentType, childType) {
37
+ const content = parentType.spec.content;
38
+ if (!content)
39
+ return false;
40
+ // Parse content expression (simplified)
41
+ // This would need more sophisticated parsing for complex expressions
42
+ const allowedTypes = content.split(/\s+/);
43
+ return allowedTypes.some(type => {
44
+ if (type === 'text')
45
+ return childType.isText;
46
+ if (type === 'inline')
47
+ return childType.isInline;
48
+ if (type === 'block')
49
+ return childType.isBlock;
50
+ return childType.name === type;
51
+ });
52
+ }
53
+ /**
54
+ * Get the text node type.
55
+ */
56
+ get text() {
57
+ return this.nodes.text;
58
+ }
59
+ /**
60
+ * Get the document node type.
61
+ */
62
+ get doc() {
63
+ return this.nodes.doc;
64
+ }
65
+ /**
66
+ * Get the paragraph node type.
67
+ */
68
+ get paragraph() {
69
+ return this.nodes.paragraph;
70
+ }
71
+ /**
72
+ * Convert to JSON representation.
73
+ */
74
+ toJSON() {
75
+ return this.spec;
76
+ }
77
+ }
78
+ /**
79
+ * Enhanced default schema with comprehensive node and mark types.
80
+ */
81
+ export const defaultSchema = new Schema({
82
+ nodes: {
83
+ doc: {
84
+ content: 'block+'
85
+ },
86
+ paragraph: {
87
+ content: 'inline*',
88
+ group: 'block',
89
+ parseDOM: [{ tag: 'p' }],
90
+ toDOM: () => ['p', 0]
91
+ },
92
+ heading: {
93
+ attrs: {
94
+ level: { default: 1, validate: (value) => value >= 1 && value <= 6 }
95
+ },
96
+ content: 'inline*',
97
+ group: 'block',
98
+ defining: true,
99
+ parseDOM: [
100
+ { tag: 'h1', attrs: { level: 1 } },
101
+ { tag: 'h2', attrs: { level: 2 } },
102
+ { tag: 'h3', attrs: { level: 3 } },
103
+ { tag: 'h4', attrs: { level: 4 } },
104
+ { tag: 'h5', attrs: { level: 5 } },
105
+ { tag: 'h6', attrs: { level: 6 } }
106
+ ],
107
+ toDOM: (node) => [`h${node.attrs.level}`, 0]
108
+ },
109
+ blockquote: {
110
+ content: 'block+',
111
+ group: 'block',
112
+ defining: true,
113
+ parseDOM: [{ tag: 'blockquote' }],
114
+ toDOM: () => ['blockquote', 0]
115
+ },
116
+ code_block: {
117
+ content: 'text*',
118
+ marks: '',
119
+ group: 'block',
120
+ code: true,
121
+ defining: true,
122
+ attrs: {
123
+ language: { default: null }
124
+ },
125
+ parseDOM: [{ tag: 'pre', preserveWhitespace: 'full' }],
126
+ toDOM: () => ['pre', ['code', 0]]
127
+ },
128
+ horizontal_rule: {
129
+ group: 'block',
130
+ parseDOM: [{ tag: 'hr' }],
131
+ toDOM: () => ['hr']
132
+ },
133
+ bullet_list: {
134
+ content: 'list_item+',
135
+ group: 'block',
136
+ parseDOM: [{ tag: 'ul' }],
137
+ toDOM: () => ['ul', 0]
138
+ },
139
+ ordered_list: {
140
+ content: 'list_item+',
141
+ group: 'block',
142
+ attrs: {
143
+ order: { default: 1 }
144
+ },
145
+ parseDOM: [{ tag: 'ol', getAttrs: (dom) => ({ order: dom.hasAttribute('start') ? +dom.getAttribute('start') : 1 }) }],
146
+ toDOM: (node) => node.attrs.order === 1 ? ['ol', 0] : ['ol', { start: node.attrs.order }, 0]
147
+ },
148
+ list_item: {
149
+ content: 'paragraph block*',
150
+ parseDOM: [{ tag: 'li' }],
151
+ toDOM: () => ['li', 0],
152
+ defining: true
153
+ },
154
+ table: {
155
+ content: 'table_row+',
156
+ group: 'block',
157
+ isolating: true,
158
+ parseDOM: [{ tag: 'table' }],
159
+ toDOM: () => ['table', ['tbody', 0]]
160
+ },
161
+ table_row: {
162
+ content: 'table_cell+',
163
+ parseDOM: [{ tag: 'tr' }],
164
+ toDOM: () => ['tr', 0]
165
+ },
166
+ table_cell: {
167
+ content: 'block+',
168
+ attrs: {
169
+ colspan: { default: 1 },
170
+ rowspan: { default: 1 },
171
+ colwidth: { default: null }
172
+ },
173
+ isolating: true,
174
+ parseDOM: [{ tag: 'td' }, { tag: 'th' }],
175
+ toDOM: (node) => {
176
+ const attrs = {};
177
+ if (node.attrs.colspan !== 1)
178
+ attrs.colspan = node.attrs.colspan;
179
+ if (node.attrs.rowspan !== 1)
180
+ attrs.rowspan = node.attrs.rowspan;
181
+ if (node.attrs.colwidth)
182
+ attrs.style = `width: ${node.attrs.colwidth.join(', ')}px`;
183
+ return ['td', attrs, 0];
184
+ }
185
+ },
186
+ hard_break: {
187
+ inline: true,
188
+ group: 'inline',
189
+ selectable: false,
190
+ parseDOM: [{ tag: 'br' }],
191
+ toDOM: () => ['br']
192
+ },
193
+ image: {
194
+ inline: true,
195
+ attrs: {
196
+ src: {},
197
+ alt: { default: null },
198
+ title: { default: null },
199
+ width: { default: null },
200
+ height: { default: null }
201
+ },
202
+ group: 'inline',
203
+ draggable: true,
204
+ parseDOM: [{
205
+ tag: 'img[src]',
206
+ getAttrs: (dom) => ({
207
+ src: dom.getAttribute('src'),
208
+ title: dom.getAttribute('title'),
209
+ alt: dom.getAttribute('alt'),
210
+ width: dom.getAttribute('width'),
211
+ height: dom.getAttribute('height')
212
+ })
213
+ }],
214
+ toDOM: (node) => ['img', node.attrs]
215
+ },
216
+ text: {
217
+ group: 'inline',
218
+ isText: true
219
+ }
220
+ },
221
+ marks: {
222
+ bold: {
223
+ parseDOM: [
224
+ { tag: 'strong' },
225
+ { tag: 'b', getAttrs: (node) => typeof node === 'string' ? null : node.style.fontWeight !== 'normal' && null },
226
+ { style: 'font-weight=400', clearMark: (m) => m.type.name === 'strong' },
227
+ { style: 'font-weight', getAttrs: (value) => typeof value === 'string' && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null }
228
+ ],
229
+ toDOM: () => ['strong', 0]
230
+ },
231
+ italic: {
232
+ parseDOM: [
233
+ { tag: 'i' },
234
+ { tag: 'em' },
235
+ { style: 'font-style=italic' }
236
+ ],
237
+ toDOM: () => ['em', 0]
238
+ },
239
+ underline: {
240
+ parseDOM: [
241
+ { tag: 'u' },
242
+ { style: 'text-decoration=underline' }
243
+ ],
244
+ toDOM: () => ['u', 0]
245
+ },
246
+ strikethrough: {
247
+ parseDOM: [
248
+ { tag: 's' },
249
+ { tag: 'strike' },
250
+ { style: 'text-decoration=line-through' }
251
+ ],
252
+ toDOM: () => ['s', 0]
253
+ },
254
+ code: {
255
+ parseDOM: [{ tag: 'code' }],
256
+ toDOM: () => ['code', 0]
257
+ },
258
+ link: {
259
+ attrs: {
260
+ href: {},
261
+ title: { default: null },
262
+ target: { default: null }
263
+ },
264
+ inclusive: false,
265
+ parseDOM: [{
266
+ tag: 'a[href]',
267
+ getAttrs: (dom) => ({
268
+ href: dom.getAttribute('href'),
269
+ title: dom.getAttribute('title'),
270
+ target: dom.getAttribute('target')
271
+ })
272
+ }],
273
+ toDOM: (node) => ['a', node.attrs, 0]
274
+ },
275
+ subscript: {
276
+ parseDOM: [{ tag: 'sub' }],
277
+ toDOM: () => ['sub', 0],
278
+ excludes: 'superscript'
279
+ },
280
+ superscript: {
281
+ parseDOM: [{ tag: 'sup' }],
282
+ toDOM: () => ['sup', 0],
283
+ excludes: 'subscript'
284
+ },
285
+ highlight: {
286
+ attrs: {
287
+ color: { default: 'yellow' }
288
+ },
289
+ parseDOM: [{
290
+ tag: 'mark',
291
+ getAttrs: (dom) => ({ color: dom.style.backgroundColor || 'yellow' })
292
+ }],
293
+ toDOM: (node) => ['mark', { style: `background-color: ${node.attrs.color}` }, 0]
294
+ }
295
+ }
296
+ });