@dxos/react-ui-editor 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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 +101 -81
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +101 -81
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Editor/Editor.d.ts.map +1 -1
- package/dist/types/src/components/EditorMenuProvider/EditorMenuProvider.d.ts.map +1 -1
- package/dist/types/src/components/EditorMenuProvider/useEditorMenu.d.ts.map +1 -1
- package/dist/types/src/components/EditorPreviewProvider/EditorPreviewProvider.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/EditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/actions.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/actions.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/blocks.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/blocks.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/formatting.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/formatting.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/headings.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/headings.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/image.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/image.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/search.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/search.d.ts.map +1 -1
- package/dist/types/src/components/EditorToolbar/view-mode.d.ts +1 -0
- package/dist/types/src/components/EditorToolbar/view-mode.d.ts.map +1 -1
- package/dist/types/src/stories/Automerge.stories.d.ts +1 -0
- package/dist/types/src/stories/Automerge.stories.d.ts.map +1 -1
- package/dist/types/src/stories/Comments.stories.d.ts +1 -1
- package/dist/types/src/stories/Experimental.stories.d.ts +1 -1
- package/dist/types/src/stories/Markdown.stories.d.ts +1 -1
- package/dist/types/src/stories/Preview.stories.d.ts +1 -1
- package/dist/types/src/stories/Preview.stories.d.ts.map +1 -1
- package/dist/types/src/stories/TextEditor.stories.d.ts +1 -1
- package/dist/types/src/stories/components/EditorStory.d.ts +2 -2
- package/dist/types/src/stories/components/EditorStory.d.ts.map +1 -1
- package/dist/types/src/stories/components/util.d.ts +3 -3
- package/dist/types/src/stories/components/util.d.ts.map +1 -1
- package/dist/types/src/util/react.d.ts +1 -4
- package/dist/types/src/util/react.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -45
- package/src/components/Editor/Editor.stories.tsx +1 -1
- package/src/components/Editor/Editor.tsx +12 -6
- package/src/components/EditorContent/EditorContent.tsx +1 -1
- package/src/components/EditorMenuProvider/EditorMenuProvider.tsx +19 -24
- package/src/components/EditorMenuProvider/useEditorMenu.ts +6 -0
- package/src/components/EditorPreviewProvider/EditorPreviewProvider.tsx +5 -7
- package/src/components/EditorToolbar/EditorToolbar.tsx +17 -33
- package/src/components/EditorToolbar/actions.ts +2 -2
- package/src/components/EditorToolbar/blocks.ts +2 -2
- package/src/components/EditorToolbar/formatting.ts +2 -2
- package/src/components/EditorToolbar/headings.ts +9 -9
- package/src/components/EditorToolbar/image.ts +2 -2
- package/src/components/EditorToolbar/search.ts +2 -2
- package/src/components/EditorToolbar/view-mode.ts +2 -2
- package/src/stories/Automerge.stories.tsx +8 -10
- package/src/stories/CommandDialog.stories.tsx +5 -5
- package/src/stories/Comments.stories.tsx +4 -4
- package/src/stories/EditorToolbar.stories.tsx +4 -4
- package/src/stories/Experimental.stories.tsx +3 -3
- package/src/stories/Markdown.stories.tsx +2 -2
- package/src/stories/Outliner.stories.tsx +2 -2
- package/src/stories/Popover.stories.tsx +3 -3
- package/src/stories/Preview.stories.tsx +58 -48
- package/src/stories/Tags.stories.tsx +5 -5
- package/src/stories/TextEditor.stories.tsx +2 -2
- package/src/stories/Theme.stories.tsx +2 -2
- package/src/stories/components/EditorStory.tsx +3 -5
- package/src/stories/components/util.tsx +19 -22
- package/src/util/react.tsx +2 -11
|
@@ -296,7 +296,7 @@ var EditorContent = /* @__PURE__ */ forwardRef(({ classNames, id, extensions, se
|
|
|
296
296
|
]);
|
|
297
297
|
return /* @__PURE__ */ React.createElement("div", {
|
|
298
298
|
role: "none",
|
|
299
|
-
className: mx("
|
|
299
|
+
className: mx("w-full outline-hidden focus:border-accent-surface focus-within:border-neutral-focus-indicator", classNames),
|
|
300
300
|
ref: parentRef,
|
|
301
301
|
...focusable ? focusAttributes : {}
|
|
302
302
|
});
|
|
@@ -702,7 +702,7 @@ import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
|
702
702
|
import React2, { Fragment, useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
703
703
|
import { addEventListener } from "@dxos/async";
|
|
704
704
|
import { invariant } from "@dxos/invariant";
|
|
705
|
-
import { DX_ANCHOR_ACTIVATE, Icon, Popover, toLocalizedString, useDynamicRef, useThemeContext, useTranslation } from "@dxos/react-ui";
|
|
705
|
+
import { DX_ANCHOR_ACTIVATE, Icon, Popover, ScrollArea, toLocalizedString, useDynamicRef, useThemeContext, useTranslation } from "@dxos/react-ui";
|
|
706
706
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-editor/src/components/EditorMenuProvider/EditorMenuProvider.tsx";
|
|
707
707
|
var EditorMenuProvider = ({ children, view, groups, currentItem, open: openProp, defaultOpen, numItems = 8, onOpenChange, onActivate, onSelect, onCancel }) => {
|
|
708
708
|
const { tx } = useThemeContext();
|
|
@@ -714,7 +714,7 @@ var EditorMenuProvider = ({ children, view, groups, currentItem, open: openProp,
|
|
|
714
714
|
onChange: (open2) => {
|
|
715
715
|
invariant(viewRef.current, void 0, {
|
|
716
716
|
F: __dxlog_file2,
|
|
717
|
-
L:
|
|
717
|
+
L: 66,
|
|
718
718
|
S: void 0,
|
|
719
719
|
A: [
|
|
720
720
|
"viewRef.current",
|
|
@@ -733,8 +733,8 @@ var EditorMenuProvider = ({ children, view, groups, currentItem, open: openProp,
|
|
|
733
733
|
return;
|
|
734
734
|
}
|
|
735
735
|
return addEventListener(root, DX_ANCHOR_ACTIVATE, (event) => {
|
|
736
|
-
const { trigger,
|
|
737
|
-
if (!
|
|
736
|
+
const { trigger, dxn } = event;
|
|
737
|
+
if (!dxn) {
|
|
738
738
|
triggerRef.current = trigger;
|
|
739
739
|
if (onActivate) {
|
|
740
740
|
onActivate({
|
|
@@ -756,7 +756,7 @@ var EditorMenuProvider = ({ children, view, groups, currentItem, open: openProp,
|
|
|
756
756
|
const handleSelect = useCallback2((item) => {
|
|
757
757
|
invariant(viewRef.current, void 0, {
|
|
758
758
|
F: __dxlog_file2,
|
|
759
|
-
L:
|
|
759
|
+
L: 101,
|
|
760
760
|
S: void 0,
|
|
761
761
|
A: [
|
|
762
762
|
"viewRef.current",
|
|
@@ -780,34 +780,36 @@ var EditorMenuProvider = ({ children, view, groups, currentItem, open: openProp,
|
|
|
780
780
|
virtualRef: triggerRef
|
|
781
781
|
}), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
782
782
|
align: "start",
|
|
783
|
-
classNames:
|
|
784
|
-
|
|
785
|
-
}, [
|
|
786
|
-
"overflow-y-auto",
|
|
783
|
+
classNames: [
|
|
784
|
+
"flex flex-col",
|
|
787
785
|
!menuGroups.length && "hidden"
|
|
788
|
-
]
|
|
786
|
+
],
|
|
789
787
|
style: {
|
|
790
788
|
maxBlockSize: 36 * numItems + 10
|
|
791
789
|
},
|
|
792
|
-
|
|
793
|
-
* NOTE: We keep the focus in the editor, but Radix routes escape key.
|
|
794
|
-
*/
|
|
790
|
+
// NOTE: We keep the focus in the editor, but Radix routes escape key.
|
|
795
791
|
onEscapeKeyDown: () => {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
792
|
+
const currentView = viewRef.current;
|
|
793
|
+
if (currentView) {
|
|
794
|
+
onCancel?.({
|
|
795
|
+
view: currentView
|
|
796
|
+
});
|
|
797
|
+
}
|
|
799
798
|
},
|
|
800
799
|
onOpenAutoFocus: (event) => event.preventDefault()
|
|
801
800
|
}, /* @__PURE__ */ React2.createElement(Popover.Viewport, {
|
|
802
|
-
|
|
803
|
-
|
|
801
|
+
asChild: true,
|
|
802
|
+
classNames: "dx-container"
|
|
803
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
804
|
+
thin: true
|
|
805
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React2.createElement(Menu, {
|
|
804
806
|
groups: menuGroups,
|
|
805
807
|
currentItem,
|
|
806
808
|
onSelect: handleSelect
|
|
807
|
-
})), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))), /* @__PURE__ */ React2.createElement("div", {
|
|
808
|
-
ref: setRoot,
|
|
809
|
+
})))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))), /* @__PURE__ */ React2.createElement("div", {
|
|
809
810
|
role: "none",
|
|
810
|
-
className: "contents"
|
|
811
|
+
className: "contents",
|
|
812
|
+
ref: setRoot
|
|
811
813
|
}, children));
|
|
812
814
|
};
|
|
813
815
|
var Menu = ({ groups, currentItem, onSelect }) => {
|
|
@@ -819,14 +821,14 @@ var Menu = ({ groups, currentItem, onSelect }) => {
|
|
|
819
821
|
currentItem,
|
|
820
822
|
onSelect
|
|
821
823
|
}), index < groups.length - 1 && /* @__PURE__ */ React2.createElement("div", {
|
|
822
|
-
className: tx("menu.separator",
|
|
824
|
+
className: tx("menu.separator", {})
|
|
823
825
|
}))));
|
|
824
826
|
};
|
|
825
827
|
var MenuGroup = ({ group, currentItem, onSelect }) => {
|
|
826
828
|
const { tx } = useThemeContext();
|
|
827
829
|
const { t } = useTranslation();
|
|
828
830
|
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, group.label && /* @__PURE__ */ React2.createElement("div", {
|
|
829
|
-
className: tx("menu.groupLabel",
|
|
831
|
+
className: tx("menu.groupLabel", {})
|
|
830
832
|
}, /* @__PURE__ */ React2.createElement("span", null, toLocalizedString(group.label, t))), group.items.map((item) => /* @__PURE__ */ React2.createElement(MenuItem, {
|
|
831
833
|
key: item.id,
|
|
832
834
|
item,
|
|
@@ -854,8 +856,8 @@ var MenuItem = ({ item, current, onSelect }) => {
|
|
|
854
856
|
]);
|
|
855
857
|
return /* @__PURE__ */ React2.createElement("li", {
|
|
856
858
|
ref: listRef,
|
|
857
|
-
className: tx("menu.item",
|
|
858
|
-
current && "bg-
|
|
859
|
+
className: tx("menu.item", {}, [
|
|
860
|
+
current && "bg-hover-surface"
|
|
859
861
|
]),
|
|
860
862
|
onClick: handleSelect
|
|
861
863
|
}, item.icon && /* @__PURE__ */ React2.createElement(Icon, {
|
|
@@ -934,10 +936,21 @@ var useEditorMenu = ({ trigger, triggerKey, placeholder: placeholder2, filter =
|
|
|
934
936
|
handleOpenChange
|
|
935
937
|
]);
|
|
936
938
|
const handleSelect = useCallback3(({ view, item }) => {
|
|
939
|
+
const { range } = view.state.field(popoverStateField) ?? {};
|
|
940
|
+
if (range) {
|
|
941
|
+
view.dispatch({
|
|
942
|
+
changes: {
|
|
943
|
+
from: range.from,
|
|
944
|
+
to: range.to,
|
|
945
|
+
insert: ""
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
}
|
|
937
949
|
void item.onSelect?.({
|
|
938
950
|
view,
|
|
939
951
|
head: view.state.selection.main.head
|
|
940
952
|
});
|
|
953
|
+
view.focus();
|
|
941
954
|
}, []);
|
|
942
955
|
const handleCancel = useCallback3(({ view }) => {
|
|
943
956
|
const { range, trigger: trigger2 } = view.state.field(popoverStateField) ?? {};
|
|
@@ -1019,7 +1032,7 @@ var useEditorMenu = ({ trigger, triggerKey, placeholder: placeholder2, filter =
|
|
|
1019
1032
|
import { Atom } from "@effect-atom/atom-react";
|
|
1020
1033
|
import React3, { memo, useMemo as useMemo3 } from "react";
|
|
1021
1034
|
import { ElevationProvider } from "@dxos/react-ui";
|
|
1022
|
-
import {
|
|
1035
|
+
import { Menu as Menu2, MenuBuilder, useMenuActions } from "@dxos/react-ui-menu";
|
|
1023
1036
|
|
|
1024
1037
|
// src/components/EditorToolbar/actions.ts
|
|
1025
1038
|
import { createMenuAction, createMenuItemGroup } from "@dxos/react-ui-menu";
|
|
@@ -1041,11 +1054,13 @@ var createLists = (state, getView) => {
|
|
|
1041
1054
|
edges: [
|
|
1042
1055
|
{
|
|
1043
1056
|
source: "root",
|
|
1044
|
-
target: "list"
|
|
1057
|
+
target: "list",
|
|
1058
|
+
relation: "child"
|
|
1045
1059
|
},
|
|
1046
1060
|
...listActionsMap.map(({ id }) => ({
|
|
1047
1061
|
source: listGroupAction.id,
|
|
1048
|
-
target: id
|
|
1062
|
+
target: id,
|
|
1063
|
+
relation: "child"
|
|
1049
1064
|
}))
|
|
1050
1065
|
]
|
|
1051
1066
|
};
|
|
@@ -1149,11 +1164,13 @@ var createBlocks = (state, getView) => {
|
|
|
1149
1164
|
edges: [
|
|
1150
1165
|
{
|
|
1151
1166
|
source: "root",
|
|
1152
|
-
target: "block"
|
|
1167
|
+
target: "block",
|
|
1168
|
+
relation: "child"
|
|
1153
1169
|
},
|
|
1154
1170
|
...blockActions.map(({ id }) => ({
|
|
1155
1171
|
source: blockGroupAction.id,
|
|
1156
|
-
target: id
|
|
1172
|
+
target: id,
|
|
1173
|
+
relation: "child"
|
|
1157
1174
|
}))
|
|
1158
1175
|
]
|
|
1159
1176
|
};
|
|
@@ -1202,11 +1219,13 @@ var createFormatting = (state, getView) => {
|
|
|
1202
1219
|
edges: [
|
|
1203
1220
|
{
|
|
1204
1221
|
source: "root",
|
|
1205
|
-
target: "formatting"
|
|
1222
|
+
target: "formatting",
|
|
1223
|
+
relation: "child"
|
|
1206
1224
|
},
|
|
1207
1225
|
...formattingActions.map(({ id }) => ({
|
|
1208
1226
|
source: formattingGroupAction.id,
|
|
1209
|
-
target: id
|
|
1227
|
+
target: id,
|
|
1228
|
+
relation: "child"
|
|
1210
1229
|
}))
|
|
1211
1230
|
]
|
|
1212
1231
|
};
|
|
@@ -1222,13 +1241,13 @@ var createHeadingGroupAction = (value) => createEditorActionGroup("heading", {
|
|
|
1222
1241
|
value
|
|
1223
1242
|
}, "ph--text-h--regular");
|
|
1224
1243
|
var createHeadingActions = (currentLevel, getView) => Object.entries({
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1244
|
+
0: "ph--paragraph--regular",
|
|
1245
|
+
1: "ph--text-h-one--regular",
|
|
1246
|
+
2: "ph--text-h-two--regular",
|
|
1247
|
+
3: "ph--text-h-three--regular",
|
|
1248
|
+
4: "ph--text-h-four--regular",
|
|
1249
|
+
5: "ph--text-h-five--regular",
|
|
1250
|
+
6: "ph--text-h-six--regular"
|
|
1232
1251
|
}).map(([levelStr, icon]) => {
|
|
1233
1252
|
const level = parseInt(levelStr);
|
|
1234
1253
|
return createEditorAction(`heading--${levelStr}`, {
|
|
@@ -1260,11 +1279,13 @@ var createHeadings = (state, getView) => {
|
|
|
1260
1279
|
edges: [
|
|
1261
1280
|
{
|
|
1262
1281
|
source: "root",
|
|
1263
|
-
target: "heading"
|
|
1282
|
+
target: "heading",
|
|
1283
|
+
relation: "child"
|
|
1264
1284
|
},
|
|
1265
1285
|
...headingActions.map(({ id }) => ({
|
|
1266
1286
|
source: headingGroupAction.id,
|
|
1267
|
-
target: id
|
|
1287
|
+
target: id,
|
|
1288
|
+
relation: "child"
|
|
1268
1289
|
}))
|
|
1269
1290
|
]
|
|
1270
1291
|
};
|
|
@@ -1282,7 +1303,8 @@ var createImageUpload = (onImageUpload) => ({
|
|
|
1282
1303
|
edges: [
|
|
1283
1304
|
{
|
|
1284
1305
|
source: "root",
|
|
1285
|
-
target: "image"
|
|
1306
|
+
target: "image",
|
|
1307
|
+
relation: "child"
|
|
1286
1308
|
}
|
|
1287
1309
|
]
|
|
1288
1310
|
});
|
|
@@ -1300,7 +1322,8 @@ var createSearch = (getView) => ({
|
|
|
1300
1322
|
edges: [
|
|
1301
1323
|
{
|
|
1302
1324
|
source: "root",
|
|
1303
|
-
target: "search"
|
|
1325
|
+
target: "search",
|
|
1326
|
+
relation: "child"
|
|
1304
1327
|
}
|
|
1305
1328
|
]
|
|
1306
1329
|
});
|
|
@@ -1341,11 +1364,13 @@ var createViewMode = (state, onViewModeChange) => {
|
|
|
1341
1364
|
edges: [
|
|
1342
1365
|
{
|
|
1343
1366
|
source: "root",
|
|
1344
|
-
target: "viewMode"
|
|
1367
|
+
target: "viewMode",
|
|
1368
|
+
relation: "child"
|
|
1345
1369
|
},
|
|
1346
1370
|
...viewModeActions.map(({ id }) => ({
|
|
1347
1371
|
source: viewModeGroupAction.id,
|
|
1348
|
-
target: id
|
|
1372
|
+
target: id,
|
|
1373
|
+
relation: "child"
|
|
1349
1374
|
}))
|
|
1350
1375
|
]
|
|
1351
1376
|
};
|
|
@@ -1356,13 +1381,12 @@ var EditorToolbar = /* @__PURE__ */ memo(({ classNames, role, attendableId, onAc
|
|
|
1356
1381
|
const menuProps = useEditorToolbarActionGraph(props);
|
|
1357
1382
|
return /* @__PURE__ */ React3.createElement(ElevationProvider, {
|
|
1358
1383
|
elevation: role === "section" ? "positioned" : "base"
|
|
1359
|
-
}, /* @__PURE__ */ React3.createElement(
|
|
1384
|
+
}, /* @__PURE__ */ React3.createElement(Menu2.Root, {
|
|
1360
1385
|
...menuProps,
|
|
1361
1386
|
attendableId,
|
|
1362
1387
|
onAction
|
|
1363
|
-
}, /* @__PURE__ */ React3.createElement(
|
|
1364
|
-
classNames
|
|
1365
|
-
textBlockWidth: true
|
|
1388
|
+
}, /* @__PURE__ */ React3.createElement(Menu2.Toolbar, {
|
|
1389
|
+
classNames
|
|
1366
1390
|
})));
|
|
1367
1391
|
});
|
|
1368
1392
|
var useEditorToolbarActionGraph = ({ state, getView, customActions, ...features }) => {
|
|
@@ -1387,41 +1411,34 @@ var useEditorToolbarActionGraph = ({ state, getView, customActions, ...features
|
|
|
1387
1411
|
};
|
|
1388
1412
|
var createToolbarActions = ({ state, getView, customActions, ...features }) => {
|
|
1389
1413
|
return Atom.make((get) => {
|
|
1390
|
-
const graph = {
|
|
1391
|
-
nodes: [],
|
|
1392
|
-
edges: []
|
|
1393
|
-
};
|
|
1394
|
-
const addSubGraph = (graph2, subGraph) => {
|
|
1395
|
-
graph2.nodes.push(...subGraph.nodes);
|
|
1396
|
-
graph2.edges.push(...subGraph.edges);
|
|
1397
|
-
};
|
|
1398
1414
|
const stateSnapshot = get(state);
|
|
1415
|
+
const builder = MenuBuilder.make();
|
|
1399
1416
|
if (features?.showHeadings ?? true) {
|
|
1400
|
-
|
|
1417
|
+
builder.subgraph(createHeadings(stateSnapshot, getView));
|
|
1401
1418
|
}
|
|
1402
1419
|
if (features?.showFormatting ?? true) {
|
|
1403
|
-
|
|
1420
|
+
builder.subgraph(createFormatting(stateSnapshot, getView));
|
|
1404
1421
|
}
|
|
1405
1422
|
if (features?.showLists ?? true) {
|
|
1406
|
-
|
|
1423
|
+
builder.subgraph(createLists(stateSnapshot, getView));
|
|
1407
1424
|
}
|
|
1408
1425
|
if (features?.showBlocks ?? true) {
|
|
1409
|
-
|
|
1426
|
+
builder.subgraph(createBlocks(stateSnapshot, getView));
|
|
1410
1427
|
}
|
|
1411
1428
|
if (features?.onImageUpload) {
|
|
1412
|
-
|
|
1429
|
+
builder.subgraph(createImageUpload(features.onImageUpload));
|
|
1413
1430
|
}
|
|
1414
|
-
|
|
1431
|
+
builder.separator("gap");
|
|
1415
1432
|
if (customActions) {
|
|
1416
|
-
|
|
1433
|
+
builder.subgraph(get(customActions));
|
|
1417
1434
|
}
|
|
1418
1435
|
if (features?.showSearch ?? true) {
|
|
1419
|
-
|
|
1436
|
+
builder.subgraph(createSearch(getView));
|
|
1420
1437
|
}
|
|
1421
1438
|
if (features?.onViewModeChange) {
|
|
1422
|
-
|
|
1439
|
+
builder.subgraph(createViewMode(stateSnapshot, features.onViewModeChange));
|
|
1423
1440
|
}
|
|
1424
|
-
return
|
|
1441
|
+
return builder.build();
|
|
1425
1442
|
});
|
|
1426
1443
|
};
|
|
1427
1444
|
|
|
@@ -1463,15 +1480,17 @@ var EditorRoot = /* @__PURE__ */ forwardRef2(({ children, extensions: extensions
|
|
|
1463
1480
|
}, children));
|
|
1464
1481
|
});
|
|
1465
1482
|
EditorRoot.displayName = "Editor.Root";
|
|
1483
|
+
var EDITOR_VIEWPORT_NAME = "Editor.Viewport";
|
|
1466
1484
|
var EditorViewport = ({ classNames, children }) => {
|
|
1467
1485
|
return /* @__PURE__ */ React4.createElement("div", {
|
|
1468
1486
|
role: "none",
|
|
1469
|
-
className: mx2("grid grid-rows-[min-content_1fr]
|
|
1487
|
+
className: mx2("grid grid-rows-[min-content_1fr] h-full overflow-hidden", classNames)
|
|
1470
1488
|
}, children);
|
|
1471
1489
|
};
|
|
1472
|
-
EditorViewport.displayName =
|
|
1490
|
+
EditorViewport.displayName = EDITOR_VIEWPORT_NAME;
|
|
1491
|
+
var EDITOR_CONTENT_NAME = "Editor.Content";
|
|
1473
1492
|
var EditorContent2 = ({ extensions: providedExtensions, ...props }) => {
|
|
1474
|
-
const { extensions: additionalExtensions = [], setController } = useEditorContext(
|
|
1493
|
+
const { extensions: additionalExtensions = [], setController } = useEditorContext(EDITOR_CONTENT_NAME);
|
|
1475
1494
|
const extensions = useMemo5(() => [
|
|
1476
1495
|
additionalExtensions,
|
|
1477
1496
|
providedExtensions
|
|
@@ -1485,13 +1504,14 @@ var EditorContent2 = ({ extensions: providedExtensions, ...props }) => {
|
|
|
1485
1504
|
ref: setController
|
|
1486
1505
|
});
|
|
1487
1506
|
};
|
|
1488
|
-
EditorContent2.displayName =
|
|
1507
|
+
EditorContent2.displayName = EDITOR_CONTENT_NAME;
|
|
1508
|
+
var EDITOR_TOOLBAR_NAME = "Editor.Toolbar";
|
|
1489
1509
|
var EditorToolbar2 = (props) => {
|
|
1490
|
-
const { controller, state } = useEditorContext(
|
|
1510
|
+
const { controller, state } = useEditorContext(EDITOR_TOOLBAR_NAME);
|
|
1491
1511
|
const getView = useCallback4(() => {
|
|
1492
1512
|
invariant3(controller?.view, void 0, {
|
|
1493
1513
|
F: __dxlog_file4,
|
|
1494
|
-
L:
|
|
1514
|
+
L: 146,
|
|
1495
1515
|
S: void 0,
|
|
1496
1516
|
A: [
|
|
1497
1517
|
"controller?.view",
|
|
@@ -1508,7 +1528,7 @@ var EditorToolbar2 = (props) => {
|
|
|
1508
1528
|
state
|
|
1509
1529
|
});
|
|
1510
1530
|
};
|
|
1511
|
-
EditorToolbar2.displayName =
|
|
1531
|
+
EditorToolbar2.displayName = EDITOR_TOOLBAR_NAME;
|
|
1512
1532
|
var Editor = {
|
|
1513
1533
|
Root: EditorRoot,
|
|
1514
1534
|
Viewport: EditorViewport,
|
|
@@ -1527,20 +1547,20 @@ var EditorPreviewProvider = ({ children, onLookup }) => {
|
|
|
1527
1547
|
const [value, setValue] = useState5({});
|
|
1528
1548
|
const [open, setOpen] = useState5(false);
|
|
1529
1549
|
const handleActivate = useCallback5((event) => {
|
|
1530
|
-
const {
|
|
1550
|
+
const { dxn, label, trigger } = event;
|
|
1531
1551
|
setValue((value2) => ({
|
|
1532
1552
|
...value2,
|
|
1533
1553
|
link: {
|
|
1534
1554
|
label,
|
|
1535
|
-
|
|
1555
|
+
dxn
|
|
1536
1556
|
},
|
|
1537
1557
|
pending: true
|
|
1538
1558
|
}));
|
|
1539
|
-
triggerRef.current =
|
|
1559
|
+
triggerRef.current = trigger;
|
|
1540
1560
|
queueMicrotask(() => setOpen(true));
|
|
1541
1561
|
void onLookup?.({
|
|
1542
1562
|
label,
|
|
1543
|
-
|
|
1563
|
+
dxn
|
|
1544
1564
|
}).then((target) => setValue((value2) => ({
|
|
1545
1565
|
...value2,
|
|
1546
1566
|
target: target ?? void 0,
|
|
@@ -1572,9 +1592,9 @@ var EditorPreviewProvider = ({ children, onLookup }) => {
|
|
|
1572
1592
|
}, /* @__PURE__ */ React5.createElement(Popover2.VirtualTrigger, {
|
|
1573
1593
|
virtualRef: triggerRef
|
|
1574
1594
|
}), /* @__PURE__ */ React5.createElement("div", {
|
|
1575
|
-
ref: setRoot,
|
|
1576
1595
|
role: "none",
|
|
1577
|
-
className: "contents"
|
|
1596
|
+
className: "contents",
|
|
1597
|
+
ref: setRoot
|
|
1578
1598
|
}, children)));
|
|
1579
1599
|
};
|
|
1580
1600
|
export {
|