@dxos/react-ui-editor 0.4.7-main.dca306f → 0.4.7-main.ea67fec
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 -47
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/styles/index.d.ts +0 -1
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/components/TextEditor/TextEditor.tsx +2 -0
- package/src/extensions/awareness.ts +3 -3
- package/src/extensions/markdown/bundle.ts +0 -1
- package/src/extensions/markdown/decorate.ts +1 -1
- package/src/hooks/useTextModel.ts +12 -5
- package/src/styles/index.ts +0 -1
- package/dist/types/src/styles/cursors.d.ts +0 -5
- package/dist/types/src/styles/cursors.d.ts.map +0 -1
- package/src/styles/cursors.ts +0 -21
|
@@ -596,7 +596,7 @@ var RemoteSelectionsDecorator = class {
|
|
|
596
596
|
to: startLine.from + startLine.length,
|
|
597
597
|
value: Decoration2.mark({
|
|
598
598
|
attributes: {
|
|
599
|
-
style: `background-color: ${
|
|
599
|
+
style: `background-color: ${lightColor}`
|
|
600
600
|
},
|
|
601
601
|
class: "cm-collab-selection"
|
|
602
602
|
})
|
|
@@ -606,7 +606,7 @@ var RemoteSelectionsDecorator = class {
|
|
|
606
606
|
to: end,
|
|
607
607
|
value: Decoration2.mark({
|
|
608
608
|
attributes: {
|
|
609
|
-
style: `background-color: ${
|
|
609
|
+
style: `background-color: ${lightColor}`
|
|
610
610
|
},
|
|
611
611
|
class: "cm-collab-selection"
|
|
612
612
|
})
|
|
@@ -618,7 +618,7 @@ var RemoteSelectionsDecorator = class {
|
|
|
618
618
|
to: linePos,
|
|
619
619
|
value: Decoration2.line({
|
|
620
620
|
attributes: {
|
|
621
|
-
style: `background-color: ${
|
|
621
|
+
style: `background-color: ${lightColor}`,
|
|
622
622
|
class: "cm-collab-selectionLine"
|
|
623
623
|
}
|
|
624
624
|
})
|
|
@@ -1072,44 +1072,6 @@ import { useEffect } from "react";
|
|
|
1072
1072
|
import { debounce } from "@dxos/async";
|
|
1073
1073
|
import { nonNullable } from "@dxos/util";
|
|
1074
1074
|
|
|
1075
|
-
// packages/ui/react-ui-editor/src/styles/cursors.ts
|
|
1076
|
-
import * as random2 from "lib0/random";
|
|
1077
|
-
var cursorColors = [
|
|
1078
|
-
{
|
|
1079
|
-
color: "#30bced",
|
|
1080
|
-
light: "#30bced33"
|
|
1081
|
-
},
|
|
1082
|
-
{
|
|
1083
|
-
color: "#6eeb83",
|
|
1084
|
-
light: "#6eeb8333"
|
|
1085
|
-
},
|
|
1086
|
-
{
|
|
1087
|
-
color: "#ffbc42",
|
|
1088
|
-
light: "#ffbc4233"
|
|
1089
|
-
},
|
|
1090
|
-
{
|
|
1091
|
-
color: "#ecd444",
|
|
1092
|
-
light: "#ecd44433"
|
|
1093
|
-
},
|
|
1094
|
-
{
|
|
1095
|
-
color: "#ee6352",
|
|
1096
|
-
light: "#ee635233"
|
|
1097
|
-
},
|
|
1098
|
-
{
|
|
1099
|
-
color: "#9ac2c9",
|
|
1100
|
-
light: "#9ac2c933"
|
|
1101
|
-
},
|
|
1102
|
-
{
|
|
1103
|
-
color: "#8acb88",
|
|
1104
|
-
light: "#8acb8833"
|
|
1105
|
-
},
|
|
1106
|
-
{
|
|
1107
|
-
color: "#1be7ff",
|
|
1108
|
-
light: "#1be7ff33"
|
|
1109
|
-
}
|
|
1110
|
-
];
|
|
1111
|
-
var cursorColor = cursorColors[random2.uint32() % cursorColors.length];
|
|
1112
|
-
|
|
1113
1075
|
// packages/ui/react-ui-editor/src/styles/markdown.ts
|
|
1114
1076
|
import { mx } from "@dxos/react-ui-theme";
|
|
1115
1077
|
var headings = {
|
|
@@ -1980,7 +1942,7 @@ var uncheckedTask = Decoration4.replace({
|
|
|
1980
1942
|
});
|
|
1981
1943
|
var editingRange = (state, range, focus) => {
|
|
1982
1944
|
const { readOnly, selection: { main: { head } } } = state;
|
|
1983
|
-
return focus && !readOnly && head >= range.from && head
|
|
1945
|
+
return focus && !readOnly && head >= range.from && head < range.to;
|
|
1984
1946
|
};
|
|
1985
1947
|
var MarksByParent = /* @__PURE__ */ new Set([
|
|
1986
1948
|
"CodeMark",
|
|
@@ -4580,11 +4542,15 @@ import { generateName } from "@dxos/display-name";
|
|
|
4580
4542
|
import { getRawDoc } from "@dxos/echo-schema";
|
|
4581
4543
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
4582
4544
|
import { isAutomergeObject } from "@dxos/react-client/echo";
|
|
4545
|
+
import { hueTokens } from "@dxos/react-ui-theme";
|
|
4546
|
+
import { hexToHue } from "@dxos/util";
|
|
4583
4547
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextModel.ts";
|
|
4584
4548
|
var useTextExtensions = ({ id, text, space, identity }) => {
|
|
4585
4549
|
const extensions = [
|
|
4586
4550
|
automerge(text)
|
|
4587
4551
|
];
|
|
4552
|
+
const peerId = identity?.identityKey.toHex();
|
|
4553
|
+
const { cursorLightValue, cursorDarkValue } = hueTokens[hexToHue(peerId ?? "0")];
|
|
4588
4554
|
if (space && identity) {
|
|
4589
4555
|
const awarenessProvider2 = new SpaceAwarenessProvider({
|
|
4590
4556
|
space,
|
|
@@ -4592,8 +4558,8 @@ var useTextExtensions = ({ id, text, space, identity }) => {
|
|
|
4592
4558
|
peerId: identity.identityKey.toHex(),
|
|
4593
4559
|
info: {
|
|
4594
4560
|
displayName: identity.profile?.displayName ?? generateName(identity.identityKey.toHex()),
|
|
4595
|
-
color:
|
|
4596
|
-
lightColor:
|
|
4561
|
+
color: cursorDarkValue,
|
|
4562
|
+
lightColor: cursorLightValue
|
|
4597
4563
|
}
|
|
4598
4564
|
});
|
|
4599
4565
|
extensions.push(awareness(awarenessProvider2));
|
|
@@ -4616,7 +4582,7 @@ var createModel = ({ space, identity, text }) => {
|
|
|
4616
4582
|
}
|
|
4617
4583
|
invariant3(isAutomergeObject(text), void 0, {
|
|
4618
4584
|
F: __dxlog_file7,
|
|
4619
|
-
L:
|
|
4585
|
+
L: 87,
|
|
4620
4586
|
S: void 0,
|
|
4621
4587
|
A: [
|
|
4622
4588
|
"isAutomergeObject(text)",
|
|
@@ -4627,13 +4593,15 @@ var createModel = ({ space, identity, text }) => {
|
|
|
4627
4593
|
const doc = getRawDoc(obj, [
|
|
4628
4594
|
obj.field
|
|
4629
4595
|
]);
|
|
4596
|
+
const peerId = identity?.identityKey.toHex();
|
|
4597
|
+
const { cursorLightValue, cursorDarkValue } = hueTokens[hexToHue(peerId ?? "0")];
|
|
4630
4598
|
const awarenessProvider2 = space && new SpaceAwarenessProvider({
|
|
4631
4599
|
space,
|
|
4632
4600
|
channel: `automerge.awareness.${obj.id}`,
|
|
4633
4601
|
info: {
|
|
4634
4602
|
displayName: identity ? identity.profile?.displayName ?? generateName(identity.identityKey.toHex()) : void 0,
|
|
4635
|
-
color:
|
|
4636
|
-
lightColor:
|
|
4603
|
+
color: cursorLightValue,
|
|
4604
|
+
lightColor: cursorDarkValue
|
|
4637
4605
|
},
|
|
4638
4606
|
peerId: identity?.identityKey.toHex() ?? "Anonymous"
|
|
4639
4607
|
});
|