@dxos/plugin-thread 0.6.10 → 0.6.11-staging.a542fc9
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/{chunk-TL3JITN7.mjs → chunk-GKPZHUT3.mjs} +2 -1
- package/dist/lib/browser/chunk-GKPZHUT3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +157 -116
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{chunk-WPPLQNMJ.cjs → chunk-D5GOVXHS.cjs} +5 -4
- package/dist/lib/node/chunk-D5GOVXHS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +167 -126
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +2 -2
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +7 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +28 -28
- package/src/ThreadPlugin.tsx +153 -101
- package/src/types.ts +10 -0
- package/dist/lib/browser/chunk-TL3JITN7.mjs.map +0 -7
- package/dist/lib/node/chunk-WPPLQNMJ.cjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
ThreadAction: () =>
|
|
31
|
+
ThreadAction: () => import_chunk_D5GOVXHS.ThreadAction,
|
|
32
32
|
ThreadPlugin: () => ThreadPlugin,
|
|
33
33
|
default: () => src_default,
|
|
34
34
|
useAnalyticsCallback: () => import_chunk_5PZNPPQF.useAnalyticsCallback,
|
|
@@ -36,7 +36,7 @@ __export(node_exports, {
|
|
|
36
36
|
useStatus: () => import_chunk_5PZNPPQF.useStatus
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(node_exports);
|
|
39
|
-
var
|
|
39
|
+
var import_chunk_D5GOVXHS = require("./chunk-D5GOVXHS.cjs");
|
|
40
40
|
var import_chunk_5PZNPPQF = require("./chunk-5PZNPPQF.cjs");
|
|
41
41
|
var import_chunk_BWBONZGU = require("./chunk-BWBONZGU.cjs");
|
|
42
42
|
var import_react = require("@phosphor-icons/react");
|
|
@@ -533,7 +533,7 @@ var ThreadPlugin = () => {
|
|
|
533
533
|
}
|
|
534
534
|
}),
|
|
535
535
|
(0, import_plugin_graph.createExtension)({
|
|
536
|
-
id:
|
|
536
|
+
id: import_chunk_D5GOVXHS.ThreadAction.CREATE,
|
|
537
537
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
538
538
|
actions: ({ node }) => {
|
|
539
539
|
const id = node.id.split("/").at(-1);
|
|
@@ -551,7 +551,7 @@ var ThreadPlugin = () => {
|
|
|
551
551
|
await dispatch2([
|
|
552
552
|
{
|
|
553
553
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
554
|
-
action:
|
|
554
|
+
action: import_chunk_D5GOVXHS.ThreadAction.CREATE
|
|
555
555
|
},
|
|
556
556
|
{
|
|
557
557
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -598,6 +598,12 @@ var ThreadPlugin = () => {
|
|
|
598
598
|
case "article":
|
|
599
599
|
case "complementary": {
|
|
600
600
|
const location = navigationPlugin?.provides.location;
|
|
601
|
+
const providesThreadsConfig = (0, import_react2.useCallback)((plugin) => (
|
|
602
|
+
// TODO(Zan): More robust runtime check.
|
|
603
|
+
"thread" in plugin.provides ? plugin : void 0
|
|
604
|
+
), []);
|
|
605
|
+
const threadsIntegrators = (0, import_app_framework.useResolvePlugins)(providesThreadsConfig);
|
|
606
|
+
const threadProvides = threadsIntegrators.map((p) => p.provides.thread);
|
|
601
607
|
if (data.object instanceof import_types2.ChannelType && data.object.threads[0]) {
|
|
602
608
|
const channel = data.object;
|
|
603
609
|
if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
|
|
@@ -616,39 +622,27 @@ var ThreadPlugin = () => {
|
|
|
616
622
|
thread: data.object.threads[0]
|
|
617
623
|
});
|
|
618
624
|
}
|
|
619
|
-
if (data.subject instanceof
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
625
|
+
if (data.subject instanceof import_types2.ThreadType) {
|
|
626
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_chunk_5PZNPPQF.ChatHeading, {
|
|
627
|
+
attendableId: data.subject.id
|
|
628
|
+
}), /* @__PURE__ */ import_react2.default.createElement(import_chunk_5PZNPPQF.ChatContainer, {
|
|
629
|
+
thread: data.subject
|
|
630
|
+
}));
|
|
631
|
+
}
|
|
632
|
+
if (data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads)) {
|
|
633
|
+
const threads = data.subject.threads.concat(state.staging[(0, import_echo.fullyQualifiedId)(data.subject)]).filter(import_util.nonNullable);
|
|
634
|
+
const createSort = threadProvides.find((p) => p.predicate(data.subject))?.createSort;
|
|
635
|
+
if (createSort) {
|
|
636
|
+
const sort = createSort(data.subject);
|
|
637
|
+
threads.sort((a, b) => sort(a.anchor, b.anchor));
|
|
626
638
|
}
|
|
627
|
-
const getStartPosition = (cursor) => {
|
|
628
|
-
const range = cursor ? (0, import_echo.getRangeFromCursor)(accessor, cursor) : void 0;
|
|
629
|
-
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
630
|
-
};
|
|
631
|
-
const threads = doc.threads.concat(state.staging[data.subject.id]).filter(import_util.nonNullable).sort((a, b) => getStartPosition(a.anchor) - getStartPosition(b.anchor));
|
|
632
639
|
const detached = data.subject.threads.filter(import_util.nonNullable).filter(({ anchor }) => !anchor).map((thread) => thread.id);
|
|
633
|
-
const qualifiedSubjectId = (0, import_echo.fullyQualifiedId)(
|
|
640
|
+
const qualifiedSubjectId = (0, import_echo.fullyQualifiedId)(data.subject);
|
|
634
641
|
const attention = attentionPlugin?.provides.attention?.attended ?? /* @__PURE__ */ new Set([
|
|
635
642
|
qualifiedSubjectId
|
|
636
643
|
]);
|
|
637
644
|
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
638
|
-
const space = (0, import_echo.getSpace)(doc);
|
|
639
645
|
const { showResolvedThreads } = getViewState(qualifiedSubjectId);
|
|
640
|
-
const dispatchAnalytic = (name, meta) => {
|
|
641
|
-
void dispatch?.({
|
|
642
|
-
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
643
|
-
data: {
|
|
644
|
-
name,
|
|
645
|
-
properties: {
|
|
646
|
-
...meta,
|
|
647
|
-
space: space?.id
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
};
|
|
652
646
|
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
653
647
|
role: "none",
|
|
654
648
|
className: "contents group/attention",
|
|
@@ -678,55 +672,41 @@ var ThreadPlugin = () => {
|
|
|
678
672
|
},
|
|
679
673
|
onThreadDelete: (thread) => dispatch?.({
|
|
680
674
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
681
|
-
action:
|
|
675
|
+
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
682
676
|
data: {
|
|
683
|
-
|
|
677
|
+
subject: data.subject,
|
|
684
678
|
thread
|
|
685
679
|
}
|
|
686
680
|
}),
|
|
687
681
|
onMessageDelete: (thread, messageId) => dispatch?.({
|
|
688
682
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
689
|
-
action:
|
|
683
|
+
action: import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE,
|
|
690
684
|
data: {
|
|
691
|
-
|
|
685
|
+
subject: data.subject,
|
|
692
686
|
thread,
|
|
693
687
|
messageId
|
|
694
688
|
}
|
|
695
689
|
}),
|
|
696
690
|
onThreadToggleResolved: (thread) => dispatch?.({
|
|
697
691
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
698
|
-
action:
|
|
692
|
+
action: import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED,
|
|
699
693
|
data: {
|
|
700
694
|
thread
|
|
701
695
|
}
|
|
702
696
|
}),
|
|
703
697
|
onComment: (thread) => {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
state.staging[doc2.id] = state.staging[doc2.id]?.filter((t) => t.id !== thread.id);
|
|
711
|
-
dispatchAnalytic("threads.thread-created", {
|
|
712
|
-
threadId: thread.id
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
dispatchAnalytic("threads.message-added", {
|
|
716
|
-
threadId: thread.id,
|
|
717
|
-
threadLength: thread.messages.length
|
|
698
|
+
void intentPlugin?.provides.intent.dispatch({
|
|
699
|
+
action: import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD,
|
|
700
|
+
data: {
|
|
701
|
+
thread,
|
|
702
|
+
subject: data.subject
|
|
703
|
+
}
|
|
718
704
|
});
|
|
719
705
|
}
|
|
720
706
|
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
721
707
|
role: "none",
|
|
722
708
|
className: "bs-10"
|
|
723
709
|
}), /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Scrollbar, null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.ScrollArea.Thumb, null)))));
|
|
724
|
-
} else if (data.subject instanceof import_types2.ThreadType) {
|
|
725
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_chunk_5PZNPPQF.ChatHeading, {
|
|
726
|
-
attendableId: data.subject.id
|
|
727
|
-
}), /* @__PURE__ */ import_react2.default.createElement(import_chunk_5PZNPPQF.ChatContainer, {
|
|
728
|
-
thread: data.subject
|
|
729
|
-
}));
|
|
730
710
|
}
|
|
731
711
|
}
|
|
732
712
|
}
|
|
@@ -736,25 +716,74 @@ var ThreadPlugin = () => {
|
|
|
736
716
|
intent: {
|
|
737
717
|
resolver: async (intent) => {
|
|
738
718
|
switch (intent.action) {
|
|
739
|
-
case
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
719
|
+
case import_chunk_D5GOVXHS.ThreadAction.CREATE: {
|
|
720
|
+
if (intent.data && intent.data.cursor !== void 0) {
|
|
721
|
+
const { cursor, name, subject } = intent.data;
|
|
722
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
723
|
+
const thread = (0, import_echo_schema2.create)(import_types2.ThreadType, {
|
|
724
|
+
name,
|
|
725
|
+
anchor: cursor,
|
|
726
|
+
messages: [],
|
|
727
|
+
status: "staged"
|
|
728
|
+
});
|
|
729
|
+
const stagingArea = state.staging[subjectId];
|
|
730
|
+
if (stagingArea) {
|
|
731
|
+
stagingArea.push(thread);
|
|
732
|
+
} else {
|
|
733
|
+
state.staging[subjectId] = [
|
|
734
|
+
thread
|
|
735
|
+
];
|
|
736
|
+
}
|
|
737
|
+
return {
|
|
738
|
+
data: thread,
|
|
739
|
+
intents: [
|
|
740
|
+
[
|
|
741
|
+
{
|
|
742
|
+
action: import_app_framework.NavigationAction.OPEN,
|
|
743
|
+
data: {
|
|
744
|
+
activeParts: {
|
|
745
|
+
complementary: `${subjectId}${import_app_framework.SLUG_PATH_SEPARATOR}comments${import_app_framework.SLUG_COLLECTION_INDICATOR}`
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
action: import_chunk_D5GOVXHS.ThreadAction.SELECT,
|
|
751
|
+
data: {
|
|
752
|
+
current: thread.id,
|
|
753
|
+
focus: true
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
758
|
+
data: {
|
|
759
|
+
element: "complementary",
|
|
760
|
+
subject: subjectId,
|
|
761
|
+
state: true
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
]
|
|
746
765
|
]
|
|
747
|
-
}
|
|
748
|
-
}
|
|
766
|
+
};
|
|
767
|
+
} else {
|
|
768
|
+
return {
|
|
769
|
+
data: (0, import_echo_schema2.create)(import_types2.ChannelType, {
|
|
770
|
+
threads: [
|
|
771
|
+
(0, import_echo_schema2.create)(import_types2.ThreadType, {
|
|
772
|
+
messages: []
|
|
773
|
+
})
|
|
774
|
+
]
|
|
775
|
+
})
|
|
776
|
+
};
|
|
777
|
+
}
|
|
749
778
|
}
|
|
750
|
-
case
|
|
779
|
+
case import_chunk_D5GOVXHS.ThreadAction.SELECT: {
|
|
751
780
|
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
752
781
|
state.current = intent.data?.current;
|
|
753
782
|
return {
|
|
754
783
|
data: true
|
|
755
784
|
};
|
|
756
785
|
}
|
|
757
|
-
case
|
|
786
|
+
case import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED: {
|
|
758
787
|
const { thread } = intent.data ?? {};
|
|
759
788
|
if (!(thread instanceof import_types2.ThreadType)) {
|
|
760
789
|
return;
|
|
@@ -783,28 +812,29 @@ var ThreadPlugin = () => {
|
|
|
783
812
|
]
|
|
784
813
|
};
|
|
785
814
|
}
|
|
786
|
-
case
|
|
787
|
-
const {
|
|
788
|
-
if (!(
|
|
815
|
+
case import_chunk_D5GOVXHS.ThreadAction.DELETE: {
|
|
816
|
+
const { subject, thread } = intent.data ?? {};
|
|
817
|
+
if (!(subject instanceof import_types.DocumentType) || !(thread instanceof import_types2.ThreadType)) {
|
|
789
818
|
return;
|
|
790
819
|
}
|
|
791
|
-
const
|
|
820
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
821
|
+
const stagingArea = state.staging[subjectId];
|
|
792
822
|
if (stagingArea) {
|
|
793
|
-
const index =
|
|
823
|
+
const index = stagingArea.findIndex((t) => t.id === thread.id);
|
|
794
824
|
if (index !== -1) {
|
|
795
|
-
|
|
825
|
+
stagingArea.splice(index, 1);
|
|
796
826
|
return;
|
|
797
827
|
}
|
|
798
828
|
}
|
|
799
829
|
const space = (0, import_echo.getSpace)(thread);
|
|
800
|
-
if (!space || !
|
|
830
|
+
if (!space || !subject.threads) {
|
|
801
831
|
return;
|
|
802
832
|
}
|
|
803
833
|
if (!intent.undo) {
|
|
804
|
-
const index =
|
|
805
|
-
const cursor =
|
|
834
|
+
const index = subject.threads.findIndex((t) => t?.id === thread.id);
|
|
835
|
+
const cursor = subject.threads[index]?.anchor;
|
|
806
836
|
if (index !== -1) {
|
|
807
|
-
|
|
837
|
+
subject.threads?.splice(index, 1);
|
|
808
838
|
}
|
|
809
839
|
space.db.remove(thread);
|
|
810
840
|
return {
|
|
@@ -831,7 +861,7 @@ var ThreadPlugin = () => {
|
|
|
831
861
|
};
|
|
832
862
|
} else if (intent.undo) {
|
|
833
863
|
const savedThread = space.db.add(thread);
|
|
834
|
-
|
|
864
|
+
subject.threads.push(savedThread);
|
|
835
865
|
return {
|
|
836
866
|
data: true,
|
|
837
867
|
intents: [
|
|
@@ -852,10 +882,53 @@ var ThreadPlugin = () => {
|
|
|
852
882
|
}
|
|
853
883
|
break;
|
|
854
884
|
}
|
|
855
|
-
case
|
|
856
|
-
const {
|
|
857
|
-
|
|
858
|
-
|
|
885
|
+
case import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD: {
|
|
886
|
+
const { thread, subject } = intent.data ?? {};
|
|
887
|
+
if (!(thread instanceof import_types2.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
891
|
+
const space = (0, import_echo.getSpace)(subject);
|
|
892
|
+
const intents = [];
|
|
893
|
+
const analyticsProperties = {
|
|
894
|
+
threadId: thread.id,
|
|
895
|
+
spaceId: space?.id
|
|
896
|
+
};
|
|
897
|
+
if (state.staging[subjectId]?.find((t) => t === thread)) {
|
|
898
|
+
thread.status = "active";
|
|
899
|
+
subject.threads ? subject.threads.push(thread) : subject.threads = [
|
|
900
|
+
thread
|
|
901
|
+
];
|
|
902
|
+
state.staging[subjectId] = state.staging[subjectId]?.filter((t) => t.id !== thread.id);
|
|
903
|
+
intents.push({
|
|
904
|
+
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
905
|
+
data: {
|
|
906
|
+
name: "threads.thread-created",
|
|
907
|
+
properties: analyticsProperties
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
intents.push({
|
|
912
|
+
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
913
|
+
data: {
|
|
914
|
+
name: "threads.message-added",
|
|
915
|
+
properties: {
|
|
916
|
+
...analyticsProperties,
|
|
917
|
+
threadLength: thread.messages.length
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
return {
|
|
922
|
+
data: thread,
|
|
923
|
+
intents: [
|
|
924
|
+
intents
|
|
925
|
+
]
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
case import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE: {
|
|
929
|
+
const { subject, thread, messageId } = intent.data ?? {};
|
|
930
|
+
const space = (0, import_echo.getSpace)(subject);
|
|
931
|
+
if (!(subject instanceof import_types.DocumentType) || !(thread instanceof import_types2.ThreadType) || !space) {
|
|
859
932
|
return;
|
|
860
933
|
}
|
|
861
934
|
if (!intent.undo) {
|
|
@@ -869,9 +942,9 @@ var ThreadPlugin = () => {
|
|
|
869
942
|
intents: [
|
|
870
943
|
[
|
|
871
944
|
{
|
|
872
|
-
action:
|
|
945
|
+
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
873
946
|
data: {
|
|
874
|
-
|
|
947
|
+
subject,
|
|
875
948
|
thread
|
|
876
949
|
}
|
|
877
950
|
}
|
|
@@ -944,7 +1017,7 @@ var ThreadPlugin = () => {
|
|
|
944
1017
|
}
|
|
945
1018
|
const threads = (0, import_signals_core.computed)(() => [
|
|
946
1019
|
...doc.threads.filter(import_util.nonNullable),
|
|
947
|
-
...state.staging[doc
|
|
1020
|
+
...state.staging[(0, import_echo.fullyQualifiedId)(doc)] ?? []
|
|
948
1021
|
].filter((thread) => !(thread?.status === "resolved")));
|
|
949
1022
|
return [
|
|
950
1023
|
(0, import_react_ui_editor.listener)({
|
|
@@ -973,49 +1046,17 @@ var ThreadPlugin = () => {
|
|
|
973
1046
|
const name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
974
1047
|
"content"
|
|
975
1048
|
]), start, end);
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
const stagingArea = state.staging[doc.id];
|
|
983
|
-
if (stagingArea) {
|
|
984
|
-
stagingArea.push(thread);
|
|
985
|
-
} else {
|
|
986
|
-
state.staging[doc.id] = [
|
|
987
|
-
thread
|
|
988
|
-
];
|
|
989
|
-
}
|
|
990
|
-
void intentPlugin?.provides.intent.dispatch([
|
|
991
|
-
{
|
|
992
|
-
action: import_app_framework.NavigationAction.OPEN,
|
|
993
|
-
data: {
|
|
994
|
-
activeParts: {
|
|
995
|
-
complementary: `${(0, import_echo.fullyQualifiedId)(doc)}${import_app_framework.SLUG_PATH_SEPARATOR}comments${import_app_framework.SLUG_COLLECTION_INDICATOR}`
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
},
|
|
999
|
-
{
|
|
1000
|
-
action: import_chunk_WPPLQNMJ.ThreadAction.SELECT,
|
|
1001
|
-
data: {
|
|
1002
|
-
current: thread.id,
|
|
1003
|
-
focus: true
|
|
1004
|
-
}
|
|
1005
|
-
},
|
|
1006
|
-
{
|
|
1007
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
1008
|
-
data: {
|
|
1009
|
-
element: "complementary",
|
|
1010
|
-
subject: doc,
|
|
1011
|
-
state: true
|
|
1012
|
-
}
|
|
1049
|
+
void intentPlugin?.provides.intent.dispatch({
|
|
1050
|
+
action: import_chunk_D5GOVXHS.ThreadAction.CREATE,
|
|
1051
|
+
data: {
|
|
1052
|
+
cursor,
|
|
1053
|
+
name,
|
|
1054
|
+
subject: doc
|
|
1013
1055
|
}
|
|
1014
|
-
|
|
1015
|
-
return thread.id;
|
|
1056
|
+
});
|
|
1016
1057
|
},
|
|
1017
1058
|
onDelete: ({ id }) => {
|
|
1018
|
-
const stagingArea = state.staging[doc
|
|
1059
|
+
const stagingArea = state.staging[(0, import_echo.fullyQualifiedId)(doc)];
|
|
1019
1060
|
if (stagingArea) {
|
|
1020
1061
|
const index = stagingArea.findIndex((thread2) => thread2.id === id);
|
|
1021
1062
|
if (index !== -1) {
|
|
@@ -1028,7 +1069,7 @@ var ThreadPlugin = () => {
|
|
|
1028
1069
|
}
|
|
1029
1070
|
},
|
|
1030
1071
|
onUpdate: ({ id, cursor }) => {
|
|
1031
|
-
const thread = state.staging[doc
|
|
1072
|
+
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => thread2.id === id) ?? doc.threads.find((thread2) => thread2?.id === id);
|
|
1032
1073
|
if (thread instanceof import_types2.ThreadType && thread.anchor) {
|
|
1033
1074
|
const [start, end] = thread.anchor.split(":");
|
|
1034
1075
|
thread.name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
@@ -1042,7 +1083,7 @@ var ThreadPlugin = () => {
|
|
|
1042
1083
|
if (dispatch2) {
|
|
1043
1084
|
void dispatch2([
|
|
1044
1085
|
{
|
|
1045
|
-
action:
|
|
1086
|
+
action: import_chunk_D5GOVXHS.ThreadAction.SELECT,
|
|
1046
1087
|
data: {
|
|
1047
1088
|
current: current ?? closest
|
|
1048
1089
|
}
|