@dxos/react-ui-editor 0.3.11-main.c0ba5b8 → 0.3.11-main.c865ffb
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 +23 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextModel.d.ts +12 -0
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/themes/default.d.ts.map +1 -1
- package/package.json +23 -23
- package/src/components/TextEditor/TextEditor.tsx +3 -4
- package/src/components/TextEditor/automerge.stories.tsx +1 -2
- package/src/extensions/awareness.ts +4 -1
- package/src/extensions/blast.ts +4 -1
- package/src/extensions/markdown/link.ts +8 -2
- package/src/hooks/useTextModel.ts +17 -1
- package/src/index.ts +1 -1
- package/src/themes/default.ts +5 -2
- package/dist/types/src/components/TextEditor/comments.stories.d.ts +0 -26
- package/dist/types/src/components/TextEditor/comments.stories.d.ts.map +0 -1
- package/src/components/TextEditor/comments.stories.tsx +0 -357
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// packages/ui/react-ui-editor/src/index.ts
|
|
2
2
|
import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
|
|
3
3
|
import { Doc, YText, YXmlFragment } from "@dxos/text-model";
|
|
4
|
+
import { keymap as keymap7 } from "@codemirror/view";
|
|
4
5
|
|
|
5
6
|
// packages/ui/react-ui-editor/src/components/TextEditor/index.ts
|
|
6
7
|
import { tags as tags2 } from "@lezer/highlight";
|
|
@@ -13,7 +14,7 @@ import defaultsDeep2 from "lodash.defaultsdeep";
|
|
|
13
14
|
import React, { forwardRef, useCallback, useEffect as useEffect2, useImperativeHandle, useRef, useState } from "react";
|
|
14
15
|
import { log as log2 } from "@dxos/log";
|
|
15
16
|
import { useThemeContext } from "@dxos/react-ui";
|
|
16
|
-
import {
|
|
17
|
+
import { focusRing, mx as mx3 } from "@dxos/react-ui-theme";
|
|
17
18
|
import { isNotFalsy as isNotFalsy3 } from "@dxos/util";
|
|
18
19
|
|
|
19
20
|
// packages/ui/react-ui-editor/src/extensions/autocomplete.ts
|
|
@@ -782,7 +783,7 @@ var Blaster = class {
|
|
|
782
783
|
initialize() {
|
|
783
784
|
invariant(!this._canvas && !this._ctx, void 0, {
|
|
784
785
|
F: __dxlog_file,
|
|
785
|
-
L:
|
|
786
|
+
L: 141,
|
|
786
787
|
S: this,
|
|
787
788
|
A: [
|
|
788
789
|
"!this._canvas && !this._ctx",
|
|
@@ -819,7 +820,7 @@ var Blaster = class {
|
|
|
819
820
|
start() {
|
|
820
821
|
invariant(this._canvas && this._ctx, void 0, {
|
|
821
822
|
F: __dxlog_file,
|
|
822
|
-
L:
|
|
823
|
+
L: 180,
|
|
823
824
|
S: this,
|
|
824
825
|
A: [
|
|
825
826
|
"this._canvas && this._ctx",
|
|
@@ -2606,8 +2607,11 @@ var defaultTheme = {
|
|
|
2606
2607
|
"&dark .cm-cursor, &dark .cm-dropCursor": {
|
|
2607
2608
|
borderLeft: "2px solid white"
|
|
2608
2609
|
},
|
|
2609
|
-
".cm-placeholder": {
|
|
2610
|
-
|
|
2610
|
+
"&light .cm-placeholder": {
|
|
2611
|
+
color: get3(tokens, "extend.semanticColors.description.light", "rgba(0,0,0,.2)")
|
|
2612
|
+
},
|
|
2613
|
+
"&dark .cm-placeholder": {
|
|
2614
|
+
color: get3(tokens, "extend.semanticColors.description.dark", "rgba(255,255,255,.2)")
|
|
2611
2615
|
},
|
|
2612
2616
|
//
|
|
2613
2617
|
// line
|
|
@@ -2948,11 +2952,10 @@ var MarkdownEditor = /* @__PURE__ */ forwardRef(({ readonly, placeholder: placeh
|
|
|
2948
2952
|
});
|
|
2949
2953
|
var defaultSlots = {
|
|
2950
2954
|
root: {
|
|
2951
|
-
|
|
2952
|
-
className: mx3("flex flex-col grow overflow-y-auto", attentionSurface)
|
|
2955
|
+
className: mx3("grow", focusRing)
|
|
2953
2956
|
},
|
|
2954
2957
|
editor: {
|
|
2955
|
-
className: "
|
|
2958
|
+
className: "bs-full"
|
|
2956
2959
|
}
|
|
2957
2960
|
};
|
|
2958
2961
|
var defaultTextSlots = {
|
|
@@ -3412,10 +3415,19 @@ var useTextModel = (props) => {
|
|
|
3412
3415
|
]);
|
|
3413
3416
|
return model;
|
|
3414
3417
|
};
|
|
3418
|
+
var useInMemoryTextModel = ({ id, defaultContent }) => {
|
|
3419
|
+
const [content, setContent] = useState4(defaultContent ?? "");
|
|
3420
|
+
return {
|
|
3421
|
+
id,
|
|
3422
|
+
content,
|
|
3423
|
+
setContent,
|
|
3424
|
+
text: () => content
|
|
3425
|
+
};
|
|
3426
|
+
};
|
|
3415
3427
|
var createModel = ({ space, identity, text }) => {
|
|
3416
3428
|
invariant3(isAutomergeObject(text), void 0, {
|
|
3417
3429
|
F: __dxlog_file6,
|
|
3418
|
-
L:
|
|
3430
|
+
L: 50,
|
|
3419
3431
|
S: void 0,
|
|
3420
3432
|
A: [
|
|
3421
3433
|
"isAutomergeObject(text)",
|
|
@@ -3499,6 +3511,7 @@ export {
|
|
|
3499
3511
|
image,
|
|
3500
3512
|
insertCodeblock,
|
|
3501
3513
|
insertTable,
|
|
3514
|
+
keymap7 as keymap,
|
|
3502
3515
|
link,
|
|
3503
3516
|
listener,
|
|
3504
3517
|
logChanges,
|
|
@@ -3525,6 +3538,7 @@ export {
|
|
|
3525
3538
|
useActionHandler,
|
|
3526
3539
|
useComments,
|
|
3527
3540
|
useEditorView,
|
|
3541
|
+
useInMemoryTextModel,
|
|
3528
3542
|
useTextEditor,
|
|
3529
3543
|
useTextModel,
|
|
3530
3544
|
useToolbarContext
|