@univerjs/docs-thread-comment-ui 0.7.0 → 0.8.0-beta.1
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/lib/cjs/index.js +2 -2
- package/lib/es/index.js +205 -200
- package/lib/index.js +205 -200
- package/lib/umd/index.js +2 -2
- package/package.json +11 -11
package/lib/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var Oe = Object.defineProperty;
|
|
2
2
|
var Me = (e, t, r) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
4
|
-
import { Inject as _, Disposable as B, CommandType as P, ICommandService as
|
|
3
|
+
var K = (e, t, r) => Me(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { Inject as _, Disposable as B, CommandType as P, ICommandService as b, CustomDecorationType as Y, sequenceExecute as ne, UniverInstanceType as p, SHEET_EDITOR_UNITS as be, IUniverInstanceService as w, Injector as re, isInternalEditorID as oe, UserManagerService as De, BuildTextUtils as ye, DependentOn as xe, IConfigService as Te, Plugin as Ue, merge as Re } from "@univerjs/core";
|
|
5
5
|
import { IRenderManagerService as F, withCurrentTypeOfRenderer as Ee, DocumentEditArea as X } from "@univerjs/engine-render";
|
|
6
|
-
import { ThreadCommentPanelService as U, SetActiveCommentOperation as
|
|
7
|
-
import { DocSelectionManagerService as H, DocSkeletonManagerService as
|
|
6
|
+
import { ThreadCommentPanelService as U, SetActiveCommentOperation as ie, ThreadCommentPanel as Pe, UniverThreadCommentUIPlugin as we } from "@univerjs/thread-comment-ui";
|
|
7
|
+
import { DocSelectionManagerService as H, DocSkeletonManagerService as Ae, RichTextEditingMutation as de, SetTextSelectionsOperation as Ne, DocInterceptorService as Ve, DOC_INTERCEPTOR_POINT as $e } from "@univerjs/docs";
|
|
8
8
|
import { addCustomDecorationBySelectionFactory as je, deleteCustomDecorationFactory as Be, DocSelectionRenderService as Fe, DocBackScrollRenderController as He, DocRenderController as Le } from "@univerjs/docs-ui";
|
|
9
|
-
import { IThreadCommentDataSourceService as We, AddCommentMutation as
|
|
10
|
-
import { ISidebarService as L, getMenuHiddenObservable as ce, MenuItemType as ae, useDependency as E, useObservable as
|
|
11
|
-
import { BehaviorSubject as
|
|
9
|
+
import { IThreadCommentDataSourceService as We, AddCommentMutation as Ze, getDT as Ke, ThreadCommentModel as se } from "@univerjs/thread-comment";
|
|
10
|
+
import { ISidebarService as L, getMenuHiddenObservable as ce, MenuItemType as ae, useDependency as E, useObservable as G, ContextMenuPosition as Ge, ContextMenuGroup as ke, RibbonInsertGroup as Je, IMenuManagerService as qe, ComponentManager as Ye } from "@univerjs/ui";
|
|
11
|
+
import { BehaviorSubject as ze, Observable as me, debounceTime as le, filter as Qe } from "rxjs";
|
|
12
12
|
import { jsx as Xe } from "react/jsx-runtime";
|
|
13
|
-
import { useMemo as
|
|
14
|
-
const rt = "DOC_THREAD_COMMENT_UI_PLUGIN", S = "default_doc",
|
|
15
|
-
var
|
|
16
|
-
for (var
|
|
17
|
-
(
|
|
18
|
-
return
|
|
13
|
+
import { useMemo as k, useState as et, useEffect as tt, forwardRef as ue, useRef as nt, createElement as fe } from "react";
|
|
14
|
+
const rt = "DOC_THREAD_COMMENT_UI_PLUGIN", S = "default_doc", ot = "docs-thread-comment-ui.config", ee = {};
|
|
15
|
+
var it = Object.getOwnPropertyDescriptor, dt = (e, t, r, n) => {
|
|
16
|
+
for (var o = n > 1 ? void 0 : n ? it(t, r) : t, i = e.length - 1, d; i >= 0; i--)
|
|
17
|
+
(d = e[i]) && (o = d(o) || o);
|
|
18
|
+
return o;
|
|
19
19
|
}, te = (e, t) => (r, n) => t(r, n, e);
|
|
20
|
-
let
|
|
20
|
+
let T = class extends B {
|
|
21
21
|
constructor(t, r) {
|
|
22
22
|
super();
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
K(this, "_addingComment$", new ze(void 0));
|
|
24
|
+
K(this, "addingComment$", this._addingComment$.asObservable());
|
|
25
25
|
this._sidebarService = t, this._threadCommentPanelService = r, this.disposeWithMe(() => {
|
|
26
26
|
this._addingComment$.complete();
|
|
27
27
|
});
|
|
@@ -36,41 +36,41 @@ let x = class extends B {
|
|
|
36
36
|
this._addingComment$.next(void 0);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
T = dt([
|
|
40
40
|
te(0, L),
|
|
41
41
|
te(1, _(U))
|
|
42
|
-
],
|
|
42
|
+
], T);
|
|
43
43
|
const he = {
|
|
44
44
|
id: "docs.command.add-comment",
|
|
45
45
|
type: P.COMMAND,
|
|
46
46
|
async handler(e, t) {
|
|
47
47
|
if (!t)
|
|
48
48
|
return !1;
|
|
49
|
-
const { comment: r, unitId: n } = t,
|
|
49
|
+
const { comment: r, unitId: n } = t, i = await e.get(We).addComment(r), d = e.get(b), s = je(
|
|
50
50
|
e,
|
|
51
51
|
{
|
|
52
|
-
id:
|
|
53
|
-
type:
|
|
52
|
+
id: i.threadId,
|
|
53
|
+
type: Y.COMMENT,
|
|
54
54
|
unitId: n
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
|
-
if (
|
|
57
|
+
if (s) {
|
|
58
58
|
const l = {
|
|
59
|
-
id:
|
|
59
|
+
id: Ze.id,
|
|
60
60
|
params: {
|
|
61
61
|
unitId: n,
|
|
62
62
|
subUnitId: S,
|
|
63
|
-
comment:
|
|
63
|
+
comment: i
|
|
64
64
|
}
|
|
65
65
|
}, f = {
|
|
66
|
-
id:
|
|
66
|
+
id: ie.id,
|
|
67
67
|
params: {
|
|
68
68
|
unitId: n,
|
|
69
69
|
subUnitId: S,
|
|
70
|
-
commentId:
|
|
70
|
+
commentId: i.id
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
return (await ne([l,
|
|
73
|
+
return (await ne([l, s, f], d)).result;
|
|
74
74
|
}
|
|
75
75
|
return !1;
|
|
76
76
|
}
|
|
@@ -80,36 +80,36 @@ const he = {
|
|
|
80
80
|
async handler(e, t) {
|
|
81
81
|
if (!t)
|
|
82
82
|
return !1;
|
|
83
|
-
const { commentId: r, unitId: n } = t,
|
|
83
|
+
const { commentId: r, unitId: n } = t, o = e.get(b), i = Be(e, {
|
|
84
84
|
id: r,
|
|
85
85
|
unitId: n
|
|
86
86
|
});
|
|
87
|
-
return
|
|
87
|
+
return i ? (await ne([i], o)).result : !1;
|
|
88
88
|
}
|
|
89
|
-
},
|
|
90
|
-
var
|
|
91
|
-
const t = e.get(F), r = e.get(H), n = (
|
|
89
|
+
}, ve = (e) => {
|
|
90
|
+
var d;
|
|
91
|
+
const t = e.get(F), r = e.get(H), n = (d = Ee(
|
|
92
92
|
p.UNIVER_DOC,
|
|
93
|
-
|
|
94
|
-
e.get(
|
|
93
|
+
Ae,
|
|
94
|
+
e.get(w),
|
|
95
95
|
t
|
|
96
|
-
)) == null ? void 0 :
|
|
97
|
-
if (
|
|
96
|
+
)) == null ? void 0 : d.getSkeleton(), o = n == null ? void 0 : n.getViewModel().getEditArea();
|
|
97
|
+
if (o === X.FOOTER || o === X.HEADER)
|
|
98
98
|
return !0;
|
|
99
|
-
const
|
|
100
|
-
return !!(
|
|
99
|
+
const i = r.getActiveTextRange();
|
|
100
|
+
return !!(i == null || i.collapsed);
|
|
101
101
|
};
|
|
102
|
-
function
|
|
102
|
+
function st(e) {
|
|
103
103
|
return {
|
|
104
104
|
id: W.id,
|
|
105
105
|
type: ae.BUTTON,
|
|
106
|
-
icon: "
|
|
106
|
+
icon: "CommentIcon",
|
|
107
107
|
title: "threadCommentUI.panel.addComment",
|
|
108
108
|
tooltip: "threadCommentUI.panel.addComment",
|
|
109
109
|
hidden$: ce(e, p.UNIVER_DOC, void 0, be),
|
|
110
110
|
disabled$: new me(function(t) {
|
|
111
111
|
const n = e.get(H).textSelection$.pipe(le(16)).subscribe(() => {
|
|
112
|
-
t.next(
|
|
112
|
+
t.next(ve(e));
|
|
113
113
|
});
|
|
114
114
|
return () => {
|
|
115
115
|
n.unsubscribe();
|
|
@@ -121,53 +121,53 @@ function ct(e) {
|
|
|
121
121
|
return {
|
|
122
122
|
id: Q.id,
|
|
123
123
|
type: ae.BUTTON,
|
|
124
|
-
icon: "
|
|
124
|
+
icon: "CommentIcon",
|
|
125
125
|
title: "threadCommentUI.panel.addComment",
|
|
126
126
|
tooltip: "threadCommentUI.panel.addComment",
|
|
127
127
|
hidden$: ce(e, p.UNIVER_DOC)
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
const
|
|
131
|
-
const e = E(
|
|
132
|
-
() =>
|
|
133
|
-
[
|
|
130
|
+
const M = () => {
|
|
131
|
+
const e = E(w), t = E(re), r = k(() => e.getCurrentTypeOfUnit$(p.UNIVER_DOC).pipe(Qe((c) => !!c && !oe(c.getUnitId()))), [e]), n = G(r), o = k(() => new me((c) => c.next(S)), []), i = E(H), d = k(
|
|
132
|
+
() => i.textSelection$.pipe(le(16)),
|
|
133
|
+
[i.textSelection$]
|
|
134
134
|
);
|
|
135
|
-
|
|
136
|
-
const
|
|
135
|
+
G(d);
|
|
136
|
+
const s = E(b), l = E(T), f = G(l.addingComment$), [a, h] = et([]);
|
|
137
137
|
if (tt(() => {
|
|
138
|
-
var
|
|
138
|
+
var D;
|
|
139
139
|
const c = /* @__PURE__ */ new Set(), m = n == null ? void 0 : n.getCustomDecorations();
|
|
140
|
-
h((
|
|
140
|
+
h((D = m == null ? void 0 : m.map((u) => u.id).filter((u) => {
|
|
141
141
|
const O = c.has(u);
|
|
142
142
|
return c.add(u), !O;
|
|
143
|
-
})) != null ?
|
|
144
|
-
const I =
|
|
143
|
+
})) != null ? D : []);
|
|
144
|
+
const I = s.onCommandExecuted((u) => {
|
|
145
145
|
var O;
|
|
146
|
-
if (u.id ===
|
|
147
|
-
const R = /* @__PURE__ */ new Set(),
|
|
148
|
-
h((O =
|
|
149
|
-
const Se = R.has(
|
|
150
|
-
return R.add(
|
|
146
|
+
if (u.id === de.id) {
|
|
147
|
+
const R = /* @__PURE__ */ new Set(), Z = n == null ? void 0 : n.getCustomDecorations();
|
|
148
|
+
h((O = Z == null ? void 0 : Z.map((A) => A.id).filter((A) => {
|
|
149
|
+
const Se = R.has(A);
|
|
150
|
+
return R.add(A), !Se;
|
|
151
151
|
})) != null ? O : []);
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
return () => {
|
|
155
155
|
I.dispose();
|
|
156
156
|
};
|
|
157
|
-
}, [
|
|
157
|
+
}, [s, n]), !n)
|
|
158
158
|
return null;
|
|
159
|
-
const
|
|
159
|
+
const v = ve(t), C = n.getUnitId();
|
|
160
160
|
return /* @__PURE__ */ Xe(
|
|
161
161
|
Pe,
|
|
162
162
|
{
|
|
163
163
|
unitId: C,
|
|
164
|
-
subUnitId$:
|
|
164
|
+
subUnitId$: o,
|
|
165
165
|
type: p.UNIVER_DOC,
|
|
166
166
|
onAdd: () => {
|
|
167
|
-
|
|
167
|
+
s.executeCommand(W.id);
|
|
168
168
|
},
|
|
169
169
|
getSubUnitName: () => "",
|
|
170
|
-
disableAdd:
|
|
170
|
+
disableAdd: v,
|
|
171
171
|
tempComment: f,
|
|
172
172
|
onAddComment: (c) => {
|
|
173
173
|
if (!c.parentId) {
|
|
@@ -176,7 +176,7 @@ const T = () => {
|
|
|
176
176
|
range: f,
|
|
177
177
|
comment: c
|
|
178
178
|
};
|
|
179
|
-
return
|
|
179
|
+
return s.executeCommand(he.id, m), l.endAdd(), !1;
|
|
180
180
|
}
|
|
181
181
|
return !0;
|
|
182
182
|
},
|
|
@@ -186,7 +186,7 @@ const T = () => {
|
|
|
186
186
|
unitId: C,
|
|
187
187
|
commentId: c.id
|
|
188
188
|
};
|
|
189
|
-
return
|
|
189
|
+
return s.executeCommand(Ce.id, m), !1;
|
|
190
190
|
}
|
|
191
191
|
return !0;
|
|
192
192
|
},
|
|
@@ -194,16 +194,16 @@ const T = () => {
|
|
|
194
194
|
}
|
|
195
195
|
);
|
|
196
196
|
};
|
|
197
|
-
|
|
198
|
-
const
|
|
197
|
+
M.componentKey = "univer.doc.thread-comment-panel";
|
|
198
|
+
const N = {
|
|
199
199
|
id: "docs.operation.show-comment-panel",
|
|
200
200
|
type: P.OPERATION,
|
|
201
201
|
handler(e, t) {
|
|
202
|
-
var
|
|
202
|
+
var o;
|
|
203
203
|
const r = e.get(U), n = e.get(L);
|
|
204
|
-
return (!r.panelVisible || ((
|
|
204
|
+
return (!r.panelVisible || ((o = n.options.children) == null ? void 0 : o.label) !== M.componentKey) && (n.open({
|
|
205
205
|
header: { title: "threadCommentUI.panel.title" },
|
|
206
|
-
children: { label:
|
|
206
|
+
children: { label: M.componentKey },
|
|
207
207
|
width: 320,
|
|
208
208
|
onClose: () => r.setPanelVisible(!1)
|
|
209
209
|
}), r.setPanelVisible(!0)), t && r.setActiveComment(t == null ? void 0 : t.activeComment), !0;
|
|
@@ -214,9 +214,9 @@ const w = {
|
|
|
214
214
|
handler(e) {
|
|
215
215
|
var n;
|
|
216
216
|
const t = e.get(U), r = e.get(L);
|
|
217
|
-
return !t.panelVisible || ((n = r.options.children) == null ? void 0 : n.label) !==
|
|
217
|
+
return !t.panelVisible || ((n = r.options.children) == null ? void 0 : n.label) !== M.componentKey ? (r.open({
|
|
218
218
|
header: { title: "threadCommentUI.panel.title" },
|
|
219
|
-
children: { label:
|
|
219
|
+
children: { label: M.componentKey },
|
|
220
220
|
width: 320,
|
|
221
221
|
onClose: () => t.setPanelVisible(!1)
|
|
222
222
|
}), t.setPanelVisible(!0)) : (r.close(), t.setPanelVisible(!1), t.setActiveComment(null)), !0;
|
|
@@ -226,20 +226,20 @@ const w = {
|
|
|
226
226
|
type: P.OPERATION,
|
|
227
227
|
handler(e) {
|
|
228
228
|
var u, O, R;
|
|
229
|
-
const t = e.get(U), n = e.get(
|
|
229
|
+
const t = e.get(U), n = e.get(w).getCurrentUnitForType(p.UNIVER_DOC), o = e.get(H), i = e.get(F), d = e.get(De), s = e.get(T), l = e.get(b), f = e.get(L), a = o.getActiveTextRange();
|
|
230
230
|
if (!n || !a)
|
|
231
231
|
return !1;
|
|
232
|
-
const h = (u =
|
|
232
|
+
const h = (u = i.getRenderById(n.getUnitId())) == null ? void 0 : u.with(Fe);
|
|
233
233
|
if (h == null || h.setReserveRangesStatus(!0), a.collapsed)
|
|
234
|
-
return t.panelVisible ? (t.setPanelVisible(!1), f.close()) : l.executeCommand(
|
|
235
|
-
l.executeCommand(
|
|
236
|
-
const
|
|
237
|
-
unitId:
|
|
234
|
+
return t.panelVisible ? (t.setPanelVisible(!1), f.close()) : l.executeCommand(N.id), !0;
|
|
235
|
+
l.executeCommand(N.id);
|
|
236
|
+
const v = n.getUnitId(), C = ((R = (O = n.getBody()) == null ? void 0 : O.dataStream) != null ? R : "").slice(a.startOffset, a.endOffset), c = ye.transform.getPlainText(C), m = S, I = "", D = {
|
|
237
|
+
unitId: v,
|
|
238
238
|
subUnitId: m,
|
|
239
239
|
id: I,
|
|
240
240
|
ref: c,
|
|
241
|
-
dT:
|
|
242
|
-
personId:
|
|
241
|
+
dT: Ke(),
|
|
242
|
+
personId: d.getCurrentUser().userID,
|
|
243
243
|
text: {
|
|
244
244
|
dataStream: `\r
|
|
245
245
|
`
|
|
@@ -249,41 +249,41 @@ const w = {
|
|
|
249
249
|
collapsed: !0,
|
|
250
250
|
threadId: I
|
|
251
251
|
};
|
|
252
|
-
return h == null || h.blur(),
|
|
253
|
-
unitId:
|
|
252
|
+
return h == null || h.blur(), s.startAdd(D), t.setActiveComment({
|
|
253
|
+
unitId: v,
|
|
254
254
|
subUnitId: m,
|
|
255
255
|
commentId: I
|
|
256
256
|
}), !0;
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
259
|
var at = Object.getOwnPropertyDescriptor, mt = (e, t, r, n) => {
|
|
260
|
-
for (var
|
|
261
|
-
(
|
|
262
|
-
return
|
|
263
|
-
},
|
|
260
|
+
for (var o = n > 1 ? void 0 : n ? at(t, r) : t, i = e.length - 1, d; i >= 0; i--)
|
|
261
|
+
(d = e[i]) && (o = d(o) || o);
|
|
262
|
+
return o;
|
|
263
|
+
}, y = (e, t) => (r, n) => t(r, n, e);
|
|
264
264
|
let V = class extends B {
|
|
265
|
-
constructor(e, t, r, n,
|
|
266
|
-
super(), this._threadCommentPanelService = e, this._univerInstanceService = t, this._commandService = r, this._docThreadCommentService = n, this._renderManagerService =
|
|
265
|
+
constructor(e, t, r, n, o, i) {
|
|
266
|
+
super(), this._threadCommentPanelService = e, this._univerInstanceService = t, this._commandService = r, this._docThreadCommentService = n, this._renderManagerService = o, this._threadCommentModel = i, this._initSelectionChange(), this._initActiveCommandChange();
|
|
267
267
|
}
|
|
268
268
|
_initSelectionChange() {
|
|
269
269
|
let e;
|
|
270
270
|
this.disposeWithMe(
|
|
271
271
|
this._commandService.onCommandExecuted((t) => {
|
|
272
|
-
var r, n,
|
|
273
|
-
if (t.id ===
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
const f = this._univerInstanceService.getUnit(
|
|
272
|
+
var r, n, o, i;
|
|
273
|
+
if (t.id === Ne.id) {
|
|
274
|
+
const d = t.params, { unitId: s, ranges: l } = d;
|
|
275
|
+
if (oe(s)) return;
|
|
276
|
+
const f = this._univerInstanceService.getUnit(s, p.UNIVER_DOC), a = l[0];
|
|
277
277
|
if ((e == null ? void 0 : e.startOffset) === (a == null ? void 0 : a.startOffset) && (e == null ? void 0 : e.endOffset) === (a == null ? void 0 : a.endOffset))
|
|
278
278
|
return;
|
|
279
279
|
if (e = a, a && f) {
|
|
280
|
-
const { startOffset: h, endOffset:
|
|
280
|
+
const { startOffset: h, endOffset: v, collapsed: C } = a;
|
|
281
281
|
let c;
|
|
282
|
-
if (C ? c = (n = (r = f.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((m) => m.startIndex <= h && m.endIndex >=
|
|
283
|
-
const m = this._threadCommentModel.getComment(
|
|
284
|
-
m && !m.resolved && this._commandService.executeCommand(
|
|
282
|
+
if (C ? c = (n = (r = f.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((m) => m.startIndex <= h && m.endIndex >= v - 1) : c = (i = (o = f.getBody()) == null ? void 0 : o.customDecorations) == null ? void 0 : i.find((m) => m.startIndex <= h && m.endIndex >= v - 1), c) {
|
|
283
|
+
const m = this._threadCommentModel.getComment(s, S, c.id);
|
|
284
|
+
m && !m.resolved && this._commandService.executeCommand(N.id, {
|
|
285
285
|
activeComment: {
|
|
286
|
-
unitId:
|
|
286
|
+
unitId: s,
|
|
287
287
|
subUnitId: S,
|
|
288
288
|
commentId: c.id
|
|
289
289
|
}
|
|
@@ -293,112 +293,112 @@ let V = class extends B {
|
|
|
293
293
|
}
|
|
294
294
|
if (!this._threadCommentPanelService.activeCommentId)
|
|
295
295
|
return;
|
|
296
|
-
this._commandService.executeCommand(
|
|
296
|
+
this._commandService.executeCommand(ie.id);
|
|
297
297
|
}
|
|
298
298
|
})
|
|
299
299
|
);
|
|
300
300
|
}
|
|
301
301
|
_initActiveCommandChange() {
|
|
302
302
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((e) => {
|
|
303
|
-
var t, r, n,
|
|
303
|
+
var t, r, n, o;
|
|
304
304
|
if (e) {
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
startOffset:
|
|
310
|
-
endOffset:
|
|
305
|
+
const i = this._univerInstanceService.getUnit(e.unitId);
|
|
306
|
+
if (i) {
|
|
307
|
+
const d = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with(He), s = (n = (r = i.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((l) => l.id === e.commentId);
|
|
308
|
+
s && d && d.scrollToRange({
|
|
309
|
+
startOffset: s.startIndex,
|
|
310
|
+
endOffset: s.endIndex,
|
|
311
311
|
collapsed: !1
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
(!e || e.commentId !== ((
|
|
315
|
+
(!e || e.commentId !== ((o = this._docThreadCommentService.addingComment) == null ? void 0 : o.id)) && this._docThreadCommentService.endAdd();
|
|
316
316
|
}));
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
V = mt([
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
320
|
+
y(0, _(U)),
|
|
321
|
+
y(1, w),
|
|
322
|
+
y(2, b),
|
|
323
|
+
y(3, _(T)),
|
|
324
|
+
y(4, F),
|
|
325
|
+
y(5, _(se))
|
|
326
326
|
], V);
|
|
327
|
-
var
|
|
328
|
-
return
|
|
327
|
+
var g = function() {
|
|
328
|
+
return g = Object.assign || function(e) {
|
|
329
329
|
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
330
330
|
t = arguments[r];
|
|
331
|
-
for (var
|
|
331
|
+
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
|
332
332
|
}
|
|
333
333
|
return e;
|
|
334
|
-
},
|
|
334
|
+
}, g.apply(this, arguments);
|
|
335
335
|
}, lt = function(e, t) {
|
|
336
336
|
var r = {};
|
|
337
337
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
338
338
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
339
|
-
for (var
|
|
340
|
-
t.indexOf(n[
|
|
339
|
+
for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
|
|
340
|
+
t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
|
|
341
341
|
return r;
|
|
342
|
-
},
|
|
343
|
-
var r = e.icon, n = e.id,
|
|
344
|
-
return _e(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current },
|
|
342
|
+
}, ge = ue(function(e, t) {
|
|
343
|
+
var r = e.icon, n = e.id, o = e.className, i = e.extend, d = lt(e, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), l = nt("_".concat(ht()));
|
|
344
|
+
return _e(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, g({ ref: t, className: s }, d), i);
|
|
345
345
|
});
|
|
346
|
-
function _e(e, t, r, n,
|
|
347
|
-
return fe(e.tag,
|
|
348
|
-
return _e(
|
|
346
|
+
function _e(e, t, r, n, o) {
|
|
347
|
+
return fe(e.tag, g(g({ key: t }, ut(e, r, o)), n), (ft(e, r).children || []).map(function(i, d) {
|
|
348
|
+
return _e(i, "".concat(t, "-").concat(e.tag, "-").concat(d), r, void 0, o);
|
|
349
349
|
}));
|
|
350
350
|
}
|
|
351
351
|
function ut(e, t, r) {
|
|
352
|
-
var n =
|
|
353
|
-
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(
|
|
354
|
-
var
|
|
355
|
-
|
|
352
|
+
var n = g({}, e.attrs);
|
|
353
|
+
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), e.tag === "mask" && n.id && (n.id = n.id + t.idSuffix), Object.entries(n).forEach(function(i) {
|
|
354
|
+
var d = i[0], s = i[1];
|
|
355
|
+
d === "mask" && typeof s == "string" && (n[d] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
356
356
|
});
|
|
357
|
-
var
|
|
358
|
-
return !
|
|
359
|
-
var
|
|
360
|
-
typeof
|
|
357
|
+
var o = t.defIds;
|
|
358
|
+
return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(i) {
|
|
359
|
+
var d = i[0], s = i[1];
|
|
360
|
+
typeof s == "string" && (n[d] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
361
361
|
})), n;
|
|
362
362
|
}
|
|
363
363
|
function ft(e, t) {
|
|
364
364
|
var r, n = t.defIds;
|
|
365
|
-
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ?
|
|
366
|
-
return typeof
|
|
365
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? g(g({}, e), { children: e.children.map(function(o) {
|
|
366
|
+
return typeof o.attrs.id == "string" && n && n.includes(o.attrs.id) ? g(g({}, o), { attrs: g(g({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
|
|
367
367
|
}) }) : e;
|
|
368
368
|
}
|
|
369
369
|
function ht() {
|
|
370
370
|
return Math.random().toString(36).substring(2, 8);
|
|
371
371
|
}
|
|
372
|
-
|
|
373
|
-
var Ct = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.
|
|
374
|
-
return fe(
|
|
375
|
-
id: "comment-
|
|
372
|
+
ge.displayName = "UniverIcon";
|
|
373
|
+
var Ct = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, pe = ue(function(e, t) {
|
|
374
|
+
return fe(ge, Object.assign({}, e, {
|
|
375
|
+
id: "comment-icon",
|
|
376
376
|
ref: t,
|
|
377
377
|
icon: Ct
|
|
378
378
|
}));
|
|
379
379
|
});
|
|
380
|
-
pe.displayName = "
|
|
381
|
-
const
|
|
382
|
-
[
|
|
380
|
+
pe.displayName = "CommentIcon";
|
|
381
|
+
const vt = {
|
|
382
|
+
[Je.MEDIA]: {
|
|
383
383
|
[Q.id]: {
|
|
384
|
-
order:
|
|
384
|
+
order: 3,
|
|
385
385
|
menuItemFactory: ct
|
|
386
386
|
}
|
|
387
387
|
},
|
|
388
|
-
[
|
|
389
|
-
[
|
|
388
|
+
[Ge.MAIN_AREA]: {
|
|
389
|
+
[ke.DATA]: {
|
|
390
390
|
[W.id]: {
|
|
391
391
|
order: 1,
|
|
392
|
-
menuItemFactory:
|
|
392
|
+
menuItemFactory: st
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
|
-
var
|
|
398
|
-
for (var
|
|
399
|
-
(
|
|
400
|
-
return
|
|
401
|
-
},
|
|
397
|
+
var gt = Object.getOwnPropertyDescriptor, _t = (e, t, r, n) => {
|
|
398
|
+
for (var o = n > 1 ? void 0 : n ? gt(t, r) : t, i = e.length - 1, d; i >= 0; i--)
|
|
399
|
+
(d = e[i]) && (o = d(o) || o);
|
|
400
|
+
return o;
|
|
401
|
+
}, J = (e, t) => (r, n) => t(r, n, e);
|
|
402
402
|
let $ = class extends B {
|
|
403
403
|
constructor(e, t, r) {
|
|
404
404
|
super(), this._commandService = e, this._menuManagerService = t, this._componentManager = r, this._initCommands(), this._initMenus(), this._initComponents();
|
|
@@ -407,7 +407,7 @@ let $ = class extends B {
|
|
|
407
407
|
[
|
|
408
408
|
he,
|
|
409
409
|
Ce,
|
|
410
|
-
|
|
410
|
+
N,
|
|
411
411
|
W,
|
|
412
412
|
Q
|
|
413
413
|
].forEach((e) => {
|
|
@@ -415,27 +415,32 @@ let $ = class extends B {
|
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
417
|
_initMenus() {
|
|
418
|
-
this._menuManagerService.mergeMenu(
|
|
418
|
+
this._menuManagerService.mergeMenu(vt);
|
|
419
419
|
}
|
|
420
420
|
_initComponents() {
|
|
421
|
-
[
|
|
422
|
-
|
|
423
|
-
|
|
421
|
+
[
|
|
422
|
+
[M.componentKey, M],
|
|
423
|
+
["CommentIcon", pe]
|
|
424
|
+
].forEach(([e, t]) => {
|
|
425
|
+
this.disposeWithMe(
|
|
426
|
+
this._componentManager.register(e, t)
|
|
427
|
+
);
|
|
428
|
+
});
|
|
424
429
|
}
|
|
425
430
|
};
|
|
426
431
|
$ = _t([
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
432
|
+
J(0, b),
|
|
433
|
+
J(1, qe),
|
|
434
|
+
J(2, _(Ye))
|
|
430
435
|
], $);
|
|
431
436
|
var pt = Object.getOwnPropertyDescriptor, It = (e, t, r, n) => {
|
|
432
|
-
for (var
|
|
433
|
-
(
|
|
434
|
-
return
|
|
435
|
-
},
|
|
436
|
-
let
|
|
437
|
-
constructor(e, t, r, n,
|
|
438
|
-
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService =
|
|
437
|
+
for (var o = n > 1 ? void 0 : n ? pt(t, r) : t, i = e.length - 1, d; i >= 0; i--)
|
|
438
|
+
(d = e[i]) && (o = d(o) || o);
|
|
439
|
+
return o;
|
|
440
|
+
}, x = (e, t) => (r, n) => t(r, n, e);
|
|
441
|
+
let z = class extends B {
|
|
442
|
+
constructor(e, t, r, n, o, i, d) {
|
|
443
|
+
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService = o, this._threadCommentModel = i, this._commandService = d, this._interceptorViewModel(), this._initReRender(), this._initSyncComments();
|
|
439
444
|
}
|
|
440
445
|
_initReRender() {
|
|
441
446
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((e) => {
|
|
@@ -455,40 +460,40 @@ let Y = class extends B {
|
|
|
455
460
|
handler: (e, t, r) => {
|
|
456
461
|
if (!e)
|
|
457
462
|
return r(e);
|
|
458
|
-
const { unitId: n, index:
|
|
463
|
+
const { unitId: n, index: o, customDecorations: i } = t, d = this._threadCommentPanelService.activeCommentId, { commentId: s, unitId: l } = d || {}, f = i.find((C) => C.id === s), a = this._threadCommentModel.getComment(n, S, e.id);
|
|
459
464
|
if (!a)
|
|
460
465
|
return r({
|
|
461
466
|
...e,
|
|
462
467
|
show: !1
|
|
463
468
|
});
|
|
464
|
-
const h = f &&
|
|
469
|
+
const h = f && o >= f.startIndex && o <= f.endIndex, v = l === n && e.id === s;
|
|
465
470
|
return r({
|
|
466
471
|
...e,
|
|
467
|
-
active:
|
|
472
|
+
active: v || h,
|
|
468
473
|
show: !a.resolved
|
|
469
474
|
});
|
|
470
475
|
}
|
|
471
476
|
});
|
|
472
477
|
}
|
|
473
478
|
_initSyncComments() {
|
|
474
|
-
var
|
|
475
|
-
const e = this._context.unit.getUnitId(), t = S, r = (
|
|
476
|
-
r.forEach((
|
|
477
|
-
this._threadCommentModel.getComment(e, t,
|
|
479
|
+
var o, i, d;
|
|
480
|
+
const e = this._context.unit.getUnitId(), t = S, r = (d = (i = (o = this._context.unit.getBody()) == null ? void 0 : o.customDecorations) == null ? void 0 : i.filter((s) => s.type === Y.COMMENT).map((s) => s.id)) != null ? d : [];
|
|
481
|
+
r.forEach((s) => {
|
|
482
|
+
this._threadCommentModel.getComment(e, t, s) || this._threadCommentModel.addComment(e, t, { id: s, threadId: s, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
478
483
|
}), r.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), S, r);
|
|
479
484
|
let n = r.sort();
|
|
480
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
485
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((s) => {
|
|
481
486
|
var l, f, a;
|
|
482
|
-
if (
|
|
483
|
-
if (
|
|
487
|
+
if (s.id === de.id) {
|
|
488
|
+
if (s.params.unitId !== this._context.unit.getUnitId())
|
|
484
489
|
return;
|
|
485
|
-
const
|
|
490
|
+
const v = (a = (f = (l = this._context.unit.getBody()) == null ? void 0 : l.customDecorations) == null ? void 0 : f.filter((c) => c.type === Y.COMMENT).map((c) => c.id)) != null ? a : [], C = v.sort();
|
|
486
491
|
if (JSON.stringify(n) !== JSON.stringify(C)) {
|
|
487
|
-
const c = new Set(n), m = new Set(C), I = /* @__PURE__ */ new Set(),
|
|
488
|
-
|
|
492
|
+
const c = new Set(n), m = new Set(C), I = /* @__PURE__ */ new Set(), D = /* @__PURE__ */ new Set();
|
|
493
|
+
v.forEach((u) => {
|
|
489
494
|
c.has(u) || I.add(u);
|
|
490
495
|
}), n.forEach((u) => {
|
|
491
|
-
m.has(u) ||
|
|
496
|
+
m.has(u) || D.add(u);
|
|
492
497
|
}), n = C, I.forEach((u) => {
|
|
493
498
|
this._threadCommentModel.getComment(e, t, u) || this._threadCommentModel.addComment(e, t, { id: u, threadId: u, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
494
499
|
}), this._threadCommentModel.syncThreadComments(e, t, [...I]);
|
|
@@ -497,34 +502,34 @@ let Y = class extends B {
|
|
|
497
502
|
}));
|
|
498
503
|
}
|
|
499
504
|
};
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
],
|
|
505
|
+
z = It([
|
|
506
|
+
x(1, _(Ve)),
|
|
507
|
+
x(2, _(U)),
|
|
508
|
+
x(3, _(Le)),
|
|
509
|
+
x(4, w),
|
|
510
|
+
x(5, _(se)),
|
|
511
|
+
x(6, b)
|
|
512
|
+
], z);
|
|
508
513
|
var St = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Mt = (e, t, r) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, bt = (e, t, r, n) => {
|
|
509
|
-
for (var
|
|
510
|
-
(
|
|
511
|
-
return
|
|
512
|
-
},
|
|
514
|
+
for (var o = n > 1 ? void 0 : n ? Ot(t, r) : t, i = e.length - 1, d; i >= 0; i--)
|
|
515
|
+
(d = e[i]) && (o = d(o) || o);
|
|
516
|
+
return o;
|
|
517
|
+
}, q = (e, t) => (r, n) => t(r, n, e), Ie = (e, t, r) => Mt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
513
518
|
let j = class extends Ue {
|
|
514
519
|
constructor(e = ee, t, r, n) {
|
|
515
520
|
super(), this._config = e, this._injector = t, this._renderManagerSrv = r, this._configService = n;
|
|
516
|
-
const { menu:
|
|
521
|
+
const { menu: o, ...i } = Re(
|
|
517
522
|
{},
|
|
518
523
|
ee,
|
|
519
524
|
this._config
|
|
520
525
|
);
|
|
521
|
-
|
|
526
|
+
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(ot, i);
|
|
522
527
|
}
|
|
523
528
|
onStarting() {
|
|
524
529
|
[
|
|
525
530
|
[$],
|
|
526
531
|
[V],
|
|
527
|
-
[
|
|
532
|
+
[T]
|
|
528
533
|
].forEach((e) => {
|
|
529
534
|
this._injector.add(e);
|
|
530
535
|
});
|
|
@@ -533,7 +538,7 @@ let j = class extends Ue {
|
|
|
533
538
|
this._initRenderModule(), this._injector.get(V), this._injector.get($);
|
|
534
539
|
}
|
|
535
540
|
_initRenderModule() {
|
|
536
|
-
[
|
|
541
|
+
[z].forEach((e) => {
|
|
537
542
|
this._renderManagerSrv.registerRenderModule(p.UNIVER_DOC, e);
|
|
538
543
|
});
|
|
539
544
|
}
|
|
@@ -541,15 +546,15 @@ let j = class extends Ue {
|
|
|
541
546
|
Ie(j, "pluginName", rt);
|
|
542
547
|
Ie(j, "type", p.UNIVER_DOC);
|
|
543
548
|
j = bt([
|
|
544
|
-
xe(
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
549
|
+
xe(we),
|
|
550
|
+
q(1, _(re)),
|
|
551
|
+
q(2, F),
|
|
552
|
+
q(3, Te)
|
|
548
553
|
], j);
|
|
549
554
|
export {
|
|
550
555
|
he as AddDocCommentComment,
|
|
551
556
|
Ce as DeleteDocCommentComment,
|
|
552
|
-
|
|
557
|
+
N as ShowCommentPanelOperation,
|
|
553
558
|
W as StartAddCommentOperation,
|
|
554
559
|
j as UniverDocsThreadCommentUIPlugin
|
|
555
560
|
};
|