@dxos/plugin-thread 0.6.10 → 0.6.11-staging.32b42e4
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 +153 -115
- 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 +164 -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/components/Chat.stories.d.ts +0 -1
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/Comments.stories.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 +147 -104
- package/src/components/Chat.stories.tsx +3 -3
- package/src/components/Comments.stories.tsx +8 -13
- 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");
|
|
@@ -332,6 +332,7 @@ var translations_default = [
|
|
|
332
332
|
var initialViewState = {
|
|
333
333
|
showResolvedThreads: false
|
|
334
334
|
};
|
|
335
|
+
var providesThreadsConfig = (plugin) => "thread" in plugin.provides ? plugin : void 0;
|
|
335
336
|
var ThreadPlugin = () => {
|
|
336
337
|
const settings = new import_local_storage.LocalStorageStore(import_chunk_BWBONZGU.THREAD_PLUGIN);
|
|
337
338
|
const state = (0, import_echo_schema2.create)({
|
|
@@ -533,7 +534,7 @@ var ThreadPlugin = () => {
|
|
|
533
534
|
}
|
|
534
535
|
}),
|
|
535
536
|
(0, import_plugin_graph.createExtension)({
|
|
536
|
-
id:
|
|
537
|
+
id: import_chunk_D5GOVXHS.ThreadAction.CREATE,
|
|
537
538
|
filter: (node) => !!settings.values.standalone && (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
|
|
538
539
|
actions: ({ node }) => {
|
|
539
540
|
const id = node.id.split("/").at(-1);
|
|
@@ -551,7 +552,7 @@ var ThreadPlugin = () => {
|
|
|
551
552
|
await dispatch2([
|
|
552
553
|
{
|
|
553
554
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
554
|
-
action:
|
|
555
|
+
action: import_chunk_D5GOVXHS.ThreadAction.CREATE
|
|
555
556
|
},
|
|
556
557
|
{
|
|
557
558
|
action: import_plugin_space.SpaceAction.ADD_OBJECT,
|
|
@@ -598,6 +599,8 @@ var ThreadPlugin = () => {
|
|
|
598
599
|
case "article":
|
|
599
600
|
case "complementary": {
|
|
600
601
|
const location = navigationPlugin?.provides.location;
|
|
602
|
+
const threadsIntegrators = (0, import_app_framework.useResolvePlugins)(providesThreadsConfig);
|
|
603
|
+
const threadProvides = threadsIntegrators.map((p) => p.provides.thread);
|
|
601
604
|
if (data.object instanceof import_types2.ChannelType && data.object.threads[0]) {
|
|
602
605
|
const channel = data.object;
|
|
603
606
|
if ((0, import_app_framework.isLayoutParts)(location?.active) && location.active.main) {
|
|
@@ -616,39 +619,27 @@ var ThreadPlugin = () => {
|
|
|
616
619
|
thread: data.object.threads[0]
|
|
617
620
|
});
|
|
618
621
|
}
|
|
619
|
-
if (data.subject instanceof
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
622
|
+
if (data.subject instanceof import_types2.ThreadType) {
|
|
623
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_chunk_5PZNPPQF.ChatHeading, {
|
|
624
|
+
attendableId: data.subject.id
|
|
625
|
+
}), /* @__PURE__ */ import_react2.default.createElement(import_chunk_5PZNPPQF.ChatContainer, {
|
|
626
|
+
thread: data.subject
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
if (data.subject && typeof data.subject === "object" && "threads" in data.subject && Array.isArray(data.subject.threads)) {
|
|
630
|
+
const threads = data.subject.threads.concat(state.staging[(0, import_echo.fullyQualifiedId)(data.subject)]).filter(import_util.nonNullable);
|
|
631
|
+
const createSort = threadProvides.find((p) => p.predicate(data.subject))?.createSort;
|
|
632
|
+
if (createSort) {
|
|
633
|
+
const sort = createSort(data.subject);
|
|
634
|
+
threads.sort((a, b) => sort(a.anchor, b.anchor));
|
|
626
635
|
}
|
|
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
636
|
const detached = data.subject.threads.filter(import_util.nonNullable).filter(({ anchor }) => !anchor).map((thread) => thread.id);
|
|
633
|
-
const qualifiedSubjectId = (0, import_echo.fullyQualifiedId)(
|
|
637
|
+
const qualifiedSubjectId = (0, import_echo.fullyQualifiedId)(data.subject);
|
|
634
638
|
const attention = attentionPlugin?.provides.attention?.attended ?? /* @__PURE__ */ new Set([
|
|
635
639
|
qualifiedSubjectId
|
|
636
640
|
]);
|
|
637
641
|
const attendableAttrs = (0, import_react_ui_attention.createAttendableAttributes)(qualifiedSubjectId);
|
|
638
|
-
const space = (0, import_echo.getSpace)(doc);
|
|
639
642
|
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
643
|
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
653
644
|
role: "none",
|
|
654
645
|
className: "contents group/attention",
|
|
@@ -678,55 +669,41 @@ var ThreadPlugin = () => {
|
|
|
678
669
|
},
|
|
679
670
|
onThreadDelete: (thread) => dispatch?.({
|
|
680
671
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
681
|
-
action:
|
|
672
|
+
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
682
673
|
data: {
|
|
683
|
-
|
|
674
|
+
subject: data.subject,
|
|
684
675
|
thread
|
|
685
676
|
}
|
|
686
677
|
}),
|
|
687
678
|
onMessageDelete: (thread, messageId) => dispatch?.({
|
|
688
679
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
689
|
-
action:
|
|
680
|
+
action: import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE,
|
|
690
681
|
data: {
|
|
691
|
-
|
|
682
|
+
subject: data.subject,
|
|
692
683
|
thread,
|
|
693
684
|
messageId
|
|
694
685
|
}
|
|
695
686
|
}),
|
|
696
687
|
onThreadToggleResolved: (thread) => dispatch?.({
|
|
697
688
|
plugin: import_chunk_BWBONZGU.THREAD_PLUGIN,
|
|
698
|
-
action:
|
|
689
|
+
action: import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED,
|
|
699
690
|
data: {
|
|
700
691
|
thread
|
|
701
692
|
}
|
|
702
693
|
}),
|
|
703
694
|
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
|
|
695
|
+
void intentPlugin?.provides.intent.dispatch({
|
|
696
|
+
action: import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD,
|
|
697
|
+
data: {
|
|
698
|
+
thread,
|
|
699
|
+
subject: data.subject
|
|
700
|
+
}
|
|
718
701
|
});
|
|
719
702
|
}
|
|
720
703
|
}), /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
721
704
|
role: "none",
|
|
722
705
|
className: "bs-10"
|
|
723
706
|
}), /* @__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
707
|
}
|
|
731
708
|
}
|
|
732
709
|
}
|
|
@@ -736,25 +713,74 @@ var ThreadPlugin = () => {
|
|
|
736
713
|
intent: {
|
|
737
714
|
resolver: async (intent) => {
|
|
738
715
|
switch (intent.action) {
|
|
739
|
-
case
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
716
|
+
case import_chunk_D5GOVXHS.ThreadAction.CREATE: {
|
|
717
|
+
if (intent.data && intent.data.cursor !== void 0) {
|
|
718
|
+
const { cursor, name, subject } = intent.data;
|
|
719
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
720
|
+
const thread = (0, import_echo_schema2.create)(import_types2.ThreadType, {
|
|
721
|
+
name,
|
|
722
|
+
anchor: cursor,
|
|
723
|
+
messages: [],
|
|
724
|
+
status: "staged"
|
|
725
|
+
});
|
|
726
|
+
const stagingArea = state.staging[subjectId];
|
|
727
|
+
if (stagingArea) {
|
|
728
|
+
stagingArea.push(thread);
|
|
729
|
+
} else {
|
|
730
|
+
state.staging[subjectId] = [
|
|
731
|
+
thread
|
|
732
|
+
];
|
|
733
|
+
}
|
|
734
|
+
return {
|
|
735
|
+
data: thread,
|
|
736
|
+
intents: [
|
|
737
|
+
[
|
|
738
|
+
{
|
|
739
|
+
action: import_app_framework.NavigationAction.OPEN,
|
|
740
|
+
data: {
|
|
741
|
+
activeParts: {
|
|
742
|
+
complementary: `${subjectId}${import_app_framework.SLUG_PATH_SEPARATOR}comments${import_app_framework.SLUG_COLLECTION_INDICATOR}`
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
action: import_chunk_D5GOVXHS.ThreadAction.SELECT,
|
|
748
|
+
data: {
|
|
749
|
+
current: thread.id,
|
|
750
|
+
focus: true
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
755
|
+
data: {
|
|
756
|
+
element: "complementary",
|
|
757
|
+
subject: subjectId,
|
|
758
|
+
state: true
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
]
|
|
746
762
|
]
|
|
747
|
-
}
|
|
748
|
-
}
|
|
763
|
+
};
|
|
764
|
+
} else {
|
|
765
|
+
return {
|
|
766
|
+
data: (0, import_echo_schema2.create)(import_types2.ChannelType, {
|
|
767
|
+
threads: [
|
|
768
|
+
(0, import_echo_schema2.create)(import_types2.ThreadType, {
|
|
769
|
+
messages: []
|
|
770
|
+
})
|
|
771
|
+
]
|
|
772
|
+
})
|
|
773
|
+
};
|
|
774
|
+
}
|
|
749
775
|
}
|
|
750
|
-
case
|
|
776
|
+
case import_chunk_D5GOVXHS.ThreadAction.SELECT: {
|
|
751
777
|
state.focus = intent.data?.current === state.current ? state.focus : intent.data?.focus;
|
|
752
778
|
state.current = intent.data?.current;
|
|
753
779
|
return {
|
|
754
780
|
data: true
|
|
755
781
|
};
|
|
756
782
|
}
|
|
757
|
-
case
|
|
783
|
+
case import_chunk_D5GOVXHS.ThreadAction.TOGGLE_RESOLVED: {
|
|
758
784
|
const { thread } = intent.data ?? {};
|
|
759
785
|
if (!(thread instanceof import_types2.ThreadType)) {
|
|
760
786
|
return;
|
|
@@ -783,28 +809,29 @@ var ThreadPlugin = () => {
|
|
|
783
809
|
]
|
|
784
810
|
};
|
|
785
811
|
}
|
|
786
|
-
case
|
|
787
|
-
const {
|
|
788
|
-
if (!(
|
|
812
|
+
case import_chunk_D5GOVXHS.ThreadAction.DELETE: {
|
|
813
|
+
const { subject, thread } = intent.data ?? {};
|
|
814
|
+
if (!(subject instanceof import_types.DocumentType) || !(thread instanceof import_types2.ThreadType)) {
|
|
789
815
|
return;
|
|
790
816
|
}
|
|
791
|
-
const
|
|
817
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
818
|
+
const stagingArea = state.staging[subjectId];
|
|
792
819
|
if (stagingArea) {
|
|
793
|
-
const index =
|
|
820
|
+
const index = stagingArea.findIndex((t) => t.id === thread.id);
|
|
794
821
|
if (index !== -1) {
|
|
795
|
-
|
|
822
|
+
stagingArea.splice(index, 1);
|
|
796
823
|
return;
|
|
797
824
|
}
|
|
798
825
|
}
|
|
799
826
|
const space = (0, import_echo.getSpace)(thread);
|
|
800
|
-
if (!space || !
|
|
827
|
+
if (!space || !subject.threads) {
|
|
801
828
|
return;
|
|
802
829
|
}
|
|
803
830
|
if (!intent.undo) {
|
|
804
|
-
const index =
|
|
805
|
-
const cursor =
|
|
831
|
+
const index = subject.threads.findIndex((t) => t?.id === thread.id);
|
|
832
|
+
const cursor = subject.threads[index]?.anchor;
|
|
806
833
|
if (index !== -1) {
|
|
807
|
-
|
|
834
|
+
subject.threads?.splice(index, 1);
|
|
808
835
|
}
|
|
809
836
|
space.db.remove(thread);
|
|
810
837
|
return {
|
|
@@ -831,7 +858,7 @@ var ThreadPlugin = () => {
|
|
|
831
858
|
};
|
|
832
859
|
} else if (intent.undo) {
|
|
833
860
|
const savedThread = space.db.add(thread);
|
|
834
|
-
|
|
861
|
+
subject.threads.push(savedThread);
|
|
835
862
|
return {
|
|
836
863
|
data: true,
|
|
837
864
|
intents: [
|
|
@@ -852,10 +879,53 @@ var ThreadPlugin = () => {
|
|
|
852
879
|
}
|
|
853
880
|
break;
|
|
854
881
|
}
|
|
855
|
-
case
|
|
856
|
-
const {
|
|
857
|
-
|
|
858
|
-
|
|
882
|
+
case import_chunk_D5GOVXHS.ThreadAction.ON_MESSAGE_ADD: {
|
|
883
|
+
const { thread, subject } = intent.data ?? {};
|
|
884
|
+
if (!(thread instanceof import_types2.ThreadType) || !(subject && typeof subject === "object" && "threads" in subject)) {
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
const subjectId = (0, import_echo.fullyQualifiedId)(subject);
|
|
888
|
+
const space = (0, import_echo.getSpace)(subject);
|
|
889
|
+
const intents = [];
|
|
890
|
+
const analyticsProperties = {
|
|
891
|
+
threadId: thread.id,
|
|
892
|
+
spaceId: space?.id
|
|
893
|
+
};
|
|
894
|
+
if (state.staging[subjectId]?.find((t) => t === thread)) {
|
|
895
|
+
thread.status = "active";
|
|
896
|
+
subject.threads ? subject.threads.push(thread) : subject.threads = [
|
|
897
|
+
thread
|
|
898
|
+
];
|
|
899
|
+
state.staging[subjectId] = state.staging[subjectId]?.filter((t) => t.id !== thread.id);
|
|
900
|
+
intents.push({
|
|
901
|
+
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
902
|
+
data: {
|
|
903
|
+
name: "threads.thread-created",
|
|
904
|
+
properties: analyticsProperties
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
intents.push({
|
|
909
|
+
action: import_meta.ObservabilityAction.SEND_EVENT,
|
|
910
|
+
data: {
|
|
911
|
+
name: "threads.message-added",
|
|
912
|
+
properties: {
|
|
913
|
+
...analyticsProperties,
|
|
914
|
+
threadLength: thread.messages.length
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
return {
|
|
919
|
+
data: thread,
|
|
920
|
+
intents: [
|
|
921
|
+
intents
|
|
922
|
+
]
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
case import_chunk_D5GOVXHS.ThreadAction.DELETE_MESSAGE: {
|
|
926
|
+
const { subject, thread, messageId } = intent.data ?? {};
|
|
927
|
+
const space = (0, import_echo.getSpace)(subject);
|
|
928
|
+
if (!(subject instanceof import_types.DocumentType) || !(thread instanceof import_types2.ThreadType) || !space) {
|
|
859
929
|
return;
|
|
860
930
|
}
|
|
861
931
|
if (!intent.undo) {
|
|
@@ -869,9 +939,9 @@ var ThreadPlugin = () => {
|
|
|
869
939
|
intents: [
|
|
870
940
|
[
|
|
871
941
|
{
|
|
872
|
-
action:
|
|
942
|
+
action: import_chunk_D5GOVXHS.ThreadAction.DELETE,
|
|
873
943
|
data: {
|
|
874
|
-
|
|
944
|
+
subject,
|
|
875
945
|
thread
|
|
876
946
|
}
|
|
877
947
|
}
|
|
@@ -944,7 +1014,7 @@ var ThreadPlugin = () => {
|
|
|
944
1014
|
}
|
|
945
1015
|
const threads = (0, import_signals_core.computed)(() => [
|
|
946
1016
|
...doc.threads.filter(import_util.nonNullable),
|
|
947
|
-
...state.staging[doc
|
|
1017
|
+
...state.staging[(0, import_echo.fullyQualifiedId)(doc)] ?? []
|
|
948
1018
|
].filter((thread) => !(thread?.status === "resolved")));
|
|
949
1019
|
return [
|
|
950
1020
|
(0, import_react_ui_editor.listener)({
|
|
@@ -973,49 +1043,17 @@ var ThreadPlugin = () => {
|
|
|
973
1043
|
const name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
974
1044
|
"content"
|
|
975
1045
|
]), 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
|
-
}
|
|
1046
|
+
void intentPlugin?.provides.intent.dispatch({
|
|
1047
|
+
action: import_chunk_D5GOVXHS.ThreadAction.CREATE,
|
|
1048
|
+
data: {
|
|
1049
|
+
cursor,
|
|
1050
|
+
name,
|
|
1051
|
+
subject: doc
|
|
1013
1052
|
}
|
|
1014
|
-
|
|
1015
|
-
return thread.id;
|
|
1053
|
+
});
|
|
1016
1054
|
},
|
|
1017
1055
|
onDelete: ({ id }) => {
|
|
1018
|
-
const stagingArea = state.staging[doc
|
|
1056
|
+
const stagingArea = state.staging[(0, import_echo.fullyQualifiedId)(doc)];
|
|
1019
1057
|
if (stagingArea) {
|
|
1020
1058
|
const index = stagingArea.findIndex((thread2) => thread2.id === id);
|
|
1021
1059
|
if (index !== -1) {
|
|
@@ -1028,7 +1066,7 @@ var ThreadPlugin = () => {
|
|
|
1028
1066
|
}
|
|
1029
1067
|
},
|
|
1030
1068
|
onUpdate: ({ id, cursor }) => {
|
|
1031
|
-
const thread = state.staging[doc
|
|
1069
|
+
const thread = state.staging[(0, import_echo.fullyQualifiedId)(doc)]?.find((thread2) => thread2.id === id) ?? doc.threads.find((thread2) => thread2?.id === id);
|
|
1032
1070
|
if (thread instanceof import_types2.ThreadType && thread.anchor) {
|
|
1033
1071
|
const [start, end] = thread.anchor.split(":");
|
|
1034
1072
|
thread.name = doc.content && (0, import_echo.getTextInRange)((0, import_echo.createDocAccessor)(doc.content, [
|
|
@@ -1042,7 +1080,7 @@ var ThreadPlugin = () => {
|
|
|
1042
1080
|
if (dispatch2) {
|
|
1043
1081
|
void dispatch2([
|
|
1044
1082
|
{
|
|
1045
|
-
action:
|
|
1083
|
+
action: import_chunk_D5GOVXHS.ThreadAction.SELECT,
|
|
1046
1084
|
data: {
|
|
1047
1085
|
current: current ?? closest
|
|
1048
1086
|
}
|