@dxos/react-ui-editor 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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 +371 -499
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +379 -515
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +371 -499
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/{stories/InputMode.stories.d.ts → InputMode.stories.d.ts} +1 -1
- package/dist/types/src/InputMode.stories.d.ts.map +1 -0
- package/dist/types/src/{stories/TextEditorBasic.stories.d.ts → TextEditor.stories.d.ts} +35 -2
- package/dist/types/src/TextEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/EditorToolbar/util.d.ts +3 -3
- package/dist/types/src/components/EditorToolbar/util.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/{view-mode.d.ts → viewMode.d.ts} +1 -1
- package/dist/types/src/components/EditorToolbar/viewMode.d.ts.map +1 -0
- package/dist/types/src/defaults.d.ts +0 -1
- package/dist/types/src/defaults.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/command/command.d.ts +10 -5
- package/dist/types/src/extensions/command/command.d.ts.map +1 -1
- package/dist/types/src/extensions/command/hint.d.ts +2 -4
- package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
- package/dist/types/src/extensions/command/index.d.ts +0 -1
- package/dist/types/src/extensions/command/index.d.ts.map +1 -1
- package/dist/types/src/extensions/command/menu.d.ts +2 -7
- package/dist/types/src/extensions/command/menu.d.ts.map +1 -1
- package/dist/types/src/extensions/command/preview.d.ts +12 -0
- package/dist/types/src/extensions/command/preview.d.ts.map +1 -0
- package/dist/types/src/extensions/command/state.d.ts +11 -9
- package/dist/types/src/extensions/command/state.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts +7 -9
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +0 -1
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts +1 -4
- package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/formatting.d.ts +2 -2
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/link.d.ts +1 -4
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -1
- package/dist/types/src/fragments.d.ts +3 -0
- package/dist/types/src/fragments.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextEditor.d.ts +1 -2
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +0 -5
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/react.d.ts +1 -6
- package/dist/types/src/util/react.d.ts.map +1 -1
- package/package.json +27 -33
- package/src/{stories/InputMode.stories.tsx → InputMode.stories.tsx} +4 -4
- package/src/TextEditor.stories.tsx +856 -0
- package/src/components/EditorToolbar/EditorToolbar.tsx +2 -2
- package/src/components/EditorToolbar/util.ts +3 -3
- package/src/defaults.ts +3 -5
- package/src/extensions/automerge/automerge.stories.tsx +11 -3
- package/src/extensions/command/command.ts +27 -9
- package/src/extensions/command/hint.ts +30 -33
- package/src/extensions/command/index.ts +0 -1
- package/src/extensions/command/menu.ts +8 -11
- package/src/extensions/command/preview.ts +79 -0
- package/src/extensions/command/state.ts +61 -41
- package/src/extensions/comments.ts +9 -9
- package/src/extensions/folding.tsx +1 -1
- package/src/extensions/index.ts +0 -1
- package/src/extensions/markdown/decorate.ts +3 -4
- package/src/extensions/markdown/formatting.ts +2 -2
- package/src/extensions/markdown/image.ts +11 -12
- package/src/extensions/markdown/link.ts +24 -33
- package/src/fragments.ts +19 -0
- package/src/hooks/useTextEditor.ts +3 -4
- package/src/types.ts +0 -7
- package/src/util/react.tsx +2 -20
- package/dist/lib/browser/testing/index.mjs +0 -67
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -101
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -69
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +0 -1
- package/dist/types/src/extensions/command/action.d.ts +0 -17
- package/dist/types/src/extensions/command/action.d.ts.map +0 -1
- package/dist/types/src/extensions/preview/index.d.ts +0 -2
- package/dist/types/src/extensions/preview/index.d.ts.map +0 -1
- package/dist/types/src/extensions/preview/preview.d.ts +0 -39
- package/dist/types/src/extensions/preview/preview.d.ts.map +0 -1
- package/dist/types/src/stories/InputMode.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorBasic.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorComments.stories.d.ts +0 -13
- package/dist/types/src/stories/TextEditorComments.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts +0 -13
- package/dist/types/src/stories/TextEditorPreview.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts +0 -19
- package/dist/types/src/stories/TextEditorSpecial.stories.d.ts.map +0 -1
- package/dist/types/src/stories/story-utils.d.ts +0 -53
- package/dist/types/src/stories/story-utils.d.ts.map +0 -1
- package/dist/types/src/testing/RefPopover.d.ts +0 -21
- package/dist/types/src/testing/RefPopover.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/src/extensions/command/action.ts +0 -49
- package/src/extensions/preview/index.ts +0 -5
- package/src/extensions/preview/preview.ts +0 -271
- package/src/stories/TextEditorBasic.stories.tsx +0 -289
- package/src/stories/TextEditorComments.stories.tsx +0 -99
- package/src/stories/TextEditorPreview.stories.tsx +0 -239
- package/src/stories/TextEditorSpecial.stories.tsx +0 -107
- package/src/stories/story-utils.tsx +0 -329
- package/src/testing/RefPopover.tsx +0 -74
- package/src/testing/index.ts +0 -5
- /package/src/components/EditorToolbar/{view-mode.ts → viewMode.ts} +0 -0
@@ -1,11 +1,6 @@
|
|
1
1
|
import { type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
2
|
-
import { type
|
3
|
-
export
|
4
|
-
renderMenu: RenderCallback<{
|
5
|
-
onAction: () => void;
|
6
|
-
}>;
|
7
|
-
};
|
8
|
-
export declare const floatingMenu: (options: FloatingMenuOptions) => ViewPlugin<{
|
2
|
+
import { type CommandOptions } from './command';
|
3
|
+
export declare const floatingMenu: (options: CommandOptions) => ViewPlugin<{
|
9
4
|
button: HTMLElement;
|
10
5
|
view: EditorView;
|
11
6
|
rafId: number | null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/menu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/menu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAKhD,eAAO,MAAM,YAAY,YAAa,cAAc;YAGtC,WAAW;UACb,UAAU;WACT,MAAM,GAAG,IAAI;mBA2BL,UAAU;;;;EAwD5B,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { type Extension } from '@codemirror/state';
|
2
|
+
export type PreviewOptions = {
|
3
|
+
onRenderPreview: (el: HTMLElement, props: {
|
4
|
+
url: string;
|
5
|
+
text: string;
|
6
|
+
}) => void;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Create image decorations.
|
10
|
+
*/
|
11
|
+
export declare const preview: (options: PreviewOptions) => Extension;
|
12
|
+
//# sourceMappingURL=preview.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/preview.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,YAAa,cAAc,KAAG,SASjD,CAAC"}
|
@@ -1,16 +1,18 @@
|
|
1
1
|
import { StateField } from '@codemirror/state';
|
2
|
-
import { type Tooltip } from '@codemirror/view';
|
3
|
-
import { type
|
4
|
-
import { type RenderCallback } from '../../types';
|
5
|
-
export declare const commandConfig: import("@codemirror/state").Facet<Partial<PopupOptions & import("./menu").FloatingMenuOptions & import("./hint").HintOptions>, Partial<PopupOptions & import("./menu").FloatingMenuOptions & import("./hint").HintOptions>>;
|
6
|
-
export type PopupOptions = {
|
7
|
-
renderDialog: RenderCallback<{
|
8
|
-
onAction: (action?: Action) => void;
|
9
|
-
}>;
|
10
|
-
};
|
2
|
+
import { type Command, type KeyBinding, type Tooltip } from '@codemirror/view';
|
3
|
+
import { type CommandOptions } from './command';
|
11
4
|
type CommandState = {
|
12
5
|
tooltip?: Tooltip | null;
|
13
6
|
};
|
7
|
+
export declare const commandConfig: import("@codemirror/state").Facet<CommandOptions, CommandOptions>;
|
14
8
|
export declare const commandState: StateField<CommandState>;
|
9
|
+
export declare const openEffect: import("@codemirror/state").StateEffectType<{
|
10
|
+
pos: number;
|
11
|
+
fullWidth?: boolean;
|
12
|
+
}>;
|
13
|
+
export declare const closeEffect: import("@codemirror/state").StateEffectType<null>;
|
14
|
+
export declare const openCommand: Command;
|
15
|
+
export declare const closeCommand: Command;
|
16
|
+
export declare const commandKeyBindings: readonly KeyBinding[];
|
15
17
|
export {};
|
16
18
|
//# sourceMappingURL=state.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/state.ts"],"names":[],"mappings":"AAIA,OAAO,
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,mEAAqC,CAAC;AAEhE,eAAO,MAAM,YAAY,0BAwDvB,CAAC;AAEH,eAAO,MAAM,UAAU;SAA6B,MAAM;gBAAc,OAAO;EAAK,CAAC;AACrF,eAAO,MAAM,WAAW,mDAA6B,CAAC;AAEtD,eAAO,MAAM,WAAW,EAAE,OAWzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,OAO1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EAGnD,CAAC"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { type EditorState, type Extension, StateField } from '@codemirror/state';
|
2
2
|
import { type Command, EditorView, type Rect } from '@codemirror/view';
|
3
3
|
import { type CleanupFn } from '@dxos/async';
|
4
|
-
import { type
|
4
|
+
import { type ReactiveObject } from '@dxos/live-object';
|
5
5
|
import { type EditorToolbarState } from '../components';
|
6
|
-
import { type
|
6
|
+
import { type Comment, type Range } from '../types';
|
7
7
|
type CommentState = {
|
8
8
|
comment: Comment;
|
9
9
|
range: Range;
|
@@ -41,12 +41,6 @@ export type CommentsOptions = {
|
|
41
41
|
* Key shortcut to create a new thread.
|
42
42
|
*/
|
43
43
|
key?: string;
|
44
|
-
/**
|
45
|
-
* Called to render tooltip.
|
46
|
-
*/
|
47
|
-
renderTooltip?: RenderCallback<{
|
48
|
-
shortcut: string;
|
49
|
-
}>;
|
50
44
|
/**
|
51
45
|
* Called to create a new thread and return the thread id.
|
52
46
|
*/
|
@@ -72,6 +66,10 @@ export type CommentsOptions = {
|
|
72
66
|
* Called to notify which thread is currently closest to the cursor.
|
73
67
|
*/
|
74
68
|
onSelect?: (state: CommentsState) => void;
|
69
|
+
/**
|
70
|
+
* Called to render tooltip.
|
71
|
+
*/
|
72
|
+
onHover?: (el: Element, shortcut: string) => void;
|
75
73
|
};
|
76
74
|
/**
|
77
75
|
* Comment threads.
|
@@ -91,7 +89,7 @@ export declare const scrollThreadIntoView: (view: EditorView, id: string, center
|
|
91
89
|
*/
|
92
90
|
export declare const selectionOverlapsComment: (state: EditorState) => boolean;
|
93
91
|
export declare const createExternalCommentSync: (id: string, subscribe: (sink: () => void) => CleanupFn, getComments: () => Comment[]) => Extension;
|
94
|
-
export declare const useCommentState: (state:
|
92
|
+
export declare const useCommentState: (state: ReactiveObject<EditorToolbarState>) => Extension;
|
95
93
|
/**
|
96
94
|
* @deprecated This hook will be removed in future versions. Use the new comment sync extension instead.
|
97
95
|
* Update comments state field.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../src/extensions/comments.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,UAAU,EAEX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAG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GAGG;AACH,eAAO,MAAM,WAAW,SAAU,UAAU,GAAG,IAAI,GAAG,SAAS,MAAM,MAAM,aAAa,OAAO,EAAE,SAYhG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,mBAAoB,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAG,SAcrF,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { type RenderCallback } from '../../types';
|
2
1
|
export interface DecorateOptions {
|
3
2
|
/**
|
4
3
|
* Prevents triggering decorations as the cursor moves through the document.
|
@@ -8,9 +7,7 @@ export interface DecorateOptions {
|
|
8
7
|
from: number;
|
9
8
|
to?: number;
|
10
9
|
};
|
11
|
-
renderLinkButton?:
|
12
|
-
url: string;
|
13
|
-
}>;
|
10
|
+
renderLinkButton?: (el: Element, url: string) => void;
|
14
11
|
}
|
15
12
|
export declare const decorateMarkdown: (options?: DecorateOptions) => import("@codemirror/state").Extension[];
|
16
13
|
//# sourceMappingURL=decorate.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/decorate.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/decorate.ts"],"names":[],"mappings":"AAmgBA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAED,eAAO,MAAM,gBAAgB,aAAa,eAAe,4CAgExD,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type Extension, type StateCommand, type EditorState } from '@codemirror/state';
|
2
2
|
import { EditorView } from '@codemirror/view';
|
3
|
-
import { type
|
3
|
+
import { type ReactiveObject } from '@dxos/live-object';
|
4
4
|
import { type EditorToolbarState } from '../../components';
|
5
5
|
export type Formatting = Partial<{
|
6
6
|
blankLine: boolean;
|
@@ -59,5 +59,5 @@ export declare const getFormatting: (state: EditorState) => Formatting;
|
|
59
59
|
/**
|
60
60
|
* Hook provides an extension to compute the current formatting state.
|
61
61
|
*/
|
62
|
-
export declare const useFormattingState: (state:
|
62
|
+
export declare const useFormattingState: (state: ReactiveObject<EditorToolbarState>) => Extension;
|
63
63
|
//# sourceMappingURL=formatting.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IAGnB,SAAS,EACL,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,IAAI,CAAC;IAET,UAAU,EAAE,OAAO,CAAC;IAEpB,MAAM,EAAE,OAAO,CAAC;IAEhB,QAAQ,EAAE,OAAO,CAAC;IAElB,aAAa,EAAE,OAAO,CAAC;IAEvB,IAAI,EAAE,OAAO,CAAC;IAEd,IAAI,EAAE,OAAO,CAAC;IAEd,SAAS,EAAE,I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cAAsB,CAAC;AAEjD,eAAO,MAAM,gBAAgB,cAAuB,CAAC;AAErD,eAAO,MAAM,gBAAgB,EAAE,YAE9B,CAAC;AAMF,eAAO,MAAM,YAAY,EAAE,YA8D1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YA0C7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,YAE7B,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEnC,eAAO,MAAM,gBAAgB,cAAc,iBAAiB,KAAQ,SAanE,CAAC;AA4CF;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,WAAW,KAAG,UAqKlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,UAAW,cAAc,CAAC,kBAAkB,CAAC,KAAG,SAY9E,CAAC"}
|
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
export declare const linkTooltip: (renderTooltip: RenderCallback<{
|
3
|
-
url: string;
|
4
|
-
}>) => import("@codemirror/state").Extension & {
|
1
|
+
export declare const linkTooltip: (render: (el: HTMLElement, url: string) => void) => import("@codemirror/state").Extension & {
|
5
2
|
active: import("@codemirror/state").StateField<readonly import("@codemirror/view").Tooltip[]>;
|
6
3
|
};
|
7
4
|
//# sourceMappingURL=link.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/link.ts"],"names":[],"mappings":"AAWA,
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/link.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,WAAW,WAAY,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI;;CA0BzE,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/fragments.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gCAAgC,UAAW,MAAM,WAI3D,CAAC;AAEJ,eAAO,MAAM,iCAAiC,UAAW,MAAM,WAI5D,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type EditorStateConfig
|
1
|
+
import { type EditorStateConfig } from '@codemirror/state';
|
2
2
|
import { EditorView } from '@codemirror/view';
|
3
3
|
import { type TabsterTypes } from '@fluentui/react-tabster';
|
4
4
|
import { type DependencyList, type KeyboardEventHandler, type RefObject } from 'react';
|
@@ -22,7 +22,6 @@ export type CursorInfo = {
|
|
22
22
|
};
|
23
23
|
export type UseTextEditorProps = Pick<EditorStateConfig, 'extensions'> & {
|
24
24
|
id?: string;
|
25
|
-
doc?: Text;
|
26
25
|
initialValue?: string;
|
27
26
|
className?: string;
|
28
27
|
autoFocus?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTextEditor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextEditor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,iBAAiB,EAAE,
|
1
|
+
{"version":3,"file":"useTextEditor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextEditor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EAAE,KAAK,eAAe,EAA6D,MAAM,eAAe,CAAC;AAGhH,MAAM,MAAM,aAAa,GAAG;IAE1B,SAAS,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,eAAe,CAAC,EAAE,YAAY,CAAC,mBAAmB,GAAG;QACnD,QAAQ,EAAE,CAAC,CAAC;QACZ,OAAO,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC;KAC/C,CAAC;CACH,CAAC;AAEF,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,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG;IACvE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,aAAa,WACjB,aAAa,CAAC,kBAAkB,CAAC,SAClC,cAAc,KACnB,aA+HF,CAAC"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { type EditorView } from '@codemirror/view';
|
2
1
|
export type Range = {
|
3
2
|
from: number;
|
4
3
|
to: number;
|
@@ -7,8 +6,4 @@ export type Comment = {
|
|
7
6
|
id: string;
|
8
7
|
cursor?: string;
|
9
8
|
};
|
10
|
-
/**
|
11
|
-
* Callback that renders into a DOM element within the editor.
|
12
|
-
*/
|
13
|
-
export type RenderCallback<Props extends object> = (el: HTMLElement, props: Props, view: EditorView) => void;
|
14
9
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAIF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
@@ -1,12 +1,7 @@
|
|
1
|
-
import { type
|
2
|
-
import { type RenderCallback } from '../types';
|
1
|
+
import { type ReactNode } from 'react';
|
3
2
|
export type ElementOptions = {
|
4
3
|
className?: string;
|
5
4
|
};
|
6
5
|
export declare const createElement: (tag: string, options?: ElementOptions, children?: ReactNode) => HTMLElement;
|
7
6
|
export declare const renderRoot: <T extends Element>(root: T, node: ReactNode) => T;
|
8
|
-
/**
|
9
|
-
* Utility to create a renderer for a React component.
|
10
|
-
*/
|
11
|
-
export declare const createRenderer: <Props extends object>(Component: FC<Props>) => RenderCallback<Props>;
|
12
7
|
//# sourceMappingURL=react.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/util/react.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/util/react.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQ9C,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,YAAY,cAAc,aAAa,SAAS,KAAG,WAU3F,CAAC;AAIF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,OAAO,QAAQ,CAAC,QAAQ,SAAS,KAAG,CAGxE,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dxos/react-ui-editor",
|
3
|
-
"version": "0.8.2-
|
3
|
+
"version": "0.8.2-staging.7ac8446",
|
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,11 +13,6 @@
|
|
13
13
|
"types": "./dist/types/src/index.d.ts",
|
14
14
|
"browser": "./dist/lib/browser/index.mjs",
|
15
15
|
"node": "./dist/lib/node-esm/index.mjs"
|
16
|
-
},
|
17
|
-
"./testing": {
|
18
|
-
"types": "./dist/types/src/testing/index.d.ts",
|
19
|
-
"browser": "./dist/lib/browser/testing/index.mjs",
|
20
|
-
"node": "./dist/lib/node-esm/testing/index.mjs"
|
21
16
|
}
|
22
17
|
},
|
23
18
|
"types": "dist/types/src/index.d.ts",
|
@@ -56,21 +51,20 @@
|
|
56
51
|
"lodash.merge": "^4.6.2",
|
57
52
|
"lodash.sortby": "^4.7.0",
|
58
53
|
"style-mod": "^4.1.0",
|
59
|
-
"@dxos/app-graph": "0.8.2-
|
60
|
-
"@dxos/
|
61
|
-
"@dxos/async": "0.8.2-
|
62
|
-
"@dxos/
|
63
|
-
"@dxos/debug": "0.8.2-
|
64
|
-
"@dxos/
|
65
|
-
"@dxos/
|
66
|
-
"@dxos/
|
67
|
-
"@dxos/
|
68
|
-
"@dxos/
|
69
|
-
"@dxos/
|
70
|
-
"@dxos/
|
71
|
-
"@dxos/react-
|
72
|
-
"@dxos/util": "0.8.2-
|
73
|
-
"@dxos/react-ui-menu": "0.8.2-main.f11618f"
|
54
|
+
"@dxos/app-graph": "0.8.2-staging.7ac8446",
|
55
|
+
"@dxos/automerge": "0.8.2-staging.7ac8446",
|
56
|
+
"@dxos/async": "0.8.2-staging.7ac8446",
|
57
|
+
"@dxos/context": "0.8.2-staging.7ac8446",
|
58
|
+
"@dxos/debug": "0.8.2-staging.7ac8446",
|
59
|
+
"@dxos/echo-schema": "0.8.2-staging.7ac8446",
|
60
|
+
"@dxos/display-name": "0.8.2-staging.7ac8446",
|
61
|
+
"@dxos/invariant": "0.8.2-staging.7ac8446",
|
62
|
+
"@dxos/live-object": "0.8.2-staging.7ac8446",
|
63
|
+
"@dxos/log": "0.8.2-staging.7ac8446",
|
64
|
+
"@dxos/protocols": "0.8.2-staging.7ac8446",
|
65
|
+
"@dxos/react-hooks": "0.8.2-staging.7ac8446",
|
66
|
+
"@dxos/react-ui-menu": "0.8.2-staging.7ac8446",
|
67
|
+
"@dxos/util": "0.8.2-staging.7ac8446"
|
74
68
|
},
|
75
69
|
"devDependencies": {
|
76
70
|
"@phosphor-icons/react": "^2.1.5",
|
@@ -94,23 +88,23 @@
|
|
94
88
|
"vite": "5.4.7",
|
95
89
|
"vite-plugin-top-level-await": "^1.4.1",
|
96
90
|
"vite-plugin-wasm": "^3.3.0",
|
97
|
-
"@dxos/automerge": "0.8.2-
|
98
|
-
"@dxos/config": "0.8.2-
|
99
|
-
"@dxos/echo-signals": "0.8.2-
|
100
|
-
"@dxos/keyboard": "0.8.2-
|
101
|
-
"@dxos/
|
102
|
-
"@dxos/react-
|
103
|
-
"@dxos/
|
104
|
-
"@dxos/
|
105
|
-
"@dxos/
|
91
|
+
"@dxos/automerge": "0.8.2-staging.7ac8446",
|
92
|
+
"@dxos/config": "0.8.2-staging.7ac8446",
|
93
|
+
"@dxos/echo-signals": "0.8.2-staging.7ac8446",
|
94
|
+
"@dxos/keyboard": "0.8.2-staging.7ac8446",
|
95
|
+
"@dxos/random": "0.8.2-staging.7ac8446",
|
96
|
+
"@dxos/react-client": "0.8.2-staging.7ac8446",
|
97
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
98
|
+
"@dxos/storybook-utils": "0.8.2-staging.7ac8446",
|
99
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446"
|
106
100
|
},
|
107
101
|
"peerDependencies": {
|
108
102
|
"@phosphor-icons/react": "^2.1.5",
|
109
103
|
"react": "~18.2.0",
|
110
104
|
"react-dom": "~18.2.0",
|
111
|
-
"@dxos/react-client": "0.8.2-
|
112
|
-
"@dxos/react-ui": "0.8.2-
|
113
|
-
"@dxos/react-ui
|
105
|
+
"@dxos/react-client": "0.8.2-staging.7ac8446",
|
106
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446",
|
107
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446"
|
114
108
|
},
|
115
109
|
"publishConfig": {
|
116
110
|
"access": "public"
|
@@ -10,7 +10,7 @@ import { Toolbar as NaturalToolbar, Select, useThemeContext } from '@dxos/react-
|
|
10
10
|
import { attentionSurface, mx } from '@dxos/react-ui-theme';
|
11
11
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
12
12
|
|
13
|
-
import { EditorToolbar, useEditorToolbarState } from '
|
13
|
+
import { EditorToolbar, useEditorToolbarState } from './components';
|
14
14
|
import {
|
15
15
|
type EditorInputMode,
|
16
16
|
decorateMarkdown,
|
@@ -20,9 +20,9 @@ import {
|
|
20
20
|
createBasicExtensions,
|
21
21
|
createThemeExtensions,
|
22
22
|
InputModeExtensions,
|
23
|
-
} from '
|
24
|
-
import { useActionHandler, useTextEditor, type UseTextEditorProps } from '
|
25
|
-
import translations from '
|
23
|
+
} from './extensions';
|
24
|
+
import { useActionHandler, useTextEditor, type UseTextEditorProps } from './hooks';
|
25
|
+
import translations from './translations';
|
26
26
|
|
27
27
|
type StoryProps = { placeholder?: string; readOnly?: boolean } & UseTextEditorProps;
|
28
28
|
|