@univerjs/docs-hyper-link-ui 0.6.0-nightly.202502191606 → 0.6.0-nightly.202502201606
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 +320 -321
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
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
|
|
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 k, 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 kn, ComponentManager as Sn, 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", ke = {}, 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 = k(S), n = k(Oe), t = xe(e.editingLink$), i = k(O), r = k(x), o = k(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,205 @@ 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({},
|
|
214
|
-
t != null && t.colorChannel1 && i.fill === "colorChannel1" && (i.fill = t.colorChannel1)
|
|
215
|
-
var r = e.defIds;
|
|
216
|
-
return !r || r.length === 0 || (n.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(o) {
|
|
210
|
+
function Un(e, n, t) {
|
|
211
|
+
var i = v({}, e.attrs);
|
|
212
|
+
t != null && t.colorChannel1 && i.fill === "colorChannel1" && (i.fill = t.colorChannel1), e.tag === "mask" && i.id && (i.id = i.id + n.idSuffix), Object.entries(i).forEach(function(o) {
|
|
217
213
|
var s = o[0], c = o[1];
|
|
218
|
-
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(
|
|
214
|
+
s === "mask" && typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
215
|
+
});
|
|
216
|
+
var r = n.defIds;
|
|
217
|
+
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) {
|
|
218
|
+
var s = o[0], c = o[1];
|
|
219
|
+
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
|
|
219
220
|
})), i;
|
|
220
221
|
}
|
|
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
|
-
}) }) :
|
|
222
|
+
function Tn(e, n) {
|
|
223
|
+
var t, i = n.defIds;
|
|
224
|
+
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) {
|
|
225
|
+
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;
|
|
226
|
+
}) }) : e;
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
+
function $n() {
|
|
228
229
|
return Math.random().toString(36).substring(2, 8);
|
|
229
230
|
}
|
|
230
231
|
$.displayName = "UniverIcon";
|
|
231
|
-
var
|
|
232
|
-
return T($, Object.assign({},
|
|
232
|
+
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) {
|
|
233
|
+
return T($, Object.assign({}, e, {
|
|
233
234
|
id: "copy-single",
|
|
234
|
-
ref:
|
|
235
|
-
icon:
|
|
235
|
+
ref: n,
|
|
236
|
+
icon: Hn
|
|
236
237
|
}));
|
|
237
238
|
});
|
|
238
239
|
Me.displayName = "CopySingle";
|
|
239
|
-
var
|
|
240
|
-
return T($, Object.assign({},
|
|
240
|
+
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) {
|
|
241
|
+
return T($, Object.assign({}, e, {
|
|
241
242
|
id: "link-single",
|
|
242
|
-
ref:
|
|
243
|
-
icon:
|
|
243
|
+
ref: n,
|
|
244
|
+
icon: jn
|
|
244
245
|
}));
|
|
245
246
|
});
|
|
246
247
|
oe.displayName = "LinkSingle";
|
|
247
|
-
var
|
|
248
|
-
return T($, Object.assign({},
|
|
248
|
+
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) {
|
|
249
|
+
return T($, Object.assign({}, e, {
|
|
249
250
|
id: "unlink-single",
|
|
250
|
-
ref:
|
|
251
|
-
icon:
|
|
251
|
+
ref: n,
|
|
252
|
+
icon: An
|
|
252
253
|
}));
|
|
253
254
|
});
|
|
254
255
|
be.displayName = "UnlinkSingle";
|
|
255
|
-
var
|
|
256
|
-
return T($, Object.assign({},
|
|
256
|
+
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) {
|
|
257
|
+
return T($, Object.assign({}, e, {
|
|
257
258
|
id: "write-single",
|
|
258
|
-
ref:
|
|
259
|
-
icon:
|
|
259
|
+
ref: n,
|
|
260
|
+
icon: Bn
|
|
260
261
|
}));
|
|
261
262
|
});
|
|
262
263
|
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
|
|
264
|
+
function De(e) {
|
|
265
|
+
var n, t, i = "";
|
|
266
|
+
if (typeof e == "string" || typeof e == "number") i += e;
|
|
267
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
268
|
+
var r = e.length;
|
|
269
|
+
for (n = 0; n < r; n++) e[n] && (t = De(e[n])) && (i && (i += " "), i += t);
|
|
270
|
+
} else for (t in e) e[t] && (i && (i += " "), i += t);
|
|
270
271
|
return i;
|
|
271
272
|
}
|
|
272
|
-
function
|
|
273
|
-
for (var
|
|
273
|
+
function Se() {
|
|
274
|
+
for (var e, n, t = 0, i = "", r = arguments.length; t < r; t++) (e = arguments[t]) && (n = De(e)) && (i && (i += " "), i += n);
|
|
274
275
|
return i;
|
|
275
276
|
}
|
|
276
277
|
const Ne = {
|
|
277
278
|
type: M.COMMAND,
|
|
278
279
|
id: "docs.command.delete-hyper-link",
|
|
279
|
-
async handler(
|
|
280
|
-
if (!
|
|
280
|
+
async handler(e, n) {
|
|
281
|
+
if (!n)
|
|
281
282
|
return !1;
|
|
282
|
-
const { unitId: t, linkId: i, segmentId: r } =
|
|
283
|
+
const { unitId: t, linkId: i, segmentId: r } = n, o = e.get(O), s = en(e, { unitId: t, rangeId: i, segmentId: r });
|
|
283
284
|
return s ? await o.syncExecuteCommand(s.id, s.params) : !1;
|
|
284
285
|
}
|
|
285
|
-
}, Ue = (
|
|
286
|
-
const
|
|
286
|
+
}, Ue = (e) => {
|
|
287
|
+
const n = e.get(b), t = e.get(x), i = n.getTextRanges();
|
|
287
288
|
if (!(i != null && i.length))
|
|
288
289
|
return !0;
|
|
289
290
|
const r = i[0];
|
|
290
|
-
return !!(!t.getCurrentUnitForType(
|
|
291
|
-
},
|
|
291
|
+
return !!(!t.getCurrentUnitForType(_.UNIVER_DOC) || !r || r.collapsed);
|
|
292
|
+
}, E = {
|
|
292
293
|
type: M.OPERATION,
|
|
293
294
|
id: "doc.operation.show-hyper-link-edit-popup",
|
|
294
|
-
handler(
|
|
295
|
+
handler(e, n) {
|
|
295
296
|
var s;
|
|
296
|
-
const t =
|
|
297
|
-
if (Ue(
|
|
297
|
+
const t = n == null ? void 0 : n.link, i = e.get(x);
|
|
298
|
+
if (Ue(e) && !t)
|
|
298
299
|
return !1;
|
|
299
|
-
const r =
|
|
300
|
+
const r = e.get(S), o = (t == null ? void 0 : t.unitId) || ((s = i.getCurrentUnitForType(_.UNIVER_DOC)) == null ? void 0 : s.getUnitId());
|
|
300
301
|
return o ? (r.showEditPopup(o, t), !0) : !1;
|
|
301
302
|
}
|
|
302
303
|
}, te = {
|
|
303
304
|
type: M.OPERATION,
|
|
304
305
|
id: "doc.operation.toggle-hyper-link-info-popup",
|
|
305
|
-
handler(
|
|
306
|
-
const t =
|
|
307
|
-
return
|
|
306
|
+
handler(e, n) {
|
|
307
|
+
const t = e.get(S);
|
|
308
|
+
return n ? (t.showInfoPopup(n), !0) : (t.hideInfoPopup(), !0);
|
|
308
309
|
}
|
|
309
310
|
}, Te = {
|
|
310
311
|
type: M.OPERATION,
|
|
311
312
|
id: "doc.operation.click-hyper-link",
|
|
312
|
-
handler(
|
|
313
|
-
var u,
|
|
314
|
-
if (!
|
|
313
|
+
handler(e, n) {
|
|
314
|
+
var u, f, m;
|
|
315
|
+
if (!n)
|
|
315
316
|
return !1;
|
|
316
|
-
const { unitId: t, linkId: i, segmentId: r } =
|
|
317
|
+
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
318
|
return l && window.open(l, "_blank", "noopener noreferrer"), !0;
|
|
318
319
|
}
|
|
319
|
-
},
|
|
320
|
-
docLink:
|
|
321
|
-
docLinkType:
|
|
322
|
-
docLinkContent:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
docLinkOperation: Jn,
|
|
327
|
-
docLinkOperationError: Qn
|
|
320
|
+
}, 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 = {
|
|
321
|
+
docLink: Kn,
|
|
322
|
+
docLinkType: Fn,
|
|
323
|
+
docLinkContent: Vn,
|
|
324
|
+
docLinkUrl: Yn,
|
|
325
|
+
docLinkOperations: Zn,
|
|
326
|
+
docLinkOperation: Wn
|
|
328
327
|
}, Y = () => {
|
|
329
328
|
var C, a;
|
|
330
|
-
const
|
|
329
|
+
const e = k(S), n = k(O), t = k(fn), i = k(Oe), r = xe(e.showingLink$), o = k(x);
|
|
331
330
|
if (!r)
|
|
332
331
|
return null;
|
|
333
|
-
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex:
|
|
332
|
+
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
333
|
if (!d)
|
|
335
334
|
return null;
|
|
336
335
|
const p = (a = d.properties) == null ? void 0 : a.url;
|
|
337
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ R(
|
|
338
337
|
"div",
|
|
339
338
|
{
|
|
340
|
-
className:
|
|
339
|
+
className: L.docLink,
|
|
341
340
|
onClick: () => {
|
|
342
|
-
|
|
341
|
+
e.hideInfoPopup();
|
|
343
342
|
},
|
|
344
343
|
children: [
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ R("div", { className: Se(L.docLinkContent), onClick: () => window.open(p), children: [
|
|
345
|
+
/* @__PURE__ */ h("div", { className: L.docLinkType, children: /* @__PURE__ */ h(oe, {}) }),
|
|
346
|
+
/* @__PURE__ */ h(B, { showIfEllipsis: !0, title: p, children: /* @__PURE__ */ h("span", { className: L.docLinkUrl, children: p }) })
|
|
348
347
|
] }),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ R("div", { className: L.docLinkOperations, children: [
|
|
349
|
+
/* @__PURE__ */ h(
|
|
351
350
|
"div",
|
|
352
351
|
{
|
|
353
|
-
className:
|
|
352
|
+
className: Se(L.docLinkOperation),
|
|
354
353
|
onClick: () => {
|
|
355
354
|
navigator.clipboard.writeText(p), t.show({
|
|
356
355
|
content: i.t("docLink.info.coped"),
|
|
357
356
|
type: hn.Info
|
|
358
357
|
});
|
|
359
358
|
},
|
|
360
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ h(B, { placement: "bottom", title: i.t("docLink.info.copy"), children: /* @__PURE__ */ h(Me, {}) })
|
|
361
360
|
}
|
|
362
361
|
),
|
|
363
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ h(
|
|
364
363
|
"div",
|
|
365
364
|
{
|
|
366
|
-
className:
|
|
365
|
+
className: L.docLinkOperation,
|
|
367
366
|
onClick: () => {
|
|
368
|
-
|
|
367
|
+
n.executeCommand(E.id, {
|
|
369
368
|
link: r
|
|
370
369
|
});
|
|
371
370
|
},
|
|
372
|
-
children: /* @__PURE__ */
|
|
371
|
+
children: /* @__PURE__ */ h(B, { placement: "bottom", title: i.t("docLink.info.edit"), children: /* @__PURE__ */ h(we, {}) })
|
|
373
372
|
}
|
|
374
373
|
),
|
|
375
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ h(
|
|
376
375
|
"div",
|
|
377
376
|
{
|
|
378
|
-
className:
|
|
377
|
+
className: L.docLinkOperation,
|
|
379
378
|
onClick: () => {
|
|
380
|
-
|
|
379
|
+
n.executeCommand(Ne.id, {
|
|
381
380
|
unitId: s,
|
|
382
381
|
linkId: d.rangeId,
|
|
383
382
|
segmentId: l
|
|
384
383
|
});
|
|
385
384
|
},
|
|
386
|
-
children: /* @__PURE__ */
|
|
385
|
+
children: /* @__PURE__ */ h(B, { placement: "bottom", title: i.t("docLink.info.cancel"), children: /* @__PURE__ */ h(be, {}) })
|
|
387
386
|
}
|
|
388
387
|
)
|
|
389
388
|
] })
|
|
@@ -392,13 +391,13 @@ const Ne = {
|
|
|
392
391
|
);
|
|
393
392
|
};
|
|
394
393
|
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(
|
|
394
|
+
var Gn = Object.getOwnPropertyDescriptor, zn = (e, n, t, i) => {
|
|
395
|
+
for (var r = i > 1 ? void 0 : i ? Gn(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
396
|
+
(s = e[o]) && (r = s(r) || r);
|
|
397
|
+
return r;
|
|
398
|
+
}, J = (e, n) => (t, i) => n(t, i, e);
|
|
399
|
+
let S = class extends N {
|
|
400
|
+
constructor(n, t, i) {
|
|
402
401
|
super();
|
|
403
402
|
P(this, "_editingLink$", new ve(null));
|
|
404
403
|
P(this, "_showingLink$", new ve(null));
|
|
@@ -406,7 +405,7 @@ let L = class extends N {
|
|
|
406
405
|
P(this, "showingLink$", this._showingLink$.asObservable());
|
|
407
406
|
P(this, "_editPopup", null);
|
|
408
407
|
P(this, "_infoPopup", null);
|
|
409
|
-
this._docCanvasPopupManagerService =
|
|
408
|
+
this._docCanvasPopupManagerService = n, this._textSelectionManagerService = t, this._univerInstanceService = i, this.disposeWithMe(() => {
|
|
410
409
|
this._editingLink$.complete(), this._showingLink$.complete();
|
|
411
410
|
});
|
|
412
411
|
}
|
|
@@ -416,9 +415,9 @@ let L = class extends N {
|
|
|
416
415
|
get showing() {
|
|
417
416
|
return this._showingLink$.value;
|
|
418
417
|
}
|
|
419
|
-
showEditPopup(
|
|
418
|
+
showEditPopup(n, t) {
|
|
420
419
|
this._editPopup && this._editPopup.dispose(), this._editingLink$.next(t);
|
|
421
|
-
const i = this._textSelectionManagerService.getTextRanges({ unitId:
|
|
420
|
+
const i = this._textSelectionManagerService.getTextRanges({ unitId: n, subUnitId: n });
|
|
422
421
|
let r = i == null ? void 0 : i[i.length - 1];
|
|
423
422
|
if (t) {
|
|
424
423
|
const { segmentId: o, segmentPage: s, startIndex: c, endIndex: l } = t;
|
|
@@ -439,17 +438,17 @@ let L = class extends N {
|
|
|
439
438
|
componentKey: V.componentKey,
|
|
440
439
|
direction: "bottom"
|
|
441
440
|
},
|
|
442
|
-
|
|
441
|
+
n
|
|
443
442
|
), this._editPopup) : null;
|
|
444
443
|
}
|
|
445
444
|
hideEditPopup() {
|
|
446
|
-
var
|
|
447
|
-
this._editingLink$.next(null), (
|
|
445
|
+
var n;
|
|
446
|
+
this._editingLink$.next(null), (n = this._editPopup) == null || n.dispose();
|
|
448
447
|
}
|
|
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 && ((
|
|
448
|
+
showInfoPopup(n) {
|
|
449
|
+
var u, f, m, g, d, p;
|
|
450
|
+
const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } = n;
|
|
451
|
+
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
452
|
return this._showingLink$.next({ unitId: i, linkId: t, segmentId: r, segmentPage: o, startIndex: s, endIndex: c }), this._infoPopup = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
454
453
|
{
|
|
455
454
|
collapsed: !1,
|
|
@@ -470,40 +469,40 @@ let L = class extends N {
|
|
|
470
469
|
), this._infoPopup;
|
|
471
470
|
}
|
|
472
471
|
hideInfoPopup() {
|
|
473
|
-
var
|
|
474
|
-
this._showingLink$.next(null), (
|
|
472
|
+
var n;
|
|
473
|
+
this._showingLink$.next(null), (n = this._infoPopup) == null || n.dispose();
|
|
475
474
|
}
|
|
476
475
|
};
|
|
477
|
-
|
|
478
|
-
J(0,
|
|
479
|
-
J(1,
|
|
476
|
+
S = zn([
|
|
477
|
+
J(0, I(sn)),
|
|
478
|
+
J(1, I(b)),
|
|
480
479
|
J(2, x)
|
|
481
|
-
],
|
|
482
|
-
var
|
|
483
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
484
|
-
(s =
|
|
485
|
-
return
|
|
486
|
-
}, Q = (
|
|
480
|
+
], S);
|
|
481
|
+
var qn = Object.getOwnPropertyDescriptor, Jn = (e, n, t, i) => {
|
|
482
|
+
for (var r = i > 1 ? void 0 : i ? qn(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
483
|
+
(s = e[o]) && (r = s(r) || r);
|
|
484
|
+
return r;
|
|
485
|
+
}, Q = (e, n) => (t, i) => n(t, i, e);
|
|
487
486
|
let Z = class extends N {
|
|
488
|
-
constructor(
|
|
489
|
-
super(), this._commandService =
|
|
487
|
+
constructor(e, n, t) {
|
|
488
|
+
super(), this._commandService = e, this._univerInstanceService = n, this._docHyperLinkService = t, this._initSelectionChange();
|
|
490
489
|
}
|
|
491
490
|
_initSelectionChange() {
|
|
492
491
|
this.disposeWithMe(
|
|
493
|
-
this._commandService.onCommandExecuted((
|
|
494
|
-
var
|
|
495
|
-
if (
|
|
496
|
-
const r =
|
|
492
|
+
this._commandService.onCommandExecuted((e) => {
|
|
493
|
+
var n, t, i;
|
|
494
|
+
if (e.id === nn.id) {
|
|
495
|
+
const r = e.params, { unitId: o, ranges: s, segmentId: c } = r, l = this._univerInstanceService.getUnit(o, _.UNIVER_DOC), u = s[0];
|
|
497
496
|
if (u && l) {
|
|
498
|
-
const { startOffset:
|
|
499
|
-
if (
|
|
500
|
-
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex <
|
|
497
|
+
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;
|
|
498
|
+
if (g) {
|
|
499
|
+
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex < f && a.endIndex > m - 1)) != null ? i : -1;
|
|
501
500
|
if (C > -1) {
|
|
502
501
|
const a = p[C];
|
|
503
502
|
this._docHyperLinkService.showInfoPopup({ unitId: o, linkId: a.rangeId, segmentId: c, segmentPage: d, startIndex: a.startIndex, endIndex: a.endIndex });
|
|
504
503
|
return;
|
|
505
504
|
}
|
|
506
|
-
} else if (p == null ? void 0 : p.find((a) => a.startIndex <=
|
|
505
|
+
} else if (p == null ? void 0 : p.find((a) => a.startIndex <= f && a.endIndex >= m - 1))
|
|
507
506
|
return;
|
|
508
507
|
}
|
|
509
508
|
this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
|
|
@@ -512,19 +511,19 @@ let Z = class extends N {
|
|
|
512
511
|
);
|
|
513
512
|
}
|
|
514
513
|
};
|
|
515
|
-
Z =
|
|
514
|
+
Z = Jn([
|
|
516
515
|
Q(0, O),
|
|
517
516
|
Q(1, x),
|
|
518
|
-
Q(2,
|
|
517
|
+
Q(2, I(S))
|
|
519
518
|
], Z);
|
|
520
|
-
var
|
|
521
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
522
|
-
(s =
|
|
523
|
-
return
|
|
524
|
-
}, w = (
|
|
519
|
+
var Qn = Object.getOwnPropertyDescriptor, Xn = (e, n, t, i) => {
|
|
520
|
+
for (var r = i > 1 ? void 0 : i ? Qn(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
521
|
+
(s = e[o]) && (r = s(r) || r);
|
|
522
|
+
return r;
|
|
523
|
+
}, w = (e, n) => (t, i) => n(t, i, e);
|
|
525
524
|
let ie = class extends N {
|
|
526
|
-
constructor(
|
|
527
|
-
super(), this._context =
|
|
525
|
+
constructor(e, n, t, i, r, o) {
|
|
526
|
+
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
527
|
}
|
|
529
528
|
get _skeleton() {
|
|
530
529
|
return this._docSkeletonManagerService.getSkeleton();
|
|
@@ -536,23 +535,23 @@ let ie = class extends N {
|
|
|
536
535
|
}
|
|
537
536
|
_initHover() {
|
|
538
537
|
this.disposeWithMe(
|
|
539
|
-
this._docEventManagerService.hoverCustomRanges$.subscribe((
|
|
538
|
+
this._docEventManagerService.hoverCustomRanges$.subscribe((e) => {
|
|
540
539
|
var r;
|
|
541
|
-
const
|
|
542
|
-
if (((r =
|
|
540
|
+
const n = e.find((o) => o.range.rangeType === D.HYPERLINK), t = this._docSelectionManagerService.getTextRanges(), i = t == null ? void 0 : t[0].segmentId;
|
|
541
|
+
if (((r = n == null ? void 0 : n.segmentId) != null ? r : "") !== i) {
|
|
543
542
|
this._hideInfoPopup();
|
|
544
543
|
return;
|
|
545
544
|
}
|
|
546
|
-
|
|
545
|
+
n ? this._commandService.executeCommand(
|
|
547
546
|
te.id,
|
|
548
547
|
{
|
|
549
548
|
unitId: this._context.unitId,
|
|
550
|
-
linkId:
|
|
551
|
-
segmentId:
|
|
552
|
-
segmentPage:
|
|
553
|
-
rangeId:
|
|
554
|
-
startIndex:
|
|
555
|
-
endIndex:
|
|
549
|
+
linkId: n.range.rangeId,
|
|
550
|
+
segmentId: n.segmentId,
|
|
551
|
+
segmentPage: n.segmentPageIndex,
|
|
552
|
+
rangeId: n.range.rangeId,
|
|
553
|
+
startIndex: n.range.startIndex,
|
|
554
|
+
endIndex: n.range.endIndex
|
|
556
555
|
}
|
|
557
556
|
) : this._hideInfoPopup();
|
|
558
557
|
})
|
|
@@ -560,81 +559,81 @@ let ie = class extends N {
|
|
|
560
559
|
}
|
|
561
560
|
_initClick() {
|
|
562
561
|
this.disposeWithMe(
|
|
563
|
-
this._docEventManagerService.clickCustomRanges$.subscribe((
|
|
564
|
-
const
|
|
565
|
-
|
|
562
|
+
this._docEventManagerService.clickCustomRanges$.subscribe((e) => {
|
|
563
|
+
const n = e.range;
|
|
564
|
+
n && this._commandService.executeCommand(
|
|
566
565
|
Te.id,
|
|
567
566
|
{
|
|
568
567
|
unitId: this._context.unitId,
|
|
569
|
-
linkId:
|
|
570
|
-
segmentId:
|
|
568
|
+
linkId: n.rangeId,
|
|
569
|
+
segmentId: e.segmentId
|
|
571
570
|
}
|
|
572
571
|
);
|
|
573
572
|
})
|
|
574
573
|
);
|
|
575
574
|
}
|
|
576
575
|
};
|
|
577
|
-
ie =
|
|
578
|
-
w(1,
|
|
576
|
+
ie = Xn([
|
|
577
|
+
w(1, I(cn)),
|
|
579
578
|
w(2, O),
|
|
580
|
-
w(3,
|
|
581
|
-
w(4,
|
|
582
|
-
w(5,
|
|
579
|
+
w(3, I(S)),
|
|
580
|
+
w(4, I(tn)),
|
|
581
|
+
w(5, I(b))
|
|
583
582
|
], ie);
|
|
584
|
-
var
|
|
585
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
586
|
-
(s =
|
|
587
|
-
return
|
|
588
|
-
}, X = (
|
|
583
|
+
var et = Object.getOwnPropertyDescriptor, nt = (e, n, t, i) => {
|
|
584
|
+
for (var r = i > 1 ? void 0 : i ? et(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
585
|
+
(s = e[o]) && (r = s(r) || r);
|
|
586
|
+
return r;
|
|
587
|
+
}, X = (e, n) => (t, i) => n(t, i, e);
|
|
589
588
|
let re = class extends N {
|
|
590
|
-
constructor(
|
|
591
|
-
super(), this._context =
|
|
589
|
+
constructor(e, n, t, i) {
|
|
590
|
+
super(), this._context = e, this._docInterceptorService = n, this._hyperLinkService = t, this._docRenderController = i, this._init(), this._initReRender();
|
|
592
591
|
}
|
|
593
592
|
_init() {
|
|
594
|
-
this._docInterceptorService.intercept(
|
|
595
|
-
handler: (
|
|
596
|
-
if (!
|
|
597
|
-
return t(
|
|
598
|
-
const { unitId: i, index: r } =
|
|
593
|
+
this._docInterceptorService.intercept(on.CUSTOM_RANGE, {
|
|
594
|
+
handler: (e, n, t) => {
|
|
595
|
+
if (!e)
|
|
596
|
+
return t(e);
|
|
597
|
+
const { unitId: i, index: r } = n, o = this._hyperLinkService.showing;
|
|
599
598
|
if (!o)
|
|
600
599
|
return t({
|
|
601
|
-
...
|
|
600
|
+
...e,
|
|
602
601
|
active: !1
|
|
603
602
|
});
|
|
604
|
-
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o,
|
|
603
|
+
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o, f = c === i && e.rangeId === s && r >= l && r <= u;
|
|
605
604
|
return t({
|
|
606
|
-
...
|
|
607
|
-
active:
|
|
605
|
+
...e,
|
|
606
|
+
active: f
|
|
608
607
|
});
|
|
609
608
|
}
|
|
610
609
|
});
|
|
611
610
|
}
|
|
612
611
|
_initReRender() {
|
|
613
612
|
this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
).subscribe(([
|
|
617
|
-
|
|
613
|
+
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)),
|
|
614
|
+
un()
|
|
615
|
+
).subscribe(([e, n]) => {
|
|
616
|
+
n ? n.unitId === this._context.unitId && this._docRenderController.reRender(n.unitId) : e && e.unitId === this._context.unitId && this._docRenderController.reRender(e.unitId);
|
|
618
617
|
}));
|
|
619
618
|
}
|
|
620
619
|
};
|
|
621
|
-
re =
|
|
622
|
-
X(1,
|
|
623
|
-
X(2,
|
|
624
|
-
X(3,
|
|
620
|
+
re = nt([
|
|
621
|
+
X(1, I(rn)),
|
|
622
|
+
X(2, I(S)),
|
|
623
|
+
X(3, I(dn))
|
|
625
624
|
], re);
|
|
626
625
|
const $e = "doc-hyper-link-icon";
|
|
627
|
-
function
|
|
626
|
+
function ye(e) {
|
|
628
627
|
return {
|
|
629
|
-
id:
|
|
630
|
-
type:
|
|
628
|
+
id: E.id,
|
|
629
|
+
type: In.BUTTON,
|
|
631
630
|
icon: $e,
|
|
632
631
|
title: "docLink.menu.tooltip",
|
|
633
632
|
tooltip: "docLink.menu.tooltip",
|
|
634
|
-
hidden$:
|
|
635
|
-
disabled$: new
|
|
636
|
-
const i =
|
|
637
|
-
|
|
633
|
+
hidden$: vn(e, _.UNIVER_DOC),
|
|
634
|
+
disabled$: new pn(function(n) {
|
|
635
|
+
const i = e.get(b).textSelection$.pipe(gn(16)).subscribe(() => {
|
|
636
|
+
n.next(Ue(e));
|
|
638
637
|
});
|
|
639
638
|
return () => {
|
|
640
639
|
i.unsubscribe();
|
|
@@ -642,95 +641,95 @@ function ke(n) {
|
|
|
642
641
|
})
|
|
643
642
|
};
|
|
644
643
|
}
|
|
645
|
-
const
|
|
646
|
-
id:
|
|
647
|
-
binding:
|
|
644
|
+
const tt = {
|
|
645
|
+
id: E.id,
|
|
646
|
+
binding: mn.CTRL_COMMAND | ne.K,
|
|
648
647
|
description: "docLink.menu.tooltip",
|
|
649
|
-
preconditions:
|
|
650
|
-
},
|
|
651
|
-
[
|
|
652
|
-
[
|
|
648
|
+
preconditions: an
|
|
649
|
+
}, it = {
|
|
650
|
+
[kn.OTHERS]: {
|
|
651
|
+
[E.id]: {
|
|
653
652
|
order: 0,
|
|
654
|
-
menuItemFactory:
|
|
653
|
+
menuItemFactory: ye
|
|
655
654
|
}
|
|
656
655
|
},
|
|
657
|
-
[
|
|
658
|
-
[
|
|
659
|
-
[
|
|
656
|
+
[_n.MAIN_AREA]: {
|
|
657
|
+
[Cn.DATA]: {
|
|
658
|
+
[E.id]: {
|
|
660
659
|
order: 0,
|
|
661
|
-
menuItemFactory:
|
|
660
|
+
menuItemFactory: ye
|
|
662
661
|
}
|
|
663
662
|
}
|
|
664
663
|
}
|
|
665
664
|
};
|
|
666
|
-
var
|
|
667
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
668
|
-
(s =
|
|
669
|
-
return
|
|
670
|
-
}, F = (
|
|
665
|
+
var rt = Object.getOwnPropertyDescriptor, ot = (e, n, t, i) => {
|
|
666
|
+
for (var r = i > 1 ? void 0 : i ? rt(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
667
|
+
(s = e[o]) && (r = s(r) || r);
|
|
668
|
+
return r;
|
|
669
|
+
}, F = (e, n) => (t, i) => n(t, i, e);
|
|
671
670
|
let W = class extends N {
|
|
672
|
-
constructor(
|
|
673
|
-
super(), this._componentManager =
|
|
671
|
+
constructor(e, n, t, i) {
|
|
672
|
+
super(), this._componentManager = e, this._commandService = n, this._menuManagerService = t, this._shortcutService = i, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortcut();
|
|
674
673
|
}
|
|
675
674
|
_initComponents() {
|
|
676
675
|
[
|
|
677
676
|
[V, V.componentKey],
|
|
678
677
|
[Y, Y.componentKey],
|
|
679
678
|
[oe, $e]
|
|
680
|
-
].forEach(([
|
|
681
|
-
this._componentManager.register(
|
|
679
|
+
].forEach(([e, n]) => {
|
|
680
|
+
this._componentManager.register(n, e);
|
|
682
681
|
});
|
|
683
682
|
}
|
|
684
683
|
_initCommands() {
|
|
685
684
|
[
|
|
686
685
|
Pe,
|
|
687
|
-
|
|
686
|
+
Re,
|
|
688
687
|
Ne,
|
|
689
|
-
|
|
688
|
+
E,
|
|
690
689
|
te,
|
|
691
690
|
Te
|
|
692
|
-
].forEach((
|
|
693
|
-
this._commandService.registerCommand(
|
|
691
|
+
].forEach((e) => {
|
|
692
|
+
this._commandService.registerCommand(e);
|
|
694
693
|
});
|
|
695
694
|
}
|
|
696
695
|
_initShortcut() {
|
|
697
|
-
[
|
|
698
|
-
this._shortcutService.registerShortcut(
|
|
696
|
+
[tt].forEach((e) => {
|
|
697
|
+
this._shortcutService.registerShortcut(e);
|
|
699
698
|
});
|
|
700
699
|
}
|
|
701
700
|
_initMenus() {
|
|
702
|
-
this._menuManagerService.mergeMenu(
|
|
701
|
+
this._menuManagerService.mergeMenu(it);
|
|
703
702
|
}
|
|
704
703
|
};
|
|
705
|
-
W =
|
|
706
|
-
F(0,
|
|
704
|
+
W = ot([
|
|
705
|
+
F(0, I(Sn)),
|
|
707
706
|
F(1, O),
|
|
708
707
|
F(2, yn),
|
|
709
|
-
F(3,
|
|
708
|
+
F(3, Ln)
|
|
710
709
|
], W);
|
|
711
|
-
const
|
|
712
|
-
var
|
|
713
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
714
|
-
(s =
|
|
715
|
-
return
|
|
716
|
-
}, ee = (
|
|
710
|
+
const st = "DOC_HYPER_LINK_UI_PLUGIN";
|
|
711
|
+
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) => {
|
|
712
|
+
for (var r = i > 1 ? void 0 : i ? dt(n, t) : n, o = e.length - 1, s; o >= 0; o--)
|
|
713
|
+
(s = e[o]) && (r = s(r) || r);
|
|
714
|
+
return r;
|
|
715
|
+
}, ee = (e, n) => (t, i) => n(t, i, e), He = (e, n, t) => at(e, typeof n != "symbol" ? n + "" : n, t);
|
|
717
716
|
let G = class extends Ge {
|
|
718
|
-
constructor(
|
|
719
|
-
super(), this._config =
|
|
717
|
+
constructor(e = ke, n, t, i) {
|
|
718
|
+
super(), this._config = e, this._injector = n, this._renderManagerSrv = t, this._configService = i;
|
|
720
719
|
const { menu: r, ...o } = ze(
|
|
721
720
|
{},
|
|
722
|
-
|
|
721
|
+
ke,
|
|
723
722
|
this._config
|
|
724
723
|
);
|
|
725
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
724
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(Pn, o);
|
|
726
725
|
}
|
|
727
726
|
onStarting() {
|
|
728
727
|
[
|
|
729
|
-
[
|
|
728
|
+
[S],
|
|
730
729
|
[W],
|
|
731
730
|
[Z]
|
|
732
|
-
].forEach((
|
|
733
|
-
this._injector.add(
|
|
731
|
+
].forEach((n) => {
|
|
732
|
+
this._injector.add(n);
|
|
734
733
|
}), this._injector.get(W);
|
|
735
734
|
}
|
|
736
735
|
onReady() {
|
|
@@ -743,18 +742,18 @@ let G = class extends Ge {
|
|
|
743
742
|
[
|
|
744
743
|
[re],
|
|
745
744
|
[ie]
|
|
746
|
-
].forEach((
|
|
747
|
-
this._renderManagerSrv.registerRenderModule(
|
|
745
|
+
].forEach((e) => {
|
|
746
|
+
this._renderManagerSrv.registerRenderModule(_.UNIVER_DOC, e);
|
|
748
747
|
});
|
|
749
748
|
}
|
|
750
749
|
};
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
G =
|
|
754
|
-
|
|
755
|
-
ee(1,
|
|
756
|
-
ee(2,
|
|
757
|
-
ee(3,
|
|
750
|
+
He(G, "pluginName", st);
|
|
751
|
+
He(G, "type", _.UNIVER_DOC);
|
|
752
|
+
G = lt([
|
|
753
|
+
Ye(qe),
|
|
754
|
+
ee(1, I(Ze)),
|
|
755
|
+
ee(2, Je),
|
|
756
|
+
ee(3, We)
|
|
758
757
|
], G);
|
|
759
758
|
export {
|
|
760
759
|
G as UniverDocsHyperLinkUIPlugin
|