@dxos/react-ui-editor 0.3.9-main.4e30508 → 0.3.9-main.501fe30
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 +412 -56
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/automerge/automerge-plugin/PatchSemaphore.d.ts +2 -2
- package/dist/types/src/automerge/automerge-plugin/PatchSemaphore.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-plugin/codeMirrorToAm.d.ts +2 -2
- package/dist/types/src/automerge/automerge-plugin/codeMirrorToAm.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-plugin/handle.d.ts +9 -0
- package/dist/types/src/automerge/automerge-plugin/handle.d.ts.map +1 -0
- package/dist/types/src/automerge/automerge-plugin/index.d.ts +2 -2
- package/dist/types/src/automerge/automerge-plugin/index.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-plugin/plugin.d.ts +6 -5
- package/dist/types/src/automerge/automerge-plugin/plugin.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge.stories.d.ts +1 -0
- package/dist/types/src/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/components/Editor/Editor.d.ts +0 -1
- package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
- package/dist/types/src/components/Editor/Editor.stories.d.ts +3 -8
- package/dist/types/src/components/Editor/Editor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Markdown.d.ts +4 -2
- package/dist/types/src/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Markdown.stories.d.ts +1 -1
- package/dist/types/src/components/Markdown/Markdown.stories.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/markdownTheme.d.ts +10 -17
- package/dist/types/src/components/Markdown/markdownTheme.d.ts.map +1 -1
- package/dist/types/src/components/RichText/RichText.stories.d.ts +2 -3
- 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 +18 -0
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkDecoration.d.ts +11 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkDecoration.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkTooltip.d.ts +8 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkTooltip.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkWidget.d.ts +10 -0
- package/dist/types/src/components/TextEditor/extensions/hyperlinkWidget.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/index.d.ts +4 -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 +9 -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/dist/types/stories/html/code-mirror.stories.d.ts.map +1 -1
- package/package.json +30 -27
- package/src/automerge/automerge-plugin/PatchSemaphore.ts +5 -5
- package/src/automerge/automerge-plugin/codeMirrorToAm.ts +10 -7
- package/src/automerge/automerge-plugin/handle.ts +14 -0
- package/src/automerge/automerge-plugin/index.ts +2 -2
- package/src/automerge/automerge-plugin/plugin.ts +39 -10
- package/src/automerge/automerge.stories.tsx +31 -47
- package/src/components/Editor/Editor.stories.tsx +7 -7
- package/src/components/Editor/Editor.tsx +6 -3
- package/src/components/Markdown/Markdown.stories.tsx +39 -25
- package/src/components/Markdown/Markdown.tsx +63 -30
- package/src/components/Markdown/markdownTheme.ts +32 -17
- package/src/components/RichText/RichText.stories.tsx +37 -33
- package/src/components/TextEditor/TextEditor.stories.tsx +72 -0
- package/src/components/TextEditor/TextEditor.tsx +131 -0
- package/src/components/TextEditor/extensions/hyperlinkDecoration.ts +99 -0
- package/src/components/TextEditor/extensions/hyperlinkTooltip.tsx +61 -0
- package/src/components/TextEditor/extensions/hyperlinkWidget.tsx +119 -0
- package/src/components/TextEditor/extensions/index.ts +7 -0
- package/src/components/TextEditor/index.ts +11 -0
- package/src/components/TextEditor/theme.ts +35 -0
- package/src/components/index.ts +1 -0
- package/src/testing/replicator.ts +0 -1
- package/dist/types/src/automerge/demo.d.ts +0 -25
- package/dist/types/src/automerge/demo.d.ts.map +0 -1
- package/src/automerge/demo.ts +0 -106
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type EditorState, type Extension, StateEffect, StateField, type Transaction, type TransactionSpec } from '@codemirror/state';
|
|
2
|
-
import { type EditorView } from '@codemirror/view';
|
|
3
2
|
import * as automerge from '@dxos/automerge/automerge';
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
3
|
+
import { type Heads, type Prop } from '@dxos/automerge/automerge';
|
|
4
|
+
import { type IDocHandle } from './handle';
|
|
6
5
|
export type Value = {
|
|
7
6
|
lastHeads: Heads;
|
|
8
7
|
path: Prop[];
|
|
@@ -16,10 +15,12 @@ export declare const updateHeads: (newHeads: automerge.next.Heads) => StateEffec
|
|
|
16
15
|
export declare const getLastHeads: (state: EditorState, field: Field) => automerge.next.Heads;
|
|
17
16
|
export declare const getPath: (state: EditorState, field: Field) => Prop[];
|
|
18
17
|
export type Field = StateField<Value>;
|
|
19
|
-
export
|
|
18
|
+
export type AutomergePlugin = {
|
|
19
|
+
extension: Extension;
|
|
20
|
+
};
|
|
21
|
+
export declare const automergePlugin: (handle: IDocHandle, path: Prop[]) => AutomergePlugin;
|
|
20
22
|
export declare const reconcileAnnotationType: import("@codemirror/state").AnnotationType<unknown>;
|
|
21
23
|
export declare const isReconcileTx: (tr: Transaction) => boolean;
|
|
22
24
|
export declare const makeReconcile: (tr: TransactionSpec) => void;
|
|
23
|
-
export declare const reconcile: (handle: Peer, view: EditorView) => void;
|
|
24
25
|
export {};
|
|
25
26
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,WAAW,EACX,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../src/automerge/automerge-plugin/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,WAAW,EACX,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,wBAAwB,EAAE,WAAW,EAAE,CAAC;CACzC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,0DAAsC,CAAC;AAE9D,eAAO,MAAM,WAAW,sCAAsB,YAAY,WAAW,CAAgC,CAAC;AAEtG,eAAO,MAAM,YAAY,UAAW,WAAW,uCAAsD,CAAC;AAEtG,eAAO,MAAM,OAAO,UAAW,WAAW,mBAAiB,IAAI,EAA6B,CAAC;AAE7F,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAMtC,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,QAAQ,IAAI,EAAE,KAAG,eA8DlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qDAA+B,CAAC;AAEpE,eAAO,MAAM,aAAa,OAAQ,WAAW,KAAG,OAAmD,CAAC;AAEpG,eAAO,MAAM,aAAa,OAAQ,eAAe,SAchD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automerge.stories.d.ts","sourceRoot":"","sources":["../../../../src/automerge/automerge.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"automerge.stories.d.ts","sourceRoot":"","sources":["../../../../src/automerge/automerge.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,uBAAuB,CAAC;;;;AA8E/B,wBAEE;AAEF,eAAO,MAAM,WAAW;;CAEvB,CAAC"}
|
|
@@ -6,7 +6,6 @@ export type EditorProps = UseTextModelOptions & {
|
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Memoized editor which depends on DXOS platform.
|
|
9
|
-
*
|
|
10
9
|
* Determines which editor to render based on the kind of text.
|
|
11
10
|
*/
|
|
12
11
|
export declare const Editor: React.MemoExoticComponent<React.ForwardRefExoticComponent<UseTextModelOptions & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,OAAO,EAAE,KAAK,WAAW,EAAgB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrE,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG;IAC9C,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAI1D,OAAO,EAAE,KAAK,WAAW,EAAgB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrE,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG;IAC9C,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF;;;GAGG;AAGH,eAAO,MAAM,MAAM;;6EAalB,CAAC"}
|
|
@@ -4,18 +4,14 @@ declare const _default: {
|
|
|
4
4
|
component: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../..").UseTextModelOptions & {
|
|
5
5
|
slots?: import("../..").EditorSlots | undefined;
|
|
6
6
|
} & React.RefAttributes<import("..").MarkdownEditorRef | import("@tiptap/react").Editor>>>;
|
|
7
|
+
decorators: import("@storybook/react").Decorator[];
|
|
7
8
|
};
|
|
8
9
|
export default _default;
|
|
9
10
|
export declare const Markdown: {
|
|
10
|
-
render: (
|
|
11
|
-
id: number;
|
|
12
|
-
}) => JSX.Element;
|
|
13
|
-
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0a347bb9").R, any>[];
|
|
11
|
+
render: () => JSX.Element;
|
|
14
12
|
};
|
|
15
13
|
export declare const Rich: {
|
|
16
|
-
render: (
|
|
17
|
-
id: number;
|
|
18
|
-
}) => JSX.Element;
|
|
14
|
+
render: () => JSX.Element;
|
|
19
15
|
args: {
|
|
20
16
|
slots: {
|
|
21
17
|
editor: {
|
|
@@ -23,6 +19,5 @@ export declare const Rich: {
|
|
|
23
19
|
};
|
|
24
20
|
};
|
|
25
21
|
};
|
|
26
|
-
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0a347bb9").R, any>[];
|
|
27
22
|
};
|
|
28
23
|
//# sourceMappingURL=Editor.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Editor/Editor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;;AAYxC,wBAGE;AAoCF,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAWF,eAAO,MAAM,IAAI;;;;;;;;;CAShB,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { EditorState, type Text } from '@codemirror/state';
|
|
1
|
+
import { EditorState, type Extension, type Text } from '@codemirror/state';
|
|
2
2
|
import { EditorView } from '@codemirror/view';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { type EditorModel, type EditorSlots } from '../../model';
|
|
5
5
|
export declare const EditorModes: readonly ["default", "vim"];
|
|
6
6
|
export type EditorMode = (typeof EditorModes)[number];
|
|
7
7
|
export type MarkdownEditorProps = {
|
|
8
|
-
model
|
|
8
|
+
model: EditorModel;
|
|
9
9
|
slots?: EditorSlots;
|
|
10
10
|
editorMode?: EditorMode;
|
|
11
|
+
showWidgets?: boolean;
|
|
12
|
+
extensions?: Extension[];
|
|
11
13
|
onChange?: (content: string | Text) => void;
|
|
12
14
|
};
|
|
13
15
|
export type MarkdownEditorRef = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAc,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAc,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,EAUL,UAAU,EACX,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,WAAW,6BAA8B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,+FAsK1B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import '@dxosTheme';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
component: React.ForwardRefExoticComponent<import("./Markdown").MarkdownEditorProps & React.RefAttributes<import("./Markdown").MarkdownEditorRef>>;
|
|
5
|
+
decorators: import("@storybook/react").Decorator[];
|
|
5
6
|
};
|
|
6
7
|
export default _default;
|
|
7
8
|
export declare const Default: {
|
|
@@ -14,6 +15,5 @@ export declare const Default: {
|
|
|
14
15
|
};
|
|
15
16
|
export declare const WithYjs: {
|
|
16
17
|
render: () => JSX.Element;
|
|
17
|
-
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0a347bb9").R, any>[];
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=Markdown.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"Markdown.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/Markdown.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;AAWxC,wBAGE;AAYF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AA2BF,eAAO,MAAM,OAAO;;CAGnB,CAAC"}
|
|
@@ -13,23 +13,9 @@ export declare const highlightBackground = "#2c313a";
|
|
|
13
13
|
export declare const tooltipBackground = "#353a42";
|
|
14
14
|
export declare const cursor = "#ffffff";
|
|
15
15
|
export declare const markdownTheme: {
|
|
16
|
-
'.
|
|
17
|
-
border: string;
|
|
16
|
+
'.cm-tooltip': {
|
|
18
17
|
backgroundColor: string;
|
|
19
|
-
|
|
20
|
-
'.dark & .cm-tooltip .cm-tooltip-arrow:before': {
|
|
21
|
-
borderTopColor: string;
|
|
22
|
-
borderBottomColor: string;
|
|
23
|
-
};
|
|
24
|
-
'.dark & .cm-tooltip .cm-tooltip-arrow:after': {
|
|
25
|
-
borderTopColor: string;
|
|
26
|
-
borderBottomColor: string;
|
|
27
|
-
};
|
|
28
|
-
'.dark & .cm-tooltip-autocomplete': {
|
|
29
|
-
'& > ul > li[aria-selected]': {
|
|
30
|
-
backgroundColor: string;
|
|
31
|
-
color: string;
|
|
32
|
-
};
|
|
18
|
+
border: string;
|
|
33
19
|
};
|
|
34
20
|
'&.cm-focused': {
|
|
35
21
|
outline: string;
|
|
@@ -102,6 +88,13 @@ export declare const markdownTheme: {
|
|
|
102
88
|
'& .cm-yLineSelection': {
|
|
103
89
|
margin: string;
|
|
104
90
|
};
|
|
91
|
+
'.cm-link': {
|
|
92
|
+
color: string;
|
|
93
|
+
textDecorationLine: string;
|
|
94
|
+
textDecorationThickness: string;
|
|
95
|
+
textUnderlineOffset: string;
|
|
96
|
+
borderRadius: string;
|
|
97
|
+
};
|
|
105
98
|
};
|
|
106
|
-
export declare const
|
|
99
|
+
export declare const markdownHighlightStyle: HighlightStyle;
|
|
107
100
|
//# sourceMappingURL=markdownTheme.d.ts.map
|
|
@@ -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;
|
|
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;AAQhC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmJzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBA6ElC,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import '@dxosTheme';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { type RichTextEditorProps } from './RichText';
|
|
4
3
|
declare const _default: {
|
|
5
4
|
component: React.ForwardRefExoticComponent<{
|
|
6
5
|
model?: import("../..").EditorModel | undefined;
|
|
@@ -9,6 +8,7 @@ declare const _default: {
|
|
|
9
8
|
} & {
|
|
10
9
|
slots?: import("../..").EditorSlots | undefined;
|
|
11
10
|
} & React.RefAttributes<import("@tiptap/react").Editor | null>>;
|
|
11
|
+
decorators: import("@storybook/react").Decorator[];
|
|
12
12
|
};
|
|
13
13
|
export default _default;
|
|
14
14
|
export declare const Default: {
|
|
@@ -20,7 +20,6 @@ export declare const Default: {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export declare const WithYjs: {
|
|
23
|
-
render: (
|
|
24
|
-
decorators: import("@storybook/csf").DecoratorFunction<import("@storybook/react/dist/types-0a347bb9").R, any>[];
|
|
23
|
+
render: () => JSX.Element;
|
|
25
24
|
};
|
|
26
25
|
//# 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;;;;;;;;;;;AAYxC,wBAGE;AAEF,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAC;AAsCF,eAAO,MAAM,OAAO;;CAGnB,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;0GAkF7D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import '@dxosTheme';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
component: React.ForwardRefExoticComponent<{
|
|
5
|
+
model?: import("../../model").EditorModel | undefined;
|
|
6
|
+
extensions?: import("@codemirror/state").Extension[] | undefined;
|
|
7
|
+
theme?: {
|
|
8
|
+
[selector: string]: import("style-mod").StyleSpec;
|
|
9
|
+
} | undefined;
|
|
10
|
+
slots?: import("../../model").EditorSlots | undefined;
|
|
11
|
+
onKeyDown?: ((event: React.KeyboardEvent<Element>, info: import("./TextEditor").CursorInfo) => void) | undefined;
|
|
12
|
+
} & Pick<React.HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur"> & React.RefAttributes<import("./TextEditor").TextEditorRef>>;
|
|
13
|
+
decorators: import("@storybook/react").Decorator[];
|
|
14
|
+
render: () => JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
17
|
+
export declare const Default: {};
|
|
18
|
+
//# 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;AAGpB,OAAO,KAA+B,MAAM,OAAO,CAAC;;;;;;;;;;;;;;AA0DpD,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RangeSet, StateField } from '@codemirror/state';
|
|
2
|
+
type HyperlinkDecorationConfig = {
|
|
3
|
+
link?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Creates a state field to replace AST elements with a hyperlink widget.
|
|
7
|
+
* https://codemirror.net/docs/ref/#state.StateField
|
|
8
|
+
*/
|
|
9
|
+
export declare const hyperlinkDecoration: ({ link }?: HyperlinkDecorationConfig) => StateField<RangeSet<any>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=hyperlinkDecoration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlinkDecoration.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlinkDecoration.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,QAAQ,EAAmB,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AA6CnH,KAAK,yBAAyB,GAAG;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,cAAc,yBAAyB,8BAMtE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
//# 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":"AAUA,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAElE;;;;GAIG;AAEH,eAAO,MAAM,sBAAsB,YAAa,gBAAgB,2DA0C5D,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 hyperlinkWidget: Extension;
|
|
10
|
+
//# sourceMappingURL=hyperlinkWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlinkWidget.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/hyperlinkWidget.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;AAuD1B,wBAAgB,kBAAkB;wBAGR,cAAc;;mBAOnB,UAAU;GAwB9B;AAED,eAAO,MAAM,cAAc,WAYzB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,SAAkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,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;;;GAGG;AAEH,eAAO,MAAM,aAAa,EAAE;IAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAiB/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-mirror.stories.d.ts","sourceRoot":"","sources":["../../../../stories/html/code-mirror.stories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code-mirror.stories.d.ts","sourceRoot":"","sources":["../../../../stories/html/code-mirror.stories.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhD,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;;;;AAS5D,wBAEE;AAoEF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAoBjF,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.501fe30",
|
|
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,16 +13,16 @@
|
|
|
13
13
|
"src"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@codemirror/autocomplete": "^6.11.
|
|
17
|
-
"@codemirror/commands": "^6.3.
|
|
18
|
-
"@codemirror/lang-markdown": "^6.2.
|
|
19
|
-
"@codemirror/language": "^6.9.
|
|
16
|
+
"@codemirror/autocomplete": "^6.11.1",
|
|
17
|
+
"@codemirror/commands": "^6.3.2",
|
|
18
|
+
"@codemirror/lang-markdown": "^6.2.3",
|
|
19
|
+
"@codemirror/language": "^6.9.3",
|
|
20
20
|
"@codemirror/language-data": "^6.3.1",
|
|
21
21
|
"@codemirror/lint": "^6.4.2",
|
|
22
|
-
"@codemirror/search": "^6.5.
|
|
23
|
-
"@codemirror/state": "^6.3.
|
|
22
|
+
"@codemirror/search": "^6.5.5",
|
|
23
|
+
"@codemirror/state": "^6.3.3",
|
|
24
24
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
25
|
-
"@codemirror/view": "^6.22.
|
|
25
|
+
"@codemirror/view": "^6.22.2",
|
|
26
26
|
"@fluentui/react-tabster": "^9.12.0",
|
|
27
27
|
"@lezer/common": "^1.1.1",
|
|
28
28
|
"@lezer/highlight": "^1.2.0",
|
|
@@ -37,44 +37,47 @@
|
|
|
37
37
|
"@tiptap/pm": "2.0.0-beta.220",
|
|
38
38
|
"@tiptap/react": "2.0.0-beta.220",
|
|
39
39
|
"@tiptap/starter-kit": "2.0.0-beta.220",
|
|
40
|
-
"codemirror": "
|
|
40
|
+
"codemirror": "6.0.1",
|
|
41
41
|
"lib0": "^0.2.65",
|
|
42
42
|
"lodash.get": "^4.4.2",
|
|
43
43
|
"prosemirror-model": "^1.19.0",
|
|
44
44
|
"prosemirror-state": "^1.4.2",
|
|
45
45
|
"prosemirror-view": "^1.30.1",
|
|
46
|
+
"style-mod": "^4.1.0",
|
|
46
47
|
"y-codemirror.next": "^0.3.2",
|
|
47
48
|
"y-prosemirror": "~1.0.20",
|
|
48
49
|
"y-protocols": "^1.0.5",
|
|
49
|
-
"yjs": "^13.6.
|
|
50
|
-
"@dxos/debug": "0.3.9-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/protocols": "0.3.9-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/react-ui
|
|
56
|
-
"@dxos/react-
|
|
57
|
-
"@dxos/util": "0.3.9-main.
|
|
58
|
-
"@dxos/text-model": "0.3.9-main.
|
|
50
|
+
"yjs": "^13.6.10",
|
|
51
|
+
"@dxos/debug": "0.3.9-main.501fe30",
|
|
52
|
+
"@dxos/display-name": "0.3.9-main.501fe30",
|
|
53
|
+
"@dxos/protocols": "0.3.9-main.501fe30",
|
|
54
|
+
"@dxos/react-async": "0.3.9-main.501fe30",
|
|
55
|
+
"@dxos/log": "0.3.9-main.501fe30",
|
|
56
|
+
"@dxos/react-ui": "0.3.9-main.501fe30",
|
|
57
|
+
"@dxos/react-ui-theme": "0.3.9-main.501fe30",
|
|
58
|
+
"@dxos/util": "0.3.9-main.501fe30",
|
|
59
|
+
"@dxos/text-model": "0.3.9-main.501fe30"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
62
|
+
"@automerge/automerge-repo-network-broadcastchannel": "^1.0.19",
|
|
63
|
+
"@phosphor-icons/react": "^2.0.5",
|
|
63
64
|
"@types/lodash.get": "^4.4.7",
|
|
64
65
|
"@types/react": "^18.0.21",
|
|
65
66
|
"@types/react-dom": "^18.0.6",
|
|
66
67
|
"react": "^18.2.0",
|
|
67
68
|
"react-dom": "^18.2.0",
|
|
68
|
-
"@dxos/automerge": "0.3.9-main.
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/echo-schema": "0.3.9-main.
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
69
|
+
"@dxos/automerge": "0.3.9-main.501fe30",
|
|
70
|
+
"@dxos/echo-typegen": "0.3.9-main.501fe30",
|
|
71
|
+
"@dxos/echo-schema": "0.3.9-main.501fe30",
|
|
72
|
+
"@dxos/react-client": "0.3.9-main.501fe30",
|
|
73
|
+
"@dxos/storybook-utils": "0.3.9-main.501fe30",
|
|
74
|
+
"@dxos/config": "0.3.9-main.501fe30"
|
|
73
75
|
},
|
|
74
76
|
"peerDependencies": {
|
|
77
|
+
"@phosphor-icons/react": "^2.0.5",
|
|
75
78
|
"react": "^18.2.0",
|
|
76
79
|
"react-dom": "^18.2.0",
|
|
77
|
-
"@dxos/react-client": "0.3.9-main.
|
|
80
|
+
"@dxos/react-client": "0.3.9-main.501fe30"
|
|
78
81
|
},
|
|
79
82
|
"publishConfig": {
|
|
80
83
|
"access": "public"
|
|
@@ -8,8 +8,8 @@ import { next as automerge } from '@dxos/automerge/automerge';
|
|
|
8
8
|
|
|
9
9
|
import amToCodemirror from './amToCodemirror';
|
|
10
10
|
import codeMirrorToAm from './codeMirrorToAm';
|
|
11
|
+
import { type IDocHandle } from './handle';
|
|
11
12
|
import { type Field, isReconcileTx, getPath, reconcileAnnotationType, updateHeads, getLastHeads } from './plugin';
|
|
12
|
-
import { type Peer } from '../demo';
|
|
13
13
|
|
|
14
14
|
type Doc<T> = automerge.Doc<T>;
|
|
15
15
|
type Heads = automerge.Heads;
|
|
@@ -27,8 +27,8 @@ export class PatchSemaphore {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
reconcile = (handle:
|
|
31
|
-
if (
|
|
30
|
+
reconcile = (handle: IDocHandle, view: EditorView) => {
|
|
31
|
+
if (this._inReconcile) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
this._inReconcile = true;
|
|
@@ -56,12 +56,12 @@ export class PatchSemaphore {
|
|
|
56
56
|
// NOTE: null and undefined each come from automerge and repo respectively
|
|
57
57
|
if (newHeads === null || newHeads === undefined) {
|
|
58
58
|
// TODO: @alexjg this is the call that's resetting the editor state on click
|
|
59
|
-
newHeads = automerge.getHeads(handle.
|
|
59
|
+
newHeads = automerge.getHeads(handle.docSync()!);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// now get the diff between the updated state of the document and the heads
|
|
63
63
|
// and apply that to the codemirror doc
|
|
64
|
-
const diff = automerge.equals(oldHeads, newHeads) ? [] : automerge.diff(handle.
|
|
64
|
+
const diff = automerge.equals(oldHeads, newHeads) ? [] : automerge.diff(handle.docSync()!, oldHeads, newHeads);
|
|
65
65
|
amToCodemirror(view, selection, path, diff);
|
|
66
66
|
|
|
67
67
|
view.dispatch({
|
|
@@ -6,21 +6,24 @@ import { type EditorState, type Text, type Transaction } from '@codemirror/state
|
|
|
6
6
|
|
|
7
7
|
import { next as am, type Heads } from '@dxos/automerge/automerge';
|
|
8
8
|
|
|
9
|
+
import { type IDocHandle } from './handle';
|
|
9
10
|
import { type Field } from './plugin';
|
|
10
|
-
import { type Peer } from '../demo';
|
|
11
11
|
|
|
12
|
-
export default (
|
|
12
|
+
export default (
|
|
13
|
+
field: Field,
|
|
14
|
+
handle: IDocHandle,
|
|
15
|
+
transactions: Transaction[],
|
|
16
|
+
state: EditorState,
|
|
17
|
+
): Heads | undefined => {
|
|
13
18
|
const { lastHeads, path } = state.field(field);
|
|
14
19
|
|
|
15
20
|
// We don't want to call `automerge.updateAt` if there are no changes.
|
|
16
21
|
// Otherwise later on `automerge.diff` will return empty patches that result in a no-op but still mess up the selection.
|
|
17
22
|
let hasChanges = false;
|
|
18
23
|
for (const tr of transactions) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
+
tr.changes.iterChanges(() => {
|
|
25
|
+
hasChanges = true;
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
if (!hasChanges) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as A from '@dxos/automerge/automerge';
|
|
6
|
+
|
|
7
|
+
export type IDocHandle<T = any> = {
|
|
8
|
+
docSync(): A.Doc<T> | undefined;
|
|
9
|
+
change(callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): void;
|
|
10
|
+
changeAt(heads: A.Heads, callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): string[] | undefined;
|
|
11
|
+
|
|
12
|
+
addListener(event: 'change', listener: () => void): void;
|
|
13
|
+
removeListener(event: 'change', listener: () => void): void;
|
|
14
|
+
};
|