@dxos/react-ui-editor 0.3.9-main.3fcc0fa → 0.3.9-main.4584ca9
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/lib/browser/index.mjs +310 -35
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/automerge/automerge-plugin/index.d.ts +1 -1
- package/dist/types/src/automerge/automerge-plugin/index.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/components/Editor/Editor.stories.d.ts +3 -2
- package/dist/types/src/components/Editor/Editor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Markdown.d.ts +2 -1
- package/dist/types/src/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Markdown.stories.d.ts +2 -1
- package/dist/types/src/components/Markdown/Markdown.stories.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/markdownTheme.d.ts +2 -16
- package/dist/types/src/components/Markdown/markdownTheme.d.ts.map +1 -1
- package/dist/types/src/components/RichText/RichText.stories.d.ts +2 -1
- package/dist/types/src/components/RichText/RichText.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +39 -0
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +32 -0
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink.d.ts +10 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlink.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkTooltip.d.ts +9 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkTooltip.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TextEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/index.d.ts +6 -0
- package/dist/types/src/components/TextEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/theme.d.ts +8 -0
- package/dist/types/src/components/TextEditor/theme.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/testing/replicator.d.ts.map +1 -1
- package/package.json +21 -17
- package/src/automerge/automerge-plugin/index.ts +1 -1
- package/src/automerge/automerge.stories.tsx +1 -2
- package/src/components/Editor/Editor.stories.tsx +4 -2
- package/src/components/Editor/Editor.tsx +2 -2
- package/src/components/Markdown/Markdown.stories.tsx +3 -0
- package/src/components/Markdown/Markdown.tsx +17 -9
- package/src/components/Markdown/markdownTheme.ts +20 -16
- package/src/components/RichText/RichText.stories.tsx +2 -0
- package/src/components/TextEditor/TextEditor.stories.tsx +83 -0
- package/src/components/TextEditor/TextEditor.tsx +130 -0
- package/src/components/TextEditor/extensions/hyperlink.tsx +108 -0
- package/src/components/TextEditor/extensions/hyperlinkTooltip.tsx +76 -0
- package/src/components/TextEditor/extensions/index.ts +6 -0
- package/src/components/TextEditor/index.ts +11 -0
- package/src/components/TextEditor/theme.ts +33 -0
- package/src/components/index.ts +1 -0
- package/src/testing/replicator.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownTheme.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/markdownTheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,eAAO,MAAM,MAAM,YAAY,CAAC;AAIhC,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"markdownTheme.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/markdownTheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,KAAK,YAAY,CAAC;AAC/B,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,IAAI,YAAY,CAAC;AAC9B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,eAAO,MAAM,MAAM,YAAY,CAAC;AAIhC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IzB,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBA6EpC,CAAC"}
|
|
@@ -9,6 +9,7 @@ declare const _default: {
|
|
|
9
9
|
} & {
|
|
10
10
|
slots?: import("../..").EditorSlots | undefined;
|
|
11
11
|
} & React.RefAttributes<import("@tiptap/react").Editor | null>>;
|
|
12
|
+
decorators: import("@storybook/react").Decorator[];
|
|
12
13
|
};
|
|
13
14
|
export default _default;
|
|
14
15
|
export declare const Default: {
|
|
@@ -21,6 +22,6 @@ export declare const Default: {
|
|
|
21
22
|
};
|
|
22
23
|
export declare const WithYjs: {
|
|
23
24
|
render: (args: Omit<RichTextEditorProps, 'model'>) => JSX.Element;
|
|
24
|
-
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-
|
|
25
|
+
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0fc72a6d").R, any>[];
|
|
25
26
|
};
|
|
26
27
|
//# sourceMappingURL=RichText.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichText.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/RichText/RichText.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RichText.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/RichText/RichText.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;AASxC,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;;;;;;;;;;;AAGtE,wBAGE;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAGF,eAAO,MAAM,OAAO;mBACH,KAAK,mBAAmB,EAAE,OAAO,CAAC;;CAmClD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EditorState, type Extension } from '@codemirror/state';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
3
|
+
import React, { type KeyboardEvent, type HTMLAttributes } from 'react';
|
|
4
|
+
import { type StyleSpec } from 'style-mod';
|
|
5
|
+
import { type EditorModel, type EditorSlots } from '../../model';
|
|
6
|
+
export type CursorInfo = {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
line: number;
|
|
10
|
+
lines: number;
|
|
11
|
+
after?: string;
|
|
12
|
+
};
|
|
13
|
+
export type TextEditorRef = {
|
|
14
|
+
editor: HTMLDivElement | null;
|
|
15
|
+
state?: EditorState;
|
|
16
|
+
view?: EditorView;
|
|
17
|
+
};
|
|
18
|
+
export type TextEditorProps = {
|
|
19
|
+
model?: EditorModel;
|
|
20
|
+
extensions?: Extension[];
|
|
21
|
+
theme?: {
|
|
22
|
+
[selector: string]: StyleSpec;
|
|
23
|
+
};
|
|
24
|
+
slots?: EditorSlots;
|
|
25
|
+
onKeyDown?: (event: KeyboardEvent, info: CursorInfo) => void;
|
|
26
|
+
} & Pick<HTMLAttributes<HTMLDivElement>, 'onBlur' | 'onFocus'>;
|
|
27
|
+
/**
|
|
28
|
+
* Simple text editor.
|
|
29
|
+
*/
|
|
30
|
+
export declare const TextEditor: React.ForwardRefExoticComponent<{
|
|
31
|
+
model?: EditorModel | undefined;
|
|
32
|
+
extensions?: Extension[] | undefined;
|
|
33
|
+
theme?: {
|
|
34
|
+
[selector: string]: StyleSpec;
|
|
35
|
+
} | undefined;
|
|
36
|
+
slots?: EditorSlots | undefined;
|
|
37
|
+
onKeyDown?: ((event: KeyboardEvent, info: CursorInfo) => void) | undefined;
|
|
38
|
+
} & Pick<React.HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur"> & React.RefAttributes<TextEditorRef>>;
|
|
39
|
+
//# sourceMappingURL=TextEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAMlB,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE;QACN,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;KAC/B,CAAC;IACF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CAC9D,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;yBAND,aAAa,QAAQ,UAAU,KAAK,IAAI;0GAiF7D,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import '@dxosTheme';
|
|
2
|
+
import { HighlightStyle, StreamLanguage } from '@codemirror/language';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export declare const nameRegex: RegExp;
|
|
5
|
+
/**
|
|
6
|
+
* Simple Monaco language extension.
|
|
7
|
+
* https://github.com/codemirror/stream-parser/blob/main/test/test-stream-parser.ts
|
|
8
|
+
*/
|
|
9
|
+
export declare const promptLanguage: StreamLanguage<{
|
|
10
|
+
count: number;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* https://codemirror.net/examples/styling
|
|
14
|
+
* https://lezer.codemirror.net/docs/ref/#highlight
|
|
15
|
+
*/
|
|
16
|
+
export declare const promptHighlightStyles: HighlightStyle;
|
|
17
|
+
declare const _default: {
|
|
18
|
+
component: React.ForwardRefExoticComponent<{
|
|
19
|
+
model?: import("../../model").EditorModel | undefined;
|
|
20
|
+
extensions?: import("@codemirror/state").Extension[] | undefined;
|
|
21
|
+
theme?: {
|
|
22
|
+
[selector: string]: import("style-mod").StyleSpec;
|
|
23
|
+
} | undefined;
|
|
24
|
+
slots?: import("../../model").EditorSlots | undefined;
|
|
25
|
+
onKeyDown?: ((event: React.KeyboardEvent<Element>, info: import("./TextEditor").CursorInfo) => void) | undefined;
|
|
26
|
+
} & Pick<React.HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur"> & React.RefAttributes<import("./TextEditor").TextEditorRef>>;
|
|
27
|
+
decorators: import("@storybook/react").Decorator[];
|
|
28
|
+
render: () => JSX.Element;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
31
|
+
export declare const Default: {};
|
|
32
|
+
//# sourceMappingURL=TextEditor.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,eAAO,MAAM,SAAS,QAAgB,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,cAAc;WAAkC,MAAM;EAcjE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,gBAShC,CAAC;;;;;;;;;;;;;;AAuBH,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Extension } from '@codemirror/state';
|
|
2
|
+
import { type DecorationSet, MatchDecorator, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
|
3
|
+
export declare function hyperLinkExtension(): ViewPlugin<{
|
|
4
|
+
readonly decorator: MatchDecorator;
|
|
5
|
+
decorations: DecorationSet;
|
|
6
|
+
update(update: ViewUpdate): void;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const hyperLinkStyle: Extension;
|
|
9
|
+
export declare const hyperlink: Extension;
|
|
10
|
+
//# sourceMappingURL=hyperlink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlink.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlink.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAEL,KAAK,aAAa,EAElB,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AA4C1B,wBAAgB,kBAAkB;wBAGR,cAAc;;mBAOnB,UAAU;GAwB9B;AAED,eAAO,MAAM,cAAc,WAYzB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,SAAkD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type OnHyperlinkHover = (el: Element, url: string) => void;
|
|
2
|
+
/**
|
|
3
|
+
* https://codemirror.net/examples/tooltip
|
|
4
|
+
* https://codemirror.net/docs/ref/#view.hoverTooltip
|
|
5
|
+
* https://github.com/codemirror/view/blob/main/src/tooltip.ts
|
|
6
|
+
*/
|
|
7
|
+
export declare const createHyperlinkTooltip: (onHover: OnHyperlinkHover, regexp?: RegExp) => import("@codemirror/state").Extension;
|
|
8
|
+
export declare const defaultHyperLinkTooltip: import("@codemirror/state").Extension;
|
|
9
|
+
//# sourceMappingURL=hyperlinkTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlinkTooltip.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlinkTooltip.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,YAAa,gBAAgB,2DA0C5D,CAAC;AAGL,eAAO,MAAM,uBAAuB,uCAUlC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,cAAc,cAAc,CAAC;AAE7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/theme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C;;GAEG;AAEH,eAAO,MAAM,aAAa,EAAE;IAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAgB/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replicator.d.ts","sourceRoot":"","sources":["../../../../src/testing/replicator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAEtE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,KAAK,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;AAM7C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,GAAG,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAClD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAM;gBAEf,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,GAAG,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,CAAA;KAAE;IA+BtG,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,YAAY;IA0CpB,OAAO,CAAC,mBAAmB;CAG5B;AAED;;GAEG;AACH,qBAAa,UAAU;IAIT,OAAO,CAAC,QAAQ,CAAC,KAAK;IAHlC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,MAAM,CAAqB;gBAEN,KAAK,EAAE,QAAQ;IAE5C,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE;IAI7B,UAAU,OAAQ,MAAM,QAAO,GAAG,KAAe,WAAW,CAmB1D;CACH;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,WAAW,4BAA6B,kBAAkB,KAAG,
|
|
1
|
+
{"version":3,"file":"replicator.d.ts","sourceRoot":"","sources":["../../../../src/testing/replicator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAEtE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,KAAK,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;AAM7C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,GAAG,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAClD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAM;gBAEf,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,GAAG,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,CAAA;KAAE;IA+BtG,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,YAAY;IA0CpB,OAAO,CAAC,mBAAmB;CAG5B;AAED;;GAEG;AACH,qBAAa,UAAU;IAIT,OAAO,CAAC,QAAQ,CAAC,KAAK;IAHlC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,MAAM,CAAqB;gBAEN,KAAK,EAAE,QAAQ;IAE5C,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE;IAI7B,UAAU,OAAQ,MAAM,QAAO,GAAG,KAAe,WAAW,CAmB1D;CACH;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,WAAW,4BAA6B,kBAAkB,KAAG,WAGzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-editor",
|
|
3
|
-
"version": "0.3.9-main.
|
|
3
|
+
"version": "0.3.9-main.4584ca9",
|
|
4
4
|
"description": "Document editing experience within a DXOS shell.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@lezer/common": "^1.1.1",
|
|
28
28
|
"@lezer/highlight": "^1.2.0",
|
|
29
29
|
"@lezer/markdown": "^1.1.1",
|
|
30
|
+
"@phosphor-icons/react": "^2.0.5",
|
|
30
31
|
"@replit/codemirror-vim": "^6.0.14",
|
|
31
32
|
"@tiptap/core": "2.0.0-beta.220",
|
|
32
33
|
"@tiptap/extension-collaboration": "2.0.0-beta.220",
|
|
@@ -43,19 +44,20 @@
|
|
|
43
44
|
"prosemirror-model": "^1.19.0",
|
|
44
45
|
"prosemirror-state": "^1.4.2",
|
|
45
46
|
"prosemirror-view": "^1.30.1",
|
|
47
|
+
"style-mod": "^4.1.0",
|
|
46
48
|
"y-codemirror.next": "^0.3.2",
|
|
47
49
|
"y-prosemirror": "~1.0.20",
|
|
48
50
|
"y-protocols": "^1.0.5",
|
|
49
|
-
"yjs": "^13.6.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/react-
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/util": "0.3.9-main.
|
|
51
|
+
"yjs": "^13.6.10",
|
|
52
|
+
"@dxos/debug": "0.3.9-main.4584ca9",
|
|
53
|
+
"@dxos/display-name": "0.3.9-main.4584ca9",
|
|
54
|
+
"@dxos/react-ui": "0.3.9-main.4584ca9",
|
|
55
|
+
"@dxos/log": "0.3.9-main.4584ca9",
|
|
56
|
+
"@dxos/protocols": "0.3.9-main.4584ca9",
|
|
57
|
+
"@dxos/react-async": "0.3.9-main.4584ca9",
|
|
58
|
+
"@dxos/react-ui-theme": "0.3.9-main.4584ca9",
|
|
59
|
+
"@dxos/text-model": "0.3.9-main.4584ca9",
|
|
60
|
+
"@dxos/util": "0.3.9-main.4584ca9"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@codemirror/basic-setup": "^0.20.0",
|
|
@@ -65,16 +67,18 @@
|
|
|
65
67
|
"@types/react-dom": "^18.0.6",
|
|
66
68
|
"react": "^18.2.0",
|
|
67
69
|
"react-dom": "^18.2.0",
|
|
68
|
-
"@dxos/config": "0.3.9-main.
|
|
69
|
-
"@dxos/automerge": "0.3.9-main.
|
|
70
|
-
"@dxos/echo-schema": "0.3.9-main.
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
70
|
+
"@dxos/config": "0.3.9-main.4584ca9",
|
|
71
|
+
"@dxos/automerge": "0.3.9-main.4584ca9",
|
|
72
|
+
"@dxos/echo-schema": "0.3.9-main.4584ca9",
|
|
73
|
+
"@dxos/echo-typegen": "0.3.9-main.4584ca9",
|
|
74
|
+
"@dxos/react-client": "0.3.9-main.4584ca9",
|
|
75
|
+
"@dxos/storybook-utils": "0.3.9-main.4584ca9"
|
|
73
76
|
},
|
|
74
77
|
"peerDependencies": {
|
|
78
|
+
"@phosphor-icons/react": "^2.0.5",
|
|
75
79
|
"react": "^18.2.0",
|
|
76
80
|
"react-dom": "^18.2.0",
|
|
77
|
-
"@dxos/react-client": "0.3.9-main.
|
|
81
|
+
"@dxos/react-client": "0.3.9-main.4584ca9"
|
|
78
82
|
},
|
|
79
83
|
"publishConfig": {
|
|
80
84
|
"access": "public"
|
|
@@ -8,8 +8,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { type Prop, next as automerge } from '@dxos/automerge/automerge';
|
|
10
10
|
|
|
11
|
-
import { plugin as amgPlugin } from './automerge-plugin';
|
|
12
|
-
import { reconcile } from './automerge-plugin/plugin';
|
|
11
|
+
import { plugin as amgPlugin, reconcile } from './automerge-plugin';
|
|
13
12
|
import { Peer } from './demo';
|
|
14
13
|
|
|
15
14
|
type EditorProps = {
|
|
@@ -11,15 +11,17 @@ import { TextObject, TextKind, useQuery, useSpace } from '@dxos/react-client/ech
|
|
|
11
11
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
12
12
|
import { ClientDecorator, setupPeersInSpace, textGenerator, useDataGenerator } from '@dxos/react-client/testing';
|
|
13
13
|
import { useId } from '@dxos/react-ui';
|
|
14
|
+
import { withTheme } from '@dxos/storybook-utils';
|
|
14
15
|
|
|
15
16
|
import { Editor, type EditorProps } from './Editor';
|
|
16
17
|
import { EditorDocument, types as schema } from '../../testing';
|
|
17
18
|
|
|
18
19
|
export default {
|
|
19
20
|
component: Editor,
|
|
21
|
+
decorators: [withTheme],
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
const Story = ({ spaceKey, ...
|
|
24
|
+
const Story = ({ spaceKey, ...params }: Pick<EditorProps, 'slots'> & { spaceKey: PublicKey }) => {
|
|
23
25
|
const [generate, setGenerate] = useState(false);
|
|
24
26
|
const generateId = useId('generate');
|
|
25
27
|
|
|
@@ -39,7 +41,7 @@ const Story = ({ spaceKey, ...args }: Pick<EditorProps, 'slots'> & { spaceKey: P
|
|
|
39
41
|
Generate Data
|
|
40
42
|
</div>
|
|
41
43
|
{document?.content.toString().length}
|
|
42
|
-
<Editor identity={identity} space={space} text={document?.content} {...
|
|
44
|
+
<Editor identity={identity} space={space} text={document?.content} {...params} />
|
|
43
45
|
</main>
|
|
44
46
|
);
|
|
45
47
|
};
|
|
@@ -22,8 +22,8 @@ export type EditorProps = UseTextModelOptions & {
|
|
|
22
22
|
// NOTE: Without `memo`, if parent component uses `observer` the editor re-renders excessively.
|
|
23
23
|
// TODO(wittjosiah): Factor out?
|
|
24
24
|
export const Editor = memo(
|
|
25
|
-
forwardRef<TipTapEditor | MarkdownEditorRef, EditorProps>(({ slots, ...
|
|
26
|
-
const model = useTextModel(
|
|
25
|
+
forwardRef<TipTapEditor | MarkdownEditorRef, EditorProps>(({ slots, ...params }, forwardedRef) => {
|
|
26
|
+
const model = useTextModel(params);
|
|
27
27
|
if (model?.content instanceof YXmlFragment) {
|
|
28
28
|
return <RichTextEditor ref={forwardedRef as Ref<TipTapEditor>} model={model} slots={slots} />;
|
|
29
29
|
} else {
|
|
@@ -10,12 +10,14 @@ import { PublicKey } from '@dxos/react-client';
|
|
|
10
10
|
import { TextKind } from '@dxos/react-client/echo';
|
|
11
11
|
import { ClientDecorator, textGenerator, useDataGenerator } from '@dxos/react-client/testing';
|
|
12
12
|
import { useId } from '@dxos/react-ui';
|
|
13
|
+
import { withTheme } from '@dxos/storybook-utils';
|
|
13
14
|
|
|
14
15
|
import { MarkdownEditor } from './Markdown';
|
|
15
16
|
import { Replicator, useYjsModel } from '../../testing';
|
|
16
17
|
|
|
17
18
|
export default {
|
|
18
19
|
component: MarkdownEditor,
|
|
20
|
+
decorators: [withTheme],
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const Default = {
|
|
@@ -28,6 +30,7 @@ export const Default = {
|
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
const replicator = new Replicator(TextKind.PLAIN);
|
|
33
|
+
|
|
31
34
|
export const WithYjs = {
|
|
32
35
|
render: () => {
|
|
33
36
|
const [generate, setGenerate] = useState(false);
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { languages } from '@codemirror/language-data';
|
|
16
16
|
import { lintKeymap } from '@codemirror/lint';
|
|
17
17
|
import { searchKeymap, highlightSelectionMatches } from '@codemirror/search';
|
|
18
|
-
import { EditorState, StateField, type Text } from '@codemirror/state';
|
|
18
|
+
import { EditorState, type Extension, StateField, type Text } from '@codemirror/state';
|
|
19
19
|
import { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';
|
|
20
20
|
import {
|
|
21
21
|
keymap,
|
|
@@ -58,6 +58,7 @@ export type MarkdownEditorProps = {
|
|
|
58
58
|
model?: EditorModel;
|
|
59
59
|
slots?: EditorSlots;
|
|
60
60
|
editorMode?: EditorMode;
|
|
61
|
+
extensions?: Extension[];
|
|
61
62
|
onChange?: (content: string | Text) => void;
|
|
62
63
|
};
|
|
63
64
|
|
|
@@ -68,7 +69,7 @@ export type MarkdownEditorRef = {
|
|
|
68
69
|
};
|
|
69
70
|
|
|
70
71
|
export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>(
|
|
71
|
-
({ model, slots = {},
|
|
72
|
+
({ model, slots = {}, editorMode, extensions = [], onChange }, forwardedRef) => {
|
|
72
73
|
const { id, content, provider, peer } = model ?? {};
|
|
73
74
|
const { themeMode } = useThemeContext();
|
|
74
75
|
const tabsterDOMAttribute = useFocusableGroup({ tabBehavior: 'limited' });
|
|
@@ -148,7 +149,8 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
|
|
|
148
149
|
indentWithTab,
|
|
149
150
|
]),
|
|
150
151
|
EditorView.lineWrapping,
|
|
151
|
-
|
|
152
|
+
|
|
153
|
+
// Themes.
|
|
152
154
|
markdown({ base: markdownLanguage, codeLanguages: languages, extensions: [markdownTagsExtension] }),
|
|
153
155
|
EditorView.theme({ ...markdownTheme, ...slots.editor?.markdownTheme }),
|
|
154
156
|
...(themeMode === 'dark'
|
|
@@ -157,8 +159,11 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
|
|
|
157
159
|
// TODO(thure): All but one rule here apply to both themes; rename or refactor.
|
|
158
160
|
syntaxHighlighting(markdownDarkHighlighting),
|
|
159
161
|
|
|
160
|
-
//
|
|
162
|
+
// Replication and awareness (incl. remote selection).
|
|
161
163
|
...(content instanceof YText ? [yCollab(content, provider?.awareness)] : []),
|
|
164
|
+
|
|
165
|
+
// Custom.
|
|
166
|
+
...extensions,
|
|
162
167
|
],
|
|
163
168
|
});
|
|
164
169
|
|
|
@@ -178,15 +183,18 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
|
|
|
178
183
|
}, [parent, content, provider?.awareness, themeMode, editorMode]);
|
|
179
184
|
|
|
180
185
|
const handleKeyUp = useCallback(
|
|
181
|
-
(
|
|
186
|
+
(event: KeyboardEvent) => {
|
|
187
|
+
const { key, altKey, shiftKey, metaKey, ctrlKey } = event;
|
|
182
188
|
switch (key) {
|
|
183
|
-
case 'Enter':
|
|
189
|
+
case 'Enter': {
|
|
184
190
|
view?.contentDOM.focus();
|
|
185
191
|
break;
|
|
192
|
+
}
|
|
186
193
|
|
|
187
|
-
case 'Escape':
|
|
194
|
+
case 'Escape': {
|
|
188
195
|
editorMode === 'vim' && (altKey || shiftKey || metaKey || ctrlKey) && parent?.focus();
|
|
189
196
|
break;
|
|
197
|
+
}
|
|
190
198
|
}
|
|
191
199
|
},
|
|
192
200
|
[view, editorMode],
|
|
@@ -195,11 +203,11 @@ export const MarkdownEditor = forwardRef<MarkdownEditorRef, MarkdownEditorProps>
|
|
|
195
203
|
return (
|
|
196
204
|
<div
|
|
197
205
|
tabIndex={0}
|
|
206
|
+
ref={setParent}
|
|
198
207
|
key={id}
|
|
199
208
|
{...slots.root}
|
|
200
|
-
onKeyUp={handleKeyUp}
|
|
201
209
|
{...(editorMode !== 'vim' ? tabsterDOMAttribute : {})}
|
|
202
|
-
|
|
210
|
+
onKeyUp={handleKeyUp}
|
|
203
211
|
/>
|
|
204
212
|
);
|
|
205
213
|
},
|
|
@@ -71,24 +71,28 @@ export const markdownTheme = {
|
|
|
71
71
|
// color: '#ddd'
|
|
72
72
|
// },
|
|
73
73
|
|
|
74
|
-
'.
|
|
74
|
+
'.cm-tooltip': {
|
|
75
|
+
backgroundColor: 'transparent',
|
|
75
76
|
border: 'none',
|
|
76
|
-
backgroundColor: tooltipBackground,
|
|
77
|
-
},
|
|
78
|
-
'.dark & .cm-tooltip .cm-tooltip-arrow:before': {
|
|
79
|
-
borderTopColor: 'transparent',
|
|
80
|
-
borderBottomColor: 'transparent',
|
|
81
|
-
},
|
|
82
|
-
'.dark & .cm-tooltip .cm-tooltip-arrow:after': {
|
|
83
|
-
borderTopColor: tooltipBackground,
|
|
84
|
-
borderBottomColor: tooltipBackground,
|
|
85
|
-
},
|
|
86
|
-
'.dark & .cm-tooltip-autocomplete': {
|
|
87
|
-
'& > ul > li[aria-selected]': {
|
|
88
|
-
backgroundColor: highlightBackground,
|
|
89
|
-
color: ivory,
|
|
90
|
-
},
|
|
91
77
|
},
|
|
78
|
+
// '.dark & .cm-tooltip': {
|
|
79
|
+
// border: 'none',
|
|
80
|
+
// backgroundColor: tooltipBackground,
|
|
81
|
+
// },
|
|
82
|
+
// '.dark & .cm-tooltip .cm-tooltip-arrow:before': {
|
|
83
|
+
// borderTopColor: 'transparent',
|
|
84
|
+
// borderBottomColor: 'transparent',
|
|
85
|
+
// },
|
|
86
|
+
// '.dark & .cm-tooltip .cm-tooltip-arrow:after': {
|
|
87
|
+
// borderTopColor: tooltipBackground,
|
|
88
|
+
// borderBottomColor: tooltipBackground,
|
|
89
|
+
// },
|
|
90
|
+
// '.dark & .cm-tooltip-autocomplete': {
|
|
91
|
+
// '& > ul > li[aria-selected]': {
|
|
92
|
+
// backgroundColor: highlightBackground,
|
|
93
|
+
// color: ivory,
|
|
94
|
+
// },
|
|
95
|
+
// },
|
|
92
96
|
'&.cm-focused': {
|
|
93
97
|
outline: 'none',
|
|
94
98
|
},
|
|
@@ -11,12 +11,14 @@ import { TextKind } from '@dxos/react-client/echo';
|
|
|
11
11
|
import { ClientDecorator, textGenerator, useDataGenerator } from '@dxos/react-client/testing';
|
|
12
12
|
import { useId } from '@dxos/react-ui';
|
|
13
13
|
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { withTheme } from '@dxos/storybook-utils';
|
|
14
15
|
|
|
15
16
|
import { RichTextEditor, type RichTextEditorProps } from './RichText';
|
|
16
17
|
import { Replicator, useYjsModel } from '../../testing';
|
|
17
18
|
|
|
18
19
|
export default {
|
|
19
20
|
component: RichTextEditor,
|
|
21
|
+
decorators: [withTheme],
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export const Default = {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxosTheme';
|
|
6
|
+
|
|
7
|
+
import { HighlightStyle, StreamLanguage } from '@codemirror/language';
|
|
8
|
+
import { tags } from '@lezer/highlight';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { TextObject } from '@dxos/echo-schema';
|
|
12
|
+
import { fixedInsetFlexLayout, groupSurface, inputSurface, mx } from '@dxos/react-ui-theme';
|
|
13
|
+
import { withTheme } from '@dxos/storybook-utils';
|
|
14
|
+
|
|
15
|
+
import { TextEditor } from './TextEditor';
|
|
16
|
+
import { defaultHyperLinkTooltip, hyperlink } from './extensions';
|
|
17
|
+
import { useTextModel } from '../../model';
|
|
18
|
+
|
|
19
|
+
export const nameRegex = /\{([\w_]+)}/;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Simple Monaco language extension.
|
|
23
|
+
* https://github.com/codemirror/stream-parser/blob/main/test/test-stream-parser.ts
|
|
24
|
+
*/
|
|
25
|
+
export const promptLanguage = StreamLanguage.define<{ count: number }>({
|
|
26
|
+
startState: () => ({ count: 0 }),
|
|
27
|
+
|
|
28
|
+
token: (stream, state) => {
|
|
29
|
+
state.count++;
|
|
30
|
+
if (stream.eatSpace()) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
if (stream.match(/^(<\w+>)/)) {
|
|
34
|
+
return 'tagName';
|
|
35
|
+
}
|
|
36
|
+
stream.next();
|
|
37
|
+
return null;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* https://codemirror.net/examples/styling
|
|
43
|
+
* https://lezer.codemirror.net/docs/ref/#highlight
|
|
44
|
+
*/
|
|
45
|
+
export const promptHighlightStyles = HighlightStyle.define([
|
|
46
|
+
{
|
|
47
|
+
tag: tags.tagName,
|
|
48
|
+
class: mx(
|
|
49
|
+
'mr-1 p-1',
|
|
50
|
+
'bg-neutral-100 dark:bg-neutral-900 text-black dark:text-white font-mono text-sm',
|
|
51
|
+
'rounded border border-neutral-300 dark:border-neutral-700',
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
const Story = () => {
|
|
57
|
+
const [item] = useState({
|
|
58
|
+
text: new TextObject(
|
|
59
|
+
'\n\n\nThis is all about [DXOS](https://dxos.org); read more [here](https://docs.dxos.org/guide/getting-started.html).\n\n\n',
|
|
60
|
+
),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const model = useTextModel({ text: item.text });
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className={mx(fixedInsetFlexLayout, groupSurface, 'p-4 gap-4')}>
|
|
67
|
+
<TextEditor
|
|
68
|
+
model={model}
|
|
69
|
+
slots={{ root: { className: mx(inputSurface, 'p-2') } }}
|
|
70
|
+
extensions={[hyperlink, defaultHyperLinkTooltip]}
|
|
71
|
+
/>
|
|
72
|
+
<pre>{JSON.stringify(model?.content?.toString(), null, 2)}</pre>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
component: TextEditor,
|
|
79
|
+
decorators: [withTheme],
|
|
80
|
+
render: Story,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Default = {};
|