@dxos/react-ui-editor 0.5.0 → 0.5.1-main.0ec204c
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 +29 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextEditor.d.ts +6 -1
- package/dist/types/src/hooks/useTextEditor.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/components/Toolbar/Toolbar.tsx +1 -1
- package/src/extensions/automerge/automerge.stories.tsx +1 -1
- package/src/extensions/markdown/formatting.ts +16 -2
- package/src/hooks/useTextEditor.ts +35 -2
|
@@ -4545,7 +4545,7 @@ var ToolbarRoot = ({ children, onAction, classNames, state: state2 }) => {
|
|
|
4545
4545
|
elevation: "chrome"
|
|
4546
4546
|
}, /* @__PURE__ */ React2.createElement(NaturalToolbar.Root, {
|
|
4547
4547
|
classNames: [
|
|
4548
|
-
"is-full shrink-0 overflow-x-auto p-1",
|
|
4548
|
+
"is-full shrink-0 overflow-x-auto overflow-y-hidden p-1",
|
|
4549
4549
|
classNames
|
|
4550
4550
|
]
|
|
4551
4551
|
}, children))));
|
|
@@ -4831,7 +4831,8 @@ var useActionHandler = (view) => {
|
|
|
4831
4831
|
// packages/ui/react-ui-editor/src/hooks/useTextEditor.ts
|
|
4832
4832
|
import { EditorSelection as EditorSelection2, EditorState as EditorState3 } from "@codemirror/state";
|
|
4833
4833
|
import { EditorView as EditorView17 } from "@codemirror/view";
|
|
4834
|
-
import {
|
|
4834
|
+
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
4835
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
4835
4836
|
import { log as log8 } from "@dxos/log";
|
|
4836
4837
|
import { isNotFalsy as isNotFalsy5 } from "@dxos/util";
|
|
4837
4838
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
|
|
@@ -4847,7 +4848,7 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4847
4848
|
id
|
|
4848
4849
|
}, {
|
|
4849
4850
|
F: __dxlog_file11,
|
|
4850
|
-
L:
|
|
4851
|
+
L: 50,
|
|
4851
4852
|
S: void 0,
|
|
4852
4853
|
C: (f, a) => f(...a)
|
|
4853
4854
|
});
|
|
@@ -4859,7 +4860,7 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4859
4860
|
EditorView17.exceptionSink.of((err) => {
|
|
4860
4861
|
log8.catch(err, void 0, {
|
|
4861
4862
|
F: __dxlog_file11,
|
|
4862
|
-
L:
|
|
4863
|
+
L: 60,
|
|
4863
4864
|
S: void 0,
|
|
4864
4865
|
C: (f, a) => f(...a)
|
|
4865
4866
|
});
|
|
@@ -4890,7 +4891,7 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4890
4891
|
id
|
|
4891
4892
|
}, {
|
|
4892
4893
|
F: __dxlog_file11,
|
|
4893
|
-
L:
|
|
4894
|
+
L: 88,
|
|
4894
4895
|
S: void 0,
|
|
4895
4896
|
C: (f, a) => f(...a)
|
|
4896
4897
|
});
|
|
@@ -4924,9 +4925,31 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4924
4925
|
selection,
|
|
4925
4926
|
scrollTo
|
|
4926
4927
|
]);
|
|
4928
|
+
const focusableGroup = useFocusableGroup2({
|
|
4929
|
+
tabBehavior: "limited"
|
|
4930
|
+
});
|
|
4931
|
+
const handleKeyUp = useCallback2((event) => {
|
|
4932
|
+
const { key, target, currentTarget } = event;
|
|
4933
|
+
if (target === currentTarget) {
|
|
4934
|
+
switch (key) {
|
|
4935
|
+
case "Enter": {
|
|
4936
|
+
view?.focus();
|
|
4937
|
+
break;
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4941
|
+
}, [
|
|
4942
|
+
view
|
|
4943
|
+
]);
|
|
4944
|
+
const focusAttributes = {
|
|
4945
|
+
tabIndex: 0,
|
|
4946
|
+
...focusableGroup,
|
|
4947
|
+
onKeyUp: handleKeyUp
|
|
4948
|
+
};
|
|
4927
4949
|
return {
|
|
4928
4950
|
parentRef,
|
|
4929
|
-
view
|
|
4951
|
+
view,
|
|
4952
|
+
focusAttributes
|
|
4930
4953
|
};
|
|
4931
4954
|
};
|
|
4932
4955
|
export {
|