@univerjs/docs-thread-comment-ui 0.16.1 → 0.17.0
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 +169 -164
- package/lib/index.js +169 -164
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +2 -2
- package/package.json +10 -10
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
- /package/lib/types/{controllers → menu}/menu.d.ts +0 -0
- /package/lib/types/{controllers/menu.schema.d.ts → menu/schema.d.ts} +0 -0
package/lib/es/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { addCustomDecorationBySelectionFactory as
|
|
6
|
-
import { IThreadCommentDataSourceService as
|
|
7
|
-
import { SetActiveCommentOperation as
|
|
8
|
-
import { DocSelectionManagerService as B, DocSkeletonManagerService as
|
|
9
|
-
import { IRenderManagerService as F, withCurrentTypeOfRenderer as
|
|
10
|
-
import { ISidebarService as H, getMenuHiddenObservable as
|
|
11
|
-
import { BehaviorSubject as Ye, Observable as
|
|
1
|
+
var Se = Object.defineProperty;
|
|
2
|
+
var Oe = (e, t, r) => t in e ? Se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var K = (e, t, r) => Oe(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { CommandType as A, ICommandService as M, CustomDecorationType as Y, sequenceExecute as ne, Inject as p, Disposable as j, UniverInstanceType as v, SHEET_EDITOR_UNITS as Me, IUniverInstanceService as $, Injector as re, isInternalEditorID as oe, UserManagerService as De, BuildTextUtils as be, DependentOn as Te, IConfigService as xe, Plugin as Ue, merge as Re } from "@univerjs/core";
|
|
5
|
+
import { addCustomDecorationBySelectionFactory as ye, deleteCustomDecorationFactory as Ee, DocSelectionRenderService as Ae, DocBackScrollRenderController as $e, DocRenderController as Pe } from "@univerjs/docs-ui";
|
|
6
|
+
import { IThreadCommentDataSourceService as we, AddCommentMutation as Ne, getDT as Ve, ThreadCommentModel as ie } from "@univerjs/thread-comment";
|
|
7
|
+
import { SetActiveCommentOperation as se, ThreadCommentPanelService as R, ThreadCommentPanel as je, UniverThreadCommentUIPlugin as Be } from "@univerjs/thread-comment-ui";
|
|
8
|
+
import { DocSelectionManagerService as B, DocSkeletonManagerService as Fe, RichTextEditingMutation as de, SetTextSelectionsOperation as He, DocInterceptorService as Le, DOC_INTERCEPTOR_POINT as We } from "@univerjs/docs";
|
|
9
|
+
import { IRenderManagerService as F, withCurrentTypeOfRenderer as Ze, DocumentEditArea as X } from "@univerjs/engine-render";
|
|
10
|
+
import { ISidebarService as H, getMenuHiddenObservable as ce, MenuItemType as ae, useDependency as E, useObservable as G, ContextMenuPosition as Ke, ContextMenuGroup as Ge, RibbonInsertGroup as Je, IMenuManagerService as ke, ComponentManager as qe } from "@univerjs/ui";
|
|
11
|
+
import { BehaviorSubject as Ye, Observable as me, debounceTime as le, filter as ze } from "rxjs";
|
|
12
12
|
import { jsx as Qe } from "react/jsx-runtime";
|
|
13
|
-
import { useMemo as
|
|
14
|
-
const
|
|
13
|
+
import { useMemo as J, useState as Xe, useEffect as et, useRef as tt, createElement as ue, forwardRef as nt } from "react";
|
|
14
|
+
const rt = "DOC_THREAD_COMMENT_UI_PLUGIN", I = "default_doc", Ce = {
|
|
15
15
|
id: "docs.command.add-comment",
|
|
16
|
-
type:
|
|
16
|
+
type: A.COMMAND,
|
|
17
17
|
async handler(e, t) {
|
|
18
18
|
if (!t)
|
|
19
19
|
return !1;
|
|
20
|
-
const { comment: r, unitId: n } = t, i = await e.get(
|
|
20
|
+
const { comment: r, unitId: n } = t, i = await e.get(we).addComment(r), s = e.get(M), d = ye(
|
|
21
21
|
e,
|
|
22
22
|
{
|
|
23
23
|
id: i.threadId,
|
|
@@ -27,47 +27,47 @@ const nt = "DOC_THREAD_COMMENT_UI_PLUGIN", I = "default_doc", ue = {
|
|
|
27
27
|
);
|
|
28
28
|
if (d) {
|
|
29
29
|
const l = {
|
|
30
|
-
id:
|
|
30
|
+
id: Ne.id,
|
|
31
31
|
params: {
|
|
32
32
|
unitId: n,
|
|
33
33
|
subUnitId: I,
|
|
34
34
|
comment: i
|
|
35
35
|
}
|
|
36
36
|
}, C = {
|
|
37
|
-
id:
|
|
37
|
+
id: se.id,
|
|
38
38
|
params: {
|
|
39
39
|
unitId: n,
|
|
40
40
|
subUnitId: I,
|
|
41
41
|
commentId: i.id
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
return (await
|
|
44
|
+
return (await ne([l, d, C], s)).result;
|
|
45
45
|
}
|
|
46
46
|
return !1;
|
|
47
47
|
}
|
|
48
|
-
},
|
|
48
|
+
}, he = {
|
|
49
49
|
id: "docs.command.delete-comment",
|
|
50
|
-
type:
|
|
50
|
+
type: A.COMMAND,
|
|
51
51
|
async handler(e, t) {
|
|
52
52
|
if (!t)
|
|
53
53
|
return !1;
|
|
54
|
-
const { commentId: r, unitId: n } = t, o = e.get(M), i =
|
|
54
|
+
const { commentId: r, unitId: n } = t, o = e.get(M), i = Ee(e, {
|
|
55
55
|
id: r,
|
|
56
56
|
unitId: n
|
|
57
57
|
});
|
|
58
|
-
return i ? (await
|
|
58
|
+
return i ? (await ne([i], o)).result : !1;
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
var
|
|
62
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
61
|
+
var ot = Object.getOwnPropertyDescriptor, it = (e, t, r, n) => {
|
|
62
|
+
for (var o = n > 1 ? void 0 : n ? ot(t, r) : t, i = e.length - 1, s; i >= 0; i--)
|
|
63
63
|
(s = e[i]) && (o = s(o) || o);
|
|
64
64
|
return o;
|
|
65
|
-
},
|
|
65
|
+
}, ee = (e, t) => (r, n) => t(r, n, e);
|
|
66
66
|
let x = class extends j {
|
|
67
67
|
constructor(t, r) {
|
|
68
68
|
super();
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
K(this, "_addingComment$", new Ye(void 0));
|
|
70
|
+
K(this, "addingComment$", this._addingComment$.asObservable());
|
|
71
71
|
this._sidebarService = t, this._threadCommentPanelService = r, this.disposeWithMe(() => {
|
|
72
72
|
this._addingComment$.complete();
|
|
73
73
|
});
|
|
@@ -82,16 +82,16 @@ let x = class extends j {
|
|
|
82
82
|
this._addingComment$.next(void 0);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
-
x =
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
x = it([
|
|
86
|
+
ee(0, H),
|
|
87
|
+
ee(1, p(R))
|
|
88
88
|
], x);
|
|
89
|
-
const
|
|
89
|
+
const fe = (e) => {
|
|
90
90
|
var s;
|
|
91
|
-
const t = e.get(F), r = e.get(B), n = (s =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
e.get(
|
|
91
|
+
const t = e.get(F), r = e.get(B), n = (s = Ze(
|
|
92
|
+
v.UNIVER_DOC,
|
|
93
|
+
Fe,
|
|
94
|
+
e.get($),
|
|
95
95
|
t
|
|
96
96
|
)) == null ? void 0 : s.getSkeleton(), o = n == null ? void 0 : n.getViewModel().getEditArea();
|
|
97
97
|
if (o === X.FOOTER || o === X.HEADER)
|
|
@@ -99,17 +99,17 @@ const he = (e) => {
|
|
|
99
99
|
const i = r.getActiveTextRange();
|
|
100
100
|
return !!(i == null || i.collapsed);
|
|
101
101
|
};
|
|
102
|
-
function
|
|
102
|
+
function st(e) {
|
|
103
103
|
return {
|
|
104
104
|
id: L.id,
|
|
105
|
-
type:
|
|
105
|
+
type: ae.BUTTON,
|
|
106
106
|
icon: "CommentIcon",
|
|
107
107
|
title: "threadCommentUI.panel.addComment",
|
|
108
108
|
tooltip: "threadCommentUI.panel.addComment",
|
|
109
|
-
hidden$:
|
|
110
|
-
disabled$: new
|
|
111
|
-
const n = e.get(B).textSelection$.pipe(
|
|
112
|
-
t.next(
|
|
109
|
+
hidden$: ce(e, v.UNIVER_DOC, void 0, Me),
|
|
110
|
+
disabled$: new me(function(t) {
|
|
111
|
+
const n = e.get(B).textSelection$.pipe(le(16)).subscribe(() => {
|
|
112
|
+
t.next(fe(e));
|
|
113
113
|
});
|
|
114
114
|
return () => {
|
|
115
115
|
n.unsubscribe();
|
|
@@ -117,52 +117,52 @@ function it(e) {
|
|
|
117
117
|
})
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function dt(e) {
|
|
121
121
|
return {
|
|
122
122
|
id: Q.id,
|
|
123
|
-
type:
|
|
123
|
+
type: ae.BUTTON,
|
|
124
124
|
icon: "CommentIcon",
|
|
125
125
|
title: "threadCommentUI.panel.addComment",
|
|
126
126
|
tooltip: "threadCommentUI.panel.addComment",
|
|
127
|
-
hidden$:
|
|
127
|
+
hidden$: ce(e, v.UNIVER_DOC)
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
const O = () => {
|
|
131
|
-
const e =
|
|
132
|
-
() => i.textSelection$.pipe(
|
|
131
|
+
const e = E($), t = E(re), r = J(() => e.getCurrentTypeOfUnit$(v.UNIVER_DOC).pipe(ze((c) => !!c && !oe(c.getUnitId()))), [e]), n = G(r), o = J(() => new me((c) => c.next(I)), []), i = E(B), s = J(
|
|
132
|
+
() => i.textSelection$.pipe(le(16)),
|
|
133
133
|
[i.textSelection$]
|
|
134
134
|
);
|
|
135
|
-
|
|
136
|
-
const d =
|
|
137
|
-
if (
|
|
135
|
+
G(s);
|
|
136
|
+
const d = E(M), l = E(x), C = G(l.addingComment$), [a, h] = Xe([]);
|
|
137
|
+
if (et(() => {
|
|
138
138
|
var D;
|
|
139
139
|
const c = /* @__PURE__ */ new Set(), m = n == null ? void 0 : n.getCustomDecorations();
|
|
140
140
|
h((D = m == null ? void 0 : m.map((u) => u.id).filter((u) => {
|
|
141
141
|
const S = c.has(u);
|
|
142
142
|
return c.add(u), !S;
|
|
143
143
|
})) != null ? D : []);
|
|
144
|
-
const
|
|
144
|
+
const _ = d.onCommandExecuted((u) => {
|
|
145
145
|
var S;
|
|
146
|
-
if (u.id ===
|
|
147
|
-
const
|
|
148
|
-
h((S =
|
|
149
|
-
const
|
|
150
|
-
return
|
|
146
|
+
if (u.id === de.id) {
|
|
147
|
+
const y = /* @__PURE__ */ new Set(), Z = n == null ? void 0 : n.getCustomDecorations();
|
|
148
|
+
h((S = Z == null ? void 0 : Z.map((P) => P.id).filter((P) => {
|
|
149
|
+
const Ie = y.has(P);
|
|
150
|
+
return y.add(P), !Ie;
|
|
151
151
|
})) != null ? S : []);
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
return () => {
|
|
155
|
-
|
|
155
|
+
_.dispose();
|
|
156
156
|
};
|
|
157
157
|
}, [d, n]), !n)
|
|
158
158
|
return null;
|
|
159
|
-
const g =
|
|
159
|
+
const g = fe(t), f = n.getUnitId();
|
|
160
160
|
return /* @__PURE__ */ Qe(
|
|
161
|
-
|
|
161
|
+
je,
|
|
162
162
|
{
|
|
163
163
|
unitId: f,
|
|
164
164
|
subUnitId$: o,
|
|
165
|
-
type:
|
|
165
|
+
type: v.UNIVER_DOC,
|
|
166
166
|
onAdd: () => {
|
|
167
167
|
d.executeCommand(L.id);
|
|
168
168
|
},
|
|
@@ -176,7 +176,7 @@ const O = () => {
|
|
|
176
176
|
range: C,
|
|
177
177
|
comment: c
|
|
178
178
|
};
|
|
179
|
-
return d.executeCommand(
|
|
179
|
+
return d.executeCommand(Ce.id, m), l.endAdd(), !1;
|
|
180
180
|
}
|
|
181
181
|
return !0;
|
|
182
182
|
},
|
|
@@ -186,7 +186,7 @@ const O = () => {
|
|
|
186
186
|
unitId: f,
|
|
187
187
|
commentId: c.id
|
|
188
188
|
};
|
|
189
|
-
return d.executeCommand(
|
|
189
|
+
return d.executeCommand(he.id, m), !1;
|
|
190
190
|
}
|
|
191
191
|
return !0;
|
|
192
192
|
},
|
|
@@ -195,12 +195,12 @@ const O = () => {
|
|
|
195
195
|
);
|
|
196
196
|
};
|
|
197
197
|
O.componentKey = "univer.doc.thread-comment-panel";
|
|
198
|
-
const
|
|
198
|
+
const w = {
|
|
199
199
|
id: "docs.operation.show-comment-panel",
|
|
200
|
-
type:
|
|
200
|
+
type: A.OPERATION,
|
|
201
201
|
handler(e, t) {
|
|
202
202
|
var o;
|
|
203
|
-
const r = e.get(
|
|
203
|
+
const r = e.get(R), n = e.get(H);
|
|
204
204
|
return (!r.panelVisible || ((o = n.options.children) == null ? void 0 : o.label) !== O.componentKey) && (n.open({
|
|
205
205
|
header: { title: "threadCommentUI.panel.title" },
|
|
206
206
|
children: { label: O.componentKey },
|
|
@@ -210,10 +210,10 @@ const P = {
|
|
|
210
210
|
}
|
|
211
211
|
}, Q = {
|
|
212
212
|
id: "docs.operation.toggle-comment-panel",
|
|
213
|
-
type:
|
|
213
|
+
type: A.OPERATION,
|
|
214
214
|
handler(e) {
|
|
215
215
|
var n;
|
|
216
|
-
const t = e.get(
|
|
216
|
+
const t = e.get(R), r = e.get(H);
|
|
217
217
|
return !t.panelVisible || ((n = r.options.children) == null ? void 0 : n.label) !== O.componentKey ? (r.open({
|
|
218
218
|
header: { title: "threadCommentUI.panel.title" },
|
|
219
219
|
children: { label: O.componentKey },
|
|
@@ -223,22 +223,22 @@ const P = {
|
|
|
223
223
|
}
|
|
224
224
|
}, L = {
|
|
225
225
|
id: "docs.operation.start-add-comment",
|
|
226
|
-
type:
|
|
226
|
+
type: A.OPERATION,
|
|
227
227
|
handler(e) {
|
|
228
|
-
var u, S,
|
|
229
|
-
const t = e.get(
|
|
228
|
+
var u, S, y;
|
|
229
|
+
const t = e.get(R), n = e.get($).getCurrentUnitForType(v.UNIVER_DOC), o = e.get(B), i = e.get(F), s = e.get(De), d = e.get(x), l = e.get(M), C = e.get(H), a = o.getActiveTextRange();
|
|
230
230
|
if (!n || !a)
|
|
231
231
|
return !1;
|
|
232
|
-
const h = (u = i.getRenderById(n.getUnitId())) == null ? void 0 : u.with(
|
|
232
|
+
const h = (u = i.getRenderById(n.getUnitId())) == null ? void 0 : u.with(Ae);
|
|
233
233
|
if (h == null || h.setReserveRangesStatus(!0), a.collapsed)
|
|
234
|
-
return t.panelVisible ? (t.setPanelVisible(!1), C.close()) : l.executeCommand(
|
|
235
|
-
l.executeCommand(
|
|
236
|
-
const g = n.getUnitId(), f = ((
|
|
234
|
+
return t.panelVisible ? (t.setPanelVisible(!1), C.close()) : l.executeCommand(w.id), !0;
|
|
235
|
+
l.executeCommand(w.id);
|
|
236
|
+
const g = n.getUnitId(), f = ((y = (S = n.getBody()) == null ? void 0 : S.dataStream) != null ? y : "").slice(a.startOffset, a.endOffset), c = be.transform.getPlainText(f), m = I, _ = "", D = {
|
|
237
237
|
unitId: g,
|
|
238
238
|
subUnitId: m,
|
|
239
|
-
id:
|
|
239
|
+
id: _,
|
|
240
240
|
ref: c,
|
|
241
|
-
dT:
|
|
241
|
+
dT: Ve(),
|
|
242
242
|
personId: s.getCurrentUser().userID,
|
|
243
243
|
text: {
|
|
244
244
|
dataStream: `\r
|
|
@@ -247,21 +247,24 @@ const P = {
|
|
|
247
247
|
startOffset: a.startOffset,
|
|
248
248
|
endOffset: a.endOffset,
|
|
249
249
|
collapsed: !0,
|
|
250
|
-
threadId:
|
|
250
|
+
threadId: _
|
|
251
251
|
};
|
|
252
252
|
return h == null || h.blur(), d.startAdd(D), t.setActiveComment({
|
|
253
253
|
unitId: g,
|
|
254
254
|
subUnitId: m,
|
|
255
|
-
commentId:
|
|
255
|
+
commentId: _
|
|
256
256
|
}), !0;
|
|
257
257
|
}
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
}, ct = "@univerjs/docs-thread-comment-ui", at = "0.17.0", ge = {
|
|
259
|
+
name: ct,
|
|
260
|
+
version: at
|
|
261
|
+
}, mt = "docs-thread-comment-ui.config", te = {};
|
|
262
|
+
var lt = Object.getOwnPropertyDescriptor, ut = (e, t, r, n) => {
|
|
263
|
+
for (var o = n > 1 ? void 0 : n ? lt(t, r) : t, i = e.length - 1, s; i >= 0; i--)
|
|
261
264
|
(s = e[i]) && (o = s(o) || o);
|
|
262
265
|
return o;
|
|
263
266
|
}, b = (e, t) => (r, n) => t(r, n, e);
|
|
264
|
-
let
|
|
267
|
+
let N = class extends j {
|
|
265
268
|
constructor(e, t, r, n, o, i) {
|
|
266
269
|
super(), this._threadCommentPanelService = e, this._univerInstanceService = t, this._commandService = r, this._docThreadCommentService = n, this._renderManagerService = o, this._threadCommentModel = i, this._initSelectionChange(), this._initActiveCommandChange();
|
|
267
270
|
}
|
|
@@ -270,10 +273,10 @@ let w = class extends j {
|
|
|
270
273
|
this.disposeWithMe(
|
|
271
274
|
this._commandService.onCommandExecuted((t) => {
|
|
272
275
|
var r, n, o, i;
|
|
273
|
-
if (t.id ===
|
|
276
|
+
if (t.id === He.id) {
|
|
274
277
|
const s = t.params, { unitId: d, ranges: l } = s;
|
|
275
|
-
if (
|
|
276
|
-
const C = this._univerInstanceService.getUnit(d,
|
|
278
|
+
if (oe(d)) return;
|
|
279
|
+
const C = this._univerInstanceService.getUnit(d, v.UNIVER_DOC), a = l[0];
|
|
277
280
|
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
281
|
return;
|
|
279
282
|
if (e = a, a && C) {
|
|
@@ -281,7 +284,7 @@ let w = class extends j {
|
|
|
281
284
|
let c;
|
|
282
285
|
if (f ? c = (n = (r = C.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((m) => m.startIndex <= h && m.endIndex >= g - 1) : c = (i = (o = C.getBody()) == null ? void 0 : o.customDecorations) == null ? void 0 : i.find((m) => m.startIndex <= h && m.endIndex >= g - 1), c) {
|
|
283
286
|
const m = this._threadCommentModel.getComment(d, I, c.id);
|
|
284
|
-
m && !m.resolved && this._commandService.executeCommand(
|
|
287
|
+
m && !m.resolved && this._commandService.executeCommand(w.id, {
|
|
285
288
|
activeComment: {
|
|
286
289
|
unitId: d,
|
|
287
290
|
subUnitId: I,
|
|
@@ -293,7 +296,7 @@ let w = class extends j {
|
|
|
293
296
|
}
|
|
294
297
|
if (!this._threadCommentPanelService.activeCommentId)
|
|
295
298
|
return;
|
|
296
|
-
this._commandService.executeCommand(
|
|
299
|
+
this._commandService.executeCommand(se.id);
|
|
297
300
|
}
|
|
298
301
|
})
|
|
299
302
|
);
|
|
@@ -304,7 +307,7 @@ let w = class extends j {
|
|
|
304
307
|
if (e) {
|
|
305
308
|
const i = this._univerInstanceService.getUnit(e.unitId);
|
|
306
309
|
if (i) {
|
|
307
|
-
const s = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with(
|
|
310
|
+
const s = (t = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : t.with($e), d = (n = (r = i.getBody()) == null ? void 0 : r.customDecorations) == null ? void 0 : n.find((l) => l.id === e.commentId);
|
|
308
311
|
d && s && s.scrollToRange({
|
|
309
312
|
startOffset: d.startIndex,
|
|
310
313
|
endOffset: d.endIndex,
|
|
@@ -316,17 +319,17 @@ let w = class extends j {
|
|
|
316
319
|
}));
|
|
317
320
|
}
|
|
318
321
|
};
|
|
319
|
-
|
|
320
|
-
b(0, p(
|
|
321
|
-
b(1,
|
|
322
|
+
N = ut([
|
|
323
|
+
b(0, p(R)),
|
|
324
|
+
b(1, $),
|
|
322
325
|
b(2, M),
|
|
323
326
|
b(3, p(x)),
|
|
324
327
|
b(4, F),
|
|
325
|
-
b(5, p(
|
|
326
|
-
],
|
|
327
|
-
function
|
|
328
|
-
const { icon: r, id: n, className: o, extend: i, ...s } = t, d = `univerjs-icon univerjs-icon-${n} ${o || ""}`.trim(), l =
|
|
329
|
-
return
|
|
328
|
+
b(5, p(ie))
|
|
329
|
+
], N);
|
|
330
|
+
function pe({ ref: e, ...t }) {
|
|
331
|
+
const { icon: r, id: n, className: o, extend: i, ...s } = t, d = `univerjs-icon univerjs-icon-${n} ${o || ""}`.trim(), l = tt(`_${ft()}`);
|
|
332
|
+
return ve(r, `${n}`, {
|
|
330
333
|
defIds: r.defIds,
|
|
331
334
|
idSuffix: l.current
|
|
332
335
|
}, {
|
|
@@ -335,14 +338,14 @@ function fe({ ref: e, ...t }) {
|
|
|
335
338
|
...s
|
|
336
339
|
}, i);
|
|
337
340
|
}
|
|
338
|
-
function
|
|
339
|
-
return
|
|
341
|
+
function ve(e, t, r, n, o) {
|
|
342
|
+
return ue(e.tag, {
|
|
340
343
|
key: t,
|
|
341
|
-
...
|
|
344
|
+
...Ct(e, r, o),
|
|
342
345
|
...n
|
|
343
|
-
}, (
|
|
346
|
+
}, (ht(e, r).children || []).map((i, s) => ve(i, `${t}-${e.tag}-${s}`, r, void 0, o)));
|
|
344
347
|
}
|
|
345
|
-
function
|
|
348
|
+
function Ct(e, t, r) {
|
|
346
349
|
const n = { ...e.attrs };
|
|
347
350
|
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(([i, s]) => {
|
|
348
351
|
i === "mask" && typeof s == "string" && (n[i] = s.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
@@ -352,7 +355,7 @@ function mt(e, t, r) {
|
|
|
352
355
|
typeof s == "string" && (n[i] = s.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
353
356
|
})), n;
|
|
354
357
|
}
|
|
355
|
-
function
|
|
358
|
+
function ht(e, t) {
|
|
356
359
|
var n;
|
|
357
360
|
const { defIds: r } = t;
|
|
358
361
|
return !r || r.length === 0 ? e : e.tag === "defs" && ((n = e.children) != null && n.length) ? {
|
|
@@ -366,11 +369,11 @@ function lt(e, t) {
|
|
|
366
369
|
} : o)
|
|
367
370
|
} : e;
|
|
368
371
|
}
|
|
369
|
-
function
|
|
372
|
+
function ft() {
|
|
370
373
|
return Math.random().toString(36).substring(2, 8);
|
|
371
374
|
}
|
|
372
|
-
|
|
373
|
-
const
|
|
375
|
+
pe.displayName = "UniverIcon";
|
|
376
|
+
const gt = {
|
|
374
377
|
tag: "svg",
|
|
375
378
|
attrs: {
|
|
376
379
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -420,44 +423,44 @@ const Ct = {
|
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
]
|
|
423
|
-
},
|
|
424
|
-
return
|
|
426
|
+
}, _e = nt(function(t, r) {
|
|
427
|
+
return ue(pe, Object.assign({}, t, {
|
|
425
428
|
id: "comment-icon",
|
|
426
429
|
ref: r,
|
|
427
|
-
icon:
|
|
430
|
+
icon: gt
|
|
428
431
|
}));
|
|
429
432
|
});
|
|
430
|
-
|
|
431
|
-
const
|
|
432
|
-
[
|
|
433
|
+
_e.displayName = "CommentIcon";
|
|
434
|
+
const pt = {
|
|
435
|
+
[Je.MEDIA]: {
|
|
433
436
|
[Q.id]: {
|
|
434
437
|
order: 3,
|
|
435
|
-
menuItemFactory:
|
|
438
|
+
menuItemFactory: dt
|
|
436
439
|
}
|
|
437
440
|
},
|
|
438
|
-
[
|
|
439
|
-
[
|
|
441
|
+
[Ke.MAIN_AREA]: {
|
|
442
|
+
[Ge.DATA]: {
|
|
440
443
|
[L.id]: {
|
|
441
444
|
order: 1,
|
|
442
|
-
menuItemFactory:
|
|
445
|
+
menuItemFactory: st
|
|
443
446
|
}
|
|
444
447
|
}
|
|
445
448
|
}
|
|
446
449
|
};
|
|
447
|
-
var
|
|
448
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
450
|
+
var vt = Object.getOwnPropertyDescriptor, _t = (e, t, r, n) => {
|
|
451
|
+
for (var o = n > 1 ? void 0 : n ? vt(t, r) : t, i = e.length - 1, s; i >= 0; i--)
|
|
449
452
|
(s = e[i]) && (o = s(o) || o);
|
|
450
453
|
return o;
|
|
451
|
-
},
|
|
452
|
-
let
|
|
454
|
+
}, k = (e, t) => (r, n) => t(r, n, e);
|
|
455
|
+
let V = class extends j {
|
|
453
456
|
constructor(e, t, r) {
|
|
454
457
|
super(), this._commandService = e, this._menuManagerService = t, this._componentManager = r, this._initCommands(), this._initMenus(), this._initComponents();
|
|
455
458
|
}
|
|
456
459
|
_initCommands() {
|
|
457
460
|
[
|
|
458
|
-
ue,
|
|
459
461
|
Ce,
|
|
460
|
-
|
|
462
|
+
he,
|
|
463
|
+
w,
|
|
461
464
|
L,
|
|
462
465
|
Q
|
|
463
466
|
].forEach((e) => {
|
|
@@ -465,12 +468,12 @@ let N = class extends j {
|
|
|
465
468
|
});
|
|
466
469
|
}
|
|
467
470
|
_initMenus() {
|
|
468
|
-
this._menuManagerService.mergeMenu(
|
|
471
|
+
this._menuManagerService.mergeMenu(pt);
|
|
469
472
|
}
|
|
470
473
|
_initComponents() {
|
|
471
474
|
[
|
|
472
475
|
[O.componentKey, O],
|
|
473
|
-
["CommentIcon",
|
|
476
|
+
["CommentIcon", _e]
|
|
474
477
|
].forEach(([e, t]) => {
|
|
475
478
|
this.disposeWithMe(
|
|
476
479
|
this._componentManager.register(e, t)
|
|
@@ -478,13 +481,13 @@ let N = class extends j {
|
|
|
478
481
|
});
|
|
479
482
|
}
|
|
480
483
|
};
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
],
|
|
486
|
-
var
|
|
487
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
484
|
+
V = _t([
|
|
485
|
+
k(0, M),
|
|
486
|
+
k(1, ke),
|
|
487
|
+
k(2, p(qe))
|
|
488
|
+
], V);
|
|
489
|
+
var It = Object.getOwnPropertyDescriptor, St = (e, t, r, n) => {
|
|
490
|
+
for (var o = n > 1 ? void 0 : n ? It(t, r) : t, i = e.length - 1, s; i >= 0; i--)
|
|
488
491
|
(s = e[i]) && (o = s(o) || o);
|
|
489
492
|
return o;
|
|
490
493
|
}, T = (e, t) => (r, n) => t(r, n, e);
|
|
@@ -499,14 +502,14 @@ let z = class extends j {
|
|
|
499
502
|
this._docRenderController.reRender(e.unitId);
|
|
500
503
|
return;
|
|
501
504
|
}
|
|
502
|
-
const t = (r = this._univerInstanceService.getCurrentUnitForType(
|
|
505
|
+
const t = (r = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC)) == null ? void 0 : r.getUnitId();
|
|
503
506
|
t && this._docRenderController.reRender(t);
|
|
504
507
|
})), this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe((e) => {
|
|
505
508
|
e.type === "resolve" && this._docRenderController.reRender(e.unitId);
|
|
506
509
|
}));
|
|
507
510
|
}
|
|
508
511
|
_interceptorViewModel() {
|
|
509
|
-
this._docInterceptorService.intercept(
|
|
512
|
+
this._docInterceptorService.intercept(We.CUSTOM_DECORATION, {
|
|
510
513
|
handler: (e, t, r) => {
|
|
511
514
|
if (!e)
|
|
512
515
|
return r(e);
|
|
@@ -534,77 +537,79 @@ let z = class extends j {
|
|
|
534
537
|
let n = r.sort();
|
|
535
538
|
this.disposeWithMe(this._commandService.onCommandExecuted((d) => {
|
|
536
539
|
var l, C, a;
|
|
537
|
-
if (d.id ===
|
|
540
|
+
if (d.id === de.id) {
|
|
538
541
|
if (d.params.unitId !== this._context.unit.getUnitId())
|
|
539
542
|
return;
|
|
540
543
|
const g = (a = (C = (l = this._context.unit.getBody()) == null ? void 0 : l.customDecorations) == null ? void 0 : C.filter((c) => c.type === Y.COMMENT).map((c) => c.id)) != null ? a : [], f = g.sort();
|
|
541
544
|
if (JSON.stringify(n) !== JSON.stringify(f)) {
|
|
542
|
-
const c = new Set(n), m = new Set(f),
|
|
545
|
+
const c = new Set(n), m = new Set(f), _ = /* @__PURE__ */ new Set(), D = /* @__PURE__ */ new Set();
|
|
543
546
|
g.forEach((u) => {
|
|
544
|
-
c.has(u) ||
|
|
547
|
+
c.has(u) || _.add(u);
|
|
545
548
|
}), n.forEach((u) => {
|
|
546
549
|
m.has(u) || D.add(u);
|
|
547
|
-
}), n = f,
|
|
550
|
+
}), n = f, _.forEach((u) => {
|
|
548
551
|
this._threadCommentModel.getComment(e, t, u) || this._threadCommentModel.addComment(e, t, { id: u, threadId: u, ref: "", dT: "", personId: "", text: { dataStream: "" }, unitId: e, subUnitId: t });
|
|
549
|
-
}), this._threadCommentModel.syncThreadComments(e, t, [...
|
|
552
|
+
}), this._threadCommentModel.syncThreadComments(e, t, [..._]);
|
|
550
553
|
}
|
|
551
554
|
}
|
|
552
555
|
}));
|
|
553
556
|
}
|
|
554
557
|
};
|
|
555
|
-
z =
|
|
556
|
-
T(1, p(
|
|
557
|
-
T(2, p(
|
|
558
|
-
T(3, p(
|
|
559
|
-
T(4,
|
|
560
|
-
T(5, p(
|
|
558
|
+
z = St([
|
|
559
|
+
T(1, p(Le)),
|
|
560
|
+
T(2, p(R)),
|
|
561
|
+
T(3, p(Pe)),
|
|
562
|
+
T(4, $),
|
|
563
|
+
T(5, p(ie)),
|
|
561
564
|
T(6, M)
|
|
562
565
|
], z);
|
|
563
|
-
var
|
|
564
|
-
for (var o = n > 1 ? void 0 : n ?
|
|
566
|
+
var Ot = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Dt = (e, t, r) => t in e ? Ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, bt = (e, t, r, n) => {
|
|
567
|
+
for (var o = n > 1 ? void 0 : n ? Mt(t, r) : t, i = e.length - 1, s; i >= 0; i--)
|
|
565
568
|
(s = e[i]) && (o = s(o) || o);
|
|
566
569
|
return o;
|
|
567
|
-
}, q = (e, t) => (r, n) => t(r, n, e),
|
|
568
|
-
let
|
|
569
|
-
constructor(e =
|
|
570
|
+
}, q = (e, t) => (r, n) => t(r, n, e), W = (e, t, r) => Dt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
571
|
+
let U = class extends Ue {
|
|
572
|
+
constructor(e = te, t, r, n) {
|
|
570
573
|
super(), this._config = e, this._injector = t, this._renderManagerSrv = r, this._configService = n;
|
|
571
|
-
const { menu: o, ...i } =
|
|
574
|
+
const { menu: o, ...i } = Re(
|
|
572
575
|
{},
|
|
573
|
-
|
|
576
|
+
te,
|
|
574
577
|
this._config
|
|
575
578
|
);
|
|
576
|
-
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(
|
|
579
|
+
o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(mt, i);
|
|
577
580
|
}
|
|
578
581
|
onStarting() {
|
|
579
582
|
[
|
|
583
|
+
[V],
|
|
580
584
|
[N],
|
|
581
|
-
[w],
|
|
582
585
|
[x]
|
|
583
586
|
].forEach((e) => {
|
|
584
587
|
this._injector.add(e);
|
|
585
588
|
});
|
|
586
589
|
}
|
|
587
590
|
onRendered() {
|
|
588
|
-
this._initRenderModule(), this._injector.get(
|
|
591
|
+
this._initRenderModule(), this._injector.get(N), this._injector.get(V);
|
|
589
592
|
}
|
|
590
593
|
_initRenderModule() {
|
|
591
594
|
[z].forEach((e) => {
|
|
592
|
-
this._renderManagerSrv.registerRenderModule(
|
|
595
|
+
this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, e);
|
|
593
596
|
});
|
|
594
597
|
}
|
|
595
598
|
};
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
W(U, "pluginName", rt);
|
|
600
|
+
W(U, "packageName", ge.name);
|
|
601
|
+
W(U, "version", ge.version);
|
|
602
|
+
W(U, "type", v.UNIVER_DOC);
|
|
603
|
+
U = bt([
|
|
604
|
+
Te(Be),
|
|
605
|
+
q(1, p(re)),
|
|
601
606
|
q(2, F),
|
|
602
|
-
q(3,
|
|
603
|
-
],
|
|
607
|
+
q(3, xe)
|
|
608
|
+
], U);
|
|
604
609
|
export {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
610
|
+
Ce as AddDocCommentComment,
|
|
611
|
+
he as DeleteDocCommentComment,
|
|
612
|
+
w as ShowCommentPanelOperation,
|
|
608
613
|
L as StartAddCommentOperation,
|
|
609
|
-
|
|
614
|
+
U as UniverDocsThreadCommentUIPlugin
|
|
610
615
|
};
|