@univerjs/docs-thread-comment-ui 0.8.0-nightly.202505261607 → 0.8.0-nightly.202505281606
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 +143 -143
- package/lib/index.js +143 -143
- package/lib/umd/index.js +2 -2
- package/package.json +9 -9
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 b, CustomDecorationType 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
|
-
(d = e[
|
|
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
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
|
});
|
|
@@ -46,28 +46,28 @@ const he = {
|
|
|
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
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
73
|
return (await ne([l, s, f], d)).result;
|
|
@@ -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
|
-
},
|
|
89
|
+
}, ve = (e) => {
|
|
90
90
|
var d;
|
|
91
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 : d.getSkeleton(),
|
|
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
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,19 +121,19 @@ 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
130
|
const M = () => {
|
|
131
|
-
const e = E(
|
|
132
|
-
() =>
|
|
133
|
-
[
|
|
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 s = E(b), l = E(T), f =
|
|
135
|
+
G(d);
|
|
136
|
+
const s = E(b), l = E(T), f = G(l.addingComment$), [a, h] = et([]);
|
|
137
137
|
if (tt(() => {
|
|
138
138
|
var D;
|
|
139
139
|
const c = /* @__PURE__ */ new Set(), m = n == null ? void 0 : n.getCustomDecorations();
|
|
@@ -144,10 +144,10 @@ const M = () => {
|
|
|
144
144
|
const I = s.onCommandExecuted((u) => {
|
|
145
145
|
var O;
|
|
146
146
|
if (u.id === de.id) {
|
|
147
|
-
const R = /* @__PURE__ */ new Set(),
|
|
148
|
-
h((O =
|
|
149
|
-
const Se = R.has(
|
|
150
|
-
return R.add(
|
|
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
|
});
|
|
@@ -156,18 +156,18 @@ const M = () => {
|
|
|
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) {
|
|
@@ -195,13 +195,13 @@ const M = () => {
|
|
|
195
195
|
);
|
|
196
196
|
};
|
|
197
197
|
M.componentKey = "univer.doc.thread-comment-panel";
|
|
198
|
-
const
|
|
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
206
|
children: { label: M.componentKey },
|
|
207
207
|
width: 320,
|
|
@@ -226,19 +226,19 @@ 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:
|
|
241
|
+
dT: Ke(),
|
|
242
242
|
personId: d.getCurrentUser().userID,
|
|
243
243
|
text: {
|
|
244
244
|
dataStream: `\r
|
|
@@ -250,38 +250,38 @@ const w = {
|
|
|
250
250
|
threadId: I
|
|
251
251
|
};
|
|
252
252
|
return h == null || h.blur(), s.startAdd(D), t.setActiveComment({
|
|
253
|
-
unitId:
|
|
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
|
-
(d = e[
|
|
262
|
-
return
|
|
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
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 ===
|
|
272
|
+
var r, n, o, i;
|
|
273
|
+
if (t.id === Ne.id) {
|
|
274
274
|
const d = t.params, { unitId: s, ranges: l } = d;
|
|
275
|
-
if (
|
|
275
|
+
if (oe(s)) return;
|
|
276
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 >=
|
|
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
283
|
const m = this._threadCommentModel.getComment(s, S, c.id);
|
|
284
|
-
m && !m.resolved && this._commandService.executeCommand(
|
|
284
|
+
m && !m.resolved && this._commandService.executeCommand(N.id, {
|
|
285
285
|
activeComment: {
|
|
286
286
|
unitId: s,
|
|
287
287
|
subUnitId: S,
|
|
@@ -293,18 +293,18 @@ 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 d = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with(He), s = (n = (r =
|
|
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
308
|
s && d && d.scrollToRange({
|
|
309
309
|
startOffset: s.startIndex,
|
|
310
310
|
endOffset: s.endIndex,
|
|
@@ -312,81 +312,81 @@ let V = class extends B {
|
|
|
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
320
|
y(0, _(U)),
|
|
321
|
-
y(1,
|
|
321
|
+
y(1, w),
|
|
322
322
|
y(2, b),
|
|
323
323
|
y(3, _(T)),
|
|
324
324
|
y(4, F),
|
|
325
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 d =
|
|
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
355
|
d === "mask" && typeof s == "string" && (n[d] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
356
356
|
});
|
|
357
|
-
var
|
|
358
|
-
return !
|
|
359
|
-
var d =
|
|
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
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
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
392
|
menuItemFactory: st
|
|
@@ -394,11 +394,11 @@ const gt = {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
|
-
var
|
|
398
|
-
for (var
|
|
399
|
-
(d = e[
|
|
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,12 +415,12 @@ 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
421
|
[
|
|
422
422
|
[M.componentKey, M],
|
|
423
|
-
["
|
|
423
|
+
["CommentIcon", pe]
|
|
424
424
|
].forEach(([e, t]) => {
|
|
425
425
|
this.disposeWithMe(
|
|
426
426
|
this._componentManager.register(e, t)
|
|
@@ -429,18 +429,18 @@ let $ = class extends B {
|
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
431
|
$ = _t([
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
J(0, b),
|
|
433
|
+
J(1, qe),
|
|
434
|
+
J(2, _(Ye))
|
|
435
435
|
], $);
|
|
436
436
|
var pt = Object.getOwnPropertyDescriptor, It = (e, t, r, n) => {
|
|
437
|
-
for (var
|
|
438
|
-
(d = e[
|
|
439
|
-
return
|
|
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
440
|
}, x = (e, t) => (r, n) => t(r, n, e);
|
|
441
|
-
let
|
|
442
|
-
constructor(e, t, r, n,
|
|
443
|
-
super(), this._context = e, this._docInterceptorService = t, this._threadCommentPanelService = r, this._docRenderController = n, this._univerInstanceService =
|
|
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();
|
|
444
444
|
}
|
|
445
445
|
_initReRender() {
|
|
446
446
|
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((e) => {
|
|
@@ -460,24 +460,24 @@ let Y = class extends B {
|
|
|
460
460
|
handler: (e, t, r) => {
|
|
461
461
|
if (!e)
|
|
462
462
|
return r(e);
|
|
463
|
-
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);
|
|
464
464
|
if (!a)
|
|
465
465
|
return r({
|
|
466
466
|
...e,
|
|
467
467
|
show: !1
|
|
468
468
|
});
|
|
469
|
-
const h = f &&
|
|
469
|
+
const h = f && o >= f.startIndex && o <= f.endIndex, v = l === n && e.id === s;
|
|
470
470
|
return r({
|
|
471
471
|
...e,
|
|
472
|
-
active:
|
|
472
|
+
active: v || h,
|
|
473
473
|
show: !a.resolved
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
478
|
_initSyncComments() {
|
|
479
|
-
var
|
|
480
|
-
const e = this._context.unit.getUnitId(), t = S, r = (d = (
|
|
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
481
|
r.forEach((s) => {
|
|
482
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 });
|
|
483
483
|
}), r.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), S, r);
|
|
@@ -487,10 +487,10 @@ let Y = class extends B {
|
|
|
487
487
|
if (s.id === de.id) {
|
|
488
488
|
if (s.params.unitId !== this._context.unit.getUnitId())
|
|
489
489
|
return;
|
|
490
|
-
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();
|
|
491
491
|
if (JSON.stringify(n) !== JSON.stringify(C)) {
|
|
492
492
|
const c = new Set(n), m = new Set(C), I = /* @__PURE__ */ new Set(), D = /* @__PURE__ */ new Set();
|
|
493
|
-
|
|
493
|
+
v.forEach((u) => {
|
|
494
494
|
c.has(u) || I.add(u);
|
|
495
495
|
}), n.forEach((u) => {
|
|
496
496
|
m.has(u) || D.add(u);
|
|
@@ -502,28 +502,28 @@ let Y = class extends B {
|
|
|
502
502
|
}));
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
|
-
|
|
505
|
+
z = It([
|
|
506
506
|
x(1, _(Ve)),
|
|
507
507
|
x(2, _(U)),
|
|
508
508
|
x(3, _(Le)),
|
|
509
|
-
x(4,
|
|
509
|
+
x(4, w),
|
|
510
510
|
x(5, _(se)),
|
|
511
511
|
x(6, b)
|
|
512
|
-
],
|
|
512
|
+
], z);
|
|
513
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) => {
|
|
514
|
-
for (var
|
|
515
|
-
(d = e[
|
|
516
|
-
return
|
|
517
|
-
},
|
|
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);
|
|
518
518
|
let j = class extends Ue {
|
|
519
519
|
constructor(e = ee, t, r, n) {
|
|
520
520
|
super(), this._config = e, this._injector = t, this._renderManagerSrv = r, this._configService = n;
|
|
521
|
-
const { menu:
|
|
521
|
+
const { menu: o, ...i } = Re(
|
|
522
522
|
{},
|
|
523
523
|
ee,
|
|
524
524
|
this._config
|
|
525
525
|
);
|
|
526
|
-
|
|
526
|
+
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(ot, i);
|
|
527
527
|
}
|
|
528
528
|
onStarting() {
|
|
529
529
|
[
|
|
@@ -538,7 +538,7 @@ let j = class extends Ue {
|
|
|
538
538
|
this._initRenderModule(), this._injector.get(V), this._injector.get($);
|
|
539
539
|
}
|
|
540
540
|
_initRenderModule() {
|
|
541
|
-
[
|
|
541
|
+
[z].forEach((e) => {
|
|
542
542
|
this._renderManagerSrv.registerRenderModule(p.UNIVER_DOC, e);
|
|
543
543
|
});
|
|
544
544
|
}
|
|
@@ -546,15 +546,15 @@ let j = class extends Ue {
|
|
|
546
546
|
Ie(j, "pluginName", rt);
|
|
547
547
|
Ie(j, "type", p.UNIVER_DOC);
|
|
548
548
|
j = bt([
|
|
549
|
-
xe(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
549
|
+
xe(we),
|
|
550
|
+
q(1, _(re)),
|
|
551
|
+
q(2, F),
|
|
552
|
+
q(3, Te)
|
|
553
553
|
], j);
|
|
554
554
|
export {
|
|
555
555
|
he as AddDocCommentComment,
|
|
556
556
|
Ce as DeleteDocCommentComment,
|
|
557
|
-
|
|
557
|
+
N as ShowCommentPanelOperation,
|
|
558
558
|
W as StartAddCommentOperation,
|
|
559
559
|
j as UniverDocsThreadCommentUIPlugin
|
|
560
560
|
};
|