rme 0.3.0-beta.4 → 0.3.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +361 -8
- package/dist/index.mjs +2485 -935
- package/dist/index.mjs.map +4 -4
- package/package.json +14 -12
package/dist/index.d.ts
CHANGED
|
@@ -2,26 +2,78 @@ import * as _drl990114_codemirror_themes from '@drl990114/codemirror-themes';
|
|
|
2
2
|
import { CreateThemeOptions } from '@drl990114/codemirror-themes';
|
|
3
3
|
export { CreateThemeOptions, createTheme } from '@drl990114/codemirror-themes';
|
|
4
4
|
import { LanguageSupport, LanguageDescription } from '@codemirror/language';
|
|
5
|
+
import { SearchQuery } from '@codemirror/search';
|
|
5
6
|
import { Compartment, Extension } from '@codemirror/state';
|
|
6
7
|
import { EditorView, EditorViewConfig } from '@codemirror/view';
|
|
7
8
|
import { ProsemirrorNode, EditorView as EditorView$1 } from '@rme-sdk/pm';
|
|
8
9
|
import * as react from 'react';
|
|
9
|
-
import react__default, { CSSProperties, ReactNode, MouseEvent, JSX, FC } from 'react';
|
|
10
|
+
import react__default, { CSSProperties, ComponentType, ReactNode, MouseEvent, JSX, FC } from 'react';
|
|
10
11
|
import { RemirrorEventListenerProps, Extension as Extension$1, RemirrorManager as RemirrorManager$1, AnyExtension as AnyExtension$1 } from '@rme-sdk/main';
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
12
|
+
import * as _rme_sdk_core from '@rme-sdk/core';
|
|
13
|
+
import { AnyExtension, RemirrorManager, DelayedPromiseCreator, ProsemirrorAttributes, NodeExtension, EditorView as EditorView$2, ApplySchemaAttributes, NodeSpecOverride, NodeExtensionSpec, PrimitiveSelection, CommandFunction, ExtensionCommandReturn, InputRule as InputRule$1, KeyBindings, ProsemirrorPlugin, ProsemirrorNode as ProsemirrorNode$1, CommandDecoratorMessageProps, CoreIcon } from '@rme-sdk/core';
|
|
14
|
+
import { Node, Schema, NodeType, Mark, NodeRange } from '@rme-sdk/pm/model';
|
|
13
15
|
import { ReactFrameworkOutput } from '@rme-sdk/react-core';
|
|
14
|
-
import {
|
|
16
|
+
import { InputRule } from '@rme-sdk/pm/inputrules';
|
|
17
|
+
import { PasteRule } from '@rme-sdk/pm/paste-rules';
|
|
15
18
|
import Token from 'markdown-it/lib/token.mjs';
|
|
19
|
+
import { Token as Token$1 } from 'markdown-it/index.js';
|
|
20
|
+
import { NodeViewComponentProps } from '@rme-sdk/react';
|
|
16
21
|
export { useCommands, useHelpers, useKeymap, useRemirrorContext } from '@rme-sdk/react';
|
|
17
22
|
import * as styled_components from 'styled-components';
|
|
18
23
|
import * as styled_components_dist_types from 'styled-components/dist/types';
|
|
24
|
+
import { IndentListOptions, DedentListOptions, UnwrapListOptions, ToggleCollapsedOptions } from '@rme-sdk/prosemirror-flat-list';
|
|
19
25
|
|
|
20
26
|
type LoadLanguage = (lang: string) => Promise<LanguageSupport> | LanguageSupport | void;
|
|
21
27
|
|
|
28
|
+
type ClipboardReadFunction = typeof clipboardRead;
|
|
29
|
+
declare function clipboardRead(): Promise<{
|
|
30
|
+
html: string;
|
|
31
|
+
text: string;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
interface CommandKeymapOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Override default keyboard shortcuts
|
|
37
|
+
* @example
|
|
38
|
+
* { toggleStrong: 'mod-shift-b', toggleEmphasis: 'ctrl-i' }
|
|
39
|
+
*/
|
|
40
|
+
overrideShortcutMap?: Partial<Record<CommandName, string>>;
|
|
41
|
+
/**
|
|
42
|
+
* Disable all built-in shortcuts
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disableAllBuildInShortcuts?: boolean;
|
|
46
|
+
clipboardReadFunction?: ClipboardReadFunction;
|
|
47
|
+
}
|
|
48
|
+
type CommandName = keyof typeof defaultCommandShortcutMap;
|
|
49
|
+
declare const defaultCommandShortcutMap: {
|
|
50
|
+
readonly copy: "mod-c";
|
|
51
|
+
readonly paste: "mod-v";
|
|
52
|
+
readonly undo: "mod-z";
|
|
53
|
+
readonly redo: "mod-shift-z";
|
|
54
|
+
readonly cut: "mod-x";
|
|
55
|
+
readonly toggleH1: "mod-1";
|
|
56
|
+
readonly toggleH2: "mod-2";
|
|
57
|
+
readonly toggleH3: "mod-3";
|
|
58
|
+
readonly toggleH4: "mod-4";
|
|
59
|
+
readonly toggleH5: "mod-5";
|
|
60
|
+
readonly toggleH6: "mod-6";
|
|
61
|
+
readonly toggleStrong: "mod-b";
|
|
62
|
+
readonly toggleEmphasis: "mod-i";
|
|
63
|
+
readonly toggleCodeText: "mod-e";
|
|
64
|
+
readonly toggleDelete: "mod-shift-s";
|
|
65
|
+
readonly insertLink: "mod-k";
|
|
66
|
+
readonly insertImage: "mod-alt-i";
|
|
67
|
+
};
|
|
68
|
+
|
|
22
69
|
type CustomCopyFunction = (code: string) => Promise<boolean> | boolean;
|
|
23
70
|
|
|
24
71
|
declare const changeTheme: (theme: CreateThemeOptions) => void;
|
|
72
|
+
declare const updateCodemirrorSearchQuery: (query: string, caseSensitive?: boolean) => void;
|
|
73
|
+
declare const updateCodemirrorSearchState: (query: string, caseSensitive?: boolean, activeMatch?: {
|
|
74
|
+
from: number;
|
|
75
|
+
to: number;
|
|
76
|
+
} | null) => void;
|
|
25
77
|
declare const extractMatches: (view: EditorView) => any[];
|
|
26
78
|
type CreateCodemirrorOptions = {
|
|
27
79
|
/**
|
|
@@ -44,6 +96,10 @@ type CreateCodemirrorOptions = {
|
|
|
44
96
|
*/
|
|
45
97
|
customCopyFunction?: CustomCopyFunction;
|
|
46
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Command keymap options for customizing keyboard shortcuts
|
|
101
|
+
*/
|
|
102
|
+
commandKeymapOptions?: CommandKeymapOptions;
|
|
47
103
|
};
|
|
48
104
|
declare class MfCodemirrorView {
|
|
49
105
|
private readonly view;
|
|
@@ -51,6 +107,7 @@ declare class MfCodemirrorView {
|
|
|
51
107
|
private readonly languageConf;
|
|
52
108
|
private readonly toggleName;
|
|
53
109
|
private readonly schema;
|
|
110
|
+
private readonly searchQueryConf;
|
|
54
111
|
private languageName;
|
|
55
112
|
id: string;
|
|
56
113
|
cm: EditorView;
|
|
@@ -74,6 +131,14 @@ declare class MfCodemirrorView {
|
|
|
74
131
|
setSelection(anchor: number, head: number): void;
|
|
75
132
|
updateLanguage(): void;
|
|
76
133
|
destroy(): void;
|
|
134
|
+
setSearchState(query: SearchQuery, active: {
|
|
135
|
+
from: number;
|
|
136
|
+
to: number;
|
|
137
|
+
} | null): void;
|
|
138
|
+
getProsemirrorContentRange(): {
|
|
139
|
+
from: number;
|
|
140
|
+
to: number;
|
|
141
|
+
};
|
|
77
142
|
forwardSelection(): void;
|
|
78
143
|
private setLanguage;
|
|
79
144
|
private valueChanged;
|
|
@@ -231,6 +296,18 @@ type EditorContext = ReactFrameworkOutput<Remirror.Extensions>;
|
|
|
231
296
|
type CreateSourceCodeManagerOptions = {
|
|
232
297
|
language?: string;
|
|
233
298
|
onCodemirrorViewLoad: (cm: MfCodemirrorView) => void;
|
|
299
|
+
/**
|
|
300
|
+
* Override default keyboard shortcuts
|
|
301
|
+
* @example
|
|
302
|
+
* { toggleStrong: 'mod-shift-b', toggleEmphasis: 'ctrl-i' }
|
|
303
|
+
*/
|
|
304
|
+
overrideShortcutMap?: Partial<Record<CommandName, string>>;
|
|
305
|
+
/**
|
|
306
|
+
* Disable all built-in shortcuts
|
|
307
|
+
* @default false
|
|
308
|
+
*/
|
|
309
|
+
disableAllBuildInShortcuts?: boolean;
|
|
310
|
+
clipboardReadFunction?: ClipboardReadFunction;
|
|
234
311
|
};
|
|
235
312
|
declare function createSourceCodeManager(options?: CreateSourceCodeManagerOptions): RemirrorManager$1<any>;
|
|
236
313
|
declare const createSourceCodeDelegate: (options?: CreateSourceCodeManagerOptions) => EditorDelegate<any>;
|
|
@@ -250,6 +327,11 @@ interface AIOptions {
|
|
|
250
327
|
}) => Promise<string | null>;
|
|
251
328
|
}
|
|
252
329
|
|
|
330
|
+
type CodemirrorOptions = {
|
|
331
|
+
lineWrapping?: boolean;
|
|
332
|
+
lineNumbers?: boolean;
|
|
333
|
+
};
|
|
334
|
+
|
|
253
335
|
type MarkdownItToken = string;
|
|
254
336
|
declare enum ParserRuleType {
|
|
255
337
|
text = 1,
|
|
@@ -316,6 +398,7 @@ declare class MarkdownParseState {
|
|
|
316
398
|
private marks;
|
|
317
399
|
private tokenHandlers;
|
|
318
400
|
private contextStack;
|
|
401
|
+
private contextTokenStack;
|
|
319
402
|
stack: StackItem[];
|
|
320
403
|
constructor(schema: Schema, tokenHandlers: TokenHandlers);
|
|
321
404
|
top(): StackItem;
|
|
@@ -328,9 +411,11 @@ declare class MarkdownParseState {
|
|
|
328
411
|
addNode(type: NodeType, attrs?: Record<string, any>, content?: Node[]): Node;
|
|
329
412
|
openNode(type: NodeType, attrs?: Record<string, any>): void;
|
|
330
413
|
closeNode(): Node;
|
|
331
|
-
openContext(context: ParserRuleContext): void;
|
|
414
|
+
openContext(context: ParserRuleContext, token: Token$1): void;
|
|
332
415
|
closeContext(): void;
|
|
416
|
+
closeContextToken(): Token$1 | undefined;
|
|
333
417
|
topContext(): ParserRuleContext | undefined;
|
|
418
|
+
topContextToken(): Token$1 | undefined;
|
|
334
419
|
}
|
|
335
420
|
declare class MarkdownParser {
|
|
336
421
|
private schema;
|
|
@@ -381,14 +466,280 @@ declare class MarkdownSerializer {
|
|
|
381
466
|
serialize(content: Node): string;
|
|
382
467
|
}
|
|
383
468
|
|
|
469
|
+
interface ImageNodeViewProps extends NodeViewComponentProps {
|
|
470
|
+
resizeable?: boolean;
|
|
471
|
+
defaultSyntaxType?: 'html' | 'md';
|
|
472
|
+
handleViewImgSrcUrl?: ExtensionsOptions['handleViewImgSrcUrl'];
|
|
473
|
+
imagePasteHandler?: ExtensionsOptions['imagePasteHandler'];
|
|
474
|
+
imageHostingHandler?: (src: string) => Promise<string>;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
type DelayedImage$1 = DelayedPromiseCreator<ImageAttributes$1>;
|
|
478
|
+
interface ImageOptions$1 {
|
|
479
|
+
createPlaceholder?: (view: EditorView$2, pos: number) => HTMLElement;
|
|
480
|
+
updatePlaceholder?: (view: EditorView$2, pos: number, element: HTMLElement, progress: number) => void;
|
|
481
|
+
handleViewImgSrcUrl?: ExtensionsOptions['handleViewImgSrcUrl'];
|
|
482
|
+
imagePasteHandler?: ExtensionsOptions['imagePasteHandler'];
|
|
483
|
+
destroyPlaceholder?: (view: EditorView$2, element: HTMLElement) => void;
|
|
484
|
+
/**
|
|
485
|
+
* The upload handler for the image extension.
|
|
486
|
+
*
|
|
487
|
+
* It receives a list of dropped or pasted files and returns a promise for the
|
|
488
|
+
* attributes which should be used to insert the image into the editor.
|
|
489
|
+
*
|
|
490
|
+
* @param files - a list of files to upload.
|
|
491
|
+
* @param setProgress - the progress handler.
|
|
492
|
+
*/
|
|
493
|
+
uploadHandler?: (files: FileWithProgress$1[]) => DelayedImage$1[];
|
|
494
|
+
/**
|
|
495
|
+
* The image hosting service upload handler.
|
|
496
|
+
* It receives the image src and returns a promise for the new src after uploading to image hosting service.
|
|
497
|
+
*
|
|
498
|
+
* @param src - the original image src
|
|
499
|
+
* @returns Promise<string> - the new image src after uploading
|
|
500
|
+
*/
|
|
501
|
+
imageHostingHandler?: (src: string) => Promise<string>;
|
|
502
|
+
/**
|
|
503
|
+
* When pasting mixed text and image content (usually from Microsoft Office products) the content on the clipboard is either:
|
|
504
|
+
*
|
|
505
|
+
* a. one large image: containing effectively a screenshot of the original content (an image with text in it).
|
|
506
|
+
* b. HTML content: containing usable text, but images with file protocol URLs (which cannot be resolved due to browser security restrictions).
|
|
507
|
+
*
|
|
508
|
+
* If true, this will extract the text from the clipboard data, and drop the images.
|
|
509
|
+
* If false, the "screenshot" image will be used and the text will be dropped.
|
|
510
|
+
*
|
|
511
|
+
* @defaultValue true
|
|
512
|
+
*/
|
|
513
|
+
preferPastedTextContent?: boolean;
|
|
514
|
+
}
|
|
515
|
+
interface FileWithProgress$1 {
|
|
516
|
+
file: File;
|
|
517
|
+
progress: SetProgress$1;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Set the progress.
|
|
521
|
+
*
|
|
522
|
+
* @param progress - a value between `0` and `1`.
|
|
523
|
+
*/
|
|
524
|
+
type SetProgress$1 = (progress: number) => void;
|
|
525
|
+
/**
|
|
526
|
+
* The image extension for placing images into your editor.
|
|
527
|
+
*
|
|
528
|
+
* TODO ->
|
|
529
|
+
* - Captions https://glitch.com/edit/#!/pet-figcaption?path=index.js%3A27%3A1 into a preset
|
|
530
|
+
*
|
|
531
|
+
* TODO => Split this into an image upload extension and image extension.
|
|
532
|
+
* - Add a base64 image
|
|
533
|
+
*/
|
|
534
|
+
declare class MdImgUriExtension extends NodeExtension<ImageOptions$1> {
|
|
535
|
+
get name(): "md_image";
|
|
536
|
+
ReactComponent: ComponentType<ImageNodeViewProps> | undefined;
|
|
537
|
+
createTags(): ("inline" | "media")[];
|
|
538
|
+
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
|
539
|
+
insertMarkdownImage(attributes: ImageAttributes$1, selection?: PrimitiveSelection): CommandFunction;
|
|
540
|
+
uploadImage: (value: DelayedPromiseCreator<ImageAttributes$1>, onElement?: ((element: HTMLElement) => void) | undefined) => CommandFunction;
|
|
541
|
+
/**
|
|
542
|
+
* Insert an image once the provide promise resolves.
|
|
543
|
+
*/
|
|
544
|
+
createCommands(): ExtensionCommandReturn;
|
|
545
|
+
uploadFiles: (options: {
|
|
546
|
+
files: File[];
|
|
547
|
+
pos?: number;
|
|
548
|
+
}) => CommandFunction;
|
|
549
|
+
private fileUploadFileHandler;
|
|
550
|
+
createPasteRules(): PasteRule[];
|
|
551
|
+
createInputRules(): InputRule[];
|
|
552
|
+
fromMarkdown(): readonly [{
|
|
553
|
+
readonly type: ParserRuleType.inline;
|
|
554
|
+
readonly token: "md_image";
|
|
555
|
+
readonly node: "md_image";
|
|
556
|
+
}];
|
|
557
|
+
toMarkdown({ state, node }: NodeSerializerOptions): void;
|
|
558
|
+
}
|
|
559
|
+
type ImageAttributes$1 = ProsemirrorAttributes<ImageExtensionAttributes$1>;
|
|
560
|
+
interface ImageExtensionAttributes$1 {
|
|
561
|
+
align?: 'center' | 'end' | 'justify' | 'left' | 'match-parent' | 'right' | 'start';
|
|
562
|
+
alt?: string;
|
|
563
|
+
height?: string | number;
|
|
564
|
+
width?: string | number;
|
|
565
|
+
rotate?: string;
|
|
566
|
+
src: string;
|
|
567
|
+
title?: string;
|
|
568
|
+
/** The file name used to create the image. */
|
|
569
|
+
'data-file-name'?: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
type DelayedImage = DelayedPromiseCreator<ImageAttributes>;
|
|
573
|
+
interface ImageOptions {
|
|
574
|
+
createPlaceholder?: (view: EditorView$2, pos: number) => HTMLElement;
|
|
575
|
+
updatePlaceholder?: (view: EditorView$2, pos: number, element: HTMLElement, progress: number) => void;
|
|
576
|
+
handleViewImgSrcUrl?: ExtensionsOptions['handleViewImgSrcUrl'];
|
|
577
|
+
imagePasteHandler?: ExtensionsOptions['imagePasteHandler'];
|
|
578
|
+
destroyPlaceholder?: (view: EditorView$2, element: HTMLElement) => void;
|
|
579
|
+
/**
|
|
580
|
+
* The upload handler for the image extension.
|
|
581
|
+
*
|
|
582
|
+
* It receives a list of dropped or pasted files and returns a promise for the
|
|
583
|
+
* attributes which should be used to insert the image into the editor.
|
|
584
|
+
*
|
|
585
|
+
* @param files - a list of files to upload.
|
|
586
|
+
* @param setProgress - the progress handler.
|
|
587
|
+
*/
|
|
588
|
+
uploadHandler?: (files: FileWithProgress[]) => DelayedImage[];
|
|
589
|
+
/**
|
|
590
|
+
* The image hosting service upload handler.
|
|
591
|
+
* It receives the image src and returns a promise for the new src after uploading to image hosting service.
|
|
592
|
+
*
|
|
593
|
+
* @param src - the original image src
|
|
594
|
+
* @returns Promise<string> - the new image src after uploading
|
|
595
|
+
*/
|
|
596
|
+
imageHostingHandler?: (src: string) => Promise<string>;
|
|
597
|
+
/**
|
|
598
|
+
* When pasting mixed text and image content (usually from Microsoft Office products) the content on the clipboard is either:
|
|
599
|
+
*
|
|
600
|
+
* a. one large image: containing effectively a screenshot of the original content (an image with text in it).
|
|
601
|
+
* b. HTML content: containing usable text, but images with file protocol URLs (which cannot be resolved due to browser security restrictions).
|
|
602
|
+
*
|
|
603
|
+
* If true, this will extract the text from the clipboard data, and drop the images.
|
|
604
|
+
* If false, the "screenshot" image will be used and the text will be dropped.
|
|
605
|
+
*
|
|
606
|
+
* @defaultValue true
|
|
607
|
+
*/
|
|
608
|
+
preferPastedTextContent?: boolean;
|
|
609
|
+
}
|
|
610
|
+
interface FileWithProgress {
|
|
611
|
+
file: File;
|
|
612
|
+
progress: SetProgress;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Set the progress.
|
|
616
|
+
*
|
|
617
|
+
* @param progress - a value between `0` and `1`.
|
|
618
|
+
*/
|
|
619
|
+
type SetProgress = (progress: number) => void;
|
|
620
|
+
/**
|
|
621
|
+
* The image extension for placing images into your editor.
|
|
622
|
+
*
|
|
623
|
+
* TODO ->
|
|
624
|
+
* - Captions https://glitch.com/edit/#!/pet-figcaption?path=index.js%3A27%3A1 into a preset
|
|
625
|
+
*
|
|
626
|
+
* TODO => Split this into an image upload extension and image extension.
|
|
627
|
+
* - Add a base64 image
|
|
628
|
+
*/
|
|
629
|
+
declare class HtmlImageExtension extends NodeExtension<ImageOptions> {
|
|
630
|
+
get name(): "html_image";
|
|
631
|
+
ReactComponent: ComponentType<ImageNodeViewProps> | undefined;
|
|
632
|
+
createTags(): ("inline" | "media")[];
|
|
633
|
+
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
|
|
634
|
+
insertImage(attributes: ImageAttributes, selection?: PrimitiveSelection): CommandFunction;
|
|
635
|
+
createInputRules(): InputRule$1[];
|
|
636
|
+
fromMarkdown(): readonly [{
|
|
637
|
+
readonly type: ParserRuleType.inline;
|
|
638
|
+
readonly token: "html_image";
|
|
639
|
+
readonly node: "html_image";
|
|
640
|
+
}];
|
|
641
|
+
toMarkdown({ state, node }: NodeSerializerOptions): void;
|
|
642
|
+
}
|
|
643
|
+
type ImageAttributes = ProsemirrorAttributes<ImageExtensionAttributes>;
|
|
644
|
+
interface ImageExtensionAttributes {
|
|
645
|
+
align?: 'center' | 'end' | 'justify' | 'left' | 'match-parent' | 'right' | 'start';
|
|
646
|
+
alt?: string;
|
|
647
|
+
height?: string | number;
|
|
648
|
+
width?: string | number;
|
|
649
|
+
rotate?: string;
|
|
650
|
+
src: string;
|
|
651
|
+
title?: string;
|
|
652
|
+
/** The file name used to create the image. */
|
|
653
|
+
'data-file-name'?: string;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* True when the provided file is an image file.
|
|
657
|
+
*/
|
|
658
|
+
declare function isImageFileType(file: File): boolean;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* @public @group Schema
|
|
662
|
+
*/
|
|
663
|
+
interface ListAttributes {
|
|
664
|
+
kind?: string;
|
|
665
|
+
order?: number | null;
|
|
666
|
+
checked?: boolean;
|
|
667
|
+
collapsed?: boolean;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
declare abstract class MarkdownNodeExtension {
|
|
671
|
+
abstract fromMarkdown: () => readonly ParserRule[];
|
|
672
|
+
abstract toMarkdown: NodeSerializerSpec;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* A Remirror extension for creating lists. It's a simple wrapper around the API from `prosemirror-flat-list`.
|
|
677
|
+
*
|
|
678
|
+
* @public
|
|
679
|
+
*/
|
|
680
|
+
declare class LineListExtension extends NodeExtension {
|
|
681
|
+
static disableExtraAttributes: boolean;
|
|
682
|
+
get name(): "list";
|
|
683
|
+
createInputRules(): InputRule$1[];
|
|
684
|
+
createTags(): "block"[];
|
|
685
|
+
createNodeSpec(): NodeExtensionSpec;
|
|
686
|
+
createKeymap(): KeyBindings;
|
|
687
|
+
createExternalPlugins(): ProsemirrorPlugin[];
|
|
688
|
+
createCommands(): {
|
|
689
|
+
readonly indentList: (props?: IndentListOptions) => _rme_sdk_core.CommandFunction<object>;
|
|
690
|
+
readonly dedentList: (props?: DedentListOptions) => _rme_sdk_core.CommandFunction<object>;
|
|
691
|
+
readonly unwrapList: (options?: UnwrapListOptions) => _rme_sdk_core.CommandFunction<object>;
|
|
692
|
+
readonly wrapInList: (getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)) => _rme_sdk_core.CommandFunction<object>;
|
|
693
|
+
readonly moveList: (direction: 'up' | 'down') => _rme_sdk_core.CommandFunction<object>;
|
|
694
|
+
readonly splitList: () => _rme_sdk_core.CommandFunction<object>;
|
|
695
|
+
readonly protectCollapsed: () => _rme_sdk_core.CommandFunction<object>;
|
|
696
|
+
readonly toggleCollapsed: (props?: ToggleCollapsedOptions) => _rme_sdk_core.CommandFunction<object>;
|
|
697
|
+
readonly toggleList: (attrs: ListAttributes) => _rme_sdk_core.CommandFunction<object>;
|
|
698
|
+
};
|
|
699
|
+
fromMarkdown(): readonly [{
|
|
700
|
+
readonly type: ParserRuleType.free;
|
|
701
|
+
readonly token: "list_item_open";
|
|
702
|
+
readonly handler: (state: MarkdownParseState, token: Token) => void;
|
|
703
|
+
}, {
|
|
704
|
+
readonly type: ParserRuleType.free;
|
|
705
|
+
readonly token: "list_checkbox";
|
|
706
|
+
readonly handler: (state: MarkdownParseState, tok: Token) => void;
|
|
707
|
+
}, {
|
|
708
|
+
readonly type: ParserRuleType.free;
|
|
709
|
+
readonly token: "list_item_close";
|
|
710
|
+
readonly handler: (state: MarkdownParseState) => void;
|
|
711
|
+
}, {
|
|
712
|
+
readonly type: ParserRuleType.context;
|
|
713
|
+
readonly token: "bullet_list";
|
|
714
|
+
readonly context: "bullet_list";
|
|
715
|
+
}, {
|
|
716
|
+
readonly type: ParserRuleType.context;
|
|
717
|
+
readonly token: "ordered_list";
|
|
718
|
+
readonly context: "ordered_list";
|
|
719
|
+
}];
|
|
720
|
+
toMarkdown({ state, node, counter }: NodeSerializerOptions): void;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Wrap the giving command function so that it always returns `true`. This is
|
|
724
|
+
* useful when we want pressing `Tab` and `Shift-Tab` won't blur the editor even
|
|
725
|
+
* if the keybinding command returns `false`
|
|
726
|
+
*
|
|
727
|
+
* @public
|
|
728
|
+
*/
|
|
729
|
+
declare function alwaysTrue<T extends unknown[]>(func: (...args: T) => boolean): (...args: T) => boolean;
|
|
730
|
+
declare function isOrderedListNode(node: ProsemirrorNode$1): boolean;
|
|
731
|
+
|
|
384
732
|
type ExtensionsOptions = {
|
|
385
733
|
disableAllBuildInShortcuts?: boolean;
|
|
386
734
|
handleViewImgSrcUrl?: (src: string) => Promise<string>;
|
|
387
735
|
imageHostingHandler?: (src: string) => Promise<string>;
|
|
388
|
-
|
|
736
|
+
imagePasteHandler?: (src: string) => Promise<string>;
|
|
389
737
|
ai?: AIOptions;
|
|
390
738
|
customCopyFunction?: CustomCopyFunction;
|
|
391
739
|
overrideShortcutMap?: Record<string, string>;
|
|
740
|
+
clipboardReadFunction?: ClipboardReadFunction;
|
|
741
|
+
codemirrorOptions?: CodemirrorOptions;
|
|
742
|
+
uploadImageHandler?: (files: FileWithProgress$1[]) => DelayedImage$1[];
|
|
392
743
|
};
|
|
393
744
|
declare function extensions(options: ExtensionsOptions): any[];
|
|
394
745
|
|
|
@@ -495,6 +846,7 @@ declare const darkTheme: {
|
|
|
495
846
|
contextMenuBgColorHover: string;
|
|
496
847
|
slashMenuBorderColor: string;
|
|
497
848
|
editorToolbarBgColor: string;
|
|
849
|
+
selectionMatchBgColor: string;
|
|
498
850
|
lineHeightBase: string;
|
|
499
851
|
titleBarHeight: string;
|
|
500
852
|
titleBarControlBtnWidth: string;
|
|
@@ -562,6 +914,7 @@ declare const lightTheme: {
|
|
|
562
914
|
contextMenuBgColorHover: string;
|
|
563
915
|
slashMenuBorderColor: string;
|
|
564
916
|
editorToolbarBgColor: string;
|
|
917
|
+
selectionMatchBgColor: string;
|
|
565
918
|
lineHeightBase: string;
|
|
566
919
|
titleBarHeight: string;
|
|
567
920
|
titleBarControlBtnWidth: string;
|
|
@@ -615,5 +968,5 @@ type WysiwygToolbarProps = {
|
|
|
615
968
|
};
|
|
616
969
|
declare const WysiwygToolbar: FC<WysiwygToolbarProps>;
|
|
617
970
|
|
|
618
|
-
export { CommandButton, CommandButtonIcon, Editor, extensions as EditorExtensions, EditorViewType, MfCodemirrorView, Preview, SourceCodeThemeWrapper, _default$1 as SourceEditor, ThemeProvider, _default as WysiwygEditor, WysiwygThemeWrapper, WysiwygToolbar, buildMarkdownParser, buildMarkdownSerializer, changeTheme, common, computeChange, createSourceCodeDelegate, createSourceCodeManager, createWysiwygDelegate, darkTheme, defaultStyleToken, extractMatches, getLanguageMap, lightTheme, loadLanguage, tableSelectorSize };
|
|
619
|
-
export type { CommandButtonIconProps, CommandButtonProps, CreateCodemirrorOptions, CreateWysiwygDelegateOptions, DocToString, EditorChangeEventParams, EditorChangeHandler, EditorContext, EditorDelegate, EditorProps, EditorRef, EditorState, HTMLAstNode, Note, StringToDoc, WysiwygToolbarProps };
|
|
971
|
+
export { CommandButton, CommandButtonIcon, Editor, extensions as EditorExtensions, EditorViewType, HtmlImageExtension, LineListExtension, MarkdownNodeExtension, MdImgUriExtension, MfCodemirrorView, Preview, SourceCodeThemeWrapper, _default$1 as SourceEditor, ThemeProvider, _default as WysiwygEditor, WysiwygThemeWrapper, WysiwygToolbar, alwaysTrue, buildMarkdownParser, buildMarkdownSerializer, changeTheme, common, computeChange, createSourceCodeDelegate, createSourceCodeManager, createWysiwygDelegate, darkTheme, defaultStyleToken, extractMatches, getLanguageMap, isImageFileType, isOrderedListNode, lightTheme, loadLanguage, tableSelectorSize, updateCodemirrorSearchQuery, updateCodemirrorSearchState };
|
|
972
|
+
export type { CommandButtonIconProps, CommandButtonProps, CreateCodemirrorOptions, CreateWysiwygDelegateOptions, DelayedImage$1 as DelayedImage, DocToString, EditorChangeEventParams, EditorChangeHandler, EditorContext, EditorDelegate, EditorProps, EditorRef, EditorState, ExtensionsOptions, FileWithProgress$1 as FileWithProgress, HTMLAstNode, ImageAttributes, ImageExtensionAttributes, ImageOptions, Note, StringToDoc, WysiwygToolbarProps };
|