@dxos/react-ui-editor 0.8.3-main.7f5a14c → 0.8.3-staging.0fa589b
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 -375
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +502 -511
- 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 -375
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/Popover/RefDropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Popover/RefPopover.d.ts.map +1 -1
- 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/action.d.ts.map +1 -1
- package/dist/types/src/extensions/command/command-menu.d.ts +20 -0
- package/dist/types/src/extensions/command/command-menu.d.ts.map +1 -0
- package/dist/types/src/extensions/command/command.d.ts.map +1 -1
- package/dist/types/src/extensions/command/floating-menu.d.ts +7 -0
- package/dist/types/src/extensions/command/floating-menu.d.ts.map +1 -0
- package/dist/types/src/extensions/command/hint.d.ts +5 -2
- package/dist/types/src/extensions/command/hint.d.ts.map +1 -1
- package/dist/types/src/extensions/command/index.d.ts +3 -1
- package/dist/types/src/extensions/command/index.d.ts.map +1 -1
- package/dist/types/src/extensions/command/placeholder.d.ts +10 -0
- package/dist/types/src/extensions/command/placeholder.d.ts.map +1 -0
- package/dist/types/src/extensions/command/state.d.ts +1 -1
- package/dist/types/src/extensions/command/state.d.ts.map +1 -1
- package/dist/types/src/extensions/command/useCommandMenu.d.ts +26 -0
- package/dist/types/src/extensions/command/useCommandMenu.d.ts.map +1 -0
- 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/bundle.d.ts.map +1 -1
- package/dist/types/src/extensions/outliner/tree.d.ts.map +1 -1
- package/dist/types/src/extensions/preview/preview.d.ts +12 -19
- package/dist/types/src/extensions/preview/preview.d.ts.map +1 -1
- package/dist/types/src/stories/CommandMenu.stories.d.ts +5 -4
- package/dist/types/src/stories/CommandMenu.stories.d.ts.map +1 -1
- package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
- package/dist/types/src/util/dom.d.ts +5 -0
- package/dist/types/src/util/dom.d.ts.map +1 -1
- package/dist/types/src/util/react.d.ts +2 -4
- package/dist/types/src/util/react.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/components/EditorToolbar/EditorToolbar.tsx +5 -9
- package/src/components/Popover/RefDropdownMenu.tsx +5 -3
- package/src/components/Popover/RefPopover.tsx +5 -3
- package/src/defaults.ts +0 -6
- package/src/extensions/automerge/automerge.stories.tsx +5 -5
- package/src/extensions/command/action.ts +9 -2
- package/src/extensions/command/command-menu.ts +210 -0
- package/src/extensions/command/command.ts +8 -8
- package/src/extensions/command/floating-menu.ts +133 -0
- package/src/extensions/command/hint.ts +29 -9
- package/src/extensions/command/index.ts +3 -1
- package/src/extensions/command/placeholder.ts +113 -0
- package/src/extensions/command/state.ts +1 -2
- package/src/extensions/command/useCommandMenu.ts +118 -0
- package/src/extensions/index.ts +0 -1
- package/src/extensions/markdown/bundle.ts +0 -2
- package/src/extensions/outliner/tree.test.ts +13 -10
- package/src/extensions/outliner/tree.ts +5 -3
- package/src/extensions/preview/preview.ts +11 -86
- package/src/stories/Command.stories.tsx +1 -1
- package/src/stories/CommandMenu.stories.tsx +35 -19
- package/src/stories/Preview.stories.tsx +134 -57
- package/src/stories/components/util.tsx +2 -2
- package/src/util/dom.ts +20 -0
- package/src/util/react.tsx +3 -20
- package/dist/types/src/extensions/command/menu.d.ts +0 -47
- package/dist/types/src/extensions/command/menu.d.ts.map +0 -1
- package/dist/types/src/extensions/placeholder.d.ts +0 -4
- package/dist/types/src/extensions/placeholder.d.ts.map +0 -1
- package/src/extensions/command/menu.ts +0 -439
- package/src/extensions/placeholder.ts +0 -82
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/command.ts"],"names":[],"mappings":"AAIA,OAAO,
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMzD,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAOzE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,GAAG,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,OAAO,GAAI,UAAS,cAAmB,KAAG,SAatD,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"floating-menu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/floating-menu.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAS,mBAAwB,4CAoH7D,CAAC"}
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import { ViewPlugin, type ViewUpdate, WidgetType } from '@codemirror/view';
|
2
2
|
export type HintOptions = {
|
3
|
-
|
3
|
+
delay?: number;
|
4
|
+
onHint?: () => string | undefined;
|
4
5
|
};
|
5
|
-
export declare const
|
6
|
+
export declare const hint: ({ delay, onHint }: HintOptions) => ViewPlugin<{
|
6
7
|
decorations: import("@codemirror/view").DecorationSet;
|
8
|
+
timeout: ReturnType<typeof setTimeout> | undefined;
|
7
9
|
update(update: ViewUpdate): void;
|
10
|
+
destroy(): void;
|
8
11
|
}>;
|
9
12
|
export declare class Hint extends WidgetType {
|
10
13
|
readonly content: string | HTMLElement;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/hint.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"hint.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/hint.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,UAAU,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnG,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,mBAA2B,WAAW;;aAI5C,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,SAAS;mBAEnC,UAAU;;EAuC9B,CAAC;AAEF,qBAAa,IAAK,SAAQ,UAAU;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;gBAA7B,OAAO,EAAE,MAAM,GAAG,WAAW;IAIlD,KAAK,IAAI,eAAe;IAcf,QAAQ,CAAC,GAAG,EAAE,WAAW;;;;;;IAgBzB,WAAW,IAAI,OAAO;CAGhC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { type Extension } from '@codemirror/state';
|
2
|
+
import { EditorView } from '@codemirror/view';
|
3
|
+
type Content = string | HTMLElement | ((view: EditorView) => HTMLElement);
|
4
|
+
export type PlaceholderOptions = {
|
5
|
+
delay?: number;
|
6
|
+
content: Content;
|
7
|
+
};
|
8
|
+
export declare const placeholder: ({ delay, content }: PlaceholderOptions) => Extension;
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=placeholder.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"placeholder.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/placeholder.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAc,UAAU,EAA2C,MAAM,kBAAkB,CAAC;AAInG,KAAK,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,CAAC,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,oBAA4B,kBAAkB,KAAG,SAiD5E,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAgC,KAAK,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAe,KAAK,MAAM,EAAc,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,aAAa,+IAAqC,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,cAAc,CAAC;QAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC,CAAC;CACvE,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,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;AAC/C,OAAO,EAAgC,KAAK,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AAEhG,OAAO,EAAe,KAAK,MAAM,EAAc,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,eAAO,MAAM,aAAa,+IAAqC,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,cAAc,CAAC;QAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC,CAAC;CACvE,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,0BAkEvB,CAAC"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { type EditorView } from '@codemirror/view';
|
2
|
+
import { type RefObject } from 'react';
|
3
|
+
import { type DxRefTag, type DxRefTagActivate } from '@dxos/lit-ui';
|
4
|
+
import { type MaybePromise } from '@dxos/util';
|
5
|
+
import { type PlaceholderOptions } from './placeholder';
|
6
|
+
import { type CommandMenuGroup, type CommandMenuItem } from '../../components';
|
7
|
+
export type UseCommandMenuOptions = {
|
8
|
+
viewRef: RefObject<EditorView | undefined>;
|
9
|
+
trigger: string | string[];
|
10
|
+
placeholder?: Partial<PlaceholderOptions>;
|
11
|
+
getMenu: (trigger: string, query?: string) => MaybePromise<CommandMenuGroup[]>;
|
12
|
+
};
|
13
|
+
export declare const useCommandMenu: ({ viewRef, trigger, placeholder, getMenu }: UseCommandMenuOptions) => {
|
14
|
+
commandMenu: (import("@codemirror/state").Extension | import("@codemirror/state").StateField<{
|
15
|
+
trigger: string;
|
16
|
+
range: import("../..").Range;
|
17
|
+
} | null>)[];
|
18
|
+
currentItem: string | undefined;
|
19
|
+
groupsRef: import("react").MutableRefObject<CommandMenuGroup[]>;
|
20
|
+
ref: import("react").MutableRefObject<DxRefTag | null>;
|
21
|
+
open: boolean;
|
22
|
+
onActivate: (event: DxRefTagActivate) => Promise<void>;
|
23
|
+
onOpenChange: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
24
|
+
onSelect: (item: CommandMenuItem) => void;
|
25
|
+
};
|
26
|
+
//# sourceMappingURL=useCommandMenu.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useCommandMenu.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/command/useCommandMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAyC,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEtH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC1C,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;CAChF,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,4CAA4C,qBAAqB;;;;;;;;;wBAwB9E,gBAAgB;;qBAeQ,eAAe;CAyDxD,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,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,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,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/bundle.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/markdown/bundle.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAKhD,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAS,qBAA0B,KAAG,SAAS,EAwCvF,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/outliner/tree.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgC,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CA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M,QAAQ,GAAI,CAAC,GAAG,GAAG,EAAE,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,GAAG,IAAI,KAAG,CAAC,GAAG,SAoB/F,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,WAAW,EAAE,MAAM,IAAI,KAAG,MAEnE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,EAAE,cAAS,WAerD,CAAC;AAUF,eAAO,MAAM,SAAS,mBAEpB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC;AAE7B;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,UAAS,WAAgB,KAAG,SAuHxD,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '@dxos/lit-ui/dx-ref-tag.pcss';
|
2
|
-
import { type Extension } from '@codemirror/state';
|
3
|
-
import { type
|
2
|
+
import { type EditorState, type Extension } from '@codemirror/state';
|
3
|
+
import { type SyntaxNode } from '@lezer/common';
|
4
4
|
export type PreviewLinkRef = {
|
5
5
|
suggest?: boolean;
|
6
6
|
block?: boolean;
|
@@ -12,28 +12,21 @@ export type PreviewLinkTarget = {
|
|
12
12
|
text?: string;
|
13
13
|
object?: any;
|
14
14
|
};
|
15
|
-
export type PreviewAction = {
|
16
|
-
type: 'insert';
|
17
|
-
link: PreviewLinkRef;
|
18
|
-
target: PreviewLinkTarget;
|
19
|
-
} | {
|
20
|
-
type: 'delete';
|
21
|
-
link: PreviewLinkRef;
|
22
|
-
};
|
23
15
|
export type PreviewLookup = (link: PreviewLinkRef) => Promise<PreviewLinkTarget | null | undefined>;
|
24
|
-
export type PreviewActionHandler = (action: PreviewAction) => void;
|
25
|
-
export type PreviewRenderProps = {
|
26
|
-
readonly: boolean;
|
27
|
-
link: PreviewLinkRef;
|
28
|
-
onAction: PreviewActionHandler;
|
29
|
-
onLookup?: PreviewLookup;
|
30
|
-
};
|
31
16
|
export type PreviewOptions = {
|
32
|
-
|
33
|
-
|
17
|
+
addBlockContainer?: (link: PreviewLinkRef, el: HTMLElement) => void;
|
18
|
+
removeBlockContainer?: (link: PreviewLinkRef) => void;
|
34
19
|
};
|
35
20
|
/**
|
36
21
|
* Create preview decorations.
|
37
22
|
*/
|
38
23
|
export declare const preview: (options?: PreviewOptions) => Extension;
|
24
|
+
/**
|
25
|
+
* Link references.
|
26
|
+
*
|
27
|
+
* [Label][dxn:echo:123] Inline reference
|
28
|
+
* ![Label][dxn:echo:123] Block reference
|
29
|
+
* ![Label][?dxn:echo:123] Suggestion
|
30
|
+
*/
|
31
|
+
export declare const getLinkRef: (state: EditorState, node: SyntaxNode) => PreviewLinkRef | undefined;
|
39
32
|
//# sourceMappingURL=preview.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/preview/preview.ts"],"names":[],"mappings":"AAIA,OAAO,8BAA8B,CAAC;AAGtC,OAAO,
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/preview/preview.ts"],"names":[],"mappings":"AAIA,OAAO,8BAA8B,CAAC;AAGtC,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAIF,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEpG,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IACpE,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;CACvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,UAAS,cAAmB,KAAG,SAatD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,WAAW,EAAE,MAAM,UAAU,KAAG,cAAc,GAAG,SAYlF,CAAC"}
|
@@ -2,11 +2,12 @@ import '@dxos-theme';
|
|
2
2
|
import { type StoryObj } from '@storybook/react';
|
3
3
|
import { type Meta } from '@dxos/storybook-utils';
|
4
4
|
import { type UseCommandMenuOptions } from '../extensions';
|
5
|
-
type
|
5
|
+
type StoryProps = Omit<UseCommandMenuOptions, 'viewRef'> & {
|
6
6
|
text: string;
|
7
7
|
};
|
8
|
-
declare const meta: Meta<
|
8
|
+
declare const meta: Meta<StoryProps>;
|
9
9
|
export default meta;
|
10
|
-
|
11
|
-
export declare const
|
10
|
+
type Story = StoryObj<StoryProps>;
|
11
|
+
export declare const Slash: Story;
|
12
|
+
export declare const Link: Story;
|
12
13
|
//# sourceMappingURL=CommandMenu.stories.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CommandMenu.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/CommandMenu.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOjD,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAczE,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"CommandMenu.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/CommandMenu.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOjD,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAczE,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAM3E,KAAK,UAAU,GAAG,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AA+B5E,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAO1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAGlC,eAAO,MAAM,KAAK,EAAE,KAmBnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KA0DlB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Preview.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Preview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"Preview.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Preview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAoD,MAAM,OAAO,CAAC;AAQzE,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAoJ3C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAKlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO;;CAoDnB,CAAC"}
|
@@ -12,4 +12,9 @@ export declare const flattenRect: (rect: Rect, left: boolean) => {
|
|
12
12
|
};
|
13
13
|
export declare const textRange: (node: Text, from: number, to?: number) => Range;
|
14
14
|
export declare const clientRectsFor: (dom: Node) => DOMRectList;
|
15
|
+
export type ElementOptions = {
|
16
|
+
className?: string;
|
17
|
+
text?: string;
|
18
|
+
};
|
19
|
+
export declare const createElement: (tag: string, options?: ElementOptions, children?: HTMLElement[]) => HTMLElement;
|
15
20
|
//# sourceMappingURL=dom.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/util/dom.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,EAAE,MAAM,OAAO;;;;;CAGpD,CAAC;AAIF,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,EAAE,MAAM,MAAM,EAAE,WAAS,UAK5D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,IAAI,gBAQvC,CAAC"}
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/util/dom.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,EAAE,MAAM,OAAO;;;;;CAGpD,CAAC;AAIF,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,EAAE,MAAM,MAAM,EAAE,WAAS,UAK5D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,IAAI,gBAQvC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,UAAU,cAAc,EAAE,WAAW,WAAW,EAAE,KAAG,WAa/F,CAAC"}
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import { type FC, type ReactNode } from 'react';
|
2
2
|
import { type RenderCallback } from '../types';
|
3
|
-
|
4
|
-
className?: string;
|
5
|
-
};
|
6
|
-
export declare const createElement: (tag: string, options?: ElementOptions, children?: ReactNode) => HTMLElement;
|
3
|
+
/** @deprecated */
|
7
4
|
export declare const renderRoot: <T extends Element>(root: T, node: ReactNode) => T;
|
8
5
|
/**
|
9
6
|
* Utility to create a renderer for a React component.
|
7
|
+
* @deprecated
|
10
8
|
*/
|
11
9
|
export declare const createRenderer: <Props extends object>(Component: FC<Props>) => RenderCallback<Props>;
|
12
10
|
//# 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,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/util/react.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,kBAAkB;AAElB,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,SAAS,KAAG,CAGxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACxB,KAAK,SAAS,MAAM,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,KAAG,cAAc,CAAC,KAAK,CAUjE,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dxos/react-ui-editor",
|
3
|
-
"version": "0.8.3-
|
3
|
+
"version": "0.8.3-staging.0fa589b",
|
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",
|
@@ -59,21 +59,21 @@
|
|
59
59
|
"lodash.merge": "^4.6.2",
|
60
60
|
"lodash.sortby": "^4.7.0",
|
61
61
|
"style-mod": "^4.1.0",
|
62
|
-
"@dxos/app-graph": "0.8.3-
|
63
|
-
"@dxos/async": "0.8.3-
|
64
|
-
"@dxos/context": "0.8.3-
|
65
|
-
"@dxos/debug": "0.8.3-
|
66
|
-
"@dxos/
|
67
|
-
"@dxos/
|
68
|
-
"@dxos/
|
69
|
-
"@dxos/
|
70
|
-
"@dxos/
|
71
|
-
"@dxos/
|
72
|
-
"@dxos/protocols": "0.8.3-
|
73
|
-
"@dxos/react-hooks": "0.8.3-
|
74
|
-
"@dxos/react-ui-menu": "0.8.3-
|
75
|
-
"@dxos/react-ui-stack": "0.8.3-
|
76
|
-
"@dxos/util": "0.8.3-
|
62
|
+
"@dxos/app-graph": "0.8.3-staging.0fa589b",
|
63
|
+
"@dxos/async": "0.8.3-staging.0fa589b",
|
64
|
+
"@dxos/context": "0.8.3-staging.0fa589b",
|
65
|
+
"@dxos/debug": "0.8.3-staging.0fa589b",
|
66
|
+
"@dxos/display-name": "0.8.3-staging.0fa589b",
|
67
|
+
"@dxos/lit-ui": "0.8.3-staging.0fa589b",
|
68
|
+
"@dxos/echo-schema": "0.8.3-staging.0fa589b",
|
69
|
+
"@dxos/invariant": "0.8.3-staging.0fa589b",
|
70
|
+
"@dxos/log": "0.8.3-staging.0fa589b",
|
71
|
+
"@dxos/live-object": "0.8.3-staging.0fa589b",
|
72
|
+
"@dxos/protocols": "0.8.3-staging.0fa589b",
|
73
|
+
"@dxos/react-hooks": "0.8.3-staging.0fa589b",
|
74
|
+
"@dxos/react-ui-menu": "0.8.3-staging.0fa589b",
|
75
|
+
"@dxos/react-ui-stack": "0.8.3-staging.0fa589b",
|
76
|
+
"@dxos/util": "0.8.3-staging.0fa589b"
|
77
77
|
},
|
78
78
|
"devDependencies": {
|
79
79
|
"@automerge/automerge": "3.0.0-beta.4",
|
@@ -102,18 +102,18 @@
|
|
102
102
|
"vite": "5.4.7",
|
103
103
|
"vite-plugin-top-level-await": "^1.4.1",
|
104
104
|
"vite-plugin-wasm": "^3.3.0",
|
105
|
-
"@dxos/config": "0.8.3-
|
106
|
-
"@dxos/echo": "0.8.3-
|
107
|
-
"@dxos/
|
108
|
-
"@dxos/
|
109
|
-
"@dxos/
|
110
|
-
"@dxos/react-
|
111
|
-
"@dxos/react-ui
|
112
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.3-
|
113
|
-
"@dxos/react-ui-theme": "0.8.3-
|
114
|
-
"@dxos/
|
115
|
-
"@dxos/
|
116
|
-
"@dxos/
|
105
|
+
"@dxos/config": "0.8.3-staging.0fa589b",
|
106
|
+
"@dxos/echo": "0.8.3-staging.0fa589b",
|
107
|
+
"@dxos/echo-signals": "0.8.3-staging.0fa589b",
|
108
|
+
"@dxos/keyboard": "0.8.3-staging.0fa589b",
|
109
|
+
"@dxos/random": "0.8.3-staging.0fa589b",
|
110
|
+
"@dxos/react-client": "0.8.3-staging.0fa589b",
|
111
|
+
"@dxos/react-ui": "0.8.3-staging.0fa589b",
|
112
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.3-staging.0fa589b",
|
113
|
+
"@dxos/react-ui-theme": "0.8.3-staging.0fa589b",
|
114
|
+
"@dxos/schema": "0.8.3-staging.0fa589b",
|
115
|
+
"@dxos/react-ui-attention": "0.8.3-staging.0fa589b",
|
116
|
+
"@dxos/storybook-utils": "0.8.3-staging.0fa589b"
|
117
117
|
},
|
118
118
|
"peerDependencies": {
|
119
119
|
"@effect-rx/rx-react": "^0.34.1",
|
@@ -122,9 +122,9 @@
|
|
122
122
|
"effect": "^3.13.3",
|
123
123
|
"react": "~18.2.0",
|
124
124
|
"react-dom": "~18.2.0",
|
125
|
-
"@dxos/react-
|
126
|
-
"@dxos/react-
|
127
|
-
"@dxos/react-ui": "0.8.3-
|
125
|
+
"@dxos/react-client": "0.8.3-staging.0fa589b",
|
126
|
+
"@dxos/react-ui": "0.8.3-staging.0fa589b",
|
127
|
+
"@dxos/react-ui-theme": "0.8.3-staging.0fa589b"
|
128
128
|
},
|
129
129
|
"publishConfig": {
|
130
130
|
"access": "public"
|
@@ -8,7 +8,6 @@ import React, { memo, useMemo } from 'react';
|
|
8
8
|
import { rxFromSignal, type NodeArg } from '@dxos/app-graph';
|
9
9
|
import { ElevationProvider } from '@dxos/react-ui';
|
10
10
|
import { MenuProvider, ToolbarMenu, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';
|
11
|
-
import { textBlockWidth } from '@dxos/react-ui-theme';
|
12
11
|
|
13
12
|
import { createBlocks } from './blocks';
|
14
13
|
import { createFormatting } from './formatting';
|
@@ -18,7 +17,6 @@ import { createLists } from './lists';
|
|
18
17
|
import { createSearch } from './search';
|
19
18
|
import { type EditorToolbarActionGraphProps, type EditorToolbarFeatureFlags, type EditorToolbarProps } from './util';
|
20
19
|
import { createViewMode } from './view-mode';
|
21
|
-
import { stackItemContentToolbarClassNames } from '../../defaults';
|
22
20
|
|
23
21
|
const createToolbar = ({
|
24
22
|
getView,
|
@@ -117,12 +115,10 @@ const useEditorToolbarActionGraph = (props: EditorToolbarProps) => {
|
|
117
115
|
export const EditorToolbar = memo(({ classNames, attendableId, role, ...props }: EditorToolbarProps) => {
|
118
116
|
const menuProps = useEditorToolbarActionGraph(props);
|
119
117
|
return (
|
120
|
-
<
|
121
|
-
<
|
122
|
-
<
|
123
|
-
|
124
|
-
|
125
|
-
</ElevationProvider>
|
126
|
-
</div>
|
118
|
+
<ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>
|
119
|
+
<MenuProvider {...menuProps} attendableId={attendableId}>
|
120
|
+
<ToolbarMenu classNames={classNames} textBlockWidth />
|
121
|
+
</MenuProvider>
|
122
|
+
</ElevationProvider>
|
127
123
|
);
|
128
124
|
});
|
@@ -51,9 +51,11 @@ const RefDropdownMenuProvider = ({ children, onLookup }: RefDropdownMenuProvider
|
|
51
51
|
);
|
52
52
|
|
53
53
|
useEffect(() => {
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
if (!rootRef) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
|
58
|
+
return addEventListener(rootRef, 'dx-ref-tag-activate' as any, handleDxRefTagActivate, customEventOptions);
|
57
59
|
}, [rootRef]);
|
58
60
|
|
59
61
|
return (
|
@@ -33,9 +33,11 @@ export const RefPopover = forwardRef<DxRefTag | null, RefPopoverProps>(
|
|
33
33
|
const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);
|
34
34
|
|
35
35
|
useEffect(() => {
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
if (!rootRef || !onActivate) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
return addEventListener(rootRef, 'dx-ref-tag-activate' as any, onActivate, customEventOptions);
|
39
41
|
}, [rootRef, onActivate]);
|
40
42
|
|
41
43
|
return (
|
package/src/defaults.ts
CHANGED
@@ -47,9 +47,3 @@ export const stackItemContentEditorClassNames = (role?: string) =>
|
|
47
47
|
'attention-surface dx-focus-ring-inset data-[toolbar=disabled]:pbs-2',
|
48
48
|
role === 'section' ? '[&_.cm-scroller]:overflow-hidden [&_.cm-scroller]:min-bs-24' : 'min-bs-0',
|
49
49
|
);
|
50
|
-
|
51
|
-
export const stackItemContentToolbarClassNames = (role?: string) =>
|
52
|
-
mx(
|
53
|
-
'relative z-[1] flex is-full bg-toolbarSurface border-be border-subduedSeparator',
|
54
|
-
role === 'section' && 'sticky block-start-0 -mbe-px min-is-0',
|
55
|
-
);
|
@@ -10,8 +10,8 @@ import { Repo } from '@automerge/automerge-repo';
|
|
10
10
|
import { BroadcastChannelNetworkAdapter } from '@automerge/automerge-repo-network-broadcastchannel';
|
11
11
|
import React, { useEffect, useState } from 'react';
|
12
12
|
|
13
|
-
import {
|
14
|
-
import { DocAccessor,
|
13
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
14
|
+
import { DocAccessor, createDocAccessor, useQuery, useSpace, type Space, Query } from '@dxos/react-client/echo';
|
15
15
|
import { useIdentity, type Identity } from '@dxos/react-client/halo';
|
16
16
|
import { ClientRepeater, type ClientRepeatedComponentProps } from '@dxos/react-client/testing';
|
17
17
|
import { useThemeContext } from '@dxos/react-ui';
|
@@ -100,7 +100,7 @@ const EchoStory = ({ spaceKey }: ClientRepeatedComponentProps) => {
|
|
100
100
|
const identity = useIdentity();
|
101
101
|
const space = useSpace(spaceKey);
|
102
102
|
const [source, setSource] = useState<DocAccessor>();
|
103
|
-
const objects = useQuery(space, Query.type(Expando, { type: 'test' }));
|
103
|
+
const objects = useQuery(space, Query.type(Type.Expando, { type: 'test' }));
|
104
104
|
|
105
105
|
useEffect(() => {
|
106
106
|
if (!source && objects.length) {
|
@@ -128,9 +128,9 @@ export const WithEcho = {
|
|
128
128
|
createSpace
|
129
129
|
onSpaceCreated={async ({ space }) => {
|
130
130
|
space.db.add(
|
131
|
-
|
131
|
+
Obj.make(Type.Expando, {
|
132
132
|
type: 'test',
|
133
|
-
content:
|
133
|
+
content: Ref.make(Obj.make(Type.Expando, { content: initialContent })),
|
134
134
|
}),
|
135
135
|
);
|
136
136
|
}}
|
@@ -44,6 +44,13 @@ export const closeCommand: Command = (view: EditorView) => {
|
|
44
44
|
};
|
45
45
|
|
46
46
|
export const commandKeyBindings: readonly KeyBinding[] = [
|
47
|
-
{
|
48
|
-
|
47
|
+
{
|
48
|
+
key: '/',
|
49
|
+
preventDefault: true,
|
50
|
+
run: openCommand,
|
51
|
+
},
|
52
|
+
{
|
53
|
+
key: 'Escape',
|
54
|
+
run: closeCommand,
|
55
|
+
},
|
49
56
|
];
|