@dxos/react-ui-editor 0.3.11-main.e0dc42b → 0.3.11-main.e19f39d
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 +1718 -1284
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts +13 -15
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +13 -10
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +4 -4
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/comments.stories.d.ts +26 -0
- package/dist/types/src/components/TextEditor/comments.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/{yjs.stories.d.ts → hooks.stories.d.ts} +13 -2
- package/dist/types/src/components/TextEditor/hooks.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +25 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +23 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.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/extensions/autocomplete.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.spec.d.ts +2 -0
- package/dist/types/src/extensions/automerge/automerge.spec.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/automerge.test.d.ts +2 -0
- package/dist/types/src/extensions/automerge/automerge.test.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/cursor.d.ts +1 -1
- package/dist/types/src/extensions/automerge/cursor.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/defs.d.ts +9 -11
- package/dist/types/src/extensions/automerge/defs.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/index.d.ts +0 -1
- package/dist/types/src/extensions/automerge/index.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/semaphore.d.ts +8 -12
- package/dist/types/src/extensions/automerge/semaphore.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/update-automerge.d.ts +2 -2
- package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +1 -1
- package/dist/types/src/extensions/awareness.d.ts +2 -2
- package/dist/types/src/extensions/awareness.d.ts.map +1 -1
- package/dist/types/src/extensions/basic.d.ts +4 -5
- package/dist/types/src/extensions/basic.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts +36 -19
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/{util → extensions}/cursor.d.ts +10 -2
- package/dist/types/src/extensions/cursor.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -7
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/bundle.d.ts +3 -6
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/code.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/formatting.d.ts +13 -0
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/heading.d.ts +6 -0
- package/dist/types/src/extensions/markdown/heading.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/hr.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/image.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/index.d.ts +8 -0
- package/dist/types/src/extensions/markdown/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/table.d.ts.map +1 -0
- package/dist/types/src/extensions/markdown/tasklist.d.ts.map +1 -0
- package/dist/types/src/extensions/mention.d.ts.map +1 -1
- package/dist/types/src/extensions/outliner.d.ts +4 -0
- package/dist/types/src/extensions/outliner.d.ts.map +1 -0
- package/dist/types/src/hooks/awareness-provider.d.ts +7 -4
- package/dist/types/src/hooks/awareness-provider.d.ts.map +1 -1
- package/dist/types/src/hooks/defs.d.ts +25 -0
- package/dist/types/src/hooks/defs.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +4 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useActionHandler.d.ts +4 -0
- package/dist/types/src/hooks/useActionHandler.d.ts.map +1 -0
- package/dist/types/src/hooks/useEditorView.d.ts +17 -0
- package/dist/types/src/hooks/useEditorView.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextEditor.d.ts +39 -0
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextModel.d.ts +2 -32
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/styles/markdown.d.ts +2 -2
- package/dist/types/src/styles/markdown.d.ts.map +1 -1
- package/dist/types/src/themes/default.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +7 -0
- package/dist/types/src/util.d.ts.map +1 -0
- package/package.json +48 -38
- package/src/components/TextEditor/MarkdownEditor.stories.tsx +77 -87
- package/src/components/TextEditor/TextEditor.stories.tsx +10 -43
- package/src/components/TextEditor/TextEditor.tsx +116 -89
- package/src/components/TextEditor/comments.stories.tsx +357 -0
- package/src/components/TextEditor/hooks.stories.tsx +106 -0
- package/src/components/Toolbar/Toolbar.stories.tsx +90 -0
- package/src/components/Toolbar/Toolbar.tsx +166 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/extensions/autocomplete.ts +6 -3
- package/src/extensions/automerge/automerge.spec.tsx +76 -0
- package/src/extensions/automerge/automerge.test.ts +13 -0
- package/src/extensions/automerge/automerge.ts +55 -46
- package/src/extensions/automerge/cursor.ts +5 -4
- package/src/extensions/automerge/defs.ts +13 -34
- package/src/extensions/automerge/index.ts +0 -1
- package/src/extensions/automerge/semaphore.ts +33 -32
- package/src/extensions/automerge/update-automerge.ts +14 -8
- package/src/extensions/automerge/update-codemirror.ts +5 -5
- package/src/extensions/awareness.ts +34 -39
- package/src/extensions/basic.ts +17 -10
- package/src/extensions/comments.ts +318 -261
- package/src/extensions/cursor.ts +50 -0
- package/src/extensions/index.ts +2 -7
- package/src/extensions/markdown/bundle.ts +23 -28
- package/src/extensions/markdown/code.ts +150 -0
- package/src/extensions/markdown/formatting.ts +188 -0
- package/src/extensions/markdown/heading.ts +59 -0
- package/src/extensions/markdown/highlight.ts +9 -23
- package/src/extensions/markdown/hr.ts +71 -0
- package/src/extensions/markdown/index.ts +8 -0
- package/src/extensions/{link.ts → markdown/link.ts} +8 -5
- package/src/extensions/markdown/tasklist.ts +110 -0
- package/src/extensions/mention.ts +9 -2
- package/src/extensions/outliner.ts +12 -0
- package/src/hooks/awareness-provider.ts +24 -20
- package/src/hooks/defs.ts +42 -0
- package/src/hooks/index.ts +5 -2
- package/src/hooks/useActionHandler.ts +62 -0
- package/src/hooks/useEditorView.ts +29 -0
- package/src/hooks/useTextEditor.ts +153 -0
- package/src/hooks/useTextModel.ts +49 -58
- package/src/styles/markdown.ts +9 -12
- package/src/themes/default.ts +19 -52
- package/src/util.ts +41 -0
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts +0 -12
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/yjs.stories.d.ts.map +0 -1
- package/dist/types/src/extensions/code.d.ts.map +0 -1
- package/dist/types/src/extensions/hr.d.ts.map +0 -1
- package/dist/types/src/extensions/image.d.ts.map +0 -1
- package/dist/types/src/extensions/link.d.ts.map +0 -1
- package/dist/types/src/extensions/table.d.ts.map +0 -1
- package/dist/types/src/extensions/tasklist.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/cursor.d.ts +0 -4
- package/dist/types/src/extensions/yjs/cursor.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/index.d.ts +0 -2
- package/dist/types/src/extensions/yjs/index.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/yjs.d.ts +0 -4
- package/dist/types/src/extensions/yjs/yjs.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/yjs.test.d.ts +0 -2
- package/dist/types/src/extensions/yjs/yjs.test.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge.d.ts +0 -3
- package/dist/types/src/hooks/automerge.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs.d.ts +0 -27
- package/dist/types/src/hooks/yjs.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/proto/gen/schema.d.ts +0 -15
- package/dist/types/src/testing/proto/gen/schema.d.ts.map +0 -1
- package/dist/types/src/testing/proto/index.d.ts +0 -2
- package/dist/types/src/testing/proto/index.d.ts.map +0 -1
- package/dist/types/src/testing/replicator.d.ts +0 -45
- package/dist/types/src/testing/replicator.d.ts.map +0 -1
- package/dist/types/src/util/cursor.d.ts.map +0 -1
- package/dist/types/src/util/index.d.ts +0 -3
- package/dist/types/src/util/index.d.ts.map +0 -1
- package/dist/types/src/util/util.d.ts +0 -5
- package/dist/types/src/util/util.d.ts.map +0 -1
- package/src/components/TextEditor/codemirror.stories.ts +0 -115
- package/src/components/TextEditor/yjs.stories.tsx +0 -56
- package/src/extensions/code.ts +0 -106
- package/src/extensions/hr.ts +0 -73
- package/src/extensions/tasklist.ts +0 -119
- package/src/extensions/yjs/cursor.ts +0 -21
- package/src/extensions/yjs/index.ts +0 -5
- package/src/extensions/yjs/yjs.test.ts +0 -35
- package/src/extensions/yjs/yjs.ts +0 -16
- package/src/hooks/automerge.ts +0 -52
- package/src/hooks/yjs.ts +0 -178
- package/src/testing/index.ts +0 -6
- package/src/testing/proto/gen/schema.ts +0 -49
- package/src/testing/proto/index.ts +0 -5
- package/src/testing/proto/schema.proto +0 -15
- package/src/testing/replicator.ts +0 -184
- package/src/util/cursor.ts +0 -29
- package/src/util/index.ts +0 -6
- package/src/util/util.ts +0 -18
- /package/dist/types/src/extensions/{code.d.ts → markdown/code.d.ts} +0 -0
- /package/dist/types/src/extensions/{hr.d.ts → markdown/hr.d.ts} +0 -0
- /package/dist/types/src/extensions/{image.d.ts → markdown/image.d.ts} +0 -0
- /package/dist/types/src/extensions/{link.d.ts → markdown/link.d.ts} +0 -0
- /package/dist/types/src/extensions/{table.d.ts → markdown/table.d.ts} +0 -0
- /package/dist/types/src/extensions/{tasklist.d.ts → markdown/tasklist.d.ts} +0 -0
- /package/src/extensions/{image.ts → markdown/image.ts} +0 -0
- /package/src/extensions/{table.ts → markdown/table.ts} +0 -0
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type * as YP from 'y-protocols/awareness';
|
|
3
|
-
import { type DocAccessor, type Space, type TextObject } from '@dxos/react-client/echo';
|
|
1
|
+
import { type Space, type TextObject } from '@dxos/react-client/echo';
|
|
4
2
|
import { type Identity } from '@dxos/react-client/halo';
|
|
5
|
-
import
|
|
6
|
-
/**
|
|
7
|
-
* State field makes the model available to other extensions.
|
|
8
|
-
*/
|
|
9
|
-
export declare const modelState: StateField<EditorModel | undefined>;
|
|
10
|
-
export type Range = {
|
|
11
|
-
from: number;
|
|
12
|
-
to: number;
|
|
13
|
-
};
|
|
14
|
-
export type CommentRange = {
|
|
15
|
-
id: string;
|
|
16
|
-
cursor: string;
|
|
17
|
-
};
|
|
18
|
-
export type EditorModel = {
|
|
19
|
-
id: string;
|
|
20
|
-
text: () => string;
|
|
21
|
-
extension?: Extension;
|
|
22
|
-
content: string | YText | YXmlFragment | DocAccessor;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use CursorConverter.
|
|
25
|
-
*/
|
|
26
|
-
getCursorFromRange?: (value: Range) => string;
|
|
27
|
-
getRangeFromCursor?: (cursor: string) => Range | undefined;
|
|
28
|
-
awareness?: YP.Awareness;
|
|
29
|
-
peer?: {
|
|
30
|
-
id: string;
|
|
31
|
-
name?: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
3
|
+
import { type EditorModel } from './defs';
|
|
34
4
|
export type UseTextModelProps = {
|
|
35
5
|
identity?: Identity | null;
|
|
36
6
|
space?: Space;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTextModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextModel.ts"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,QAAQ,CAAC;AAKtD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,iBAAiB,KAAG,WAAW,GAAG,SAKrE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
2
|
-
export declare const headings: Record<HeadingLevel, string
|
|
3
|
-
export declare const heading: (level: HeadingLevel
|
|
2
|
+
export declare const headings: Record<HeadingLevel, string>;
|
|
3
|
+
export declare const heading: (level: HeadingLevel) => string;
|
|
4
4
|
export declare const text = "text-neutral-800 dark:text-neutral-200";
|
|
5
5
|
export declare const light = "text-neutral-200 dark:text-neutral-800";
|
|
6
6
|
export declare const mark: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../src/styles/markdown.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAIjD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../src/styles/markdown.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAIjD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAOjD,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,YAAY,WAE1C,CAAC;AAEF,eAAO,MAAM,IAAI,2CAA2C,CAAC;AAC7D,eAAO,MAAM,KAAK,2CAA2C,CAAC;AAE9D,eAAO,MAAM,IAAI,QAAmE,CAAC;AAErF,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAE5C,eAAO,MAAM,IAAI,mEAAmE,CAAC;AACrF,eAAO,MAAM,QAAQ,+BAA+B,CAAC;AACrD,eAAO,MAAM,SAAS,kDAAkD,CAAC;AAEzE,eAAO,MAAM,SAAS,QAAmB,CAAC;AAE1C,eAAO,MAAM,UAAU,QAAsF,CAAC;AAE9G,eAAO,MAAM,cAAc,0GAC8E,CAAC;AAG1G,eAAO,MAAM,aAAa,wHAC6F,CAAC;AACxH,eAAO,MAAM,WAAW,+IACkH,CAAC;AAE3I,eAAO,MAAM,QAAQ,gDAAgD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/themes/default.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,WAAW,CAAC;AAKrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/themes/default.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,WAAW,CAAC;AAKrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,WAiO1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAOvB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAO3B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAOvB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Transaction } from '@codemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* CodeMirror callbacks swallow errors so wrap handlers.
|
|
4
|
+
*/
|
|
5
|
+
export declare const callbackWrapper: <T extends Function>(fn: T) => T;
|
|
6
|
+
export declare const logChanges: (trs: readonly Transaction[]) => void;
|
|
7
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AAEH,eAAO,MAAM,eAAe,kCAOR,CAAC;AAErB,eAAO,MAAM,UAAU,QAAS,SAAS,WAAW,EAAE,SAmBrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-editor",
|
|
3
|
-
"version": "0.3.11-main.
|
|
3
|
+
"version": "0.3.11-main.e19f39d",
|
|
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",
|
|
@@ -13,20 +13,21 @@
|
|
|
13
13
|
"src"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@codemirror/autocomplete": "^6.
|
|
17
|
-
"@codemirror/commands": "^6.3.
|
|
18
|
-
"@codemirror/lang-markdown": "^6.2.
|
|
19
|
-
"@codemirror/language": "^6.
|
|
16
|
+
"@codemirror/autocomplete": "^6.12.0",
|
|
17
|
+
"@codemirror/commands": "^6.3.3",
|
|
18
|
+
"@codemirror/lang-markdown": "^6.2.4",
|
|
19
|
+
"@codemirror/language": "^6.10.0",
|
|
20
20
|
"@codemirror/language-data": "^6.3.1",
|
|
21
21
|
"@codemirror/lint": "^6.4.2",
|
|
22
22
|
"@codemirror/search": "^6.5.5",
|
|
23
|
-
"@codemirror/state": "^6.
|
|
23
|
+
"@codemirror/state": "^6.4.0",
|
|
24
24
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
25
|
-
"@codemirror/view": "^6.
|
|
26
|
-
"@fluentui/react-tabster": "^9.
|
|
27
|
-
"@lezer/common": "^1.
|
|
25
|
+
"@codemirror/view": "^6.23.0",
|
|
26
|
+
"@fluentui/react-tabster": "^9.17.4",
|
|
27
|
+
"@lezer/common": "^1.2.1",
|
|
28
28
|
"@lezer/highlight": "^1.2.0",
|
|
29
|
-
"@lezer/markdown": "^1.
|
|
29
|
+
"@lezer/markdown": "^1.2.0",
|
|
30
|
+
"@radix-ui/react-context": "^1.0.0",
|
|
30
31
|
"@replit/codemirror-vim": "^6.0.14",
|
|
31
32
|
"codemirror": "6.0.1",
|
|
32
33
|
"lib0": "^0.2.65",
|
|
@@ -35,56 +36,65 @@
|
|
|
35
36
|
"lodash.pick": "^4.4.0",
|
|
36
37
|
"lodash.sortby": "^4.7.0",
|
|
37
38
|
"style-mod": "^4.1.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/text-model": "0.3.11-main.
|
|
52
|
-
"@dxos/react-ui-theme": "0.3.11-main.e0dc42b",
|
|
53
|
-
"@dxos/util": "0.3.11-main.e0dc42b",
|
|
54
|
-
"@dxos/react-ui": "0.3.11-main.e0dc42b"
|
|
39
|
+
"@dxos/async": "0.3.11-main.e19f39d",
|
|
40
|
+
"@dxos/automerge": "0.3.11-main.e19f39d",
|
|
41
|
+
"@dxos/context": "0.3.11-main.e19f39d",
|
|
42
|
+
"@dxos/debug": "0.3.11-main.e19f39d",
|
|
43
|
+
"@dxos/log": "0.3.11-main.e19f39d",
|
|
44
|
+
"@dxos/display-name": "0.3.11-main.e19f39d",
|
|
45
|
+
"@dxos/invariant": "0.3.11-main.e19f39d",
|
|
46
|
+
"@dxos/echo-schema": "0.3.11-main.e19f39d",
|
|
47
|
+
"@dxos/protocols": "0.3.11-main.e19f39d",
|
|
48
|
+
"@dxos/react-async": "0.3.11-main.e19f39d",
|
|
49
|
+
"@dxos/react-ui": "0.3.11-main.e19f39d",
|
|
50
|
+
"@dxos/react-ui-theme": "0.3.11-main.e19f39d",
|
|
51
|
+
"@dxos/util": "0.3.11-main.e19f39d",
|
|
52
|
+
"@dxos/text-model": "0.3.11-main.e19f39d"
|
|
55
53
|
},
|
|
56
54
|
"devDependencies": {
|
|
57
|
-
"@automerge/automerge-repo-network-broadcastchannel": "^1.0
|
|
58
|
-
"@faker-js/faker": "^8.
|
|
55
|
+
"@automerge/automerge-repo-network-broadcastchannel": "^1.1.0",
|
|
56
|
+
"@faker-js/faker": "^8.3.1",
|
|
59
57
|
"@phosphor-icons/react": "^2.0.5",
|
|
60
58
|
"@preact/signals-react": "^1.3.6",
|
|
59
|
+
"@testing-library/dom": "^8.17.1",
|
|
60
|
+
"@testing-library/react": "^13.4.0",
|
|
61
|
+
"@testing-library/user-event": "^14.4.3",
|
|
61
62
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
62
63
|
"@types/lodash.get": "^4.4.7",
|
|
63
64
|
"@types/lodash.pick": "^4.4.7",
|
|
64
65
|
"@types/lodash.sortby": "^4.7.7",
|
|
65
66
|
"@types/react": "^18.0.21",
|
|
66
67
|
"@types/react-dom": "^18.0.6",
|
|
68
|
+
"@types/react-test-renderer": "^17.0.2",
|
|
69
|
+
"@vitest/ui": "^1.2.1",
|
|
67
70
|
"deepsignal": "1.4.0-shallow.0",
|
|
71
|
+
"happy-dom": "^13.3.1",
|
|
72
|
+
"jsdom": "^20.0.1",
|
|
68
73
|
"react": "^18.2.0",
|
|
69
74
|
"react-dom": "^18.2.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/echo-signals": "0.3.11-main.
|
|
75
|
+
"react-test-renderer": "^18.2.0",
|
|
76
|
+
"vite": "^5.0.12",
|
|
77
|
+
"vite-plugin-top-level-await": "^1.4.1",
|
|
78
|
+
"vite-plugin-wasm": "^3.3.0",
|
|
79
|
+
"vitest": "^1.2.1",
|
|
80
|
+
"@dxos/config": "0.3.11-main.e19f39d",
|
|
81
|
+
"@dxos/echo-signals": "0.3.11-main.e19f39d",
|
|
82
|
+
"@dxos/echo-typegen": "0.3.11-main.e19f39d",
|
|
83
|
+
"@dxos/keyboard": "0.3.11-main.e19f39d",
|
|
84
|
+
"@dxos/react-ui": "0.3.11-main.e19f39d",
|
|
85
|
+
"@dxos/react-client": "0.3.11-main.e19f39d",
|
|
86
|
+
"@dxos/storybook-utils": "0.3.11-main.e19f39d"
|
|
77
87
|
},
|
|
78
88
|
"peerDependencies": {
|
|
79
89
|
"@phosphor-icons/react": "^2.0.5",
|
|
80
90
|
"react": "^18.2.0",
|
|
81
91
|
"react-dom": "^18.2.0",
|
|
82
|
-
"@dxos/react-client": "0.3.11-main.
|
|
92
|
+
"@dxos/react-client": "0.3.11-main.e19f39d"
|
|
83
93
|
},
|
|
84
94
|
"publishConfig": {
|
|
85
95
|
"access": "public"
|
|
86
96
|
},
|
|
87
97
|
"scripts": {
|
|
88
|
-
"
|
|
98
|
+
"vitest": "vitest --ui"
|
|
89
99
|
}
|
|
90
100
|
}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxosTheme';
|
|
6
6
|
|
|
7
|
-
import { EditorView } from '@codemirror/view';
|
|
7
|
+
import { type EditorView } from '@codemirror/view';
|
|
8
8
|
import { faker } from '@faker-js/faker';
|
|
9
9
|
import { ArrowSquareOut } from '@phosphor-icons/react';
|
|
10
10
|
import defaultsDeep from 'lodash.defaultsdeep';
|
|
11
|
-
import React, { type FC, StrictMode, useState } from 'react';
|
|
11
|
+
import React, { type FC, StrictMode, useRef, useState } from 'react';
|
|
12
12
|
import { createRoot } from 'react-dom/client';
|
|
13
13
|
|
|
14
14
|
import { TextObject } from '@dxos/echo-schema';
|
|
@@ -19,27 +19,25 @@ import { withTheme } from '@dxos/storybook-utils';
|
|
|
19
19
|
|
|
20
20
|
import { MarkdownEditor, type TextEditorProps } from './TextEditor';
|
|
21
21
|
import {
|
|
22
|
+
type CommentsOptions,
|
|
23
|
+
type LinkOptions,
|
|
22
24
|
autocomplete,
|
|
23
25
|
blast,
|
|
24
26
|
code,
|
|
25
27
|
comments,
|
|
26
28
|
defaultOptions,
|
|
29
|
+
heading,
|
|
27
30
|
hr,
|
|
28
31
|
image,
|
|
29
|
-
listener,
|
|
30
32
|
link,
|
|
31
33
|
mention,
|
|
32
34
|
table,
|
|
33
35
|
tasklist,
|
|
34
36
|
typewriter,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
useComments,
|
|
38
|
+
formatting,
|
|
37
39
|
} from '../../extensions';
|
|
38
|
-
import { type
|
|
39
|
-
|
|
40
|
-
// Extensions:
|
|
41
|
-
// TODO(burdon): Table of contents.
|
|
42
|
-
// TODO(burdon): Front-matter
|
|
40
|
+
import { type Comment, useTextModel } from '../../hooks';
|
|
43
41
|
|
|
44
42
|
faker.seed(101);
|
|
45
43
|
|
|
@@ -55,8 +53,8 @@ const text = {
|
|
|
55
53
|
'- [x] decorator',
|
|
56
54
|
'- [ ] checkbox',
|
|
57
55
|
' - [ ] state',
|
|
58
|
-
'
|
|
59
|
-
'
|
|
56
|
+
' - [ ] indent',
|
|
57
|
+
' - [x] style',
|
|
60
58
|
'',
|
|
61
59
|
),
|
|
62
60
|
|
|
@@ -82,7 +80,7 @@ const text = {
|
|
|
82
80
|
'## Code',
|
|
83
81
|
'',
|
|
84
82
|
'```',
|
|
85
|
-
'
|
|
83
|
+
'$ ls -las',
|
|
86
84
|
'```',
|
|
87
85
|
'',
|
|
88
86
|
'```tsx',
|
|
@@ -162,6 +160,8 @@ const links = [
|
|
|
162
160
|
{ label: 'StackEdit', apply: '[StackEdit](https://stackedit.io/app)' },
|
|
163
161
|
];
|
|
164
162
|
|
|
163
|
+
const names = ['adam', 'alice', 'alison', 'bob', 'carol', 'charlie', 'sayuri', 'shoko'];
|
|
164
|
+
|
|
165
165
|
const hover =
|
|
166
166
|
'rounded-sm text-base text-primary-600 hover:text-primary-500 dark:text-primary-300 hover:dark:text-primary-200';
|
|
167
167
|
|
|
@@ -202,7 +202,7 @@ const onRenderLink: LinkOptions['onRender'] = (el, url) => {
|
|
|
202
202
|
createRoot(el).render(
|
|
203
203
|
<StrictMode>
|
|
204
204
|
<a href={url} target='_blank' rel='noreferrer' className={hover}>
|
|
205
|
-
<ArrowSquareOut weight='bold' className={mx(getSize(4), 'inline-block leading-none mis-1 mb-
|
|
205
|
+
<ArrowSquareOut weight='bold' className={mx(getSize(4), 'inline-block leading-none mis-1 mb-[2px]')} />
|
|
206
206
|
</a>
|
|
207
207
|
</StrictMode>,
|
|
208
208
|
);
|
|
@@ -210,22 +210,23 @@ const onRenderLink: LinkOptions['onRender'] = (el, url) => {
|
|
|
210
210
|
|
|
211
211
|
type StoryProps = {
|
|
212
212
|
text?: string;
|
|
213
|
-
|
|
214
|
-
} & Pick<TextEditorProps, '
|
|
213
|
+
comments?: Comment[];
|
|
214
|
+
} & Pick<TextEditorProps, 'readonly' | 'placeholder' | 'slots' | 'extensions'>;
|
|
215
215
|
|
|
216
|
-
const Story = ({ text,
|
|
217
|
-
const [item] = useState({ text: new TextObject(text
|
|
216
|
+
const Story = ({ text, comments, placeholder = 'New document.', ...props }: StoryProps) => {
|
|
217
|
+
const [item] = useState({ text: new TextObject(text) });
|
|
218
|
+
const view = useRef<EditorView>(null);
|
|
218
219
|
const model = useTextModel({ text: item.text });
|
|
220
|
+
useComments(view.current, comments);
|
|
219
221
|
if (!model) {
|
|
220
222
|
return null;
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
return (
|
|
224
226
|
<div className={mx(fixedInsetFlexLayout, groupSurface)}>
|
|
225
|
-
<div className='flex justify-center
|
|
226
|
-
<div className='flex flex-col w-[800px]
|
|
227
|
-
<MarkdownEditor model={model} {...props} />
|
|
228
|
-
<div className='flex shrink-0 h-[300px]'></div>
|
|
227
|
+
<div className='flex h-full justify-center'>
|
|
228
|
+
<div className='flex flex-col h-full w-[800px]'>
|
|
229
|
+
<MarkdownEditor ref={view} model={model} placeholder={placeholder} {...props} />
|
|
229
230
|
</div>
|
|
230
231
|
</div>
|
|
231
232
|
</div>
|
|
@@ -239,11 +240,13 @@ export default {
|
|
|
239
240
|
render: Story,
|
|
240
241
|
};
|
|
241
242
|
|
|
242
|
-
const
|
|
243
|
+
const defaults = [
|
|
243
244
|
autocomplete({
|
|
244
245
|
onSearch: (text) => links.filter(({ label }) => label.toLowerCase().includes(text.toLowerCase())),
|
|
245
246
|
}),
|
|
246
247
|
code(),
|
|
248
|
+
formatting(),
|
|
249
|
+
heading(),
|
|
247
250
|
hr(),
|
|
248
251
|
image(),
|
|
249
252
|
link({ onRender: onRenderLink, onHover: onHoverLinkTooltip }),
|
|
@@ -252,35 +255,25 @@ const extensions = [
|
|
|
252
255
|
];
|
|
253
256
|
|
|
254
257
|
export const Default = {
|
|
255
|
-
render: () => <Story text={document} extensions={
|
|
258
|
+
render: () => <Story text={document} extensions={defaults} />,
|
|
256
259
|
};
|
|
257
260
|
|
|
258
261
|
export const Readonly = {
|
|
259
|
-
render: () => <Story text={document} extensions={
|
|
262
|
+
render: () => <Story text={document} extensions={defaults} readonly />,
|
|
260
263
|
};
|
|
261
264
|
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
export const Large = {
|
|
265
|
-
render: () => <Story text={str('# Large Document', '', large)} extensions={[]} />,
|
|
265
|
+
export const NoExtensions = {
|
|
266
|
+
render: () => <Story text={document} />,
|
|
266
267
|
};
|
|
267
268
|
|
|
269
|
+
const large = faker.helpers.multiple(() => faker.lorem.paragraph({ min: 8, max: 16 }), { count: 20 }).join('\n\n');
|
|
270
|
+
|
|
268
271
|
export const Empty = {
|
|
269
272
|
render: () => <Story />,
|
|
270
273
|
};
|
|
271
274
|
|
|
272
|
-
export const
|
|
273
|
-
render: () => <Story text={
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
// TODO(burdon): Cursor bug if no newline after BR (cursor down just loops back to start of each paragraph).
|
|
277
|
-
export const HorizontalRule = {
|
|
278
|
-
render: () => (
|
|
279
|
-
<Story
|
|
280
|
-
text={str('# Horizontal Rule', '', text.paragraphs, '---', '', text.paragraphs, '---', '', text.paragraphs)}
|
|
281
|
-
extensions={[hr()]}
|
|
282
|
-
/>
|
|
283
|
-
),
|
|
275
|
+
export const Scrolling = {
|
|
276
|
+
render: () => <Story text={str('# Large Document', '', large)} extensions={[]} />,
|
|
284
277
|
};
|
|
285
278
|
|
|
286
279
|
export const Links = {
|
|
@@ -293,37 +286,36 @@ export const Links = {
|
|
|
293
286
|
};
|
|
294
287
|
|
|
295
288
|
export const Code = {
|
|
296
|
-
render: () => <Story text={str(text.code, text.footer)} extensions={[code()]}
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
export const Table = {
|
|
300
|
-
render: () => <Story text={str(text.table, text.footer)} extensions={[table()]} />,
|
|
289
|
+
render: () => <Story text={str(text.code, text.footer)} extensions={[code()]} />,
|
|
301
290
|
};
|
|
302
291
|
|
|
303
292
|
export const Image = {
|
|
304
|
-
render: () => <Story text={str(text.image, text.footer)}
|
|
293
|
+
render: () => <Story text={str(text.image, text.footer)} extensions={[image()]} />,
|
|
305
294
|
};
|
|
306
295
|
|
|
307
|
-
export const
|
|
296
|
+
export const Lists = {
|
|
308
297
|
render: () => (
|
|
309
|
-
<Story
|
|
310
|
-
text={str(text.tasks, '', text.list, text.footer)}
|
|
311
|
-
extensions={[
|
|
312
|
-
tasklist(),
|
|
313
|
-
listener({
|
|
314
|
-
onChange: (text) => {
|
|
315
|
-
console.log(text);
|
|
316
|
-
},
|
|
317
|
-
}),
|
|
318
|
-
]}
|
|
319
|
-
/>
|
|
298
|
+
<Story text={str(text.tasks, '', text.list, '', text.numbered, text.footer)} extensions={[tasklist()]} />
|
|
320
299
|
),
|
|
321
300
|
};
|
|
322
301
|
|
|
302
|
+
export const Table = {
|
|
303
|
+
render: () => <Story text={str(text.table, text.footer)} extensions={[table()]} />,
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// export const Outliner = {
|
|
307
|
+
// render: () => (
|
|
308
|
+
// <Story
|
|
309
|
+
// text={str('# Outliner', '', 'Block', ': this is a block', ': with multiple lines', text.footer)}
|
|
310
|
+
// extensions={[outliner()]}
|
|
311
|
+
// />
|
|
312
|
+
// ),
|
|
313
|
+
// };
|
|
314
|
+
|
|
323
315
|
export const Autocomplete = {
|
|
324
316
|
render: () => (
|
|
325
317
|
<Story
|
|
326
|
-
text={str('# Autocomplete', '', 'Press
|
|
318
|
+
text={str('# Autocomplete', '', 'Press Ctrl-Space...', text.footer)}
|
|
327
319
|
extensions={[
|
|
328
320
|
link({ onRender: onRenderLink }),
|
|
329
321
|
autocomplete({
|
|
@@ -334,8 +326,6 @@ export const Autocomplete = {
|
|
|
334
326
|
),
|
|
335
327
|
};
|
|
336
328
|
|
|
337
|
-
const names = ['adam', 'alice', 'alison', 'bob', 'carol', 'charlie', 'sayuri', 'shoko'];
|
|
338
|
-
|
|
339
329
|
export const Mention = {
|
|
340
330
|
render: () => (
|
|
341
331
|
<Story
|
|
@@ -351,18 +341,18 @@ export const Mention = {
|
|
|
351
341
|
|
|
352
342
|
export const Comments = {
|
|
353
343
|
render: () => {
|
|
354
|
-
const [
|
|
344
|
+
const [_comments, setComments] = useState<Comment[]>([]);
|
|
355
345
|
|
|
356
346
|
return (
|
|
357
347
|
<Story
|
|
358
348
|
text={str('# Comments', '', text.paragraphs, text.footer)}
|
|
359
|
-
comments={
|
|
349
|
+
comments={_comments}
|
|
360
350
|
extensions={[
|
|
361
351
|
comments({
|
|
362
352
|
onHover: onCommentsHover,
|
|
363
|
-
onCreate: (
|
|
353
|
+
onCreate: (range) => {
|
|
364
354
|
const id = PublicKey.random().toHex();
|
|
365
|
-
|
|
355
|
+
setComments((commentRanges) => [...commentRanges, { id, cursor: range }]);
|
|
366
356
|
return id;
|
|
367
357
|
},
|
|
368
358
|
onSelect: (state) => {
|
|
@@ -371,9 +361,9 @@ export const Comments = {
|
|
|
371
361
|
console.log(
|
|
372
362
|
'update',
|
|
373
363
|
JSON.stringify({
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
364
|
+
comments: state.comments.length,
|
|
365
|
+
active: state.selection.current?.slice(0, 8),
|
|
366
|
+
closest: state.selection.closest?.slice(0, 8),
|
|
377
367
|
}),
|
|
378
368
|
);
|
|
379
369
|
}
|
|
@@ -385,8 +375,24 @@ export const Comments = {
|
|
|
385
375
|
},
|
|
386
376
|
};
|
|
387
377
|
|
|
378
|
+
export const HorizontalRule = {
|
|
379
|
+
render: () => (
|
|
380
|
+
<Story
|
|
381
|
+
text={str('# Horizontal Rule', '', text.paragraphs, '---', text.paragraphs, '---', text.paragraphs)}
|
|
382
|
+
extensions={[hr()]}
|
|
383
|
+
/>
|
|
384
|
+
),
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const typewriterItems = localStorage.getItem('dxos.org/plugin/markdown/typewriter')?.split(',');
|
|
388
|
+
|
|
388
389
|
export const Typewriter = {
|
|
389
|
-
render: () =>
|
|
390
|
+
render: () => (
|
|
391
|
+
<Story
|
|
392
|
+
text={str('# Typewriter', '', text.paragraphs, text.footer)}
|
|
393
|
+
extensions={[typewriter({ items: typewriterItems })]}
|
|
394
|
+
/>
|
|
395
|
+
),
|
|
390
396
|
};
|
|
391
397
|
|
|
392
398
|
export const Blast = {
|
|
@@ -394,9 +400,7 @@ export const Blast = {
|
|
|
394
400
|
<Story
|
|
395
401
|
text={str('# Blast', '', text.paragraphs, text.code, text.paragraphs)}
|
|
396
402
|
extensions={[
|
|
397
|
-
typewriter({
|
|
398
|
-
items: localStorage.getItem('dxos.composer.extension.demo')?.split(','),
|
|
399
|
-
}),
|
|
403
|
+
typewriter({ items: typewriterItems }),
|
|
400
404
|
blast(
|
|
401
405
|
defaultsDeep(
|
|
402
406
|
{
|
|
@@ -413,17 +417,3 @@ export const Blast = {
|
|
|
413
417
|
/>
|
|
414
418
|
),
|
|
415
419
|
};
|
|
416
|
-
|
|
417
|
-
export const Diagnostics = {
|
|
418
|
-
render: () => (
|
|
419
|
-
<Story
|
|
420
|
-
text={document}
|
|
421
|
-
extensions={[
|
|
422
|
-
// Cursor moved.
|
|
423
|
-
EditorView.updateListener.of((update) => {
|
|
424
|
-
console.log('update', update.view.state.selection.main.head);
|
|
425
|
-
}),
|
|
426
|
-
]}
|
|
427
|
-
/>
|
|
428
|
-
),
|
|
429
|
-
};
|
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxosTheme';
|
|
6
6
|
|
|
7
|
-
import defaultsDeep from 'lodash.defaultsdeep';
|
|
8
7
|
import React, { useState } from 'react';
|
|
9
8
|
|
|
10
9
|
import { TextObject } from '@dxos/echo-schema';
|
|
11
10
|
import { fixedInsetFlexLayout, groupSurface, mx } from '@dxos/react-ui-theme';
|
|
12
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
13
12
|
|
|
14
|
-
import {
|
|
13
|
+
import { TextEditor, type TextEditorProps } from './TextEditor';
|
|
15
14
|
import { listener } from '../../extensions';
|
|
16
15
|
import { useTextModel } from '../../hooks';
|
|
17
|
-
import { textTheme } from '../../themes';
|
|
18
16
|
|
|
19
17
|
const initialText = [
|
|
20
18
|
'# TextEditor',
|
|
@@ -30,7 +28,7 @@ const Story = ({
|
|
|
30
28
|
text,
|
|
31
29
|
automerge,
|
|
32
30
|
...props
|
|
33
|
-
}: { text?: string; automerge?: boolean } & Pick<TextEditorProps, 'extensions' | 'slots'>) => {
|
|
31
|
+
}: { text?: string; automerge?: boolean } & Pick<TextEditorProps, 'extensions' | 'placeholder' | 'slots'>) => {
|
|
34
32
|
const [item] = useState({ text: new TextObject(text, undefined, undefined, { automerge }) });
|
|
35
33
|
const model = useTextModel({ text: item.text });
|
|
36
34
|
if (!model) {
|
|
@@ -39,10 +37,9 @@ const Story = ({
|
|
|
39
37
|
|
|
40
38
|
return (
|
|
41
39
|
<div className={mx(fixedInsetFlexLayout, groupSurface)}>
|
|
42
|
-
<div className='flex justify-center
|
|
40
|
+
<div className='flex justify-center'>
|
|
43
41
|
<div className='flex flex-col w-[800px] py-16'>
|
|
44
42
|
<TextEditor model={model} {...props} />
|
|
45
|
-
<div className='flex shrink-0 h-[300px]'></div>
|
|
46
43
|
</div>
|
|
47
44
|
</div>
|
|
48
45
|
</div>
|
|
@@ -57,49 +54,19 @@ export default {
|
|
|
57
54
|
};
|
|
58
55
|
|
|
59
56
|
export const Default = {
|
|
60
|
-
render: () =>
|
|
61
|
-
<Story
|
|
62
|
-
slots={defaultsDeep(
|
|
63
|
-
{ editor: { theme: textTheme, placeholder: 'Enter text...' } } satisfies TextEditorSlots,
|
|
64
|
-
defaultSlots,
|
|
65
|
-
)}
|
|
66
|
-
/>
|
|
67
|
-
),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const Listener = {
|
|
71
|
-
render: () => (
|
|
72
|
-
<Story
|
|
73
|
-
slots={defaultsDeep(
|
|
74
|
-
{ editor: { theme: textTheme, placeholder: 'Enter text...' } } satisfies TextEditorSlots,
|
|
75
|
-
defaultSlots,
|
|
76
|
-
)}
|
|
77
|
-
extensions={[listener({ onChange: (text) => console.log(text) })]}
|
|
78
|
-
/>
|
|
79
|
-
),
|
|
57
|
+
render: () => <Story placeholder='Enter text...' />,
|
|
80
58
|
};
|
|
81
59
|
|
|
82
60
|
export const Text = {
|
|
83
|
-
render: () =>
|
|
84
|
-
<Story
|
|
85
|
-
text={initialText}
|
|
86
|
-
slots={defaultsDeep(
|
|
87
|
-
{ editor: { theme: textTheme, placeholder: 'Enter text...' } } satisfies TextEditorSlots,
|
|
88
|
-
defaultSlots,
|
|
89
|
-
)}
|
|
90
|
-
/>
|
|
91
|
-
),
|
|
61
|
+
render: () => <Story text={initialText} placeholder='Enter text...' />,
|
|
92
62
|
};
|
|
93
63
|
|
|
94
64
|
export const Automerge = {
|
|
65
|
+
render: () => <Story text={initialText} placeholder='Enter text...' automerge />,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const Listener = {
|
|
95
69
|
render: () => (
|
|
96
|
-
<Story
|
|
97
|
-
automerge
|
|
98
|
-
text={initialText}
|
|
99
|
-
slots={defaultsDeep(
|
|
100
|
-
{ editor: { theme: textTheme, placeholder: 'Enter text...' } } satisfies TextEditorSlots,
|
|
101
|
-
defaultSlots,
|
|
102
|
-
)}
|
|
103
|
-
/>
|
|
70
|
+
<Story placeholder='Enter text...' extensions={[listener({ onChange: (text) => console.log(text) })]} />
|
|
104
71
|
),
|
|
105
72
|
};
|