@dxos/react-ui-editor 0.4.10-main.c32f430 → 0.4.10-main.c42bfdb
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 +15 -15
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDocAccessor.d.ts +2 -2
- package/dist/types/src/hooks/useDocAccessor.d.ts.map +1 -1
- package/package.json +26 -25
- package/src/components/TextEditor/TextEditor.stories.tsx +4 -3
- package/src/components/Toolbar/Toolbar.stories.tsx +7 -4
- package/src/extensions/automerge/automerge.stories.tsx +7 -6
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useDocAccessor.ts +3 -9
|
@@ -4837,28 +4837,15 @@ var useActionHandler = (view) => {
|
|
|
4837
4837
|
return (action) => view && processAction(view, action);
|
|
4838
4838
|
};
|
|
4839
4839
|
|
|
4840
|
-
// packages/ui/react-ui-editor/src/hooks/useDocAccessor.ts
|
|
4841
|
-
import { useMemo as useMemo2 } from "react";
|
|
4842
|
-
import { createDocAccessor, getTextContent } from "@dxos/echo-schema";
|
|
4843
|
-
var useDocAccessor = (text) => {
|
|
4844
|
-
return useMemo2(() => ({
|
|
4845
|
-
id: text.id,
|
|
4846
|
-
doc: getTextContent(text),
|
|
4847
|
-
accessor: createDocAccessor(text)
|
|
4848
|
-
}), [
|
|
4849
|
-
text
|
|
4850
|
-
]);
|
|
4851
|
-
};
|
|
4852
|
-
|
|
4853
4840
|
// packages/ui/react-ui-editor/src/hooks/useTextEditor.ts
|
|
4854
4841
|
import { EditorSelection as EditorSelection2, EditorState as EditorState3 } from "@codemirror/state";
|
|
4855
4842
|
import { EditorView as EditorView17 } from "@codemirror/view";
|
|
4856
|
-
import { useEffect as useEffect4, useMemo as
|
|
4843
|
+
import { useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
4857
4844
|
import { log as log8 } from "@dxos/log";
|
|
4858
4845
|
import { isNotFalsy as isNotFalsy5 } from "@dxos/util";
|
|
4859
4846
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
|
|
4860
4847
|
var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
4861
|
-
let { id, doc, selection, extensions, autoFocus, scrollTo, debug } =
|
|
4848
|
+
let { id, doc, selection, extensions, autoFocus, scrollTo, debug } = useMemo2(cb, deps ?? []);
|
|
4862
4849
|
const onUpdate = useRef3();
|
|
4863
4850
|
const [view, setView] = useState4();
|
|
4864
4851
|
const parentRef = useRef3(null);
|
|
@@ -4952,6 +4939,19 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4952
4939
|
view
|
|
4953
4940
|
};
|
|
4954
4941
|
};
|
|
4942
|
+
|
|
4943
|
+
// packages/ui/react-ui-editor/src/hooks/useDocAccessor.ts
|
|
4944
|
+
import { useMemo as useMemo3 } from "react";
|
|
4945
|
+
import { createDocAccessor, getTextContent } from "@dxos/echo-schema";
|
|
4946
|
+
var useDocAccessor = (text) => {
|
|
4947
|
+
return useMemo3(() => ({
|
|
4948
|
+
id: text.id,
|
|
4949
|
+
doc: getTextContent(text),
|
|
4950
|
+
accessor: createDocAccessor(text)
|
|
4951
|
+
}), [
|
|
4952
|
+
text
|
|
4953
|
+
]);
|
|
4954
|
+
};
|
|
4955
4955
|
export {
|
|
4956
4956
|
Cursor,
|
|
4957
4957
|
EditorModes,
|