@blockslides/extension-drag-handle-vue-3 0.1.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.
@@ -0,0 +1,2760 @@
1
+ import * as _floating_ui_dom from '@floating-ui/dom';
2
+ import * as _blockslides_pm_model from '@blockslides/pm/model';
3
+ import { Slice, Node as Node$2, Mark as Mark$1, Schema, NodeType as NodeType$1, NodeSpec, DOMOutputSpec, MarkType as MarkType$1, MarkSpec, ParseOptions, ResolvedPos, Fragment } from '@blockslides/pm/model';
4
+ import * as vue from 'vue';
5
+ import { PropType } from 'vue';
6
+ import * as _blockslides_pm_state from '@blockslides/pm/state';
7
+ import { Transaction, EditorState, Plugin, PluginKey } from '@blockslides/pm/state';
8
+ import { DragHandlePluginProps } from '@blockslides/extension-drag-handle';
9
+ import { NodeViewConstructor, NodeView, MarkViewConstructor, MarkView, EditorProps, EditorView } from '@blockslides/pm/view';
10
+ import { Transform } from '@blockslides/pm/transform';
11
+
12
+ type StringKeyOf<T> = Extract<keyof T, string>;
13
+ type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
14
+ type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
15
+ declare class EventEmitter<T extends Record<string, any>> {
16
+ private callbacks;
17
+ on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
18
+ emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
19
+ off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
20
+ once<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
21
+ removeAllListeners(): void;
22
+ }
23
+
24
+ /**
25
+ * Editor Theme System
26
+ *
27
+ * Defines the styling system for both editor and slides.
28
+ * Single unified theme that controls all visual aspects.
29
+ */
30
+ /**
31
+ * Complete theme definition
32
+ */
33
+ interface Theme {
34
+ name: string;
35
+ editor: {
36
+ background: string;
37
+ foreground: string;
38
+ border: string;
39
+ };
40
+ slide: {
41
+ background: string;
42
+ border: string;
43
+ borderRadius: string;
44
+ shadow: string;
45
+ marginBottom: string;
46
+ padding: string;
47
+ minHeight?: string;
48
+ };
49
+ selection: string;
50
+ selectionBg: string;
51
+ hover: string;
52
+ active: string;
53
+ focus: string;
54
+ }
55
+ /**
56
+ * Resolved theme type (can be null if no theme should be applied)
57
+ */
58
+ type ResolvedTheme = Theme | null;
59
+ /**
60
+ * Partial theme for extending/overriding built-in themes
61
+ */
62
+ type PartialTheme = {
63
+ name?: string;
64
+ editor?: Partial<Theme["editor"]>;
65
+ slide?: Partial<Theme["slide"]>;
66
+ selection?: string;
67
+ selectionBg?: string;
68
+ hover?: string;
69
+ active?: string;
70
+ focus?: string;
71
+ };
72
+ /**
73
+ * Theme configuration with optional extension
74
+ */
75
+ type ThemeConfig = PartialTheme & {
76
+ extends?: string;
77
+ };
78
+
79
+ type InputRuleMatch = {
80
+ index: number;
81
+ text: string;
82
+ replaceWith?: string;
83
+ match?: RegExpMatchArray;
84
+ data?: Record<string, any>;
85
+ };
86
+ type InputRuleFinder = RegExp | ((text: string) => InputRuleMatch | null);
87
+ declare class InputRule {
88
+ find: InputRuleFinder;
89
+ handler: (props: {
90
+ state: EditorState;
91
+ range: Range;
92
+ match: ExtendedRegExpMatchArray;
93
+ commands: SingleCommands;
94
+ chain: () => ChainedCommands;
95
+ can: () => CanCommands;
96
+ }) => void | null;
97
+ undoable: boolean;
98
+ constructor(config: {
99
+ find: InputRuleFinder;
100
+ handler: (props: {
101
+ state: EditorState;
102
+ range: Range;
103
+ match: ExtendedRegExpMatchArray;
104
+ commands: SingleCommands;
105
+ chain: () => ChainedCommands;
106
+ can: () => CanCommands;
107
+ }) => void | null;
108
+ undoable?: boolean;
109
+ });
110
+ }
111
+
112
+ interface MarkConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, MarkConfig<Options, Storage>, MarkType$1> {
113
+ /**
114
+ * Mark View
115
+ */
116
+ addMarkView?: ((this: {
117
+ name: string;
118
+ options: Options;
119
+ storage: Storage;
120
+ editor: SlideEditor;
121
+ type: MarkType$1;
122
+ parent: ParentConfig<MarkConfig<Options, Storage>>["addMarkView"];
123
+ }) => MarkViewRenderer) | null;
124
+ /**
125
+ * Keep mark after split node
126
+ */
127
+ keepOnSplit?: boolean | (() => boolean);
128
+ /**
129
+ * Inclusive
130
+ */
131
+ inclusive?: MarkSpec["inclusive"] | ((this: {
132
+ name: string;
133
+ options: Options;
134
+ storage: Storage;
135
+ parent: ParentConfig<MarkConfig<Options, Storage>>["inclusive"];
136
+ editor?: SlideEditor;
137
+ }) => MarkSpec["inclusive"]);
138
+ /**
139
+ * Excludes
140
+ */
141
+ excludes?: MarkSpec["excludes"] | ((this: {
142
+ name: string;
143
+ options: Options;
144
+ storage: Storage;
145
+ parent: ParentConfig<MarkConfig<Options, Storage>>["excludes"];
146
+ editor?: SlideEditor;
147
+ }) => MarkSpec["excludes"]);
148
+ /**
149
+ * Marks this Mark as exitable
150
+ */
151
+ exitable?: boolean | (() => boolean);
152
+ /**
153
+ * Group
154
+ */
155
+ group?: MarkSpec["group"] | ((this: {
156
+ name: string;
157
+ options: Options;
158
+ storage: Storage;
159
+ parent: ParentConfig<MarkConfig<Options, Storage>>["group"];
160
+ editor?: SlideEditor;
161
+ }) => MarkSpec["group"]);
162
+ /**
163
+ * Spanning
164
+ */
165
+ spanning?: MarkSpec["spanning"] | ((this: {
166
+ name: string;
167
+ options: Options;
168
+ storage: Storage;
169
+ parent: ParentConfig<MarkConfig<Options, Storage>>["spanning"];
170
+ editor?: SlideEditor;
171
+ }) => MarkSpec["spanning"]);
172
+ /**
173
+ * Code
174
+ */
175
+ code?: boolean | ((this: {
176
+ name: string;
177
+ options: Options;
178
+ storage: Storage;
179
+ parent: ParentConfig<MarkConfig<Options, Storage>>["code"];
180
+ editor?: SlideEditor;
181
+ }) => boolean);
182
+ /**
183
+ * Parse HTML
184
+ */
185
+ parseHTML?: (this: {
186
+ name: string;
187
+ options: Options;
188
+ storage: Storage;
189
+ parent: ParentConfig<MarkConfig<Options, Storage>>["parseHTML"];
190
+ editor?: SlideEditor;
191
+ }) => MarkSpec["parseDOM"];
192
+ /**
193
+ * Render HTML
194
+ */
195
+ renderHTML?: ((this: {
196
+ name: string;
197
+ options: Options;
198
+ storage: Storage;
199
+ parent: ParentConfig<MarkConfig<Options, Storage>>["renderHTML"];
200
+ editor?: SlideEditor;
201
+ }, props: {
202
+ mark: Mark$1;
203
+ HTMLAttributes: Record<string, any>;
204
+ }) => DOMOutputSpec) | null;
205
+ /**
206
+ * Attributes
207
+ */
208
+ addAttributes?: (this: {
209
+ name: string;
210
+ options: Options;
211
+ storage: Storage;
212
+ parent: ParentConfig<MarkConfig<Options, Storage>>["addAttributes"];
213
+ editor?: SlideEditor;
214
+ }) => Attributes$1 | {};
215
+ }
216
+ declare class Mark<Options = any, Storage = any> extends Extendable<Options, Storage, MarkConfig<Options, Storage>> {
217
+ type: string;
218
+ /**
219
+ * Create a new Mark instance
220
+ * @param config - Mark configuration object or a function that returns a configuration object
221
+ */
222
+ static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>> | (() => Partial<MarkConfig<O, S>>)): Mark<O, S>;
223
+ static handleExit({ editor, mark }: {
224
+ editor: SlideEditor;
225
+ mark: Mark;
226
+ }): boolean;
227
+ configure(options?: Partial<Options>): Mark<Options, Storage>;
228
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
229
+ name: string;
230
+ options: ExtendedOptions;
231
+ storage: ExtendedStorage;
232
+ editor: SlideEditor;
233
+ type: MarkType$1;
234
+ }>)): Mark<ExtendedOptions, ExtendedStorage>;
235
+ }
236
+
237
+ interface NodeConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, NodeConfig<Options, Storage>, NodeType$1> {
238
+ /**
239
+ * Node View
240
+ */
241
+ addNodeView?: ((this: {
242
+ name: string;
243
+ options: Options;
244
+ storage: Storage;
245
+ editor: SlideEditor;
246
+ type: NodeType$1;
247
+ parent: ParentConfig<NodeConfig<Options, Storage>>["addNodeView"];
248
+ }) => NodeViewRenderer) | null;
249
+ /**
250
+ * Defines if this node should be a top level node (doc)
251
+ * @default false
252
+ * @example true
253
+ */
254
+ topNode?: boolean;
255
+ /**
256
+ * The content expression for this node, as described in the [schema
257
+ * guide](/docs/guide/#schema.content_expressions). When not given,
258
+ * the node does not allow any content.
259
+ *
260
+ * You can read more about it on the Prosemirror documentation here
261
+ * @see https://prosemirror.net/docs/guide/#schema.content_expressions
262
+ * @default undefined
263
+ * @example content: 'block+'
264
+ * @example content: 'headline paragraph block*'
265
+ */
266
+ content?: NodeSpec["content"] | ((this: {
267
+ name: string;
268
+ options: Options;
269
+ storage: Storage;
270
+ parent: ParentConfig<NodeConfig<Options, Storage>>["content"];
271
+ editor?: SlideEditor;
272
+ }) => NodeSpec["content"]);
273
+ /**
274
+ * The marks that are allowed inside of this node. May be a
275
+ * space-separated string referring to mark names or groups, `"_"`
276
+ * to explicitly allow all marks, or `""` to disallow marks. When
277
+ * not given, nodes with inline content default to allowing all
278
+ * marks, other nodes default to not allowing marks.
279
+ *
280
+ * @example marks: 'strong em'
281
+ */
282
+ marks?: NodeSpec["marks"] | ((this: {
283
+ name: string;
284
+ options: Options;
285
+ storage: Storage;
286
+ parent: ParentConfig<NodeConfig<Options, Storage>>["marks"];
287
+ editor?: SlideEditor;
288
+ }) => NodeSpec["marks"]);
289
+ /**
290
+ * The group or space-separated groups to which this node belongs,
291
+ * which can be referred to in the content expressions for the
292
+ * schema.
293
+ *
294
+ * By default BlockSlides uses the groups 'block' and 'inline' for nodes. You
295
+ * can also use custom groups if you want to group specific nodes together
296
+ * and handle them in your schema.
297
+ * @example group: 'block'
298
+ * @example group: 'inline'
299
+ * @example group: 'customBlock' // this uses a custom group
300
+ */
301
+ group?: NodeSpec["group"] | ((this: {
302
+ name: string;
303
+ options: Options;
304
+ storage: Storage;
305
+ parent: ParentConfig<NodeConfig<Options, Storage>>["group"];
306
+ editor?: SlideEditor;
307
+ }) => NodeSpec["group"]);
308
+ /**
309
+ * Should be set to true for inline nodes. (Implied for text nodes.)
310
+ */
311
+ inline?: NodeSpec["inline"] | ((this: {
312
+ name: string;
313
+ options: Options;
314
+ storage: Storage;
315
+ parent: ParentConfig<NodeConfig<Options, Storage>>["inline"];
316
+ editor?: SlideEditor;
317
+ }) => NodeSpec["inline"]);
318
+ /**
319
+ * Can be set to true to indicate that, though this isn't a [leaf
320
+ * node](https://prosemirror.net/docs/ref/#model.NodeType.isLeaf), it doesn't have directly editable
321
+ * content and should be treated as a single unit in the view.
322
+ *
323
+ * @example atom: true
324
+ */
325
+ atom?: NodeSpec["atom"] | ((this: {
326
+ name: string;
327
+ options: Options;
328
+ storage: Storage;
329
+ parent: ParentConfig<NodeConfig<Options, Storage>>["atom"];
330
+ editor?: SlideEditor;
331
+ }) => NodeSpec["atom"]);
332
+ /**
333
+ * Controls whether nodes of this type can be selected as a [node
334
+ * selection](https://prosemirror.net/docs/ref/#state.NodeSelection). Defaults to true for non-text
335
+ * nodes.
336
+ *
337
+ * @default true
338
+ * @example selectable: false
339
+ */
340
+ selectable?: NodeSpec["selectable"] | ((this: {
341
+ name: string;
342
+ options: Options;
343
+ storage: Storage;
344
+ parent: ParentConfig<NodeConfig<Options, Storage>>["selectable"];
345
+ editor?: SlideEditor;
346
+ }) => NodeSpec["selectable"]);
347
+ /**
348
+ * Determines whether nodes of this type can be dragged without
349
+ * being selected. Defaults to false.
350
+ *
351
+ * @default: false
352
+ * @example: draggable: true
353
+ */
354
+ draggable?: NodeSpec["draggable"] | ((this: {
355
+ name: string;
356
+ options: Options;
357
+ storage: Storage;
358
+ parent: ParentConfig<NodeConfig<Options, Storage>>["draggable"];
359
+ editor?: SlideEditor;
360
+ }) => NodeSpec["draggable"]);
361
+ /**
362
+ * Can be used to indicate that this node contains code, which
363
+ * causes some commands to behave differently.
364
+ */
365
+ code?: NodeSpec["code"] | ((this: {
366
+ name: string;
367
+ options: Options;
368
+ storage: Storage;
369
+ parent: ParentConfig<NodeConfig<Options, Storage>>["code"];
370
+ editor?: SlideEditor;
371
+ }) => NodeSpec["code"]);
372
+ /**
373
+ * Controls way whitespace in this a node is parsed. The default is
374
+ * `"normal"`, which causes the [DOM parser](https://prosemirror.net/docs/ref/#model.DOMParser) to
375
+ * collapse whitespace in normal mode, and normalize it (replacing
376
+ * newlines and such with spaces) otherwise. `"pre"` causes the
377
+ * parser to preserve spaces inside the node. When this option isn't
378
+ * given, but [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) is true, `whitespace`
379
+ * will default to `"pre"`. Note that this option doesn't influence
380
+ * the way the node is rendered—that should be handled by `toDOM`
381
+ * and/or styling.
382
+ */
383
+ whitespace?: NodeSpec["whitespace"] | ((this: {
384
+ name: string;
385
+ options: Options;
386
+ storage: Storage;
387
+ parent: ParentConfig<NodeConfig<Options, Storage>>["whitespace"];
388
+ editor?: SlideEditor;
389
+ }) => NodeSpec["whitespace"]);
390
+ /**
391
+ * Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
392
+ * When converting between block types that have whitespace set to "pre"
393
+ * and don't support the linebreak node (e.g. codeBlock) and other block types
394
+ * that do support the linebreak node (e.g. paragraphs) - this node will be used
395
+ * as the linebreak instead of stripping the newline.
396
+ *
397
+ * See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
398
+ */
399
+ linebreakReplacement?: NodeSpec["linebreakReplacement"] | ((this: {
400
+ name: string;
401
+ options: Options;
402
+ storage: Storage;
403
+ parent: ParentConfig<NodeConfig<Options, Storage>>["linebreakReplacement"];
404
+ editor?: SlideEditor;
405
+ }) => NodeSpec["linebreakReplacement"]);
406
+ /**
407
+ * When enabled, enables both
408
+ * [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
409
+ * [`definingForContent`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
410
+ *
411
+ * @default false
412
+ * @example isolating: true
413
+ */
414
+ defining?: NodeSpec["defining"] | ((this: {
415
+ name: string;
416
+ options: Options;
417
+ storage: Storage;
418
+ parent: ParentConfig<NodeConfig<Options, Storage>>["defining"];
419
+ editor?: SlideEditor;
420
+ }) => NodeSpec["defining"]);
421
+ /**
422
+ * When enabled (default is false), the sides of nodes of this type
423
+ * count as boundaries that regular editing operations, like
424
+ * backspacing or lifting, won't cross. An example of a node that
425
+ * should probably have this enabled is a table cell.
426
+ */
427
+ isolating?: NodeSpec["isolating"] | ((this: {
428
+ name: string;
429
+ options: Options;
430
+ storage: Storage;
431
+ parent: ParentConfig<NodeConfig<Options, Storage>>["isolating"];
432
+ editor?: SlideEditor;
433
+ }) => NodeSpec["isolating"]);
434
+ /**
435
+ * Associates DOM parser information with this node, which can be
436
+ * used by [`DOMParser.fromSchema`](https://prosemirror.net/docs/ref/#model.DOMParser^fromSchema) to
437
+ * automatically derive a parser. The `node` field in the rules is
438
+ * implied (the name of this node will be filled in automatically).
439
+ * If you supply your own parser, you do not need to also specify
440
+ * parsing rules in your schema.
441
+ *
442
+ * @example parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
443
+ */
444
+ parseHTML?: (this: {
445
+ name: string;
446
+ options: Options;
447
+ storage: Storage;
448
+ parent: ParentConfig<NodeConfig<Options, Storage>>["parseHTML"];
449
+ editor?: SlideEditor;
450
+ }) => NodeSpec["parseDOM"];
451
+ /**
452
+ * A description of a DOM structure. Can be either a string, which is
453
+ * interpreted as a text node, a DOM node, which is interpreted as
454
+ * itself, a `{dom, contentDOM}` object, or an array.
455
+ *
456
+ * An array describes a DOM element. The first value in the array
457
+ * should be a string—the name of the DOM element, optionally prefixed
458
+ * by a namespace URL and a space. If the second element is plain
459
+ * object, it is interpreted as a set of attributes for the element.
460
+ * Any elements after that (including the 2nd if it's not an attribute
461
+ * object) are interpreted as children of the DOM elements, and must
462
+ * either be valid `DOMOutputSpec` values, or the number zero.
463
+ *
464
+ * The number zero (pronounced “hole”) is used to indicate the place
465
+ * where a node's child nodes should be inserted. If it occurs in an
466
+ * output spec, it should be the only child element in its parent
467
+ * node.
468
+ *
469
+ * @example toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
470
+ */
471
+ renderHTML?: ((this: {
472
+ name: string;
473
+ options: Options;
474
+ storage: Storage;
475
+ parent: ParentConfig<NodeConfig<Options, Storage>>["renderHTML"];
476
+ editor?: SlideEditor;
477
+ }, props: {
478
+ node: Node$2;
479
+ HTMLAttributes: Record<string, any>;
480
+ }) => DOMOutputSpec) | null;
481
+ /**
482
+ * renders the node as text
483
+ * @example renderText: () => 'foo
484
+ */
485
+ renderText?: ((this: {
486
+ name: string;
487
+ options: Options;
488
+ storage: Storage;
489
+ parent: ParentConfig<NodeConfig<Options, Storage>>["renderText"];
490
+ editor?: SlideEditor;
491
+ }, props: {
492
+ node: Node$2;
493
+ pos: number;
494
+ parent: Node$2;
495
+ index: number;
496
+ }) => string) | null;
497
+ /**
498
+ * Add attributes to the node
499
+ * @example addAttributes: () => ({ class: 'foo' })
500
+ */
501
+ addAttributes?: (this: {
502
+ name: string;
503
+ options: Options;
504
+ storage: Storage;
505
+ parent: ParentConfig<NodeConfig<Options, Storage>>["addAttributes"];
506
+ editor?: SlideEditor;
507
+ }) => Attributes$1 | {};
508
+ }
509
+ declare class Node$1<Options = any, Storage = any> extends Extendable<Options, Storage, NodeConfig<Options, Storage>> {
510
+ type: string;
511
+ /**
512
+ * Create a new Node instance
513
+ * @param config - Node configuration object or a function that returns a configuration object
514
+ */
515
+ static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>> | (() => Partial<NodeConfig<O, S>>)): Node$1<O, S>;
516
+ configure(options?: Partial<Options>): Node$1<Options, Storage>;
517
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = NodeConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
518
+ name: string;
519
+ options: ExtendedOptions;
520
+ storage: ExtendedStorage;
521
+ editor: SlideEditor;
522
+ type: NodeType$1;
523
+ }>)): Node$1<ExtendedOptions, ExtendedStorage>;
524
+ }
525
+
526
+ type PasteRuleMatch = {
527
+ index: number;
528
+ text: string;
529
+ replaceWith?: string;
530
+ match?: RegExpMatchArray;
531
+ data?: Record<string, any>;
532
+ };
533
+ type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
534
+ declare class PasteRule {
535
+ find: PasteRuleFinder;
536
+ handler: (props: {
537
+ state: EditorState;
538
+ range: Range;
539
+ match: ExtendedRegExpMatchArray;
540
+ commands: SingleCommands;
541
+ chain: () => ChainedCommands;
542
+ can: () => CanCommands;
543
+ pasteEvent: ClipboardEvent | null;
544
+ dropEvent: DragEvent | null;
545
+ }) => void | null;
546
+ constructor(config: {
547
+ find: PasteRuleFinder;
548
+ handler: (props: {
549
+ can: () => CanCommands;
550
+ chain: () => ChainedCommands;
551
+ commands: SingleCommands;
552
+ dropEvent: DragEvent | null;
553
+ match: ExtendedRegExpMatchArray;
554
+ pasteEvent: ClipboardEvent | null;
555
+ range: Range;
556
+ state: EditorState;
557
+ }) => void | null;
558
+ });
559
+ }
560
+
561
+ interface ExtendableConfig<Options = any, Storage = any, Config extends ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage> | ExtendableConfig<Options, Storage> = ExtendableConfig<Options, Storage, any, any>, PMType = any> {
562
+ /**
563
+ * The extension name - this must be unique.
564
+ * It will be used to identify the extension.
565
+ *
566
+ * @example 'myExtension'
567
+ */
568
+ name: string;
569
+ /**
570
+ * The priority of your extension. The higher, the earlier it will be called
571
+ * and will take precedence over other extensions with a lower priority.
572
+ * @default 100
573
+ * @example 101
574
+ */
575
+ priority?: number;
576
+ addOptions?: (this: {
577
+ name: string;
578
+ parent: ParentConfig<Config>["addOptions"];
579
+ }) => Options;
580
+ addStorage?: (this: {
581
+ name: string;
582
+ options: Options;
583
+ parent: ParentConfig<Config>["addStorage"];
584
+ }) => Storage;
585
+ addGlobalAttributes?: (this: {
586
+ name: string;
587
+ options: Options;
588
+ storage: Storage;
589
+ extensions: (Node$1 | Mark)[];
590
+ parent: ParentConfig<Config>["addGlobalAttributes"];
591
+ }) => GlobalAttributes;
592
+ addCommands?: (this: {
593
+ name: string;
594
+ options: Options;
595
+ storage: Storage;
596
+ editor: SlideEditor;
597
+ type: PMType;
598
+ parent: ParentConfig<Config>["addCommands"];
599
+ }) => Partial<RawCommands>;
600
+ addKeyboardShortcuts?: (this: {
601
+ name: string;
602
+ options: Options;
603
+ storage: Storage;
604
+ editor: SlideEditor;
605
+ type: PMType;
606
+ parent: ParentConfig<Config>["addKeyboardShortcuts"];
607
+ }) => {
608
+ [key: string]: KeyboardShortcutCommand;
609
+ };
610
+ addInputRules?: (this: {
611
+ name: string;
612
+ options: Options;
613
+ storage: Storage;
614
+ editor: SlideEditor;
615
+ type: PMType;
616
+ parent: ParentConfig<Config>["addInputRules"];
617
+ }) => InputRule[];
618
+ addPasteRules?: (this: {
619
+ name: string;
620
+ options: Options;
621
+ storage: Storage;
622
+ editor: SlideEditor;
623
+ type: PMType;
624
+ parent: ParentConfig<Config>["addPasteRules"];
625
+ }) => PasteRule[];
626
+ addProseMirrorPlugins?: (this: {
627
+ name: string;
628
+ options: Options;
629
+ storage: Storage;
630
+ editor: SlideEditor;
631
+ type: PMType;
632
+ parent: ParentConfig<Config>["addProseMirrorPlugins"];
633
+ }) => Plugin[];
634
+ addExtensions?: (this: {
635
+ name: string;
636
+ options: Options;
637
+ storage: Storage;
638
+ parent: ParentConfig<Config>["addExtensions"];
639
+ }) => Extensions;
640
+ markdownTokenName?: string;
641
+ /**
642
+ * The parse function used by the markdown parser to convert markdown tokens to ProseMirror nodes.
643
+ */
644
+ parseMarkdown?: (token: MarkdownToken, helpers: MarkdownParseHelpers) => MarkdownParseResult;
645
+ /**
646
+ * The serializer function used by the markdown serializer to convert ProseMirror nodes to markdown tokens.
647
+ */
648
+ renderMarkdown?: (node: JSONContent, helpers: MarkdownRendererHelpers, ctx: RenderContext) => string;
649
+ /**
650
+ * The markdown tokenizer responsible for turning a markdown string into tokens
651
+ *
652
+ * Custom tokenizers are only needed when you want to parse non-standard markdown token.
653
+ */
654
+ markdownTokenizer?: MarkdownTokenizer;
655
+ /**
656
+ * Optional markdown options for indentation
657
+ */
658
+ markdownOptions?: {
659
+ /**
660
+ * Defines if this markdown element should indent it's child elements
661
+ */
662
+ indentsContent?: boolean;
663
+ };
664
+ /**
665
+ * This function extends the schema of the node.
666
+ * @example
667
+ * extendNodeSchema() {
668
+ * return {
669
+ * group: 'inline',
670
+ * selectable: false,
671
+ * }
672
+ * }
673
+ */
674
+ extendNodeSchema?: ((this: {
675
+ name: string;
676
+ options: Options;
677
+ storage: Storage;
678
+ parent: ParentConfig<Config>["extendNodeSchema"];
679
+ }, extension: Node$1) => Record<string, any>) | null;
680
+ /**
681
+ * This function extends the schema of the mark.
682
+ * @example
683
+ * extendMarkSchema() {
684
+ * return {
685
+ * group: 'inline',
686
+ * selectable: false,
687
+ * }
688
+ * }
689
+ */
690
+ extendMarkSchema?: ((this: {
691
+ name: string;
692
+ options: Options;
693
+ storage: Storage;
694
+ parent: ParentConfig<Config>["extendMarkSchema"];
695
+ }, extension: Mark) => Record<string, any>) | null;
696
+ /**
697
+ * The editor is not ready yet.
698
+ */
699
+ onBeforeCreate?: ((this: {
700
+ name: string;
701
+ options: Options;
702
+ storage: Storage;
703
+ editor: SlideEditor;
704
+ type: PMType;
705
+ parent: ParentConfig<Config>["onBeforeCreate"];
706
+ }, event: EditorEvents["beforeCreate"]) => void) | null;
707
+ /**
708
+ * The editor is ready.
709
+ */
710
+ onCreate?: ((this: {
711
+ name: string;
712
+ options: Options;
713
+ storage: Storage;
714
+ editor: SlideEditor;
715
+ type: PMType;
716
+ parent: ParentConfig<Config>["onCreate"];
717
+ }, event: EditorEvents["create"]) => void) | null;
718
+ /**
719
+ * The content has changed.
720
+ */
721
+ onUpdate?: ((this: {
722
+ name: string;
723
+ options: Options;
724
+ storage: Storage;
725
+ editor: SlideEditor;
726
+ type: PMType;
727
+ parent: ParentConfig<Config>["onUpdate"];
728
+ }, event: EditorEvents["update"]) => void) | null;
729
+ /**
730
+ * The selection has changed.
731
+ */
732
+ onSelectionUpdate?: ((this: {
733
+ name: string;
734
+ options: Options;
735
+ storage: Storage;
736
+ editor: SlideEditor;
737
+ type: PMType;
738
+ parent: ParentConfig<Config>["onSelectionUpdate"];
739
+ }, event: EditorEvents["selectionUpdate"]) => void) | null;
740
+ /**
741
+ * The editor state has changed.
742
+ */
743
+ onTransaction?: ((this: {
744
+ name: string;
745
+ options: Options;
746
+ storage: Storage;
747
+ editor: SlideEditor;
748
+ type: PMType;
749
+ parent: ParentConfig<Config>["onTransaction"];
750
+ }, event: EditorEvents["transaction"]) => void) | null;
751
+ /**
752
+ * The editor is focused.
753
+ */
754
+ onFocus?: ((this: {
755
+ name: string;
756
+ options: Options;
757
+ storage: Storage;
758
+ editor: SlideEditor;
759
+ type: PMType;
760
+ parent: ParentConfig<Config>["onFocus"];
761
+ }, event: EditorEvents["focus"]) => void) | null;
762
+ /**
763
+ * The editor isn’t focused anymore.
764
+ */
765
+ onBlur?: ((this: {
766
+ name: string;
767
+ options: Options;
768
+ storage: Storage;
769
+ editor: SlideEditor;
770
+ type: PMType;
771
+ parent: ParentConfig<Config>["onBlur"];
772
+ }, event: EditorEvents["blur"]) => void) | null;
773
+ /**
774
+ * The editor is destroyed.
775
+ */
776
+ onDestroy?: ((this: {
777
+ name: string;
778
+ options: Options;
779
+ storage: Storage;
780
+ editor: SlideEditor;
781
+ type: PMType;
782
+ parent: ParentConfig<Config>["onDestroy"];
783
+ }, event: EditorEvents["destroy"]) => void) | null;
784
+ }
785
+ declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>> {
786
+ type: string;
787
+ parent: Extendable | null;
788
+ child: Extendable | null;
789
+ name: string;
790
+ config: Config;
791
+ constructor(config?: Partial<Config>);
792
+ get options(): Options;
793
+ get storage(): Readonly<Storage>;
794
+ configure(options?: Partial<Options>): Extendable<Options, Storage, ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>>;
795
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage> | NodeConfig<ExtendedOptions, ExtendedStorage> | MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Extendable<ExtendedOptions, ExtendedStorage>;
796
+ }
797
+ type AnyExtension = Extendable;
798
+ type Extensions = AnyExtension[];
799
+ type ParentConfig<T> = Partial<{
800
+ [P in keyof T]: Required<T>[P] extends (...args: any) => any ? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]> : T[P];
801
+ }>;
802
+ interface EditorEvents {
803
+ mount: {
804
+ /**
805
+ * The editor instance
806
+ */
807
+ editor: SlideEditor;
808
+ };
809
+ unmount: {
810
+ /**
811
+ * The editor instance
812
+ */
813
+ editor: SlideEditor;
814
+ };
815
+ beforeCreate: {
816
+ /**
817
+ * The editor instance
818
+ */
819
+ editor: SlideEditor;
820
+ };
821
+ create: {
822
+ /**
823
+ * The editor instance
824
+ */
825
+ editor: SlideEditor;
826
+ };
827
+ contentError: {
828
+ /**
829
+ * The editor instance
830
+ */
831
+ editor: SlideEditor;
832
+ /**
833
+ * The error that occurred while parsing the content
834
+ */
835
+ error: Error;
836
+ /**
837
+ * If called, will re-initialize the editor with the collaboration extension removed.
838
+ * This will prevent syncing back deletions of content not present in the current schema.
839
+ */
840
+ disableCollaboration: () => void;
841
+ };
842
+ update: {
843
+ /**
844
+ * The editor instance
845
+ */
846
+ editor: SlideEditor;
847
+ /**
848
+ * The transaction that caused the update
849
+ */
850
+ transaction: Transaction;
851
+ /**
852
+ * Appended transactions that were added to the initial transaction by plugins
853
+ */
854
+ appendedTransactions: Transaction[];
855
+ };
856
+ selectionUpdate: {
857
+ /**
858
+ * The editor instance
859
+ */
860
+ editor: SlideEditor;
861
+ /**
862
+ * The transaction that caused the selection update
863
+ */
864
+ transaction: Transaction;
865
+ };
866
+ beforeTransaction: {
867
+ /**
868
+ * The editor instance
869
+ */
870
+ editor: SlideEditor;
871
+ /**
872
+ * The transaction that will be applied
873
+ */
874
+ transaction: Transaction;
875
+ /**
876
+ * The next state of the editor after the transaction is applied
877
+ */
878
+ nextState: EditorState;
879
+ };
880
+ transaction: {
881
+ /**
882
+ * The editor instance
883
+ */
884
+ editor: SlideEditor;
885
+ /**
886
+ * The initial transaction
887
+ */
888
+ transaction: Transaction;
889
+ /**
890
+ * Appended transactions that were added to the initial transaction by plugins
891
+ */
892
+ appendedTransactions: Transaction[];
893
+ };
894
+ focus: {
895
+ /**
896
+ * The editor instance
897
+ */
898
+ editor: SlideEditor;
899
+ /**
900
+ * The focus event
901
+ */
902
+ event: FocusEvent;
903
+ /**
904
+ * The transaction that caused the focus
905
+ */
906
+ transaction: Transaction;
907
+ };
908
+ blur: {
909
+ /**
910
+ * The editor instance
911
+ */
912
+ editor: SlideEditor;
913
+ /**
914
+ * The focus event
915
+ */
916
+ event: FocusEvent;
917
+ /**
918
+ * The transaction that caused the blur
919
+ */
920
+ transaction: Transaction;
921
+ };
922
+ destroy: void;
923
+ paste: {
924
+ /**
925
+ * The editor instance
926
+ */
927
+ editor: SlideEditor;
928
+ /**
929
+ * The clipboard event
930
+ */
931
+ event: ClipboardEvent;
932
+ /**
933
+ * The slice that was pasted
934
+ */
935
+ slice: Slice;
936
+ };
937
+ drop: {
938
+ /**
939
+ * The editor instance
940
+ */
941
+ editor: SlideEditor;
942
+ /**
943
+ * The drag event
944
+ */
945
+ event: DragEvent;
946
+ /**
947
+ * The slice that was dropped
948
+ */
949
+ slice: Slice;
950
+ /**
951
+ * Whether the content was moved (true) or copied (false)
952
+ */
953
+ moved: boolean;
954
+ };
955
+ delete: {
956
+ /**
957
+ * The editor instance
958
+ */
959
+ editor: SlideEditor;
960
+ /**
961
+ * The range of the deleted content (before the deletion)
962
+ */
963
+ deletedRange: Range;
964
+ /**
965
+ * The new range of positions of where the deleted content was in the new document (after the deletion)
966
+ */
967
+ newRange: Range;
968
+ /**
969
+ * The transaction that caused the deletion
970
+ */
971
+ transaction: Transaction;
972
+ /**
973
+ * The combined transform (including all appended transactions) that caused the deletion
974
+ */
975
+ combinedTransform: Transform;
976
+ /**
977
+ * Whether the deletion was partial (only a part of this content was deleted)
978
+ */
979
+ partial: boolean;
980
+ /**
981
+ * This is the start position of the mark in the document (before the deletion)
982
+ */
983
+ from: number;
984
+ /**
985
+ * This is the end position of the mark in the document (before the deletion)
986
+ */
987
+ to: number;
988
+ } & ({
989
+ /**
990
+ * The content that was deleted
991
+ */
992
+ type: "node";
993
+ /**
994
+ * The node which the deletion occurred in
995
+ * @note This can be a parent node of the deleted content
996
+ */
997
+ node: Node$2;
998
+ /**
999
+ * The new start position of the node in the document (after the deletion)
1000
+ */
1001
+ newFrom: number;
1002
+ /**
1003
+ * The new end position of the node in the document (after the deletion)
1004
+ */
1005
+ newTo: number;
1006
+ } | {
1007
+ /**
1008
+ * The content that was deleted
1009
+ */
1010
+ type: "mark";
1011
+ /**
1012
+ * The mark that was deleted
1013
+ */
1014
+ mark: Mark$1;
1015
+ });
1016
+ }
1017
+ type EnableRules = (AnyExtension | string)[] | boolean;
1018
+ interface EditorOptions {
1019
+ /**
1020
+ * The element to bind the editor to:
1021
+ * - If an `Element` is passed, the editor will be mounted appended to that element
1022
+ * - If `null` is passed, the editor will not be mounted automatically
1023
+ * - If an object with a `mount` property is passed, the editor will be mounted to that element
1024
+ * - If a function is passed, it will be called with the editor's element, which should place the editor within the document
1025
+ */
1026
+ element: Element | {
1027
+ mount: HTMLElement;
1028
+ } | ((editor: HTMLElement) => void) | null;
1029
+ /**
1030
+ * The content of the editor (HTML, JSON, or a JSON array)
1031
+ */
1032
+ content: Content;
1033
+ /**
1034
+ * The extensions to use
1035
+ */
1036
+ extensions: Extensions;
1037
+ /**
1038
+ * Editor theme for UI styling
1039
+ *
1040
+ * Can be:
1041
+ * - String: 'light' or 'dark' (built-in themes)
1042
+ * - Full theme object with all colors
1043
+ * - Partial theme with extends property to override built-in theme
1044
+ *
1045
+ * @default undefined (no theme applied)
1046
+ * @example 'light'
1047
+ * @example 'dark'
1048
+ * @example { name: 'custom', colors: { background: '#000', ... } }
1049
+ * @example { extends: 'dark', colors: { background: '#0a0a0a' } }
1050
+ */
1051
+ theme?: string | Theme | ThemeConfig;
1052
+ /**
1053
+ * Whether to inject base CSS styles
1054
+ */
1055
+ injectCSS: boolean;
1056
+ /**
1057
+ * A nonce to use for CSP while injecting styles
1058
+ */
1059
+ injectNonce: string | undefined;
1060
+ /**
1061
+ * The editor's initial focus position
1062
+ */
1063
+ autofocus: FocusPosition;
1064
+ /**
1065
+ * Whether the editor is editable
1066
+ */
1067
+ editable: boolean;
1068
+ /**
1069
+ * The editor's props
1070
+ */
1071
+ editorProps: EditorProps;
1072
+ /**
1073
+ * The editor's content parser options
1074
+ */
1075
+ parseOptions: ParseOptions;
1076
+ /**
1077
+ * The editor's core extension options
1078
+ */
1079
+ coreExtensionOptions?: {
1080
+ clipboardTextSerializer?: {
1081
+ blockSeparator?: string;
1082
+ };
1083
+ delete?: {
1084
+ /**
1085
+ * Whether the `delete` extension should be called asynchronously to avoid blocking the editor while processing deletions
1086
+ * @default true deletion events are called asynchronously
1087
+ */
1088
+ async?: boolean;
1089
+ /**
1090
+ * Allows filtering the transactions that are processed by the `delete` extension.
1091
+ * If the function returns `true`, the transaction will be ignored.
1092
+ */
1093
+ filterTransaction?: (transaction: Transaction) => boolean;
1094
+ };
1095
+ };
1096
+ /**
1097
+ * Whether to enable input rules behavior
1098
+ */
1099
+ enableInputRules: EnableRules;
1100
+ /**
1101
+ * Whether to enable paste rules behavior
1102
+ */
1103
+ enablePasteRules: EnableRules;
1104
+ /**
1105
+ * Determines whether core extensions are enabled.
1106
+ *
1107
+ * If set to `false`, all core extensions will be disabled.
1108
+ * To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`.
1109
+ * Extensions not listed in the object will remain enabled.
1110
+ *
1111
+ * @example
1112
+ * // Disable all core extensions
1113
+ * enabledCoreExtensions: false
1114
+ *
1115
+ * @example
1116
+ * // Disable only the keymap core extension
1117
+ * enabledCoreExtensions: { keymap: false }
1118
+ *
1119
+ * @default true
1120
+ */
1121
+ enableCoreExtensions?: boolean | Partial<Record<"editable" | "clipboardTextSerializer" | "commands" | "focusEvents" | "keymap" | "tabindex" | "drop" | "paste" | "delete", false>>;
1122
+ /**
1123
+ * If `true`, the editor will check the content for errors on initialization.
1124
+ * Emitting the `contentError` event if the content is invalid.
1125
+ * Which can be used to show a warning or error message to the user.
1126
+ * @default false
1127
+ */
1128
+ enableContentCheck: boolean;
1129
+ /**
1130
+ * If `true`, the editor will emit the `contentError` event if invalid content is
1131
+ * encountered but `enableContentCheck` is `false`. This lets you preserve the
1132
+ * invalid editor content while still showing a warning or error message to
1133
+ * the user.
1134
+ *
1135
+ * @default false
1136
+ */
1137
+ emitContentError: boolean;
1138
+ /**
1139
+ * Called before the editor is constructed.
1140
+ */
1141
+ onBeforeCreate: (props: EditorEvents["beforeCreate"]) => void;
1142
+ /**
1143
+ * Called after the editor is constructed.
1144
+ */
1145
+ onCreate: (props: EditorEvents["create"]) => void;
1146
+ /**
1147
+ * Called when the editor is mounted.
1148
+ */
1149
+ onMount: (props: EditorEvents["mount"]) => void;
1150
+ /**
1151
+ * Called when the editor is unmounted.
1152
+ */
1153
+ onUnmount: (props: EditorEvents["unmount"]) => void;
1154
+ /**
1155
+ * Called when the editor encounters an error while parsing the content.
1156
+ * Only enabled if `enableContentCheck` is `true`.
1157
+ */
1158
+ onContentError: (props: EditorEvents["contentError"]) => void;
1159
+ /**
1160
+ * Called when the editor's content is updated.
1161
+ */
1162
+ onUpdate: (props: EditorEvents["update"]) => void;
1163
+ /**
1164
+ * Called when the editor's selection is updated.
1165
+ */
1166
+ onSelectionUpdate: (props: EditorEvents["selectionUpdate"]) => void;
1167
+ /**
1168
+ * Called after a transaction is applied to the editor.
1169
+ */
1170
+ onTransaction: (props: EditorEvents["transaction"]) => void;
1171
+ /**
1172
+ * Called on focus events.
1173
+ */
1174
+ onFocus: (props: EditorEvents["focus"]) => void;
1175
+ /**
1176
+ * Called on blur events.
1177
+ */
1178
+ onBlur: (props: EditorEvents["blur"]) => void;
1179
+ /**
1180
+ * Called when the editor is destroyed.
1181
+ */
1182
+ onDestroy: (props: EditorEvents["destroy"]) => void;
1183
+ /**
1184
+ * Called when content is pasted into the editor.
1185
+ */
1186
+ onPaste: (e: ClipboardEvent, slice: Slice) => void;
1187
+ /**
1188
+ * Called when content is dropped into the editor.
1189
+ */
1190
+ onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void;
1191
+ /**
1192
+ * Called when content is deleted from the editor.
1193
+ */
1194
+ onDelete: (props: EditorEvents["delete"]) => void;
1195
+ }
1196
+ /**
1197
+ * The editor's content as HTML
1198
+ */
1199
+ type HTMLContent = string;
1200
+ /**
1201
+ * Loosely describes a JSON representation of a Prosemirror document or node
1202
+ */
1203
+ type JSONContent = {
1204
+ type?: string;
1205
+ attrs?: Record<string, any> | undefined;
1206
+ content?: JSONContent[];
1207
+ marks?: {
1208
+ type: string;
1209
+ attrs?: Record<string, any>;
1210
+ [key: string]: any;
1211
+ }[];
1212
+ text?: string;
1213
+ [key: string]: any;
1214
+ };
1215
+ /**
1216
+ * A mark type is either a JSON representation of a mark or a Prosemirror mark instance
1217
+ */
1218
+ type MarkType<Type extends string | {
1219
+ name: string;
1220
+ } = any, TAttributes extends undefined | Record<string, any> = any> = {
1221
+ type: Type;
1222
+ attrs: TAttributes;
1223
+ };
1224
+ /**
1225
+ * A node type is either a JSON representation of a node or a Prosemirror node instance
1226
+ */
1227
+ type NodeType<Type extends string | {
1228
+ name: string;
1229
+ } = any, TAttributes extends undefined | Record<string, any> = any, NodeMarkType extends MarkType = any, TContent extends (NodeType | TextType)[] = any> = {
1230
+ type: Type;
1231
+ attrs: TAttributes;
1232
+ content?: TContent;
1233
+ marks?: NodeMarkType[];
1234
+ };
1235
+ /**
1236
+ * A node type is either a JSON representation of a doc node or a Prosemirror doc node instance
1237
+ */
1238
+ type DocumentType<TDocAttributes extends Record<string, any> | undefined = Record<string, any>, TContentType extends NodeType[] = NodeType[]> = Omit<NodeType<"doc", TDocAttributes, never, TContentType>, "marks" | "content"> & {
1239
+ content: TContentType;
1240
+ };
1241
+ /**
1242
+ * A node type is either a JSON representation of a text node or a Prosemirror text node instance
1243
+ */
1244
+ type TextType<TMarkType extends MarkType = MarkType> = {
1245
+ type: "text";
1246
+ text: string;
1247
+ marks: TMarkType[];
1248
+ };
1249
+ type Content = HTMLContent | JSONContent | JSONContent[] | null;
1250
+ type CommandProps = {
1251
+ editor: SlideEditor;
1252
+ tr: Transaction;
1253
+ commands: SingleCommands;
1254
+ can: () => CanCommands;
1255
+ chain: () => ChainedCommands;
1256
+ state: EditorState;
1257
+ view: EditorView;
1258
+ dispatch: ((args?: any) => any) | undefined;
1259
+ };
1260
+ type Command = (props: CommandProps) => boolean;
1261
+ type KeyboardShortcutCommand = (props: {
1262
+ editor: SlideEditor;
1263
+ }) => boolean;
1264
+ type Attribute = {
1265
+ default?: any;
1266
+ validate?: string | ((value: any) => void);
1267
+ rendered?: boolean;
1268
+ renderHTML?: ((attributes: Record<string, any>) => Record<string, any> | null) | null;
1269
+ parseHTML?: ((element: HTMLElement) => any | null) | null;
1270
+ keepOnSplit?: boolean;
1271
+ isRequired?: boolean;
1272
+ };
1273
+ type Attributes$1 = {
1274
+ [key: string]: Attribute;
1275
+ };
1276
+ type ExtensionAttribute = {
1277
+ type: string;
1278
+ name: string;
1279
+ attribute: Required<Omit<Attribute, "validate">> & Pick<Attribute, "validate">;
1280
+ };
1281
+ type GlobalAttributes = {
1282
+ /**
1283
+ * The node & mark types this attribute should be applied to.
1284
+ */
1285
+ types: string[];
1286
+ /**
1287
+ * The attributes to add to the node or mark types.
1288
+ */
1289
+ attributes: Record<string, Attribute | undefined>;
1290
+ }[];
1291
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
1292
+ type ValuesOf<T> = T[keyof T];
1293
+ type KeysWithTypeOf<T, Type> = {
1294
+ [P in keyof T]: T[P] extends Type ? P : never;
1295
+ }[keyof T];
1296
+ interface NodeViewRendererProps {
1297
+ /**
1298
+ * The node that is being rendered.
1299
+ */
1300
+ node: Parameters<NodeViewConstructor>[0];
1301
+ /**
1302
+ * The editor's view.
1303
+ */
1304
+ view: Parameters<NodeViewConstructor>[1];
1305
+ /**
1306
+ * A function that can be called to get the node's current position in the document.
1307
+ */
1308
+ getPos: Parameters<NodeViewConstructor>[2];
1309
+ /**
1310
+ * is an array of node or inline decorations that are active around the node.
1311
+ * They are automatically drawn in the normal way, and you will usually just want to ignore this, but they can also be used as a way to provide context information to the node view without adding it to the document itself.
1312
+ */
1313
+ decorations: Parameters<NodeViewConstructor>[3];
1314
+ /**
1315
+ * holds the decorations for the node's content. You can safely ignore this if your view has no content or a contentDOM property, since the editor will draw the decorations on the content.
1316
+ * But if you, for example, want to create a nested editor with the content, it may make sense to provide it with the inner decorations.
1317
+ */
1318
+ innerDecorations: Parameters<NodeViewConstructor>[4];
1319
+ /**
1320
+ * The editor instance.
1321
+ */
1322
+ editor: SlideEditor;
1323
+ /**
1324
+ * The extension that is responsible for the node.
1325
+ */
1326
+ extension: Node$1;
1327
+ /**
1328
+ * The HTML attributes that should be added to the node's DOM element.
1329
+ */
1330
+ HTMLAttributes: Record<string, any>;
1331
+ }
1332
+ type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView;
1333
+ interface MarkViewRendererProps {
1334
+ /**
1335
+ * The node that is being rendered.
1336
+ */
1337
+ mark: Parameters<MarkViewConstructor>[0];
1338
+ /**
1339
+ * The editor's view.
1340
+ */
1341
+ view: Parameters<MarkViewConstructor>[1];
1342
+ /**
1343
+ * indicates whether the mark's content is inline
1344
+ */
1345
+ inline: Parameters<MarkViewConstructor>[2];
1346
+ /**
1347
+ * The editor instance.
1348
+ */
1349
+ editor: SlideEditor;
1350
+ /**
1351
+ * The extension that is responsible for the mark.
1352
+ */
1353
+ extension: Mark;
1354
+ /**
1355
+ * The HTML attributes that should be added to the mark's DOM element.
1356
+ */
1357
+ HTMLAttributes: Record<string, any>;
1358
+ updateAttributes: (attrs: Record<string, any>) => void;
1359
+ }
1360
+ type MarkViewRenderer<Props = MarkViewRendererProps> = (props: Props) => MarkView;
1361
+ type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, object>>>>;
1362
+ type RawCommands = {
1363
+ [Item in keyof UnionCommands]: UnionCommands<Command>[Item];
1364
+ };
1365
+ type SingleCommands = {
1366
+ [Item in keyof UnionCommands]: UnionCommands<boolean>[Item];
1367
+ };
1368
+ type ChainedCommands = {
1369
+ [Item in keyof UnionCommands]: UnionCommands<ChainedCommands>[Item];
1370
+ } & {
1371
+ run: () => boolean;
1372
+ };
1373
+ type CanCommands = SingleCommands & {
1374
+ chain: () => ChainedCommands;
1375
+ };
1376
+ type FocusPosition = "start" | "end" | "all" | number | boolean | null;
1377
+ type Range = {
1378
+ from: number;
1379
+ to: number;
1380
+ };
1381
+ type TextSerializer = (props: {
1382
+ node: Node$2;
1383
+ pos: number;
1384
+ parent: Node$2;
1385
+ index: number;
1386
+ range: Range;
1387
+ }) => string;
1388
+ type ExtendedRegExpMatchArray = RegExpMatchArray & {
1389
+ data?: Record<string, any>;
1390
+ };
1391
+ /** Markdown related types */
1392
+ type MarkdownToken = {
1393
+ type?: string;
1394
+ raw?: string;
1395
+ text?: string;
1396
+ tokens?: MarkdownToken[];
1397
+ depth?: number;
1398
+ items?: MarkdownToken[];
1399
+ [key: string]: any;
1400
+ };
1401
+ /**
1402
+ * Helpers specifically for parsing markdown tokens into blockslides JSON.
1403
+ * These are provided to extension parse handlers.
1404
+ */
1405
+ type MarkdownParseHelpers = {
1406
+ /** Parse an array of inline tokens into text nodes with marks */
1407
+ parseInline: (tokens: MarkdownToken[]) => JSONContent[];
1408
+ /** Parse an array of block-level tokens */
1409
+ parseChildren: (tokens: MarkdownToken[]) => JSONContent[];
1410
+ /** Create a text node with optional marks */
1411
+ createTextNode: (text: string, marks?: Array<{
1412
+ type: string;
1413
+ attrs?: any;
1414
+ }>) => JSONContent;
1415
+ /** Create any node type with attributes and content */
1416
+ createNode: (type: string, attrs?: any, content?: JSONContent[]) => JSONContent;
1417
+ /** Apply a mark to content (used for inline marks like bold, italic) */
1418
+ applyMark: (markType: string, content: JSONContent[], attrs?: any) => {
1419
+ mark: string;
1420
+ content: JSONContent[];
1421
+ attrs?: any;
1422
+ };
1423
+ };
1424
+
1425
+ /**
1426
+ * Return shape for parser-level `parse` handlers.
1427
+ * - a single JSON-like node
1428
+ * - an array of JSON-like nodes
1429
+ * - or a `{ mark: string, content: JSONLike[] }` shape to apply a mark
1430
+ */
1431
+ type MarkdownParseResult = JSONContent | JSONContent[] | {
1432
+ mark: string;
1433
+ content: JSONContent[];
1434
+ attrs?: any;
1435
+ };
1436
+ type RenderContext = {
1437
+ index: number;
1438
+ level: number;
1439
+ meta?: Record<string, any>;
1440
+ parentType?: string | null;
1441
+ };
1442
+ /**
1443
+ * Configuration object passed to custom marked.js tokenizers
1444
+ */
1445
+ type MarkdownLexerConfiguration = {
1446
+ /**
1447
+ * Can be used to transform source text into inline tokens - useful while tokenizing child tokens.
1448
+ * @param src
1449
+ * @returns Array of inline tokens
1450
+ */
1451
+ inlineTokens: (src: string) => MarkdownToken[];
1452
+ /**
1453
+ * Can be used to transform source text into block-level tokens - useful while tokenizing child tokens.
1454
+ * @param src
1455
+ * @returns Array of block-level tokens
1456
+ */
1457
+ blockTokens: (src: string) => MarkdownToken[];
1458
+ };
1459
+ /** Custom tokenizer function for marked.js extensions */
1460
+ type MarkdownTokenizer = {
1461
+ /** Token name this tokenizer creates */
1462
+ name: string;
1463
+ /** Priority level for tokenizer ordering (higher = earlier) */
1464
+ level?: "block" | "inline";
1465
+ /** A string to look for or a function that returns the start index of the token in the source string */
1466
+ start?: string | ((src: string) => number);
1467
+ /** Function that attempts to parse custom syntax from start of text */
1468
+ tokenize: (src: string, tokens: MarkdownToken[], lexer: MarkdownLexerConfiguration) => MarkdownToken | undefined | void;
1469
+ };
1470
+ type MarkdownRendererHelpers = {
1471
+ /**
1472
+ * Render children nodes to a markdown string, optionally separated by a string.
1473
+ * @param nodes The node or array of nodes to render
1474
+ * @param separator An optional separator string (legacy) or RenderContext
1475
+ * @returns The rendered markdown string
1476
+ */
1477
+ renderChildren: (nodes: JSONContent | JSONContent[], separator?: string) => string;
1478
+ /**
1479
+ * Render a text token to a markdown string
1480
+ * @param prefix The prefix to add before the content
1481
+ * @param content The content to wrap
1482
+ * @returns The wrapped content
1483
+ */
1484
+ wrapInBlock: (prefix: string, content: string) => string;
1485
+ /**
1486
+ * Indent a markdown string according to the provided RenderContext
1487
+ * @param content The content to indent
1488
+ * @returns The indented content
1489
+ */
1490
+ indent: (content: string) => string;
1491
+ };
1492
+
1493
+ /**
1494
+ * Create a flattened array of extensions by traversing the `addExtensions` field.
1495
+ * @param extensions An array of Tiptap extensions
1496
+ * @returns A flattened array of Tiptap extensions
1497
+ */
1498
+ declare function flattenExtensions(extensions: Extensions): Extensions;
1499
+
1500
+ interface ExtensionConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, ExtensionConfig<Options, Storage>, null> {
1501
+ }
1502
+
1503
+ /**
1504
+ * Returns a flattened and sorted extension list while
1505
+ * also checking for duplicated extensions and warns the user.
1506
+ * @param extensions An array of BlockSlides extensions
1507
+ * @returns An flattened and sorted array of BlockSlides extensions
1508
+ */
1509
+ declare function resolveExtensions(extensions: Extensions): Extensions;
1510
+
1511
+ /**
1512
+ * Sort extensions by priority.
1513
+ * @param extensions An array of Tiptap extensions
1514
+ * @returns A sorted array of Tiptap extensions by priority
1515
+ */
1516
+ declare function sortExtensions(extensions: Extensions): Extensions;
1517
+
1518
+ declare class ExtensionManager {
1519
+ editor: SlideEditor;
1520
+ schema: Schema;
1521
+ /**
1522
+ * A flattened and sorted array of all extensions
1523
+ */
1524
+ extensions: Extensions;
1525
+ /**
1526
+ * A non-flattened array of base extensions (no sub-extensions)
1527
+ */
1528
+ baseExtensions: Extensions;
1529
+ splittableMarks: string[];
1530
+ constructor(extensions: Extensions, editor: SlideEditor);
1531
+ static resolve: typeof resolveExtensions;
1532
+ static sort: typeof sortExtensions;
1533
+ static flatten: typeof flattenExtensions;
1534
+ /**
1535
+ * Get all commands from the extensions.
1536
+ * @returns An object with all commands where the key is the command name and the value is the command function
1537
+ */
1538
+ get commands(): RawCommands;
1539
+ /**
1540
+ * Get all registered Prosemirror plugins from the extensions.
1541
+ * @returns An array of Prosemirror plugins
1542
+ */
1543
+ get plugins(): Plugin[];
1544
+ /**
1545
+ * Get all attributes from the extensions.
1546
+ * @returns An array of attributes
1547
+ */
1548
+ get attributes(): ExtensionAttribute[];
1549
+ /**
1550
+ * Get all node views from the extensions.
1551
+ * @returns An object with all node views where the key is the node name and the value is the node view function
1552
+ */
1553
+ get nodeViews(): Record<string, NodeViewConstructor>;
1554
+ get markViews(): Record<string, MarkViewConstructor>;
1555
+ /**
1556
+ * Go through all extensions, create extension storages & setup marks
1557
+ * & bind editor event listener.
1558
+ */
1559
+ private setupExtensions;
1560
+ }
1561
+
1562
+ declare class NodePos {
1563
+ private resolvedPos;
1564
+ private isBlock;
1565
+ private editor;
1566
+ private get name();
1567
+ constructor(pos: ResolvedPos, editor: SlideEditor, isBlock?: boolean, node?: Node$2 | null);
1568
+ private currentNode;
1569
+ get node(): Node$2;
1570
+ get element(): HTMLElement;
1571
+ actualDepth: number | null;
1572
+ get depth(): number;
1573
+ get pos(): number;
1574
+ get content(): Fragment;
1575
+ set content(content: Content);
1576
+ get attributes(): {
1577
+ [key: string]: any;
1578
+ };
1579
+ get textContent(): string;
1580
+ get size(): number;
1581
+ get from(): number;
1582
+ get range(): Range;
1583
+ get to(): number;
1584
+ get parent(): NodePos | null;
1585
+ get before(): NodePos | null;
1586
+ get after(): NodePos | null;
1587
+ get children(): NodePos[];
1588
+ get firstChild(): NodePos | null;
1589
+ get lastChild(): NodePos | null;
1590
+ closest(selector: string, attributes?: {
1591
+ [key: string]: any;
1592
+ }): NodePos | null;
1593
+ querySelector(selector: string, attributes?: {
1594
+ [key: string]: any;
1595
+ }): NodePos | null;
1596
+ querySelectorAll(selector: string, attributes?: {
1597
+ [key: string]: any;
1598
+ }, firstItemOnly?: boolean): NodePos[];
1599
+ setAttribute(attributes: {
1600
+ [key: string]: any;
1601
+ }): void;
1602
+ }
1603
+
1604
+ declare module "@blockslides/core" {
1605
+ interface Commands<ReturnType> {
1606
+ focus: {
1607
+ /**
1608
+ * Focus the editor at the given position.
1609
+ * @param position The position to focus at.
1610
+ * @param options.scrollIntoView Scroll the focused position into view after focusing
1611
+ * @example editor.commands.focus()
1612
+ * @example editor.commands.focus(32, { scrollIntoView: false })
1613
+ */
1614
+ focus: (
1615
+ /**
1616
+ * The position to focus at.
1617
+ */
1618
+ position?: FocusPosition,
1619
+ /**
1620
+ * Optional options
1621
+ * @default { scrollIntoView: true }
1622
+ */
1623
+ options?: {
1624
+ scrollIntoView?: boolean;
1625
+ }) => ReturnType;
1626
+ };
1627
+ }
1628
+ }
1629
+
1630
+ interface InsertContentOptions {
1631
+ /**
1632
+ * Options for parsing the content.
1633
+ */
1634
+ parseOptions?: ParseOptions;
1635
+ /**
1636
+ * Whether to update the selection after inserting the content.
1637
+ */
1638
+ updateSelection?: boolean;
1639
+ applyInputRules?: boolean;
1640
+ applyPasteRules?: boolean;
1641
+ }
1642
+
1643
+ interface InsertContentAtOptions {
1644
+ /**
1645
+ * Options for parsing the content.
1646
+ */
1647
+ parseOptions?: ParseOptions;
1648
+ /**
1649
+ * Whether to update the selection after inserting the content.
1650
+ */
1651
+ updateSelection?: boolean;
1652
+ /**
1653
+ * Whether to apply input rules after inserting the content.
1654
+ */
1655
+ applyInputRules?: boolean;
1656
+ /**
1657
+ * Whether to apply paste rules after inserting the content.
1658
+ */
1659
+ applyPasteRules?: boolean;
1660
+ /**
1661
+ * Whether to throw an error if the content is invalid.
1662
+ */
1663
+ errorOnInvalidContent?: boolean;
1664
+ }
1665
+
1666
+ interface SetContentOptions {
1667
+ /**
1668
+ * Options for parsing the content.
1669
+ * @default {}
1670
+ */
1671
+ parseOptions?: ParseOptions;
1672
+ /**
1673
+ * Whether to throw an error if the content is invalid.
1674
+ */
1675
+ errorOnInvalidContent?: boolean;
1676
+ /**
1677
+ * Whether to emit an update event.
1678
+ * @default true
1679
+ */
1680
+ emitUpdate?: boolean;
1681
+ }
1682
+
1683
+ declare module '@blockslides/core' {
1684
+ interface Commands<ReturnType> {
1685
+ blur: {
1686
+ /**
1687
+ * Removes focus from the editor.
1688
+ * @example editor.commands.blur()
1689
+ */
1690
+ blur: () => ReturnType;
1691
+ };
1692
+ }
1693
+ }
1694
+
1695
+ declare module '@blockslides/core' {
1696
+ interface Commands<ReturnType> {
1697
+ clearContent: {
1698
+ /**
1699
+ * Clear the whole document.
1700
+ * @example editor.commands.clearContent()
1701
+ */
1702
+ clearContent: (
1703
+ /**
1704
+ * Whether to emit an update event.
1705
+ * @default true
1706
+ */
1707
+ emitUpdate?: boolean) => ReturnType;
1708
+ };
1709
+ }
1710
+ }
1711
+
1712
+ declare module '@blockslides/core' {
1713
+ interface Commands<ReturnType> {
1714
+ clearNodes: {
1715
+ /**
1716
+ * Normalize nodes to a simple paragraph.
1717
+ * @example editor.commands.clearNodes()
1718
+ */
1719
+ clearNodes: () => ReturnType;
1720
+ };
1721
+ }
1722
+ }
1723
+
1724
+ declare module '@blockslides/core' {
1725
+ interface Commands<ReturnType> {
1726
+ command: {
1727
+ /**
1728
+ * Define a command inline.
1729
+ * @param fn The command function.
1730
+ * @example
1731
+ * editor.commands.command(({ tr, state }) => {
1732
+ * ...
1733
+ * return true
1734
+ * })
1735
+ */
1736
+ command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
1737
+ };
1738
+ }
1739
+ }
1740
+
1741
+ declare module '@blockslides/core' {
1742
+ interface Commands<ReturnType> {
1743
+ createParagraphNear: {
1744
+ /**
1745
+ * Create a paragraph nearby.
1746
+ * @example editor.commands.createParagraphNear()
1747
+ */
1748
+ createParagraphNear: () => ReturnType;
1749
+ };
1750
+ }
1751
+ }
1752
+
1753
+ declare module '@blockslides/core' {
1754
+ interface Commands<ReturnType> {
1755
+ cut: {
1756
+ /**
1757
+ * Cuts content from a range and inserts it at a given position.
1758
+ * @param range The range to cut.
1759
+ * @param range.from The start position of the range.
1760
+ * @param range.to The end position of the range.
1761
+ * @param targetPos The position to insert the content at.
1762
+ * @example editor.commands.cut({ from: 1, to: 3 }, 5)
1763
+ */
1764
+ cut: ({ from, to }: {
1765
+ from: number;
1766
+ to: number;
1767
+ }, targetPos: number) => ReturnType;
1768
+ };
1769
+ }
1770
+ }
1771
+
1772
+ declare module '@blockslides/core' {
1773
+ interface Commands<ReturnType> {
1774
+ deleteCurrentNode: {
1775
+ /**
1776
+ * Delete the node that currently has the selection anchor.
1777
+ * @example editor.commands.deleteCurrentNode()
1778
+ */
1779
+ deleteCurrentNode: () => ReturnType;
1780
+ };
1781
+ }
1782
+ }
1783
+
1784
+ declare module '@blockslides/core' {
1785
+ interface Commands<ReturnType> {
1786
+ deleteNode: {
1787
+ /**
1788
+ * Delete a node with a given type or name.
1789
+ * @param typeOrName The type or name of the node.
1790
+ * @example editor.commands.deleteNode('paragraph')
1791
+ */
1792
+ deleteNode: (typeOrName: string | NodeType$1) => ReturnType;
1793
+ };
1794
+ }
1795
+ }
1796
+
1797
+ declare module '@blockslides/core' {
1798
+ interface Commands<ReturnType> {
1799
+ deleteRange: {
1800
+ /**
1801
+ * Delete a given range.
1802
+ * @param range The range to delete.
1803
+ * @example editor.commands.deleteRange({ from: 1, to: 3 })
1804
+ */
1805
+ deleteRange: (range: Range) => ReturnType;
1806
+ };
1807
+ }
1808
+ }
1809
+
1810
+ declare module '@blockslides/core' {
1811
+ interface Commands<ReturnType> {
1812
+ deleteSelection: {
1813
+ /**
1814
+ * Delete the selection, if there is one.
1815
+ * @example editor.commands.deleteSelection()
1816
+ */
1817
+ deleteSelection: () => ReturnType;
1818
+ };
1819
+ }
1820
+ }
1821
+
1822
+ declare module '@blockslides/core' {
1823
+ interface Commands<ReturnType> {
1824
+ enter: {
1825
+ /**
1826
+ * Trigger enter.
1827
+ * @example editor.commands.enter()
1828
+ */
1829
+ enter: () => ReturnType;
1830
+ };
1831
+ }
1832
+ }
1833
+
1834
+ declare module '@blockslides/core' {
1835
+ interface Commands<ReturnType> {
1836
+ exitCode: {
1837
+ /**
1838
+ * Exit from a code block.
1839
+ * @example editor.commands.exitCode()
1840
+ */
1841
+ exitCode: () => ReturnType;
1842
+ };
1843
+ }
1844
+ }
1845
+
1846
+ declare module '@blockslides/core' {
1847
+ interface Commands<ReturnType> {
1848
+ extendMarkRange: {
1849
+ /**
1850
+ * Extends the text selection to the current mark by type or name.
1851
+ * @param typeOrName The type or name of the mark.
1852
+ * @param attributes The attributes of the mark.
1853
+ * @example editor.commands.extendMarkRange('bold')
1854
+ * @example editor.commands.extendMarkRange('mention', { userId: "1" })
1855
+ */
1856
+ extendMarkRange: (
1857
+ /**
1858
+ * The type or name of the mark.
1859
+ */
1860
+ typeOrName: string | MarkType$1,
1861
+ /**
1862
+ * The attributes of the mark.
1863
+ */
1864
+ attributes?: Record<string, any>) => ReturnType;
1865
+ };
1866
+ }
1867
+ }
1868
+
1869
+ declare module '@blockslides/core' {
1870
+ interface Commands<ReturnType> {
1871
+ first: {
1872
+ /**
1873
+ * Runs one command after the other and stops at the first which returns true.
1874
+ * @param commands The commands to run.
1875
+ * @example editor.commands.first([command1, command2])
1876
+ */
1877
+ first: (commands: Command[] | ((props: CommandProps) => Command[])) => ReturnType;
1878
+ };
1879
+ }
1880
+ }
1881
+
1882
+ declare module '@blockslides/core' {
1883
+ interface Commands<ReturnType> {
1884
+ forEach: {
1885
+ /**
1886
+ * Loop through an array of items.
1887
+ */
1888
+ forEach: <T>(items: T[], fn: (item: T, props: CommandProps & {
1889
+ index: number;
1890
+ }) => boolean) => ReturnType;
1891
+ };
1892
+ }
1893
+ }
1894
+ declare module '@blockslides/core' {
1895
+ interface Commands<ReturnType> {
1896
+ insertContent: {
1897
+ /**
1898
+ * Insert a node or string of HTML at the current position.
1899
+ * @example editor.commands.insertContent('<h1>Example</h1>')
1900
+ * @example editor.commands.insertContent('<h1>Example</h1>', { updateSelection: false })
1901
+ */
1902
+ insertContent: (
1903
+ /**
1904
+ * The ProseMirror content to insert.
1905
+ */
1906
+ value: Content | Node$2 | Fragment,
1907
+ /**
1908
+ * Optional options
1909
+ */
1910
+ options?: InsertContentOptions) => ReturnType;
1911
+ };
1912
+ }
1913
+ }
1914
+ declare module '@blockslides/core' {
1915
+ interface Commands<ReturnType> {
1916
+ insertContentAt: {
1917
+ /**
1918
+ * Insert a node or string of HTML at a specific position.
1919
+ * @example editor.commands.insertContentAt(0, '<h1>Example</h1>')
1920
+ */
1921
+ insertContentAt: (
1922
+ /**
1923
+ * The position to insert the content at.
1924
+ */
1925
+ position: number | Range,
1926
+ /**
1927
+ * The ProseMirror content to insert.
1928
+ */
1929
+ value: Content | Node$2 | Fragment,
1930
+ /**
1931
+ * Optional options
1932
+ */
1933
+ options?: InsertContentAtOptions) => ReturnType;
1934
+ };
1935
+ }
1936
+ }
1937
+
1938
+ declare module '@blockslides/core' {
1939
+ interface Commands<ReturnType> {
1940
+ joinUp: {
1941
+ /**
1942
+ * Join the selected block or, if there is a text selection, the closest ancestor block of the selection that can be joined, with the sibling above it.
1943
+ * @example editor.commands.joinUp()
1944
+ */
1945
+ joinUp: () => ReturnType;
1946
+ };
1947
+ joinDown: {
1948
+ /**
1949
+ * Join the selected block, or the closest ancestor of the selection that can be joined, with the sibling after it.
1950
+ * @example editor.commands.joinDown()
1951
+ */
1952
+ joinDown: () => ReturnType;
1953
+ };
1954
+ joinBackward: {
1955
+ /**
1956
+ * If the selection is empty and at the start of a textblock, try to reduce the distance between that block and the one before it—if there's a block directly before it that can be joined, join them.
1957
+ * If not, try to move the selected block closer to the next one in the document structure by lifting it out of its
1958
+ * parent or moving it into a parent of the previous block. Will use the view for accurate (bidi-aware) start-of-textblock detection if given.
1959
+ * @example editor.commands.joinBackward()
1960
+ */
1961
+ joinBackward: () => ReturnType;
1962
+ };
1963
+ joinForward: {
1964
+ /**
1965
+ * If the selection is empty and the cursor is at the end of a textblock, try to reduce or remove the boundary between that block and the one after it,
1966
+ * either by joining them or by moving the other block closer to this one in the tree structure.
1967
+ * Will use the view for accurate start-of-textblock detection if given.
1968
+ * @example editor.commands.joinForward()
1969
+ */
1970
+ joinForward: () => ReturnType;
1971
+ };
1972
+ }
1973
+ }
1974
+
1975
+ declare module '@blockslides/core' {
1976
+ interface Commands<ReturnType> {
1977
+ joinItemBackward: {
1978
+ /**
1979
+ * Join two items backward.
1980
+ * @example editor.commands.joinItemBackward()
1981
+ */
1982
+ joinItemBackward: () => ReturnType;
1983
+ };
1984
+ }
1985
+ }
1986
+
1987
+ declare module '@blockslides/core' {
1988
+ interface Commands<ReturnType> {
1989
+ joinItemForward: {
1990
+ /**
1991
+ * Join two items Forwards.
1992
+ * @example editor.commands.joinItemForward()
1993
+ */
1994
+ joinItemForward: () => ReturnType;
1995
+ };
1996
+ }
1997
+ }
1998
+
1999
+ declare module '@blockslides/core' {
2000
+ interface Commands<ReturnType> {
2001
+ joinTextblockBackward: {
2002
+ /**
2003
+ * A more limited form of joinBackward that only tries to join the current textblock to the one before it, if the cursor is at the start of a textblock.
2004
+ */
2005
+ joinTextblockBackward: () => ReturnType;
2006
+ };
2007
+ }
2008
+ }
2009
+
2010
+ declare module '@blockslides/core' {
2011
+ interface Commands<ReturnType> {
2012
+ joinTextblockForward: {
2013
+ /**
2014
+ * A more limited form of joinForward that only tries to join the current textblock to the one after it, if the cursor is at the end of a textblock.
2015
+ */
2016
+ joinTextblockForward: () => ReturnType;
2017
+ };
2018
+ }
2019
+ }
2020
+
2021
+ declare module '@blockslides/core' {
2022
+ interface Commands<ReturnType> {
2023
+ keyboardShortcut: {
2024
+ /**
2025
+ * Trigger a keyboard shortcut.
2026
+ * @param name The name of the keyboard shortcut.
2027
+ * @example editor.commands.keyboardShortcut('Mod-b')
2028
+ */
2029
+ keyboardShortcut: (name: string) => ReturnType;
2030
+ };
2031
+ }
2032
+ }
2033
+
2034
+ declare module '@blockslides/core' {
2035
+ interface Commands<ReturnType> {
2036
+ lift: {
2037
+ /**
2038
+ * Removes an existing wrap if possible lifting the node out of it
2039
+ * @param typeOrName The type or name of the node.
2040
+ * @param attributes The attributes of the node.
2041
+ * @example editor.commands.lift('paragraph')
2042
+ * @example editor.commands.lift('heading', { level: 1 })
2043
+ */
2044
+ lift: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2045
+ };
2046
+ }
2047
+ }
2048
+
2049
+ declare module '@blockslides/core' {
2050
+ interface Commands<ReturnType> {
2051
+ liftEmptyBlock: {
2052
+ /**
2053
+ * If the cursor is in an empty textblock that can be lifted, lift the block.
2054
+ * @example editor.commands.liftEmptyBlock()
2055
+ */
2056
+ liftEmptyBlock: () => ReturnType;
2057
+ };
2058
+ }
2059
+ }
2060
+
2061
+ declare module '@blockslides/core' {
2062
+ interface Commands<ReturnType> {
2063
+ liftListItem: {
2064
+ /**
2065
+ * Create a command to lift the list item around the selection up into a wrapping list.
2066
+ * @param typeOrName The type or name of the node.
2067
+ * @example editor.commands.liftListItem('listItem')
2068
+ */
2069
+ liftListItem: (typeOrName: string | NodeType$1) => ReturnType;
2070
+ };
2071
+ }
2072
+ }
2073
+
2074
+ declare module '@blockslides/core' {
2075
+ interface Commands<ReturnType> {
2076
+ newlineInCode: {
2077
+ /**
2078
+ * Add a newline character in code.
2079
+ * @example editor.commands.newlineInCode()
2080
+ */
2081
+ newlineInCode: () => ReturnType;
2082
+ };
2083
+ }
2084
+ }
2085
+
2086
+ declare module '@blockslides/core' {
2087
+ interface Commands<ReturnType> {
2088
+ resetAttributes: {
2089
+ /**
2090
+ * Resets some node attributes to the default value.
2091
+ * @param typeOrName The type or name of the node.
2092
+ * @param attributes The attributes of the node to reset.
2093
+ * @example editor.commands.resetAttributes('heading', 'level')
2094
+ */
2095
+ resetAttributes: (typeOrName: string | NodeType$1 | MarkType$1, attributes: string | string[]) => ReturnType;
2096
+ };
2097
+ }
2098
+ }
2099
+
2100
+ declare module '@blockslides/core' {
2101
+ interface Commands<ReturnType> {
2102
+ scrollIntoView: {
2103
+ /**
2104
+ * Scroll the selection into view.
2105
+ * @example editor.commands.scrollIntoView()
2106
+ */
2107
+ scrollIntoView: () => ReturnType;
2108
+ };
2109
+ }
2110
+ }
2111
+
2112
+ declare module '@blockslides/core' {
2113
+ interface Commands<ReturnType> {
2114
+ selectAll: {
2115
+ /**
2116
+ * Select the whole document.
2117
+ * @example editor.commands.selectAll()
2118
+ */
2119
+ selectAll: () => ReturnType;
2120
+ };
2121
+ }
2122
+ }
2123
+
2124
+ declare module '@blockslides/core' {
2125
+ interface Commands<ReturnType> {
2126
+ selectNodeBackward: {
2127
+ /**
2128
+ * Select a node backward.
2129
+ * @example editor.commands.selectNodeBackward()
2130
+ */
2131
+ selectNodeBackward: () => ReturnType;
2132
+ };
2133
+ }
2134
+ }
2135
+
2136
+ declare module '@blockslides/core' {
2137
+ interface Commands<ReturnType> {
2138
+ selectNodeForward: {
2139
+ /**
2140
+ * Select a node forward.
2141
+ * @example editor.commands.selectNodeForward()
2142
+ */
2143
+ selectNodeForward: () => ReturnType;
2144
+ };
2145
+ }
2146
+ }
2147
+
2148
+ declare module '@blockslides/core' {
2149
+ interface Commands<ReturnType> {
2150
+ selectParentNode: {
2151
+ /**
2152
+ * Select the parent node.
2153
+ * @example editor.commands.selectParentNode()
2154
+ */
2155
+ selectParentNode: () => ReturnType;
2156
+ };
2157
+ }
2158
+ }
2159
+
2160
+ declare module '@blockslides/core' {
2161
+ interface Commands<ReturnType> {
2162
+ selectTextblockEnd: {
2163
+ /**
2164
+ * Moves the cursor to the end of current text block.
2165
+ * @example editor.commands.selectTextblockEnd()
2166
+ */
2167
+ selectTextblockEnd: () => ReturnType;
2168
+ };
2169
+ }
2170
+ }
2171
+
2172
+ declare module '@blockslides/core' {
2173
+ interface Commands<ReturnType> {
2174
+ selectTextblockStart: {
2175
+ /**
2176
+ * Moves the cursor to the start of current text block.
2177
+ * @example editor.commands.selectTextblockStart()
2178
+ */
2179
+ selectTextblockStart: () => ReturnType;
2180
+ };
2181
+ }
2182
+ }
2183
+ declare module '@blockslides/core' {
2184
+ interface Commands<ReturnType> {
2185
+ setContent: {
2186
+ /**
2187
+ * Replace the whole document with new content.
2188
+ * @param content The new content.
2189
+ * @param emitUpdate Whether to emit an update event.
2190
+ * @param parseOptions Options for parsing the content.
2191
+ * @example editor.commands.setContent('<p>Example text</p>')
2192
+ */
2193
+ setContent: (
2194
+ /**
2195
+ * The new content.
2196
+ */
2197
+ content: Content | Fragment | Node$2,
2198
+ /**
2199
+ * Options for `setContent`.
2200
+ */
2201
+ options?: SetContentOptions) => ReturnType;
2202
+ };
2203
+ }
2204
+ }
2205
+
2206
+ declare module '@blockslides/core' {
2207
+ interface Commands<ReturnType> {
2208
+ setMark: {
2209
+ /**
2210
+ * Add a mark with new attributes.
2211
+ * @param typeOrName The mark type or name.
2212
+ * @example editor.commands.setMark('bold', { level: 1 })
2213
+ */
2214
+ setMark: (typeOrName: string | MarkType$1, attributes?: Record<string, any>) => ReturnType;
2215
+ };
2216
+ }
2217
+ }
2218
+
2219
+ declare module '@blockslides/core' {
2220
+ interface Commands<ReturnType> {
2221
+ setMeta: {
2222
+ /**
2223
+ * Store a metadata property in the current transaction.
2224
+ * @param key The key of the metadata property.
2225
+ * @param value The value to store.
2226
+ * @example editor.commands.setMeta('foo', 'bar')
2227
+ */
2228
+ setMeta: (key: string | Plugin | PluginKey, value: any) => ReturnType;
2229
+ };
2230
+ }
2231
+ }
2232
+
2233
+ declare module '@blockslides/core' {
2234
+ interface Commands<ReturnType> {
2235
+ setNode: {
2236
+ /**
2237
+ * Replace a given range with a node.
2238
+ * @param typeOrName The type or name of the node
2239
+ * @param attributes The attributes of the node
2240
+ * @example editor.commands.setNode('paragraph')
2241
+ */
2242
+ setNode: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2243
+ };
2244
+ }
2245
+ }
2246
+
2247
+ declare module '@blockslides/core' {
2248
+ interface Commands<ReturnType> {
2249
+ setNodeSelection: {
2250
+ /**
2251
+ * Creates a NodeSelection.
2252
+ * @param position - Position of the node.
2253
+ * @example editor.commands.setNodeSelection(10)
2254
+ */
2255
+ setNodeSelection: (position: number) => ReturnType;
2256
+ };
2257
+ }
2258
+ }
2259
+
2260
+ declare module '@blockslides/core' {
2261
+ interface Commands<ReturnType> {
2262
+ setTextSelection: {
2263
+ /**
2264
+ * Creates a TextSelection.
2265
+ * @param position The position of the selection.
2266
+ * @example editor.commands.setTextSelection(10)
2267
+ */
2268
+ setTextSelection: (position: number | Range) => ReturnType;
2269
+ };
2270
+ }
2271
+ }
2272
+
2273
+ declare module '@blockslides/core' {
2274
+ interface Commands<ReturnType> {
2275
+ sinkListItem: {
2276
+ /**
2277
+ * Sink the list item down into an inner list.
2278
+ * @param typeOrName The type or name of the node.
2279
+ * @example editor.commands.sinkListItem('listItem')
2280
+ */
2281
+ sinkListItem: (typeOrName: string | NodeType$1) => ReturnType;
2282
+ };
2283
+ }
2284
+ }
2285
+
2286
+ declare module '@blockslides/core' {
2287
+ interface Commands<ReturnType> {
2288
+ splitBlock: {
2289
+ /**
2290
+ * Forks a new node from an existing node.
2291
+ * @param options.keepMarks Keep marks from the previous node.
2292
+ * @example editor.commands.splitBlock()
2293
+ * @example editor.commands.splitBlock({ keepMarks: true })
2294
+ */
2295
+ splitBlock: (options?: {
2296
+ keepMarks?: boolean;
2297
+ }) => ReturnType;
2298
+ };
2299
+ }
2300
+ }
2301
+
2302
+ declare module '@blockslides/core' {
2303
+ interface Commands<ReturnType> {
2304
+ splitListItem: {
2305
+ /**
2306
+ * Splits one list item into two list items.
2307
+ * @param typeOrName The type or name of the node.
2308
+ * @param overrideAttrs The attributes to ensure on the new node.
2309
+ * @example editor.commands.splitListItem('listItem')
2310
+ */
2311
+ splitListItem: (typeOrName: string | NodeType$1, overrideAttrs?: Record<string, any>) => ReturnType;
2312
+ };
2313
+ }
2314
+ }
2315
+
2316
+ declare module '@blockslides/core' {
2317
+ interface Commands<ReturnType> {
2318
+ toggleList: {
2319
+ /**
2320
+ * Toggle between different list types.
2321
+ * @param listTypeOrName The type or name of the list.
2322
+ * @param itemTypeOrName The type or name of the list item.
2323
+ * @param keepMarks Keep marks when toggling.
2324
+ * @param attributes Attributes for the new list.
2325
+ * @example editor.commands.toggleList('bulletList', 'listItem')
2326
+ */
2327
+ toggleList: (listTypeOrName: string | NodeType$1, itemTypeOrName: string | NodeType$1, keepMarks?: boolean, attributes?: Record<string, any>) => ReturnType;
2328
+ };
2329
+ }
2330
+ }
2331
+
2332
+ declare module '@blockslides/core' {
2333
+ interface Commands<ReturnType> {
2334
+ toggleMark: {
2335
+ /**
2336
+ * Toggle a mark on and off.
2337
+ * @param typeOrName The mark type or name.
2338
+ * @param attributes The attributes of the mark.
2339
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
2340
+ * @example editor.commands.toggleMark('bold')
2341
+ */
2342
+ toggleMark: (
2343
+ /**
2344
+ * The mark type or name.
2345
+ */
2346
+ typeOrName: string | MarkType$1,
2347
+ /**
2348
+ * The attributes of the mark.
2349
+ */
2350
+ attributes?: Record<string, any>, options?: {
2351
+ /**
2352
+ * Removes the mark even across the current selection. Defaults to `false`.
2353
+ */
2354
+ extendEmptyMarkRange?: boolean;
2355
+ }) => ReturnType;
2356
+ };
2357
+ }
2358
+ }
2359
+
2360
+ declare module '@blockslides/core' {
2361
+ interface Commands<ReturnType> {
2362
+ toggleNode: {
2363
+ /**
2364
+ * Toggle a node with another node.
2365
+ * @param typeOrName The type or name of the node.
2366
+ * @param toggleTypeOrName The type or name of the node to toggle.
2367
+ * @param attributes The attributes of the node.
2368
+ * @example editor.commands.toggleNode('heading', 'paragraph')
2369
+ */
2370
+ toggleNode: (typeOrName: string | NodeType$1, toggleTypeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2371
+ };
2372
+ }
2373
+ }
2374
+
2375
+ declare module '@blockslides/core' {
2376
+ interface Commands<ReturnType> {
2377
+ toggleWrap: {
2378
+ /**
2379
+ * Wraps nodes in another node, or removes an existing wrap.
2380
+ * @param typeOrName The type or name of the node.
2381
+ * @param attributes The attributes of the node.
2382
+ * @example editor.commands.toggleWrap('blockquote')
2383
+ */
2384
+ toggleWrap: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2385
+ };
2386
+ }
2387
+ }
2388
+
2389
+ declare module '@blockslides/core' {
2390
+ interface Commands<ReturnType> {
2391
+ undoInputRule: {
2392
+ /**
2393
+ * Undo an input rule.
2394
+ * @example editor.commands.undoInputRule()
2395
+ */
2396
+ undoInputRule: () => ReturnType;
2397
+ };
2398
+ }
2399
+ }
2400
+
2401
+ declare module '@blockslides/core' {
2402
+ interface Commands<ReturnType> {
2403
+ unsetAllMarks: {
2404
+ /**
2405
+ * Remove all marks in the current selection.
2406
+ * @example editor.commands.unsetAllMarks()
2407
+ */
2408
+ unsetAllMarks: () => ReturnType;
2409
+ };
2410
+ }
2411
+ }
2412
+
2413
+ declare module '@blockslides/core' {
2414
+ interface Commands<ReturnType> {
2415
+ unsetMark: {
2416
+ /**
2417
+ * Remove all marks in the current selection.
2418
+ * @param typeOrName The mark type or name.
2419
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
2420
+ * @example editor.commands.unsetMark('bold')
2421
+ */
2422
+ unsetMark: (
2423
+ /**
2424
+ * The mark type or name.
2425
+ */
2426
+ typeOrName: string | MarkType$1, options?: {
2427
+ /**
2428
+ * Removes the mark even across the current selection. Defaults to `false`.
2429
+ */
2430
+ extendEmptyMarkRange?: boolean;
2431
+ }) => ReturnType;
2432
+ };
2433
+ }
2434
+ }
2435
+
2436
+ declare module '@blockslides/core' {
2437
+ interface Commands<ReturnType> {
2438
+ updateAttributes: {
2439
+ /**
2440
+ * Update attributes of a node or mark.
2441
+ * @param typeOrName The type or name of the node or mark.
2442
+ * @param attributes The attributes of the node or mark.
2443
+ * @example editor.commands.updateAttributes('mention', { userId: "2" })
2444
+ */
2445
+ updateAttributes: (
2446
+ /**
2447
+ * The type or name of the node or mark.
2448
+ */
2449
+ typeOrName: string | NodeType$1 | MarkType$1,
2450
+ /**
2451
+ * The attributes of the node or mark.
2452
+ */
2453
+ attributes: Record<string, any>) => ReturnType;
2454
+ };
2455
+ }
2456
+ }
2457
+
2458
+ declare module '@blockslides/core' {
2459
+ interface Commands<ReturnType> {
2460
+ wrapIn: {
2461
+ /**
2462
+ * Wraps nodes in another node.
2463
+ * @param typeOrName The type or name of the node.
2464
+ * @param attributes The attributes of the node.
2465
+ * @example editor.commands.wrapIn('blockquote')
2466
+ */
2467
+ wrapIn: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2468
+ };
2469
+ }
2470
+ }
2471
+
2472
+ declare module '@blockslides/core' {
2473
+ interface Commands<ReturnType> {
2474
+ wrapInList: {
2475
+ /**
2476
+ * Wrap a node in a list.
2477
+ * @param typeOrName The type or name of the node.
2478
+ * @param attributes The attributes of the node.
2479
+ * @example editor.commands.wrapInList('bulletList')
2480
+ */
2481
+ wrapInList: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2482
+ };
2483
+ }
2484
+ }
2485
+ declare class SlideEditor extends EventEmitter<EditorEvents> {
2486
+ private commandManager;
2487
+ extensionManager: ExtensionManager;
2488
+ private css;
2489
+ schema: Schema;
2490
+ private editorView;
2491
+ isFocused: boolean;
2492
+ private editorState;
2493
+ /**
2494
+ * The editor is considered initialized after the `create` event has been emitted.
2495
+ */
2496
+ isInitialized: boolean;
2497
+ extensionStorage: Storage;
2498
+ /**
2499
+ * Resolved editor theme (null if no theme applied)
2500
+ */
2501
+ private resolvedTheme;
2502
+ /**
2503
+ * A unique ID for this editor instance.
2504
+ */
2505
+ instanceId: string;
2506
+ options: EditorOptions;
2507
+ constructor(options?: Partial<EditorOptions>);
2508
+ /**
2509
+ * Attach the editor to the DOM, creating a new editor view.
2510
+ */
2511
+ mount(el: NonNullable<EditorOptions["element"]> & {}): void;
2512
+ /**
2513
+ * Remove the editor from the DOM, but still allow remounting at a different point in time
2514
+ */
2515
+ unmount(): void;
2516
+ /**
2517
+ * Returns the editor storage.
2518
+ */
2519
+ get storage(): Storage;
2520
+ /**
2521
+ * An object of all registered commands.
2522
+ */
2523
+ get commands(): SingleCommands;
2524
+ /**
2525
+ * Create a command chain to call multiple commands at once.
2526
+ */
2527
+ chain(): ChainedCommands;
2528
+ /**
2529
+ * Check if a command or a command chain can be executed. Without executing it.
2530
+ */
2531
+ can(): CanCommands;
2532
+ /**
2533
+ * Inject CSS styles.
2534
+ */
2535
+ private injectCSS;
2536
+ /**
2537
+ * Update editor options.
2538
+ *
2539
+ * @param options A list of options
2540
+ */
2541
+ setOptions(options?: Partial<EditorOptions>): void;
2542
+ /**
2543
+ * Update editable state of the editor.
2544
+ */
2545
+ setEditable(editable: boolean, emitUpdate?: boolean): void;
2546
+ /**
2547
+ * Returns whether the editor is editable.
2548
+ */
2549
+ get isEditable(): boolean;
2550
+ /**
2551
+ * Returns the editor state.
2552
+ */
2553
+ get view(): EditorView;
2554
+ /**
2555
+ * Returns the editor state.
2556
+ */
2557
+ get state(): EditorState;
2558
+ /**
2559
+ * Register a ProseMirror plugin.
2560
+ *
2561
+ * @param plugin A ProseMirror plugin
2562
+ * @param handlePlugins Control how to merge the plugin into the existing plugins.
2563
+ * @returns The new editor state
2564
+ */
2565
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
2566
+ /**
2567
+ * Unregister a ProseMirror plugin.
2568
+ *
2569
+ * @param nameOrPluginKeyToRemove The plugins name
2570
+ * @returns The new editor state or undefined if the editor is destroyed
2571
+ */
2572
+ unregisterPlugin(nameOrPluginKeyToRemove: string | PluginKey | (string | PluginKey)[]): EditorState | undefined;
2573
+ /**
2574
+ * Creates an extension manager.
2575
+ */
2576
+ private createExtensionManager;
2577
+ /**
2578
+ * Creates an command manager.
2579
+ */
2580
+ private createCommandManager;
2581
+ /**
2582
+ * Creates a ProseMirror schema.
2583
+ */
2584
+ private createSchema;
2585
+ /**
2586
+ * Creates the initial document.
2587
+ */
2588
+ private createDoc;
2589
+ /**
2590
+ * Creates a ProseMirror view.
2591
+ */
2592
+ private createView;
2593
+ /**
2594
+ * Creates all node and mark views.
2595
+ */
2596
+ createNodeViews(): void;
2597
+ /**
2598
+ * Prepend class name to element.
2599
+ */
2600
+ prependClass(): void;
2601
+ isCapturingTransaction: boolean;
2602
+ private capturedTransaction;
2603
+ captureTransaction(fn: () => void): Transaction | null;
2604
+ /**
2605
+ * The callback over which to send transactions (state updates) produced by the view.
2606
+ *
2607
+ * @param transaction An editor state transaction
2608
+ */
2609
+ private dispatchTransaction;
2610
+ /**
2611
+ * Get attributes of the currently selected node or mark.
2612
+ */
2613
+ getAttributes(nameOrType: string | NodeType$1 | MarkType$1): Record<string, any>;
2614
+ /**
2615
+ * Returns if the currently selected node or mark is active.
2616
+ *
2617
+ * @param name Name of the node or mark
2618
+ * @param attributes Attributes of the node or mark
2619
+ */
2620
+ isActive(name: string, attributes?: {}): boolean;
2621
+ isActive(attributes: {}): boolean;
2622
+ /**
2623
+ * Get the document as JSON.
2624
+ */
2625
+ getJSON(): DocumentType<Record<string, any> | undefined, NodeType<string, undefined | Record<string, any>, any, (NodeType | TextType)[]>[]>;
2626
+ /**
2627
+ * Get the document as HTML.
2628
+ */
2629
+ getHTML(): string;
2630
+ /**
2631
+ * Get the document as text.
2632
+ */
2633
+ getText(options?: {
2634
+ blockSeparator?: string;
2635
+ textSerializers?: Record<string, TextSerializer>;
2636
+ }): string;
2637
+ /**
2638
+ * Check if there is no content.
2639
+ */
2640
+ get isEmpty(): boolean;
2641
+ /**
2642
+ * Set or change the editor theme
2643
+ *
2644
+ * @param theme - Theme to apply (string, full theme object, or partial theme)
2645
+ *
2646
+ * @example
2647
+ * // Switch to built-in dark theme
2648
+ * editor.setTheme('dark');
2649
+ *
2650
+ * @example
2651
+ * // Apply custom theme
2652
+ * editor.setTheme({
2653
+ * extends: 'dark',
2654
+ * colors: { background: '#0a0a0a' }
2655
+ * });
2656
+ */
2657
+ setTheme(theme: typeof this$1.options.theme): void;
2658
+ /**
2659
+ * Get the current theme
2660
+ *
2661
+ * @returns Current resolved theme (null if no theme applied)
2662
+ */
2663
+ getTheme(): ResolvedTheme;
2664
+ /**
2665
+ * Destroy the editor.
2666
+ */
2667
+ destroy(): void;
2668
+ /**
2669
+ * Check if the editor is already destroyed.
2670
+ */
2671
+ get isDestroyed(): boolean;
2672
+ $node(selector: string, attributes?: {
2673
+ [key: string]: any;
2674
+ }): NodePos | null;
2675
+ $nodes(selector: string, attributes?: {
2676
+ [key: string]: any;
2677
+ }): NodePos[] | null;
2678
+ $pos(pos: number): NodePos;
2679
+ get $doc(): NodePos;
2680
+ }
2681
+
2682
+ interface Commands<ReturnType = any> {
2683
+ }
2684
+ interface Storage {
2685
+ }
2686
+
2687
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
2688
+ type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {
2689
+ class?: string;
2690
+ onNodeChange?: (data: {
2691
+ node: Node | null;
2692
+ editor: SlideEditor;
2693
+ pos: number;
2694
+ }) => void;
2695
+ };
2696
+ declare const DragHandle: vue.DefineComponent<vue.ExtractPropTypes<{
2697
+ pluginKey: {
2698
+ type: PropType<DragHandleProps["pluginKey"]>;
2699
+ default: _blockslides_pm_state.PluginKey<any>;
2700
+ };
2701
+ editor: {
2702
+ type: PropType<DragHandleProps["editor"]>;
2703
+ required: true;
2704
+ };
2705
+ computePositionConfig: {
2706
+ type: PropType<DragHandleProps["computePositionConfig"]>;
2707
+ default: () => {};
2708
+ };
2709
+ onNodeChange: {
2710
+ type: PropType<DragHandleProps["onNodeChange"]>;
2711
+ default: null;
2712
+ };
2713
+ class: {
2714
+ type: PropType<DragHandleProps["class"]>;
2715
+ default: string;
2716
+ };
2717
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
2718
+ [key: string]: any;
2719
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
2720
+ pluginKey: {
2721
+ type: PropType<DragHandleProps["pluginKey"]>;
2722
+ default: _blockslides_pm_state.PluginKey<any>;
2723
+ };
2724
+ editor: {
2725
+ type: PropType<DragHandleProps["editor"]>;
2726
+ required: true;
2727
+ };
2728
+ computePositionConfig: {
2729
+ type: PropType<DragHandleProps["computePositionConfig"]>;
2730
+ default: () => {};
2731
+ };
2732
+ onNodeChange: {
2733
+ type: PropType<DragHandleProps["onNodeChange"]>;
2734
+ default: null;
2735
+ };
2736
+ class: {
2737
+ type: PropType<DragHandleProps["class"]>;
2738
+ default: string;
2739
+ };
2740
+ }>> & Readonly<{}>, {
2741
+ pluginKey: string | _blockslides_pm_state.PluginKey<any> | undefined;
2742
+ onNodeChange: (((data: {
2743
+ editor: SlideEditor;
2744
+ node: _blockslides_pm_model.Node | null;
2745
+ pos: number;
2746
+ }) => void) & ((data: {
2747
+ node: Node | null;
2748
+ editor: SlideEditor;
2749
+ pos: number;
2750
+ }) => void)) | undefined;
2751
+ computePositionConfig: {
2752
+ placement?: _floating_ui_dom.Placement | undefined;
2753
+ strategy?: _floating_ui_dom.Strategy | undefined;
2754
+ middleware?: Array<_floating_ui_dom.Middleware | null | undefined | false> | undefined;
2755
+ platform?: _floating_ui_dom.Platform | undefined;
2756
+ } | undefined;
2757
+ class: string | undefined;
2758
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
2759
+
2760
+ export { DragHandle, type DragHandleProps, DragHandle as default };