@univerjs/docs-hyper-link-ui 0.6.0-nightly.202502121606 → 0.6.0-nightly.202502141606
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 +1 -1
- package/lib/es/index.js +315 -319
- package/lib/umd/index.js +1 -1
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var P = (
|
|
4
|
-
import { CommandType as M, ICommandService as O, generateRandomId as
|
|
5
|
-
import { UniverDocsHyperLinkPlugin as
|
|
6
|
-
import { IRenderManagerService as
|
|
7
|
-
import { addCustomRangeBySelectionFactory as
|
|
8
|
-
import { DocCanvasPopManagerService as
|
|
9
|
-
import { BehaviorSubject as ve, distinctUntilChanged as
|
|
10
|
-
import { jsxs as
|
|
11
|
-
import { FormLayout as
|
|
12
|
-
import { useDependency as S, useObservable as xe, KeyCode as ne, IMessageService as
|
|
13
|
-
import { useState as q, useEffect as
|
|
14
|
-
const
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Ae = (e, n, t) => n in e ? je(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var P = (e, n, t) => Ae(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { CommandType as M, ICommandService as O, generateRandomId as Be, CustomRangeType as D, IUniverInstanceService as x, UniverInstanceType as _, getBodySlice as Le, LocaleService as Oe, Tools as Ke, BuildTextUtils as me, Inject as I, Disposable as N, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Fe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ve, DependentOn as Ye, Injector as Ze, IConfigService as We, Plugin as Ge, merge as ze } from "@univerjs/core";
|
|
5
|
+
import { UniverDocsHyperLinkPlugin as qe } from "@univerjs/docs-hyper-link";
|
|
6
|
+
import { IRenderManagerService as Je } from "@univerjs/engine-render";
|
|
7
|
+
import { addCustomRangeBySelectionFactory as Qe, DocSelectionManagerService as b, replaceSelectionFactory as Xe, deleteCustomRangeFactory as en, SetTextSelectionsOperation as nn, DocSkeletonManagerService as tn, DocInterceptorService as rn, DOC_INTERCEPTOR_POINT as on } from "@univerjs/docs";
|
|
8
|
+
import { DocCanvasPopManagerService as sn, DocEventManagerService as cn, DocRenderController as dn, whenDocAndEditorFocused as an } from "@univerjs/docs-ui";
|
|
9
|
+
import { BehaviorSubject as ve, distinctUntilChanged as ln, pairwise as un, Observable as pn, debounceTime as gn } from "rxjs";
|
|
10
|
+
import { jsxs as R, jsx as h } from "react/jsx-runtime";
|
|
11
|
+
import { FormLayout as Ie, Input as _e, Button as Ce, Tooltip as B, MessageType as hn } from "@univerjs/design";
|
|
12
|
+
import { useDependency as S, useObservable as xe, KeyCode as ne, IMessageService as fn, MetaKeys as mn, getMenuHiddenObservable as vn, MenuItemType as In, ContextMenuPosition as _n, ContextMenuGroup as Cn, RibbonStartGroup as Sn, ComponentManager as kn, IMenuManagerService as yn, IShortcutService as Ln } from "@univerjs/ui";
|
|
13
|
+
import { useState as q, useEffect as On, forwardRef as U, useRef as xn, createElement as T } from "react";
|
|
14
|
+
const Pn = "docs-hyper-link-ui.config", Se = {}, Pe = {
|
|
15
15
|
type: M.COMMAND,
|
|
16
16
|
id: "docs.command.add-hyper-link",
|
|
17
|
-
async handler(
|
|
18
|
-
if (!
|
|
17
|
+
async handler(e, n) {
|
|
18
|
+
if (!n)
|
|
19
19
|
return !1;
|
|
20
|
-
const { payload: t, unitId: i, selections: r } =
|
|
21
|
-
|
|
20
|
+
const { payload: t, unitId: i, selections: r } = n, o = e.get(O), s = Be(), c = Qe(
|
|
21
|
+
e,
|
|
22
22
|
{
|
|
23
23
|
rangeId: s,
|
|
24
24
|
rangeType: D.HYPERLINK,
|
|
@@ -31,32 +31,32 @@ const En = "docs-hyper-link-ui.config", Se = {}, Pe = {
|
|
|
31
31
|
);
|
|
32
32
|
return c ? o.syncExecuteCommand(c.id, c.params) : !1;
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Re = {
|
|
35
35
|
id: "docs.command.update-hyper-link",
|
|
36
36
|
type: M.COMMAND,
|
|
37
|
-
handler(
|
|
37
|
+
handler(e, n) {
|
|
38
38
|
var p;
|
|
39
|
-
if (!
|
|
39
|
+
if (!n)
|
|
40
40
|
return !1;
|
|
41
|
-
const { unitId: t, payload: i, segmentId: r, linkId: o } =
|
|
42
|
-
if (!u || !
|
|
41
|
+
const { unitId: t, payload: i, segmentId: r, linkId: o } = n, s = e.get(O), c = e.get(x), u = e.get(b).getActiveTextRange(), f = c.getUnit(t, _.UNIVER_DOC);
|
|
42
|
+
if (!u || !f)
|
|
43
43
|
return !1;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const d =
|
|
44
|
+
const g = (p = Le(f.getSelfOrHeaderFooterModel(r).getBody(), u.startOffset, u.endOffset).textRuns) == null ? void 0 : p[0];
|
|
45
|
+
g && (g.ed = n.label.length + 1);
|
|
46
|
+
const d = Xe(e, {
|
|
47
47
|
unitId: t,
|
|
48
48
|
body: {
|
|
49
|
-
dataStream: `${
|
|
49
|
+
dataStream: `${n.label}`,
|
|
50
50
|
customRanges: [{
|
|
51
51
|
rangeId: o,
|
|
52
52
|
rangeType: D.HYPERLINK,
|
|
53
53
|
startIndex: 0,
|
|
54
|
-
endIndex:
|
|
54
|
+
endIndex: n.label.length + 1,
|
|
55
55
|
properties: {
|
|
56
56
|
url: i
|
|
57
57
|
}
|
|
58
58
|
}],
|
|
59
|
-
textRuns:
|
|
59
|
+
textRuns: g ? [g] : void 0
|
|
60
60
|
},
|
|
61
61
|
selection: {
|
|
62
62
|
startOffset: u.startOffset,
|
|
@@ -67,43 +67,41 @@ const En = "docs-hyper-link-ui.config", Se = {}, Pe = {
|
|
|
67
67
|
});
|
|
68
68
|
return d ? s.syncExecuteCommand(d.id, d.params) : !1;
|
|
69
69
|
}
|
|
70
|
-
}, Rn = "univer-docs-link-edit",
|
|
70
|
+
}, Rn = "univer-docs-link-edit", En = "univer-docs-link-edit-buttons", Mn = "univer-docs-link-edit-button", K = {
|
|
71
71
|
docsLinkEdit: Rn,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
docsLinkEditButtons: wn,
|
|
75
|
-
docsLinkEditButton: Dn
|
|
72
|
+
docsLinkEditButtons: En,
|
|
73
|
+
docsLinkEditButton: Mn
|
|
76
74
|
};
|
|
77
|
-
function
|
|
78
|
-
return /^[a-zA-Z]+:\/\//.test(
|
|
75
|
+
function bn(e) {
|
|
76
|
+
return /^[a-zA-Z]+:\/\//.test(e);
|
|
79
77
|
}
|
|
80
|
-
function
|
|
81
|
-
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(
|
|
78
|
+
function wn(e) {
|
|
79
|
+
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e);
|
|
82
80
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
81
|
+
function Dn(e) {
|
|
82
|
+
return bn(e) ? e : wn(e) ? `mailto://${e}` : `https://${e}`;
|
|
85
83
|
}
|
|
86
84
|
const V = () => {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
var ce, de, ae, le, ue, pe,
|
|
85
|
+
const e = S(k), n = S(Oe), t = xe(e.editingLink$), i = S(O), r = S(x), o = S(b), [s, c] = q(""), [l, u] = q(""), [f, m] = q(!1), g = Ke.isLegalUrl(s), d = t ? r.getUnit(t.unitId, _.UNIVER_DOC) : r.getCurrentUnitForType(_.UNIVER_DOC);
|
|
86
|
+
On(() => {
|
|
87
|
+
var ce, de, ae, le, ue, pe, ge, he, fe;
|
|
90
88
|
const a = o.getActiveTextRange();
|
|
91
89
|
if (!a)
|
|
92
90
|
return;
|
|
93
91
|
if (t) {
|
|
94
92
|
const j = (ce = d == null ? void 0 : d.getSelfOrHeaderFooterModel(t.segmentId)) == null ? void 0 : ce.getBody(), A = (de = j == null ? void 0 : j.customRanges) == null ? void 0 : de.find((z) => (t == null ? void 0 : t.linkId) === z.rangeId && z.startIndex === t.startIndex && z.endIndex === t.endIndex);
|
|
95
|
-
d && A && (c((le = (ae = A.properties) == null ? void 0 : ae.url) != null ? le : ""), u(me.transform.getPlainText(
|
|
93
|
+
d && A && (c((le = (ae = A.properties) == null ? void 0 : ae.url) != null ? le : ""), u(me.transform.getPlainText(Le(j, A.startIndex, A.endIndex + 1).dataStream)));
|
|
96
94
|
return;
|
|
97
95
|
}
|
|
98
|
-
const
|
|
99
|
-
d && H && c((
|
|
96
|
+
const y = (ue = d == null ? void 0 : d.getSelfOrHeaderFooterModel(a.segmentId)) == null ? void 0 : ue.getBody(), se = y ? a : null, H = se && ((ge = me.customRange.getCustomRangesInterestsWithSelection(se, (pe = y == null ? void 0 : y.customRanges) != null ? pe : [])) == null ? void 0 : ge[0]);
|
|
97
|
+
d && H && c((fe = (he = H == null ? void 0 : H.properties) == null ? void 0 : he.url) != null ? fe : "");
|
|
100
98
|
}, [d, t, o, r]);
|
|
101
99
|
const p = () => {
|
|
102
|
-
|
|
100
|
+
e.hideEditPopup();
|
|
103
101
|
}, C = () => {
|
|
104
|
-
if (m(!0), !
|
|
102
|
+
if (m(!0), !g || !d)
|
|
105
103
|
return;
|
|
106
|
-
const a =
|
|
104
|
+
const a = Dn(s);
|
|
107
105
|
if (!t)
|
|
108
106
|
i.executeCommand(Pe.id, {
|
|
109
107
|
unitId: d.getUnitId(),
|
|
@@ -112,7 +110,7 @@ const V = () => {
|
|
|
112
110
|
else {
|
|
113
111
|
if (!l)
|
|
114
112
|
return;
|
|
115
|
-
i.executeCommand(
|
|
113
|
+
i.executeCommand(Re.id, {
|
|
116
114
|
unitId: d.getUnitId(),
|
|
117
115
|
payload: a,
|
|
118
116
|
linkId: t.linkId,
|
|
@@ -120,18 +118,18 @@ const V = () => {
|
|
|
120
118
|
segmentId: t.segmentId
|
|
121
119
|
});
|
|
122
120
|
}
|
|
123
|
-
|
|
121
|
+
e.hideEditPopup();
|
|
124
122
|
};
|
|
125
123
|
if (d)
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
t ? /* @__PURE__ */
|
|
129
|
-
|
|
124
|
+
return /* @__PURE__ */ R("div", { className: K.docsLinkEdit, children: [
|
|
125
|
+
/* @__PURE__ */ R("div", { children: [
|
|
126
|
+
t ? /* @__PURE__ */ h(
|
|
127
|
+
Ie,
|
|
130
128
|
{
|
|
131
|
-
label:
|
|
132
|
-
error:
|
|
133
|
-
children: /* @__PURE__ */
|
|
134
|
-
|
|
129
|
+
label: n.t("docLink.edit.label"),
|
|
130
|
+
error: f && !l ? n.t("docLink.edit.labelError") : "",
|
|
131
|
+
children: /* @__PURE__ */ h(
|
|
132
|
+
_e,
|
|
135
133
|
{
|
|
136
134
|
value: l,
|
|
137
135
|
onChange: u,
|
|
@@ -143,13 +141,13 @@ const V = () => {
|
|
|
143
141
|
)
|
|
144
142
|
}
|
|
145
143
|
) : null,
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
144
|
+
/* @__PURE__ */ h(
|
|
145
|
+
Ie,
|
|
148
146
|
{
|
|
149
|
-
label:
|
|
150
|
-
error:
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
|
|
147
|
+
label: n.t("docLink.edit.address"),
|
|
148
|
+
error: f && !g ? n.t("docLink.edit.addressError") : "",
|
|
149
|
+
children: /* @__PURE__ */ h(
|
|
150
|
+
_e,
|
|
153
151
|
{
|
|
154
152
|
value: s,
|
|
155
153
|
onChange: c,
|
|
@@ -162,23 +160,23 @@ const V = () => {
|
|
|
162
160
|
}
|
|
163
161
|
)
|
|
164
162
|
] }),
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ R("div", { className: K.docsLinkEditButtons, children: [
|
|
164
|
+
/* @__PURE__ */ h(
|
|
167
165
|
Ce,
|
|
168
166
|
{
|
|
169
167
|
className: K.docsLinkEditButton,
|
|
170
168
|
onClick: p,
|
|
171
|
-
children:
|
|
169
|
+
children: n.t("docLink.edit.cancel")
|
|
172
170
|
}
|
|
173
171
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ h(
|
|
175
173
|
Ce,
|
|
176
174
|
{
|
|
177
175
|
disabled: !s,
|
|
178
176
|
className: K.docsLinkEditButton,
|
|
179
177
|
type: "primary",
|
|
180
178
|
onClick: C,
|
|
181
|
-
children:
|
|
179
|
+
children: n.t("docLink.edit.confirm")
|
|
182
180
|
}
|
|
183
181
|
)
|
|
184
182
|
] })
|
|
@@ -186,204 +184,202 @@ const V = () => {
|
|
|
186
184
|
};
|
|
187
185
|
V.componentKey = "docs-hyper-link-edit";
|
|
188
186
|
var v = function() {
|
|
189
|
-
return v = Object.assign || function(
|
|
190
|
-
for (var
|
|
191
|
-
|
|
192
|
-
for (var r in
|
|
187
|
+
return v = Object.assign || function(e) {
|
|
188
|
+
for (var n, t = 1, i = arguments.length; t < i; t++) {
|
|
189
|
+
n = arguments[t];
|
|
190
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
193
191
|
}
|
|
194
|
-
return
|
|
192
|
+
return e;
|
|
195
193
|
}, v.apply(this, arguments);
|
|
196
|
-
},
|
|
194
|
+
}, Nn = function(e, n) {
|
|
197
195
|
var t = {};
|
|
198
|
-
for (var i in
|
|
199
|
-
if (
|
|
200
|
-
for (var r = 0, i = Object.getOwnPropertySymbols(
|
|
201
|
-
|
|
196
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && n.indexOf(i) < 0 && (t[i] = e[i]);
|
|
197
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
198
|
+
for (var r = 0, i = Object.getOwnPropertySymbols(e); r < i.length; r++)
|
|
199
|
+
n.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[r]) && (t[i[r]] = e[i[r]]);
|
|
202
200
|
return t;
|
|
203
|
-
}, $ = U(function(
|
|
204
|
-
var t =
|
|
205
|
-
return
|
|
201
|
+
}, $ = U(function(e, n) {
|
|
202
|
+
var t = e.icon, i = e.id, r = e.className, o = e.extend, s = Nn(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), l = xn("_".concat($n()));
|
|
203
|
+
return Ee(t, "".concat(i), { defIds: t.defIds, idSuffix: l.current }, v({ ref: n, className: c }, s), o);
|
|
206
204
|
});
|
|
207
|
-
function
|
|
208
|
-
return T(
|
|
209
|
-
return
|
|
205
|
+
function Ee(e, n, t, i, r) {
|
|
206
|
+
return T(e.tag, v(v({ key: n }, Un(e, t, r)), i), (Tn(e, t).children || []).map(function(o, s) {
|
|
207
|
+
return Ee(o, "".concat(n, "-").concat(e.tag, "-").concat(s), t, void 0, r);
|
|
210
208
|
}));
|
|
211
209
|
}
|
|
212
|
-
function
|
|
213
|
-
var i = v({},
|
|
210
|
+
function Un(e, n, t) {
|
|
211
|
+
var i = v({}, e.attrs);
|
|
214
212
|
t != null && t.colorChannel1 && i.fill === "colorChannel1" && (i.fill = t.colorChannel1);
|
|
215
|
-
var r =
|
|
216
|
-
return !r || r.length === 0 || (
|
|
213
|
+
var r = n.defIds;
|
|
214
|
+
return !r || r.length === 0 || (e.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + n.idSuffix), Object.entries(i).forEach(function(o) {
|
|
217
215
|
var s = o[0], c = o[1];
|
|
218
|
-
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(
|
|
216
|
+
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
219
217
|
})), i;
|
|
220
218
|
}
|
|
221
|
-
function
|
|
222
|
-
var t, i =
|
|
223
|
-
return !i || i.length === 0 ?
|
|
224
|
-
return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? v(v({}, r), { attrs: v(v({}, r.attrs), { id: r.attrs.id +
|
|
225
|
-
}) }) :
|
|
219
|
+
function Tn(e, n) {
|
|
220
|
+
var t, i = n.defIds;
|
|
221
|
+
return !i || i.length === 0 ? e : e.tag === "defs" && (!((t = e.children) === null || t === void 0) && t.length) ? v(v({}, e), { children: e.children.map(function(r) {
|
|
222
|
+
return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? v(v({}, r), { attrs: v(v({}, r.attrs), { id: r.attrs.id + n.idSuffix }) }) : r;
|
|
223
|
+
}) }) : e;
|
|
226
224
|
}
|
|
227
|
-
function
|
|
225
|
+
function $n() {
|
|
228
226
|
return Math.random().toString(36).substring(2, 8);
|
|
229
227
|
}
|
|
230
228
|
$.displayName = "UniverIcon";
|
|
231
|
-
var
|
|
232
|
-
return T($, Object.assign({},
|
|
229
|
+
var Hn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Me = U(function(e, n) {
|
|
230
|
+
return T($, Object.assign({}, e, {
|
|
233
231
|
id: "copy-single",
|
|
234
|
-
ref:
|
|
235
|
-
icon:
|
|
232
|
+
ref: n,
|
|
233
|
+
icon: Hn
|
|
236
234
|
}));
|
|
237
235
|
});
|
|
238
236
|
Me.displayName = "CopySingle";
|
|
239
|
-
var
|
|
240
|
-
return T($, Object.assign({},
|
|
237
|
+
var jn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z" } }] }, oe = U(function(e, n) {
|
|
238
|
+
return T($, Object.assign({}, e, {
|
|
241
239
|
id: "link-single",
|
|
242
|
-
ref:
|
|
243
|
-
icon:
|
|
240
|
+
ref: n,
|
|
241
|
+
icon: jn
|
|
244
242
|
}));
|
|
245
243
|
});
|
|
246
244
|
oe.displayName = "LinkSingle";
|
|
247
|
-
var
|
|
248
|
-
return T($, Object.assign({},
|
|
245
|
+
var An = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z" } }] }, be = U(function(e, n) {
|
|
246
|
+
return T($, Object.assign({}, e, {
|
|
249
247
|
id: "unlink-single",
|
|
250
|
-
ref:
|
|
251
|
-
icon:
|
|
248
|
+
ref: n,
|
|
249
|
+
icon: An
|
|
252
250
|
}));
|
|
253
251
|
});
|
|
254
252
|
be.displayName = "UnlinkSingle";
|
|
255
|
-
var
|
|
256
|
-
return T($, Object.assign({},
|
|
253
|
+
var Bn = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z" } }] }, we = U(function(e, n) {
|
|
254
|
+
return T($, Object.assign({}, e, {
|
|
257
255
|
id: "write-single",
|
|
258
|
-
ref:
|
|
259
|
-
icon:
|
|
256
|
+
ref: n,
|
|
257
|
+
icon: Bn
|
|
260
258
|
}));
|
|
261
259
|
});
|
|
262
260
|
we.displayName = "WriteSingle";
|
|
263
|
-
function De(
|
|
264
|
-
var
|
|
265
|
-
if (typeof
|
|
266
|
-
else if (typeof
|
|
267
|
-
var r =
|
|
268
|
-
for (
|
|
269
|
-
} else for (t in
|
|
261
|
+
function De(e) {
|
|
262
|
+
var n, t, i = "";
|
|
263
|
+
if (typeof e == "string" || typeof e == "number") i += e;
|
|
264
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
265
|
+
var r = e.length;
|
|
266
|
+
for (n = 0; n < r; n++) e[n] && (t = De(e[n])) && (i && (i += " "), i += t);
|
|
267
|
+
} else for (t in e) e[t] && (i && (i += " "), i += t);
|
|
270
268
|
return i;
|
|
271
269
|
}
|
|
272
|
-
function
|
|
273
|
-
for (var
|
|
270
|
+
function ke() {
|
|
271
|
+
for (var e, n, t = 0, i = "", r = arguments.length; t < r; t++) (e = arguments[t]) && (n = De(e)) && (i && (i += " "), i += n);
|
|
274
272
|
return i;
|
|
275
273
|
}
|
|
276
274
|
const Ne = {
|
|
277
275
|
type: M.COMMAND,
|
|
278
276
|
id: "docs.command.delete-hyper-link",
|
|
279
|
-
async handler(
|
|
280
|
-
if (!
|
|
277
|
+
async handler(e, n) {
|
|
278
|
+
if (!n)
|
|
281
279
|
return !1;
|
|
282
|
-
const { unitId: t, linkId: i, segmentId: r } =
|
|
280
|
+
const { unitId: t, linkId: i, segmentId: r } = n, o = e.get(O), s = en(e, { unitId: t, rangeId: i, segmentId: r });
|
|
283
281
|
return s ? await o.syncExecuteCommand(s.id, s.params) : !1;
|
|
284
282
|
}
|
|
285
|
-
}, Ue = (
|
|
286
|
-
const
|
|
283
|
+
}, Ue = (e) => {
|
|
284
|
+
const n = e.get(b), t = e.get(x), i = n.getTextRanges();
|
|
287
285
|
if (!(i != null && i.length))
|
|
288
286
|
return !0;
|
|
289
287
|
const r = i[0];
|
|
290
|
-
return !!(!t.getCurrentUnitForType(
|
|
291
|
-
},
|
|
288
|
+
return !!(!t.getCurrentUnitForType(_.UNIVER_DOC) || !r || r.collapsed);
|
|
289
|
+
}, E = {
|
|
292
290
|
type: M.OPERATION,
|
|
293
291
|
id: "doc.operation.show-hyper-link-edit-popup",
|
|
294
|
-
handler(
|
|
292
|
+
handler(e, n) {
|
|
295
293
|
var s;
|
|
296
|
-
const t =
|
|
297
|
-
if (Ue(
|
|
294
|
+
const t = n == null ? void 0 : n.link, i = e.get(x);
|
|
295
|
+
if (Ue(e) && !t)
|
|
298
296
|
return !1;
|
|
299
|
-
const r =
|
|
297
|
+
const r = e.get(k), o = (t == null ? void 0 : t.unitId) || ((s = i.getCurrentUnitForType(_.UNIVER_DOC)) == null ? void 0 : s.getUnitId());
|
|
300
298
|
return o ? (r.showEditPopup(o, t), !0) : !1;
|
|
301
299
|
}
|
|
302
300
|
}, te = {
|
|
303
301
|
type: M.OPERATION,
|
|
304
302
|
id: "doc.operation.toggle-hyper-link-info-popup",
|
|
305
|
-
handler(
|
|
306
|
-
const t =
|
|
307
|
-
return
|
|
303
|
+
handler(e, n) {
|
|
304
|
+
const t = e.get(k);
|
|
305
|
+
return n ? (t.showInfoPopup(n), !0) : (t.hideInfoPopup(), !0);
|
|
308
306
|
}
|
|
309
307
|
}, Te = {
|
|
310
308
|
type: M.OPERATION,
|
|
311
309
|
id: "doc.operation.click-hyper-link",
|
|
312
|
-
handler(
|
|
313
|
-
var u,
|
|
314
|
-
if (!
|
|
310
|
+
handler(e, n) {
|
|
311
|
+
var u, f, m;
|
|
312
|
+
if (!n)
|
|
315
313
|
return !1;
|
|
316
|
-
const { unitId: t, linkId: i, segmentId: r } =
|
|
314
|
+
const { unitId: t, linkId: i, segmentId: r } = n, s = e.get(x).getUnit(t, _.UNIVER_DOC), c = s == null ? void 0 : s.getSelfOrHeaderFooterModel(r).getBody(), l = (m = (f = (u = c == null ? void 0 : c.customRanges) == null ? void 0 : u.find((g) => g.rangeId === i && g.rangeType === D.HYPERLINK)) == null ? void 0 : f.properties) == null ? void 0 : m.url;
|
|
317
315
|
return l && window.open(l, "_blank", "noopener noreferrer"), !0;
|
|
318
316
|
}
|
|
319
|
-
},
|
|
320
|
-
docLink:
|
|
321
|
-
docLinkType:
|
|
322
|
-
docLinkContent:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
docLinkOperation: Jn,
|
|
327
|
-
docLinkOperationError: Qn
|
|
317
|
+
}, Kn = "univer-doc-link", Fn = "univer-doc-link-type", Vn = "univer-doc-link-content", Yn = "univer-doc-link-url", Zn = "univer-doc-link-operations", Wn = "univer-doc-link-operation", L = {
|
|
318
|
+
docLink: Kn,
|
|
319
|
+
docLinkType: Fn,
|
|
320
|
+
docLinkContent: Vn,
|
|
321
|
+
docLinkUrl: Yn,
|
|
322
|
+
docLinkOperations: Zn,
|
|
323
|
+
docLinkOperation: Wn
|
|
328
324
|
}, Y = () => {
|
|
329
325
|
var C, a;
|
|
330
|
-
const
|
|
326
|
+
const e = S(k), n = S(O), t = S(fn), i = S(Oe), r = xe(e.showingLink$), o = S(x);
|
|
331
327
|
if (!r)
|
|
332
328
|
return null;
|
|
333
|
-
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex:
|
|
329
|
+
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex: f } = r, m = o.getUnit(s, _.UNIVER_DOC), g = m == null ? void 0 : m.getSelfOrHeaderFooterModel(l).getBody(), d = (C = g == null ? void 0 : g.customRanges) == null ? void 0 : C.find((y) => y.rangeId === c && y.rangeType === D.HYPERLINK && y.startIndex === u && y.endIndex === f);
|
|
334
330
|
if (!d)
|
|
335
331
|
return null;
|
|
336
332
|
const p = (a = d.properties) == null ? void 0 : a.url;
|
|
337
|
-
return /* @__PURE__ */
|
|
333
|
+
return /* @__PURE__ */ R(
|
|
338
334
|
"div",
|
|
339
335
|
{
|
|
340
|
-
className:
|
|
336
|
+
className: L.docLink,
|
|
341
337
|
onClick: () => {
|
|
342
|
-
|
|
338
|
+
e.hideInfoPopup();
|
|
343
339
|
},
|
|
344
340
|
children: [
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ R("div", { className: ke(L.docLinkContent), onClick: () => window.open(p), children: [
|
|
342
|
+
/* @__PURE__ */ h("div", { className: L.docLinkType, children: /* @__PURE__ */ h(oe, {}) }),
|
|
343
|
+
/* @__PURE__ */ h(B, { showIfEllipsis: !0, title: p, children: /* @__PURE__ */ h("span", { className: L.docLinkUrl, children: p }) })
|
|
348
344
|
] }),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ R("div", { className: L.docLinkOperations, children: [
|
|
346
|
+
/* @__PURE__ */ h(
|
|
351
347
|
"div",
|
|
352
348
|
{
|
|
353
|
-
className:
|
|
349
|
+
className: ke(L.docLinkOperation),
|
|
354
350
|
onClick: () => {
|
|
355
351
|
navigator.clipboard.writeText(p), t.show({
|
|
356
352
|
content: i.t("docLink.info.coped"),
|
|
357
353
|
type: hn.Info
|
|
358
354
|
});
|
|
359
355
|
},
|
|
360
|
-
children: /* @__PURE__ */
|
|
356
|
+
children: /* @__PURE__ */ h(B, { placement: "bottom", title: i.t("docLink.info.copy"), children: /* @__PURE__ */ h(Me, {}) })
|
|
361
357
|
}
|
|
362
358
|
),
|
|
363
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ h(
|
|
364
360
|
"div",
|
|
365
361
|
{
|
|
366
|
-
className:
|
|
362
|
+
className: L.docLinkOperation,
|
|
367
363
|
onClick: () => {
|
|
368
|
-
|
|
364
|
+
n.executeCommand(E.id, {
|
|
369
365
|
link: r
|
|
370
366
|
});
|
|
371
367
|
},
|
|
372
|
-
children: /* @__PURE__ */
|
|
368
|
+
children: /* @__PURE__ */ h(B, { placement: "bottom", title: i.t("docLink.info.edit"), children: /* @__PURE__ */ h(we, {}) })
|
|
373
369
|
}
|
|
374
370
|
),
|
|
375
|
-
/* @__PURE__ */
|
|
371
|
+
/* @__PURE__ */ h(
|
|
376
372
|
"div",
|
|
377
373
|
{
|
|
378
|
-
className:
|
|
374
|
+
className: L.docLinkOperation,
|
|
379
375
|
onClick: () => {
|
|
380
|
-
|
|
376
|
+
n.executeCommand(Ne.id, {
|
|
381
377
|
unitId: s,
|
|
382
378
|
linkId: d.rangeId,
|
|
383
379
|
segmentId: l
|
|
384
380
|
});
|
|
385
381
|
},
|
|
386
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ h(B, { placement: "bottom", title: i.t("docLink.info.cancel"), children: /* @__PURE__ */ h(be, {}) })
|
|
387
383
|
}
|
|
388
384
|
)
|
|
389
385
|
] })
|
|
@@ -392,13 +388,13 @@ const Ne = {
|
|
|
392
388
|
);
|
|
393
389
|
};
|
|
394
390
|
Y.componentKey = "univer.doc.link-info-popup";
|
|
395
|
-
var
|
|
396
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
397
|
-
(s =
|
|
398
|
-
return
|
|
399
|
-
}, J = (
|
|
400
|
-
let
|
|
401
|
-
constructor(
|
|
391
|
+
var Gn = Object.getOwnPropertyDescriptor, zn = (e, n, t, i) => {
|
|
392
|
+
for (var r = i > 1 ? void 0 : i ? Gn(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
393
|
+
(s = e[o]) && (r = s(r) || r);
|
|
394
|
+
return r;
|
|
395
|
+
}, J = (e, n) => (t, i) => n(t, i, e);
|
|
396
|
+
let k = class extends N {
|
|
397
|
+
constructor(n, t, i) {
|
|
402
398
|
super();
|
|
403
399
|
P(this, "_editingLink$", new ve(null));
|
|
404
400
|
P(this, "_showingLink$", new ve(null));
|
|
@@ -406,7 +402,7 @@ let L = class extends N {
|
|
|
406
402
|
P(this, "showingLink$", this._showingLink$.asObservable());
|
|
407
403
|
P(this, "_editPopup", null);
|
|
408
404
|
P(this, "_infoPopup", null);
|
|
409
|
-
this._docCanvasPopupManagerService =
|
|
405
|
+
this._docCanvasPopupManagerService = n, this._textSelectionManagerService = t, this._univerInstanceService = i, this.disposeWithMe(() => {
|
|
410
406
|
this._editingLink$.complete(), this._showingLink$.complete();
|
|
411
407
|
});
|
|
412
408
|
}
|
|
@@ -416,9 +412,9 @@ let L = class extends N {
|
|
|
416
412
|
get showing() {
|
|
417
413
|
return this._showingLink$.value;
|
|
418
414
|
}
|
|
419
|
-
showEditPopup(
|
|
415
|
+
showEditPopup(n, t) {
|
|
420
416
|
this._editPopup && this._editPopup.dispose(), this._editingLink$.next(t);
|
|
421
|
-
const i = this._textSelectionManagerService.getTextRanges({ unitId:
|
|
417
|
+
const i = this._textSelectionManagerService.getTextRanges({ unitId: n, subUnitId: n });
|
|
422
418
|
let r = i == null ? void 0 : i[i.length - 1];
|
|
423
419
|
if (t) {
|
|
424
420
|
const { segmentId: o, segmentPage: s, startIndex: c, endIndex: l } = t;
|
|
@@ -439,17 +435,17 @@ let L = class extends N {
|
|
|
439
435
|
componentKey: V.componentKey,
|
|
440
436
|
direction: "bottom"
|
|
441
437
|
},
|
|
442
|
-
|
|
438
|
+
n
|
|
443
439
|
), this._editPopup) : null;
|
|
444
440
|
}
|
|
445
441
|
hideEditPopup() {
|
|
446
|
-
var
|
|
447
|
-
this._editingLink$.next(null), (
|
|
442
|
+
var n;
|
|
443
|
+
this._editingLink$.next(null), (n = this._editPopup) == null || n.dispose();
|
|
448
444
|
}
|
|
449
|
-
showInfoPopup(
|
|
450
|
-
var u,
|
|
451
|
-
const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } =
|
|
452
|
-
if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((
|
|
445
|
+
showInfoPopup(n) {
|
|
446
|
+
var u, f, m, g, d, p;
|
|
447
|
+
const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } = n;
|
|
448
|
+
if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((f = this.showing) == null ? void 0 : f.unitId) === i && ((m = this.showing) == null ? void 0 : m.segmentId) === r && ((g = this.showing) == null ? void 0 : g.segmentPage) === o && ((d = this.showing) == null ? void 0 : d.startIndex) === s && ((p = this.showing) == null ? void 0 : p.endIndex) === c || (this._infoPopup && this._infoPopup.dispose(), !this._univerInstanceService.getUnit(i, _.UNIVER_DOC))))
|
|
453
449
|
return this._showingLink$.next({ unitId: i, linkId: t, segmentId: r, segmentPage: o, startIndex: s, endIndex: c }), this._infoPopup = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
454
450
|
{
|
|
455
451
|
collapsed: !1,
|
|
@@ -470,40 +466,40 @@ let L = class extends N {
|
|
|
470
466
|
), this._infoPopup;
|
|
471
467
|
}
|
|
472
468
|
hideInfoPopup() {
|
|
473
|
-
var
|
|
474
|
-
this._showingLink$.next(null), (
|
|
469
|
+
var n;
|
|
470
|
+
this._showingLink$.next(null), (n = this._infoPopup) == null || n.dispose();
|
|
475
471
|
}
|
|
476
472
|
};
|
|
477
|
-
|
|
478
|
-
J(0,
|
|
479
|
-
J(1,
|
|
473
|
+
k = zn([
|
|
474
|
+
J(0, I(sn)),
|
|
475
|
+
J(1, I(b)),
|
|
480
476
|
J(2, x)
|
|
481
|
-
],
|
|
482
|
-
var
|
|
483
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
484
|
-
(s =
|
|
485
|
-
return
|
|
486
|
-
}, Q = (
|
|
477
|
+
], k);
|
|
478
|
+
var qn = Object.getOwnPropertyDescriptor, Jn = (e, n, t, i) => {
|
|
479
|
+
for (var r = i > 1 ? void 0 : i ? qn(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
480
|
+
(s = e[o]) && (r = s(r) || r);
|
|
481
|
+
return r;
|
|
482
|
+
}, Q = (e, n) => (t, i) => n(t, i, e);
|
|
487
483
|
let Z = class extends N {
|
|
488
|
-
constructor(
|
|
489
|
-
super(), this._commandService =
|
|
484
|
+
constructor(e, n, t) {
|
|
485
|
+
super(), this._commandService = e, this._univerInstanceService = n, this._docHyperLinkService = t, this._initSelectionChange();
|
|
490
486
|
}
|
|
491
487
|
_initSelectionChange() {
|
|
492
488
|
this.disposeWithMe(
|
|
493
|
-
this._commandService.onCommandExecuted((
|
|
494
|
-
var
|
|
495
|
-
if (
|
|
496
|
-
const r =
|
|
489
|
+
this._commandService.onCommandExecuted((e) => {
|
|
490
|
+
var n, t, i;
|
|
491
|
+
if (e.id === nn.id) {
|
|
492
|
+
const r = e.params, { unitId: o, ranges: s, segmentId: c } = r, l = this._univerInstanceService.getUnit(o, _.UNIVER_DOC), u = s[0];
|
|
497
493
|
if (u && l) {
|
|
498
|
-
const { startOffset:
|
|
499
|
-
if (
|
|
500
|
-
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex <
|
|
494
|
+
const { startOffset: f, endOffset: m, collapsed: g, segmentPage: d } = u, p = (t = (n = l.getSelfOrHeaderFooterModel(c)) == null ? void 0 : n.getBody()) == null ? void 0 : t.customRanges;
|
|
495
|
+
if (g) {
|
|
496
|
+
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex < f && a.endIndex > m - 1)) != null ? i : -1;
|
|
501
497
|
if (C > -1) {
|
|
502
498
|
const a = p[C];
|
|
503
499
|
this._docHyperLinkService.showInfoPopup({ unitId: o, linkId: a.rangeId, segmentId: c, segmentPage: d, startIndex: a.startIndex, endIndex: a.endIndex });
|
|
504
500
|
return;
|
|
505
501
|
}
|
|
506
|
-
} else if (p == null ? void 0 : p.find((a) => a.startIndex <=
|
|
502
|
+
} else if (p == null ? void 0 : p.find((a) => a.startIndex <= f && a.endIndex >= m - 1))
|
|
507
503
|
return;
|
|
508
504
|
}
|
|
509
505
|
this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
|
|
@@ -512,19 +508,19 @@ let Z = class extends N {
|
|
|
512
508
|
);
|
|
513
509
|
}
|
|
514
510
|
};
|
|
515
|
-
Z =
|
|
511
|
+
Z = Jn([
|
|
516
512
|
Q(0, O),
|
|
517
513
|
Q(1, x),
|
|
518
|
-
Q(2,
|
|
514
|
+
Q(2, I(k))
|
|
519
515
|
], Z);
|
|
520
|
-
var
|
|
521
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
522
|
-
(s =
|
|
523
|
-
return
|
|
524
|
-
}, w = (
|
|
516
|
+
var Qn = Object.getOwnPropertyDescriptor, Xn = (e, n, t, i) => {
|
|
517
|
+
for (var r = i > 1 ? void 0 : i ? Qn(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
518
|
+
(s = e[o]) && (r = s(r) || r);
|
|
519
|
+
return r;
|
|
520
|
+
}, w = (e, n) => (t, i) => n(t, i, e);
|
|
525
521
|
let ie = class extends N {
|
|
526
|
-
constructor(
|
|
527
|
-
super(), this._context =
|
|
522
|
+
constructor(e, n, t, i, r, o) {
|
|
523
|
+
super(), this._context = e, this._docEventManagerService = n, this._commandService = t, this._hyperLinkPopupService = i, this._docSkeletonManagerService = r, this._docSelectionManagerService = o, !(this._context.unitId === Fe || this._context.unitId === Ve) && (this._initHover(), this._initClick());
|
|
528
524
|
}
|
|
529
525
|
get _skeleton() {
|
|
530
526
|
return this._docSkeletonManagerService.getSkeleton();
|
|
@@ -536,23 +532,23 @@ let ie = class extends N {
|
|
|
536
532
|
}
|
|
537
533
|
_initHover() {
|
|
538
534
|
this.disposeWithMe(
|
|
539
|
-
this._docEventManagerService.hoverCustomRanges$.subscribe((
|
|
535
|
+
this._docEventManagerService.hoverCustomRanges$.subscribe((e) => {
|
|
540
536
|
var r;
|
|
541
|
-
const
|
|
542
|
-
if (((r =
|
|
537
|
+
const n = e.find((o) => o.range.rangeType === D.HYPERLINK), t = this._docSelectionManagerService.getTextRanges(), i = t == null ? void 0 : t[0].segmentId;
|
|
538
|
+
if (((r = n == null ? void 0 : n.segmentId) != null ? r : "") !== i) {
|
|
543
539
|
this._hideInfoPopup();
|
|
544
540
|
return;
|
|
545
541
|
}
|
|
546
|
-
|
|
542
|
+
n ? this._commandService.executeCommand(
|
|
547
543
|
te.id,
|
|
548
544
|
{
|
|
549
545
|
unitId: this._context.unitId,
|
|
550
|
-
linkId:
|
|
551
|
-
segmentId:
|
|
552
|
-
segmentPage:
|
|
553
|
-
rangeId:
|
|
554
|
-
startIndex:
|
|
555
|
-
endIndex:
|
|
546
|
+
linkId: n.range.rangeId,
|
|
547
|
+
segmentId: n.segmentId,
|
|
548
|
+
segmentPage: n.segmentPageIndex,
|
|
549
|
+
rangeId: n.range.rangeId,
|
|
550
|
+
startIndex: n.range.startIndex,
|
|
551
|
+
endIndex: n.range.endIndex
|
|
556
552
|
}
|
|
557
553
|
) : this._hideInfoPopup();
|
|
558
554
|
})
|
|
@@ -560,81 +556,81 @@ let ie = class extends N {
|
|
|
560
556
|
}
|
|
561
557
|
_initClick() {
|
|
562
558
|
this.disposeWithMe(
|
|
563
|
-
this._docEventManagerService.clickCustomRanges$.subscribe((
|
|
564
|
-
const
|
|
565
|
-
|
|
559
|
+
this._docEventManagerService.clickCustomRanges$.subscribe((e) => {
|
|
560
|
+
const n = e.range;
|
|
561
|
+
n && this._commandService.executeCommand(
|
|
566
562
|
Te.id,
|
|
567
563
|
{
|
|
568
564
|
unitId: this._context.unitId,
|
|
569
|
-
linkId:
|
|
570
|
-
segmentId:
|
|
565
|
+
linkId: n.rangeId,
|
|
566
|
+
segmentId: e.segmentId
|
|
571
567
|
}
|
|
572
568
|
);
|
|
573
569
|
})
|
|
574
570
|
);
|
|
575
571
|
}
|
|
576
572
|
};
|
|
577
|
-
ie =
|
|
578
|
-
w(1,
|
|
573
|
+
ie = Xn([
|
|
574
|
+
w(1, I(cn)),
|
|
579
575
|
w(2, O),
|
|
580
|
-
w(3,
|
|
581
|
-
w(4,
|
|
582
|
-
w(5,
|
|
576
|
+
w(3, I(k)),
|
|
577
|
+
w(4, I(tn)),
|
|
578
|
+
w(5, I(b))
|
|
583
579
|
], ie);
|
|
584
|
-
var
|
|
585
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
586
|
-
(s =
|
|
587
|
-
return
|
|
588
|
-
}, X = (
|
|
580
|
+
var et = Object.getOwnPropertyDescriptor, nt = (e, n, t, i) => {
|
|
581
|
+
for (var r = i > 1 ? void 0 : i ? et(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
582
|
+
(s = e[o]) && (r = s(r) || r);
|
|
583
|
+
return r;
|
|
584
|
+
}, X = (e, n) => (t, i) => n(t, i, e);
|
|
589
585
|
let re = class extends N {
|
|
590
|
-
constructor(
|
|
591
|
-
super(), this._context =
|
|
586
|
+
constructor(e, n, t, i) {
|
|
587
|
+
super(), this._context = e, this._docInterceptorService = n, this._hyperLinkService = t, this._docRenderController = i, this._init(), this._initReRender();
|
|
592
588
|
}
|
|
593
589
|
_init() {
|
|
594
|
-
this._docInterceptorService.intercept(
|
|
595
|
-
handler: (
|
|
596
|
-
if (!
|
|
597
|
-
return t(
|
|
598
|
-
const { unitId: i, index: r } =
|
|
590
|
+
this._docInterceptorService.intercept(on.CUSTOM_RANGE, {
|
|
591
|
+
handler: (e, n, t) => {
|
|
592
|
+
if (!e)
|
|
593
|
+
return t(e);
|
|
594
|
+
const { unitId: i, index: r } = n, o = this._hyperLinkService.showing;
|
|
599
595
|
if (!o)
|
|
600
596
|
return t({
|
|
601
|
-
...
|
|
597
|
+
...e,
|
|
602
598
|
active: !1
|
|
603
599
|
});
|
|
604
|
-
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o,
|
|
600
|
+
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o, f = c === i && e.rangeId === s && r >= l && r <= u;
|
|
605
601
|
return t({
|
|
606
|
-
...
|
|
607
|
-
active:
|
|
602
|
+
...e,
|
|
603
|
+
active: f
|
|
608
604
|
});
|
|
609
605
|
}
|
|
610
606
|
});
|
|
611
607
|
}
|
|
612
608
|
_initReRender() {
|
|
613
609
|
this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
).subscribe(([
|
|
617
|
-
|
|
610
|
+
ln((e, n) => (e == null ? void 0 : e.linkId) === (n == null ? void 0 : n.linkId) && (e == null ? void 0 : e.unitId) === (n == null ? void 0 : n.unitId) && (e == null ? void 0 : e.startIndex) === (n == null ? void 0 : n.startIndex)),
|
|
611
|
+
un()
|
|
612
|
+
).subscribe(([e, n]) => {
|
|
613
|
+
n ? n.unitId === this._context.unitId && this._docRenderController.reRender(n.unitId) : e && e.unitId === this._context.unitId && this._docRenderController.reRender(e.unitId);
|
|
618
614
|
}));
|
|
619
615
|
}
|
|
620
616
|
};
|
|
621
|
-
re =
|
|
622
|
-
X(1,
|
|
623
|
-
X(2,
|
|
624
|
-
X(3,
|
|
617
|
+
re = nt([
|
|
618
|
+
X(1, I(rn)),
|
|
619
|
+
X(2, I(k)),
|
|
620
|
+
X(3, I(dn))
|
|
625
621
|
], re);
|
|
626
622
|
const $e = "doc-hyper-link-icon";
|
|
627
|
-
function
|
|
623
|
+
function ye(e) {
|
|
628
624
|
return {
|
|
629
|
-
id:
|
|
630
|
-
type:
|
|
625
|
+
id: E.id,
|
|
626
|
+
type: In.BUTTON,
|
|
631
627
|
icon: $e,
|
|
632
628
|
title: "docLink.menu.tooltip",
|
|
633
629
|
tooltip: "docLink.menu.tooltip",
|
|
634
|
-
hidden$:
|
|
635
|
-
disabled$: new
|
|
636
|
-
const i =
|
|
637
|
-
|
|
630
|
+
hidden$: vn(e, _.UNIVER_DOC),
|
|
631
|
+
disabled$: new pn(function(n) {
|
|
632
|
+
const i = e.get(b).textSelection$.pipe(gn(16)).subscribe(() => {
|
|
633
|
+
n.next(Ue(e));
|
|
638
634
|
});
|
|
639
635
|
return () => {
|
|
640
636
|
i.unsubscribe();
|
|
@@ -642,95 +638,95 @@ function ke(n) {
|
|
|
642
638
|
})
|
|
643
639
|
};
|
|
644
640
|
}
|
|
645
|
-
const
|
|
646
|
-
id:
|
|
647
|
-
binding:
|
|
641
|
+
const tt = {
|
|
642
|
+
id: E.id,
|
|
643
|
+
binding: mn.CTRL_COMMAND | ne.K,
|
|
648
644
|
description: "docLink.menu.tooltip",
|
|
649
|
-
preconditions:
|
|
650
|
-
},
|
|
651
|
-
[
|
|
652
|
-
[
|
|
645
|
+
preconditions: an
|
|
646
|
+
}, it = {
|
|
647
|
+
[Sn.OTHERS]: {
|
|
648
|
+
[E.id]: {
|
|
653
649
|
order: 0,
|
|
654
|
-
menuItemFactory:
|
|
650
|
+
menuItemFactory: ye
|
|
655
651
|
}
|
|
656
652
|
},
|
|
657
|
-
[
|
|
658
|
-
[
|
|
659
|
-
[
|
|
653
|
+
[_n.MAIN_AREA]: {
|
|
654
|
+
[Cn.DATA]: {
|
|
655
|
+
[E.id]: {
|
|
660
656
|
order: 0,
|
|
661
|
-
menuItemFactory:
|
|
657
|
+
menuItemFactory: ye
|
|
662
658
|
}
|
|
663
659
|
}
|
|
664
660
|
}
|
|
665
661
|
};
|
|
666
|
-
var
|
|
667
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
668
|
-
(s =
|
|
669
|
-
return
|
|
670
|
-
}, F = (
|
|
662
|
+
var rt = Object.getOwnPropertyDescriptor, ot = (e, n, t, i) => {
|
|
663
|
+
for (var r = i > 1 ? void 0 : i ? rt(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
664
|
+
(s = e[o]) && (r = s(r) || r);
|
|
665
|
+
return r;
|
|
666
|
+
}, F = (e, n) => (t, i) => n(t, i, e);
|
|
671
667
|
let W = class extends N {
|
|
672
|
-
constructor(
|
|
673
|
-
super(), this._componentManager =
|
|
668
|
+
constructor(e, n, t, i) {
|
|
669
|
+
super(), this._componentManager = e, this._commandService = n, this._menuManagerService = t, this._shortcutService = i, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortcut();
|
|
674
670
|
}
|
|
675
671
|
_initComponents() {
|
|
676
672
|
[
|
|
677
673
|
[V, V.componentKey],
|
|
678
674
|
[Y, Y.componentKey],
|
|
679
675
|
[oe, $e]
|
|
680
|
-
].forEach(([
|
|
681
|
-
this._componentManager.register(
|
|
676
|
+
].forEach(([e, n]) => {
|
|
677
|
+
this._componentManager.register(n, e);
|
|
682
678
|
});
|
|
683
679
|
}
|
|
684
680
|
_initCommands() {
|
|
685
681
|
[
|
|
686
682
|
Pe,
|
|
687
|
-
|
|
683
|
+
Re,
|
|
688
684
|
Ne,
|
|
689
|
-
|
|
685
|
+
E,
|
|
690
686
|
te,
|
|
691
687
|
Te
|
|
692
|
-
].forEach((
|
|
693
|
-
this._commandService.registerCommand(
|
|
688
|
+
].forEach((e) => {
|
|
689
|
+
this._commandService.registerCommand(e);
|
|
694
690
|
});
|
|
695
691
|
}
|
|
696
692
|
_initShortcut() {
|
|
697
|
-
[
|
|
698
|
-
this._shortcutService.registerShortcut(
|
|
693
|
+
[tt].forEach((e) => {
|
|
694
|
+
this._shortcutService.registerShortcut(e);
|
|
699
695
|
});
|
|
700
696
|
}
|
|
701
697
|
_initMenus() {
|
|
702
|
-
this._menuManagerService.mergeMenu(
|
|
698
|
+
this._menuManagerService.mergeMenu(it);
|
|
703
699
|
}
|
|
704
700
|
};
|
|
705
|
-
W =
|
|
706
|
-
F(0,
|
|
701
|
+
W = ot([
|
|
702
|
+
F(0, I(kn)),
|
|
707
703
|
F(1, O),
|
|
708
704
|
F(2, yn),
|
|
709
|
-
F(3,
|
|
705
|
+
F(3, Ln)
|
|
710
706
|
], W);
|
|
711
|
-
const
|
|
712
|
-
var
|
|
713
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
714
|
-
(s =
|
|
715
|
-
return
|
|
716
|
-
}, ee = (
|
|
707
|
+
const st = "DOC_HYPER_LINK_UI_PLUGIN";
|
|
708
|
+
var ct = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, at = (e, n, t) => n in e ? ct(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, lt = (e, n, t, i) => {
|
|
709
|
+
for (var r = i > 1 ? void 0 : i ? dt(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
710
|
+
(s = e[o]) && (r = s(r) || r);
|
|
711
|
+
return r;
|
|
712
|
+
}, ee = (e, n) => (t, i) => n(t, i, e), He = (e, n, t) => at(e, typeof n != "symbol" ? n + "" : n, t);
|
|
717
713
|
let G = class extends Ge {
|
|
718
|
-
constructor(
|
|
719
|
-
super(), this._config =
|
|
714
|
+
constructor(e = Se, n, t, i) {
|
|
715
|
+
super(), this._config = e, this._injector = n, this._renderManagerSrv = t, this._configService = i;
|
|
720
716
|
const { menu: r, ...o } = ze(
|
|
721
717
|
{},
|
|
722
718
|
Se,
|
|
723
719
|
this._config
|
|
724
720
|
);
|
|
725
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
721
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Pn, o);
|
|
726
722
|
}
|
|
727
723
|
onStarting() {
|
|
728
724
|
[
|
|
729
|
-
[
|
|
725
|
+
[k],
|
|
730
726
|
[W],
|
|
731
727
|
[Z]
|
|
732
|
-
].forEach((
|
|
733
|
-
this._injector.add(
|
|
728
|
+
].forEach((n) => {
|
|
729
|
+
this._injector.add(n);
|
|
734
730
|
}), this._injector.get(W);
|
|
735
731
|
}
|
|
736
732
|
onReady() {
|
|
@@ -743,18 +739,18 @@ let G = class extends Ge {
|
|
|
743
739
|
[
|
|
744
740
|
[re],
|
|
745
741
|
[ie]
|
|
746
|
-
].forEach((
|
|
747
|
-
this._renderManagerSrv.registerRenderModule(
|
|
742
|
+
].forEach((e) => {
|
|
743
|
+
this._renderManagerSrv.registerRenderModule(_.UNIVER_DOC, e);
|
|
748
744
|
});
|
|
749
745
|
}
|
|
750
746
|
};
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
G =
|
|
754
|
-
|
|
755
|
-
ee(1,
|
|
756
|
-
ee(2,
|
|
757
|
-
ee(3,
|
|
747
|
+
He(G, "pluginName", st);
|
|
748
|
+
He(G, "type", _.UNIVER_DOC);
|
|
749
|
+
G = lt([
|
|
750
|
+
Ye(qe),
|
|
751
|
+
ee(1, I(Ze)),
|
|
752
|
+
ee(2, Je),
|
|
753
|
+
ee(3, We)
|
|
758
754
|
], G);
|
|
759
755
|
export {
|
|
760
756
|
G as UniverDocsHyperLinkUIPlugin
|