@univerjs/docs-hyper-link-ui 0.6.0-nightly.202502131606 → 0.6.0-nightly.202502151605
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 +319 -315
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
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 Ae = Object.defineProperty;
|
|
2
|
+
var Be = (n, e, t) => e in n ? Ae(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var P = (n, e, t) => Be(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CommandType as M, ICommandService as O, generateRandomId as Ke, CustomRangeType as D, IUniverInstanceService as x, UniverInstanceType as I, getBodySlice as ye, LocaleService as Oe, Tools as Fe, BuildTextUtils as me, Disposable as N, Inject as _, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Ve, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ye, DependentOn as Ze, Injector as We, Plugin as Ge, merge as ze, IConfigService as qe } from "@univerjs/core";
|
|
5
|
+
import { UniverDocsHyperLinkPlugin as Je } from "@univerjs/docs-hyper-link";
|
|
6
|
+
import { IRenderManagerService as Qe } from "@univerjs/engine-render";
|
|
7
|
+
import { addCustomRangeBySelectionFactory as Xe, DocSelectionManagerService as b, replaceSelectionFactory as en, deleteCustomRangeFactory as nn, SetTextSelectionsOperation as tn, DocSkeletonManagerService as rn, DocInterceptorService as on, DOC_INTERCEPTOR_POINT as sn } from "@univerjs/docs";
|
|
8
|
+
import { DocCanvasPopManagerService as cn, DocEventManagerService as dn, DocRenderController as an, whenDocAndEditorFocused as ln } from "@univerjs/docs-ui";
|
|
9
|
+
import { BehaviorSubject as ve, distinctUntilChanged as un, pairwise as pn, Observable as fn, debounceTime as gn } from "rxjs";
|
|
10
|
+
import { jsxs as E, jsx as g } from "react/jsx-runtime";
|
|
11
|
+
import { FormLayout as _e, Input as Ie, 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 mn, MetaKeys as vn, MenuItemType as _n, getMenuHiddenObservable as In, RibbonStartGroup as Cn, ContextMenuPosition as Sn, ContextMenuGroup as Ln, ComponentManager as kn, IMenuManagerService as yn, IShortcutService as On } from "@univerjs/ui";
|
|
13
|
+
import { useState as q, useEffect as xn, forwardRef as U, useRef as Pn, createElement as T } from "react";
|
|
14
|
+
const En = "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(n, e) {
|
|
18
|
+
if (!e)
|
|
19
19
|
return !1;
|
|
20
|
-
const { payload: t, unitId: i, selections: r } =
|
|
21
|
-
|
|
20
|
+
const { payload: t, unitId: i, selections: r } = e, o = n.get(O), s = Ke(), c = Xe(
|
|
21
|
+
n,
|
|
22
22
|
{
|
|
23
23
|
rangeId: s,
|
|
24
24
|
rangeType: D.HYPERLINK,
|
|
@@ -31,32 +31,32 @@ const Pn = "docs-hyper-link-ui.config", Se = {}, Pe = {
|
|
|
31
31
|
);
|
|
32
32
|
return c ? o.syncExecuteCommand(c.id, c.params) : !1;
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Ee = {
|
|
35
35
|
id: "docs.command.update-hyper-link",
|
|
36
36
|
type: M.COMMAND,
|
|
37
|
-
handler(
|
|
37
|
+
handler(n, e) {
|
|
38
38
|
var p;
|
|
39
|
-
if (!
|
|
39
|
+
if (!e)
|
|
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 } = e, s = n.get(O), c = n.get(x), u = n.get(b).getActiveTextRange(), h = c.getUnit(t, I.UNIVER_DOC);
|
|
42
|
+
if (!u || !h)
|
|
43
43
|
return !1;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const d =
|
|
44
|
+
const f = (p = ye(h.getSelfOrHeaderFooterModel(r).getBody(), u.startOffset, u.endOffset).textRuns) == null ? void 0 : p[0];
|
|
45
|
+
f && (f.ed = e.label.length + 1);
|
|
46
|
+
const d = en(n, {
|
|
47
47
|
unitId: t,
|
|
48
48
|
body: {
|
|
49
|
-
dataStream: `${
|
|
49
|
+
dataStream: `${e.label}`,
|
|
50
50
|
customRanges: [{
|
|
51
51
|
rangeId: o,
|
|
52
52
|
rangeType: D.HYPERLINK,
|
|
53
53
|
startIndex: 0,
|
|
54
|
-
endIndex:
|
|
54
|
+
endIndex: e.label.length + 1,
|
|
55
55
|
properties: {
|
|
56
56
|
url: i
|
|
57
57
|
}
|
|
58
58
|
}],
|
|
59
|
-
textRuns:
|
|
59
|
+
textRuns: f ? [f] : void 0
|
|
60
60
|
},
|
|
61
61
|
selection: {
|
|
62
62
|
startOffset: u.startOffset,
|
|
@@ -67,41 +67,43 @@ const Pn = "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", Mn = "univer-docs-link-edit-title", bn = "univer-docs-link-edit-close", wn = "univer-docs-link-edit-buttons", Dn = "univer-docs-link-edit-button", K = {
|
|
71
71
|
docsLinkEdit: Rn,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
docsLinkEditTitle: Mn,
|
|
73
|
+
docsLinkEditClose: bn,
|
|
74
|
+
docsLinkEditButtons: wn,
|
|
75
|
+
docsLinkEditButton: Dn
|
|
74
76
|
};
|
|
75
|
-
function
|
|
76
|
-
return /^[a-zA-Z]+:\/\//.test(
|
|
77
|
+
function Nn(n) {
|
|
78
|
+
return /^[a-zA-Z]+:\/\//.test(n);
|
|
77
79
|
}
|
|
78
|
-
function
|
|
79
|
-
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(
|
|
80
|
+
function Un(n) {
|
|
81
|
+
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(n);
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
83
|
+
function Tn(n) {
|
|
84
|
+
return Nn(n) ? n : Un(n) ? `mailto://${n}` : `https://${n}`;
|
|
83
85
|
}
|
|
84
86
|
const V = () => {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
var ce, de, ae, le, ue, pe, ge, he
|
|
87
|
+
const n = S(L), e = S(Oe), t = xe(n.editingLink$), i = S(O), r = S(x), o = S(b), [s, c] = q(""), [l, u] = q(""), [h, m] = q(!1), f = Fe.isLegalUrl(s), d = t ? r.getUnit(t.unitId, I.UNIVER_DOC) : r.getCurrentUnitForType(I.UNIVER_DOC);
|
|
88
|
+
xn(() => {
|
|
89
|
+
var ce, de, ae, le, ue, pe, fe, ge, he;
|
|
88
90
|
const a = o.getActiveTextRange();
|
|
89
91
|
if (!a)
|
|
90
92
|
return;
|
|
91
93
|
if (t) {
|
|
92
94
|
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);
|
|
93
|
-
d && A && (c((le = (ae = A.properties) == null ? void 0 : ae.url) != null ? le : ""), u(me.transform.getPlainText(
|
|
95
|
+
d && A && (c((le = (ae = A.properties) == null ? void 0 : ae.url) != null ? le : ""), u(me.transform.getPlainText(ye(j, A.startIndex, A.endIndex + 1).dataStream)));
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
|
-
const
|
|
97
|
-
d && H && c((
|
|
98
|
+
const k = (ue = d == null ? void 0 : d.getSelfOrHeaderFooterModel(a.segmentId)) == null ? void 0 : ue.getBody(), se = k ? a : null, H = se && ((fe = me.customRange.getCustomRangesInterestsWithSelection(se, (pe = k == null ? void 0 : k.customRanges) != null ? pe : [])) == null ? void 0 : fe[0]);
|
|
99
|
+
d && H && c((he = (ge = H == null ? void 0 : H.properties) == null ? void 0 : ge.url) != null ? he : "");
|
|
98
100
|
}, [d, t, o, r]);
|
|
99
101
|
const p = () => {
|
|
100
|
-
|
|
102
|
+
n.hideEditPopup();
|
|
101
103
|
}, C = () => {
|
|
102
|
-
if (m(!0), !
|
|
104
|
+
if (m(!0), !f || !d)
|
|
103
105
|
return;
|
|
104
|
-
const a =
|
|
106
|
+
const a = Tn(s);
|
|
105
107
|
if (!t)
|
|
106
108
|
i.executeCommand(Pe.id, {
|
|
107
109
|
unitId: d.getUnitId(),
|
|
@@ -110,7 +112,7 @@ const V = () => {
|
|
|
110
112
|
else {
|
|
111
113
|
if (!l)
|
|
112
114
|
return;
|
|
113
|
-
i.executeCommand(
|
|
115
|
+
i.executeCommand(Ee.id, {
|
|
114
116
|
unitId: d.getUnitId(),
|
|
115
117
|
payload: a,
|
|
116
118
|
linkId: t.linkId,
|
|
@@ -118,18 +120,18 @@ const V = () => {
|
|
|
118
120
|
segmentId: t.segmentId
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
|
-
|
|
123
|
+
n.hideEditPopup();
|
|
122
124
|
};
|
|
123
125
|
if (d)
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
t ? /* @__PURE__ */
|
|
127
|
-
|
|
126
|
+
return /* @__PURE__ */ E("div", { className: K.docsLinkEdit, children: [
|
|
127
|
+
/* @__PURE__ */ E("div", { children: [
|
|
128
|
+
t ? /* @__PURE__ */ g(
|
|
129
|
+
_e,
|
|
128
130
|
{
|
|
129
|
-
label:
|
|
130
|
-
error:
|
|
131
|
-
children: /* @__PURE__ */
|
|
132
|
-
|
|
131
|
+
label: e.t("docLink.edit.label"),
|
|
132
|
+
error: h && !l ? e.t("docLink.edit.labelError") : "",
|
|
133
|
+
children: /* @__PURE__ */ g(
|
|
134
|
+
Ie,
|
|
133
135
|
{
|
|
134
136
|
value: l,
|
|
135
137
|
onChange: u,
|
|
@@ -141,13 +143,13 @@ const V = () => {
|
|
|
141
143
|
)
|
|
142
144
|
}
|
|
143
145
|
) : null,
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
146
|
+
/* @__PURE__ */ g(
|
|
147
|
+
_e,
|
|
146
148
|
{
|
|
147
|
-
label:
|
|
148
|
-
error:
|
|
149
|
-
children: /* @__PURE__ */
|
|
150
|
-
|
|
149
|
+
label: e.t("docLink.edit.address"),
|
|
150
|
+
error: h && !f ? e.t("docLink.edit.addressError") : "",
|
|
151
|
+
children: /* @__PURE__ */ g(
|
|
152
|
+
Ie,
|
|
151
153
|
{
|
|
152
154
|
value: s,
|
|
153
155
|
onChange: c,
|
|
@@ -160,23 +162,23 @@ const V = () => {
|
|
|
160
162
|
}
|
|
161
163
|
)
|
|
162
164
|
] }),
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ E("div", { className: K.docsLinkEditButtons, children: [
|
|
166
|
+
/* @__PURE__ */ g(
|
|
165
167
|
Ce,
|
|
166
168
|
{
|
|
167
169
|
className: K.docsLinkEditButton,
|
|
168
170
|
onClick: p,
|
|
169
|
-
children:
|
|
171
|
+
children: e.t("docLink.edit.cancel")
|
|
170
172
|
}
|
|
171
173
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ g(
|
|
173
175
|
Ce,
|
|
174
176
|
{
|
|
175
177
|
disabled: !s,
|
|
176
178
|
className: K.docsLinkEditButton,
|
|
177
179
|
type: "primary",
|
|
178
180
|
onClick: C,
|
|
179
|
-
children:
|
|
181
|
+
children: e.t("docLink.edit.confirm")
|
|
180
182
|
}
|
|
181
183
|
)
|
|
182
184
|
] })
|
|
@@ -184,202 +186,204 @@ const V = () => {
|
|
|
184
186
|
};
|
|
185
187
|
V.componentKey = "docs-hyper-link-edit";
|
|
186
188
|
var v = function() {
|
|
187
|
-
return v = Object.assign || function(
|
|
188
|
-
for (var
|
|
189
|
-
|
|
190
|
-
for (var r in
|
|
189
|
+
return v = Object.assign || function(n) {
|
|
190
|
+
for (var e, t = 1, i = arguments.length; t < i; t++) {
|
|
191
|
+
e = arguments[t];
|
|
192
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]);
|
|
191
193
|
}
|
|
192
|
-
return
|
|
194
|
+
return n;
|
|
193
195
|
}, v.apply(this, arguments);
|
|
194
|
-
},
|
|
196
|
+
}, $n = function(n, e) {
|
|
195
197
|
var t = {};
|
|
196
|
-
for (var i in
|
|
197
|
-
if (
|
|
198
|
-
for (var r = 0, i = Object.getOwnPropertySymbols(
|
|
199
|
-
|
|
198
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
|
|
199
|
+
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
200
|
+
for (var r = 0, i = Object.getOwnPropertySymbols(n); r < i.length; r++)
|
|
201
|
+
e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, i[r]) && (t[i[r]] = n[i[r]]);
|
|
200
202
|
return t;
|
|
201
|
-
}, $ = U(function(
|
|
202
|
-
var t =
|
|
203
|
-
return
|
|
203
|
+
}, $ = U(function(n, e) {
|
|
204
|
+
var t = n.icon, i = n.id, r = n.className, o = n.extend, s = $n(n, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), l = Pn("_".concat(An()));
|
|
205
|
+
return Re(t, "".concat(i), { defIds: t.defIds, idSuffix: l.current }, v({ ref: e, className: c }, s), o);
|
|
204
206
|
});
|
|
205
|
-
function
|
|
206
|
-
return T(
|
|
207
|
-
return
|
|
207
|
+
function Re(n, e, t, i, r) {
|
|
208
|
+
return T(n.tag, v(v({ key: e }, Hn(n, t, r)), i), (jn(n, t).children || []).map(function(o, s) {
|
|
209
|
+
return Re(o, "".concat(e, "-").concat(n.tag, "-").concat(s), t, void 0, r);
|
|
208
210
|
}));
|
|
209
211
|
}
|
|
210
|
-
function
|
|
211
|
-
var i = v({},
|
|
212
|
+
function Hn(n, e, t) {
|
|
213
|
+
var i = v({}, n.attrs);
|
|
212
214
|
t != null && t.colorChannel1 && i.fill === "colorChannel1" && (i.fill = t.colorChannel1);
|
|
213
|
-
var r =
|
|
214
|
-
return !r || r.length === 0 || (
|
|
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) {
|
|
215
217
|
var s = o[0], c = o[1];
|
|
216
|
-
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(
|
|
218
|
+
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
217
219
|
})), i;
|
|
218
220
|
}
|
|
219
|
-
function
|
|
220
|
-
var t, i =
|
|
221
|
-
return !i || i.length === 0 ?
|
|
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 +
|
|
223
|
-
}) }) :
|
|
221
|
+
function jn(n, e) {
|
|
222
|
+
var t, i = e.defIds;
|
|
223
|
+
return !i || i.length === 0 ? n : n.tag === "defs" && (!((t = n.children) === null || t === void 0) && t.length) ? v(v({}, n), { children: n.children.map(function(r) {
|
|
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 + e.idSuffix }) }) : r;
|
|
225
|
+
}) }) : n;
|
|
224
226
|
}
|
|
225
|
-
function
|
|
227
|
+
function An() {
|
|
226
228
|
return Math.random().toString(36).substring(2, 8);
|
|
227
229
|
}
|
|
228
230
|
$.displayName = "UniverIcon";
|
|
229
|
-
var
|
|
230
|
-
return T($, Object.assign({},
|
|
231
|
+
var Bn = { 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(n, e) {
|
|
232
|
+
return T($, Object.assign({}, n, {
|
|
231
233
|
id: "copy-single",
|
|
232
|
-
ref:
|
|
233
|
-
icon:
|
|
234
|
+
ref: e,
|
|
235
|
+
icon: Bn
|
|
234
236
|
}));
|
|
235
237
|
});
|
|
236
238
|
Me.displayName = "CopySingle";
|
|
237
|
-
var
|
|
238
|
-
return T($, Object.assign({},
|
|
239
|
+
var Kn = { 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(n, e) {
|
|
240
|
+
return T($, Object.assign({}, n, {
|
|
239
241
|
id: "link-single",
|
|
240
|
-
ref:
|
|
241
|
-
icon:
|
|
242
|
+
ref: e,
|
|
243
|
+
icon: Kn
|
|
242
244
|
}));
|
|
243
245
|
});
|
|
244
246
|
oe.displayName = "LinkSingle";
|
|
245
|
-
var
|
|
246
|
-
return T($, Object.assign({},
|
|
247
|
+
var Fn = { 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(n, e) {
|
|
248
|
+
return T($, Object.assign({}, n, {
|
|
247
249
|
id: "unlink-single",
|
|
248
|
-
ref:
|
|
249
|
-
icon:
|
|
250
|
+
ref: e,
|
|
251
|
+
icon: Fn
|
|
250
252
|
}));
|
|
251
253
|
});
|
|
252
254
|
be.displayName = "UnlinkSingle";
|
|
253
|
-
var
|
|
254
|
-
return T($, Object.assign({},
|
|
255
|
+
var Vn = { 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(n, e) {
|
|
256
|
+
return T($, Object.assign({}, n, {
|
|
255
257
|
id: "write-single",
|
|
256
|
-
ref:
|
|
257
|
-
icon:
|
|
258
|
+
ref: e,
|
|
259
|
+
icon: Vn
|
|
258
260
|
}));
|
|
259
261
|
});
|
|
260
262
|
we.displayName = "WriteSingle";
|
|
261
|
-
function De(
|
|
262
|
-
var
|
|
263
|
-
if (typeof
|
|
264
|
-
else if (typeof
|
|
265
|
-
var r =
|
|
266
|
-
for (
|
|
267
|
-
} else for (t in
|
|
263
|
+
function De(n) {
|
|
264
|
+
var e, t, i = "";
|
|
265
|
+
if (typeof n == "string" || typeof n == "number") i += n;
|
|
266
|
+
else if (typeof n == "object") if (Array.isArray(n)) {
|
|
267
|
+
var r = n.length;
|
|
268
|
+
for (e = 0; e < r; e++) n[e] && (t = De(n[e])) && (i && (i += " "), i += t);
|
|
269
|
+
} else for (t in n) n[t] && (i && (i += " "), i += t);
|
|
268
270
|
return i;
|
|
269
271
|
}
|
|
270
|
-
function
|
|
271
|
-
for (var
|
|
272
|
+
function Le() {
|
|
273
|
+
for (var n, e, t = 0, i = "", r = arguments.length; t < r; t++) (n = arguments[t]) && (e = De(n)) && (i && (i += " "), i += e);
|
|
272
274
|
return i;
|
|
273
275
|
}
|
|
274
276
|
const Ne = {
|
|
275
277
|
type: M.COMMAND,
|
|
276
278
|
id: "docs.command.delete-hyper-link",
|
|
277
|
-
async handler(
|
|
278
|
-
if (!
|
|
279
|
+
async handler(n, e) {
|
|
280
|
+
if (!e)
|
|
279
281
|
return !1;
|
|
280
|
-
const { unitId: t, linkId: i, segmentId: r } =
|
|
282
|
+
const { unitId: t, linkId: i, segmentId: r } = e, o = n.get(O), s = nn(n, { unitId: t, rangeId: i, segmentId: r });
|
|
281
283
|
return s ? await o.syncExecuteCommand(s.id, s.params) : !1;
|
|
282
284
|
}
|
|
283
|
-
}, Ue = (
|
|
284
|
-
const
|
|
285
|
+
}, Ue = (n) => {
|
|
286
|
+
const e = n.get(b), t = n.get(x), i = e.getTextRanges();
|
|
285
287
|
if (!(i != null && i.length))
|
|
286
288
|
return !0;
|
|
287
289
|
const r = i[0];
|
|
288
|
-
return !!(!t.getCurrentUnitForType(
|
|
289
|
-
},
|
|
290
|
+
return !!(!t.getCurrentUnitForType(I.UNIVER_DOC) || !r || r.collapsed);
|
|
291
|
+
}, R = {
|
|
290
292
|
type: M.OPERATION,
|
|
291
293
|
id: "doc.operation.show-hyper-link-edit-popup",
|
|
292
|
-
handler(
|
|
294
|
+
handler(n, e) {
|
|
293
295
|
var s;
|
|
294
|
-
const t =
|
|
295
|
-
if (Ue(
|
|
296
|
+
const t = e == null ? void 0 : e.link, i = n.get(x);
|
|
297
|
+
if (Ue(n) && !t)
|
|
296
298
|
return !1;
|
|
297
|
-
const r =
|
|
299
|
+
const r = n.get(L), o = (t == null ? void 0 : t.unitId) || ((s = i.getCurrentUnitForType(I.UNIVER_DOC)) == null ? void 0 : s.getUnitId());
|
|
298
300
|
return o ? (r.showEditPopup(o, t), !0) : !1;
|
|
299
301
|
}
|
|
300
302
|
}, te = {
|
|
301
303
|
type: M.OPERATION,
|
|
302
304
|
id: "doc.operation.toggle-hyper-link-info-popup",
|
|
303
|
-
handler(
|
|
304
|
-
const t =
|
|
305
|
-
return
|
|
305
|
+
handler(n, e) {
|
|
306
|
+
const t = n.get(L);
|
|
307
|
+
return e ? (t.showInfoPopup(e), !0) : (t.hideInfoPopup(), !0);
|
|
306
308
|
}
|
|
307
309
|
}, Te = {
|
|
308
310
|
type: M.OPERATION,
|
|
309
311
|
id: "doc.operation.click-hyper-link",
|
|
310
|
-
handler(
|
|
311
|
-
var u,
|
|
312
|
-
if (!
|
|
312
|
+
handler(n, e) {
|
|
313
|
+
var u, h, m;
|
|
314
|
+
if (!e)
|
|
313
315
|
return !1;
|
|
314
|
-
const { unitId: t, linkId: i, segmentId: r } =
|
|
316
|
+
const { unitId: t, linkId: i, segmentId: r } = e, s = n.get(x).getUnit(t, I.UNIVER_DOC), c = s == null ? void 0 : s.getSelfOrHeaderFooterModel(r).getBody(), l = (m = (h = (u = c == null ? void 0 : c.customRanges) == null ? void 0 : u.find((f) => f.rangeId === i && f.rangeType === D.HYPERLINK)) == null ? void 0 : h.properties) == null ? void 0 : m.url;
|
|
315
317
|
return l && window.open(l, "_blank", "noopener noreferrer"), !0;
|
|
316
318
|
}
|
|
317
|
-
},
|
|
318
|
-
docLink:
|
|
319
|
-
docLinkType:
|
|
320
|
-
docLinkContent:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
319
|
+
}, Yn = "univer-doc-link", Zn = "univer-doc-link-type", Wn = "univer-doc-link-content", Gn = "univer-doc-link-content-error", zn = "univer-doc-link-url", qn = "univer-doc-link-operations", Jn = "univer-doc-link-operation", Qn = "univer-doc-link-operation-error", y = {
|
|
320
|
+
docLink: Yn,
|
|
321
|
+
docLinkType: Zn,
|
|
322
|
+
docLinkContent: Wn,
|
|
323
|
+
docLinkContentError: Gn,
|
|
324
|
+
docLinkUrl: zn,
|
|
325
|
+
docLinkOperations: qn,
|
|
326
|
+
docLinkOperation: Jn,
|
|
327
|
+
docLinkOperationError: Qn
|
|
324
328
|
}, Y = () => {
|
|
325
329
|
var C, a;
|
|
326
|
-
const
|
|
330
|
+
const n = S(L), e = S(O), t = S(mn), i = S(Oe), r = xe(n.showingLink$), o = S(x);
|
|
327
331
|
if (!r)
|
|
328
332
|
return null;
|
|
329
|
-
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex:
|
|
333
|
+
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex: h } = r, m = o.getUnit(s, I.UNIVER_DOC), f = m == null ? void 0 : m.getSelfOrHeaderFooterModel(l).getBody(), d = (C = f == null ? void 0 : f.customRanges) == null ? void 0 : C.find((k) => k.rangeId === c && k.rangeType === D.HYPERLINK && k.startIndex === u && k.endIndex === h);
|
|
330
334
|
if (!d)
|
|
331
335
|
return null;
|
|
332
336
|
const p = (a = d.properties) == null ? void 0 : a.url;
|
|
333
|
-
return /* @__PURE__ */
|
|
337
|
+
return /* @__PURE__ */ E(
|
|
334
338
|
"div",
|
|
335
339
|
{
|
|
336
|
-
className:
|
|
340
|
+
className: y.docLink,
|
|
337
341
|
onClick: () => {
|
|
338
|
-
|
|
342
|
+
n.hideInfoPopup();
|
|
339
343
|
},
|
|
340
344
|
children: [
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ E("div", { className: Le(y.docLinkContent), onClick: () => window.open(p), children: [
|
|
346
|
+
/* @__PURE__ */ g("div", { className: y.docLinkType, children: /* @__PURE__ */ g(oe, {}) }),
|
|
347
|
+
/* @__PURE__ */ g(B, { showIfEllipsis: !0, title: p, children: /* @__PURE__ */ g("span", { className: y.docLinkUrl, children: p }) })
|
|
344
348
|
] }),
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ E("div", { className: y.docLinkOperations, children: [
|
|
350
|
+
/* @__PURE__ */ g(
|
|
347
351
|
"div",
|
|
348
352
|
{
|
|
349
|
-
className:
|
|
353
|
+
className: Le(y.docLinkOperation),
|
|
350
354
|
onClick: () => {
|
|
351
355
|
navigator.clipboard.writeText(p), t.show({
|
|
352
356
|
content: i.t("docLink.info.coped"),
|
|
353
357
|
type: hn.Info
|
|
354
358
|
});
|
|
355
359
|
},
|
|
356
|
-
children: /* @__PURE__ */
|
|
360
|
+
children: /* @__PURE__ */ g(B, { placement: "bottom", title: i.t("docLink.info.copy"), children: /* @__PURE__ */ g(Me, {}) })
|
|
357
361
|
}
|
|
358
362
|
),
|
|
359
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ g(
|
|
360
364
|
"div",
|
|
361
365
|
{
|
|
362
|
-
className:
|
|
366
|
+
className: y.docLinkOperation,
|
|
363
367
|
onClick: () => {
|
|
364
|
-
|
|
368
|
+
e.executeCommand(R.id, {
|
|
365
369
|
link: r
|
|
366
370
|
});
|
|
367
371
|
},
|
|
368
|
-
children: /* @__PURE__ */
|
|
372
|
+
children: /* @__PURE__ */ g(B, { placement: "bottom", title: i.t("docLink.info.edit"), children: /* @__PURE__ */ g(we, {}) })
|
|
369
373
|
}
|
|
370
374
|
),
|
|
371
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ g(
|
|
372
376
|
"div",
|
|
373
377
|
{
|
|
374
|
-
className:
|
|
378
|
+
className: y.docLinkOperation,
|
|
375
379
|
onClick: () => {
|
|
376
|
-
|
|
380
|
+
e.executeCommand(Ne.id, {
|
|
377
381
|
unitId: s,
|
|
378
382
|
linkId: d.rangeId,
|
|
379
383
|
segmentId: l
|
|
380
384
|
});
|
|
381
385
|
},
|
|
382
|
-
children: /* @__PURE__ */
|
|
386
|
+
children: /* @__PURE__ */ g(B, { placement: "bottom", title: i.t("docLink.info.cancel"), children: /* @__PURE__ */ g(be, {}) })
|
|
383
387
|
}
|
|
384
388
|
)
|
|
385
389
|
] })
|
|
@@ -388,13 +392,13 @@ const Ne = {
|
|
|
388
392
|
);
|
|
389
393
|
};
|
|
390
394
|
Y.componentKey = "univer.doc.link-info-popup";
|
|
391
|
-
var
|
|
392
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
393
|
-
(s =
|
|
394
|
-
return r;
|
|
395
|
-
}, J = (
|
|
396
|
-
let
|
|
397
|
-
constructor(
|
|
395
|
+
var Xn = Object.defineProperty, et = Object.getOwnPropertyDescriptor, nt = (n, e, t, i) => {
|
|
396
|
+
for (var r = i > 1 ? void 0 : i ? et(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
397
|
+
(s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
|
|
398
|
+
return i && r && Xn(e, t, r), r;
|
|
399
|
+
}, J = (n, e) => (t, i) => e(t, i, n);
|
|
400
|
+
let L = class extends N {
|
|
401
|
+
constructor(e, t, i) {
|
|
398
402
|
super();
|
|
399
403
|
P(this, "_editingLink$", new ve(null));
|
|
400
404
|
P(this, "_showingLink$", new ve(null));
|
|
@@ -402,7 +406,7 @@ let k = class extends N {
|
|
|
402
406
|
P(this, "showingLink$", this._showingLink$.asObservable());
|
|
403
407
|
P(this, "_editPopup", null);
|
|
404
408
|
P(this, "_infoPopup", null);
|
|
405
|
-
this._docCanvasPopupManagerService =
|
|
409
|
+
this._docCanvasPopupManagerService = e, this._textSelectionManagerService = t, this._univerInstanceService = i, this.disposeWithMe(() => {
|
|
406
410
|
this._editingLink$.complete(), this._showingLink$.complete();
|
|
407
411
|
});
|
|
408
412
|
}
|
|
@@ -412,9 +416,9 @@ let k = class extends N {
|
|
|
412
416
|
get showing() {
|
|
413
417
|
return this._showingLink$.value;
|
|
414
418
|
}
|
|
415
|
-
showEditPopup(
|
|
419
|
+
showEditPopup(e, t) {
|
|
416
420
|
this._editPopup && this._editPopup.dispose(), this._editingLink$.next(t);
|
|
417
|
-
const i = this._textSelectionManagerService.getTextRanges({ unitId:
|
|
421
|
+
const i = this._textSelectionManagerService.getTextRanges({ unitId: e, subUnitId: e });
|
|
418
422
|
let r = i == null ? void 0 : i[i.length - 1];
|
|
419
423
|
if (t) {
|
|
420
424
|
const { segmentId: o, segmentPage: s, startIndex: c, endIndex: l } = t;
|
|
@@ -435,17 +439,17 @@ let k = class extends N {
|
|
|
435
439
|
componentKey: V.componentKey,
|
|
436
440
|
direction: "bottom"
|
|
437
441
|
},
|
|
438
|
-
|
|
442
|
+
e
|
|
439
443
|
), this._editPopup) : null;
|
|
440
444
|
}
|
|
441
445
|
hideEditPopup() {
|
|
442
|
-
var
|
|
443
|
-
this._editingLink$.next(null), (
|
|
446
|
+
var e;
|
|
447
|
+
this._editingLink$.next(null), (e = this._editPopup) == null || e.dispose();
|
|
444
448
|
}
|
|
445
|
-
showInfoPopup(
|
|
446
|
-
var u,
|
|
447
|
-
const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } =
|
|
448
|
-
if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((
|
|
449
|
+
showInfoPopup(e) {
|
|
450
|
+
var u, h, m, f, d, p;
|
|
451
|
+
const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } = e;
|
|
452
|
+
if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((h = this.showing) == null ? void 0 : h.unitId) === i && ((m = this.showing) == null ? void 0 : m.segmentId) === r && ((f = this.showing) == null ? void 0 : f.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, I.UNIVER_DOC))))
|
|
449
453
|
return this._showingLink$.next({ unitId: i, linkId: t, segmentId: r, segmentPage: o, startIndex: s, endIndex: c }), this._infoPopup = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
450
454
|
{
|
|
451
455
|
collapsed: !1,
|
|
@@ -466,40 +470,40 @@ let k = class extends N {
|
|
|
466
470
|
), this._infoPopup;
|
|
467
471
|
}
|
|
468
472
|
hideInfoPopup() {
|
|
469
|
-
var
|
|
470
|
-
this._showingLink$.next(null), (
|
|
473
|
+
var e;
|
|
474
|
+
this._showingLink$.next(null), (e = this._infoPopup) == null || e.dispose();
|
|
471
475
|
}
|
|
472
476
|
};
|
|
473
|
-
|
|
474
|
-
J(0,
|
|
475
|
-
J(1,
|
|
477
|
+
L = nt([
|
|
478
|
+
J(0, _(cn)),
|
|
479
|
+
J(1, _(b)),
|
|
476
480
|
J(2, x)
|
|
477
|
-
],
|
|
478
|
-
var
|
|
479
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
480
|
-
(s =
|
|
481
|
-
return r;
|
|
482
|
-
}, Q = (
|
|
481
|
+
], L);
|
|
482
|
+
var tt = Object.defineProperty, it = Object.getOwnPropertyDescriptor, rt = (n, e, t, i) => {
|
|
483
|
+
for (var r = i > 1 ? void 0 : i ? it(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
484
|
+
(s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
|
|
485
|
+
return i && r && tt(e, t, r), r;
|
|
486
|
+
}, Q = (n, e) => (t, i) => e(t, i, n);
|
|
483
487
|
let Z = class extends N {
|
|
484
|
-
constructor(
|
|
485
|
-
super(), this._commandService =
|
|
488
|
+
constructor(n, e, t) {
|
|
489
|
+
super(), this._commandService = n, this._univerInstanceService = e, this._docHyperLinkService = t, this._initSelectionChange();
|
|
486
490
|
}
|
|
487
491
|
_initSelectionChange() {
|
|
488
492
|
this.disposeWithMe(
|
|
489
|
-
this._commandService.onCommandExecuted((
|
|
490
|
-
var
|
|
491
|
-
if (
|
|
492
|
-
const r =
|
|
493
|
+
this._commandService.onCommandExecuted((n) => {
|
|
494
|
+
var e, t, i;
|
|
495
|
+
if (n.id === tn.id) {
|
|
496
|
+
const r = n.params, { unitId: o, ranges: s, segmentId: c } = r, l = this._univerInstanceService.getUnit(o, I.UNIVER_DOC), u = s[0];
|
|
493
497
|
if (u && l) {
|
|
494
|
-
const { startOffset:
|
|
495
|
-
if (
|
|
496
|
-
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex <
|
|
498
|
+
const { startOffset: h, endOffset: m, collapsed: f, segmentPage: d } = u, p = (t = (e = l.getSelfOrHeaderFooterModel(c)) == null ? void 0 : e.getBody()) == null ? void 0 : t.customRanges;
|
|
499
|
+
if (f) {
|
|
500
|
+
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex < h && a.endIndex > m - 1)) != null ? i : -1;
|
|
497
501
|
if (C > -1) {
|
|
498
502
|
const a = p[C];
|
|
499
503
|
this._docHyperLinkService.showInfoPopup({ unitId: o, linkId: a.rangeId, segmentId: c, segmentPage: d, startIndex: a.startIndex, endIndex: a.endIndex });
|
|
500
504
|
return;
|
|
501
505
|
}
|
|
502
|
-
} else if (p == null ? void 0 : p.find((a) => a.startIndex <=
|
|
506
|
+
} else if (p == null ? void 0 : p.find((a) => a.startIndex <= h && a.endIndex >= m - 1))
|
|
503
507
|
return;
|
|
504
508
|
}
|
|
505
509
|
this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
|
|
@@ -508,19 +512,19 @@ let Z = class extends N {
|
|
|
508
512
|
);
|
|
509
513
|
}
|
|
510
514
|
};
|
|
511
|
-
Z =
|
|
515
|
+
Z = rt([
|
|
512
516
|
Q(0, O),
|
|
513
517
|
Q(1, x),
|
|
514
|
-
Q(2,
|
|
518
|
+
Q(2, _(L))
|
|
515
519
|
], Z);
|
|
516
|
-
var
|
|
517
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
518
|
-
(s =
|
|
519
|
-
return r;
|
|
520
|
-
}, w = (
|
|
520
|
+
var ot = Object.defineProperty, st = Object.getOwnPropertyDescriptor, ct = (n, e, t, i) => {
|
|
521
|
+
for (var r = i > 1 ? void 0 : i ? st(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
522
|
+
(s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
|
|
523
|
+
return i && r && ot(e, t, r), r;
|
|
524
|
+
}, w = (n, e) => (t, i) => e(t, i, n);
|
|
521
525
|
let ie = class extends N {
|
|
522
|
-
constructor(
|
|
523
|
-
super(), this._context =
|
|
526
|
+
constructor(n, e, t, i, r, o) {
|
|
527
|
+
super(), this._context = n, this._docEventManagerService = e, this._commandService = t, this._hyperLinkPopupService = i, this._docSkeletonManagerService = r, this._docSelectionManagerService = o, !(this._context.unitId === Ve || this._context.unitId === Ye) && (this._initHover(), this._initClick());
|
|
524
528
|
}
|
|
525
529
|
get _skeleton() {
|
|
526
530
|
return this._docSkeletonManagerService.getSkeleton();
|
|
@@ -532,23 +536,23 @@ let ie = class extends N {
|
|
|
532
536
|
}
|
|
533
537
|
_initHover() {
|
|
534
538
|
this.disposeWithMe(
|
|
535
|
-
this._docEventManagerService.hoverCustomRanges$.subscribe((
|
|
539
|
+
this._docEventManagerService.hoverCustomRanges$.subscribe((n) => {
|
|
536
540
|
var r;
|
|
537
|
-
const
|
|
538
|
-
if (((r =
|
|
541
|
+
const e = n.find((o) => o.range.rangeType === D.HYPERLINK), t = this._docSelectionManagerService.getTextRanges(), i = t == null ? void 0 : t[0].segmentId;
|
|
542
|
+
if (((r = e == null ? void 0 : e.segmentId) != null ? r : "") !== i) {
|
|
539
543
|
this._hideInfoPopup();
|
|
540
544
|
return;
|
|
541
545
|
}
|
|
542
|
-
|
|
546
|
+
e ? this._commandService.executeCommand(
|
|
543
547
|
te.id,
|
|
544
548
|
{
|
|
545
549
|
unitId: this._context.unitId,
|
|
546
|
-
linkId:
|
|
547
|
-
segmentId:
|
|
548
|
-
segmentPage:
|
|
549
|
-
rangeId:
|
|
550
|
-
startIndex:
|
|
551
|
-
endIndex:
|
|
550
|
+
linkId: e.range.rangeId,
|
|
551
|
+
segmentId: e.segmentId,
|
|
552
|
+
segmentPage: e.segmentPageIndex,
|
|
553
|
+
rangeId: e.range.rangeId,
|
|
554
|
+
startIndex: e.range.startIndex,
|
|
555
|
+
endIndex: e.range.endIndex
|
|
552
556
|
}
|
|
553
557
|
) : this._hideInfoPopup();
|
|
554
558
|
})
|
|
@@ -556,81 +560,81 @@ let ie = class extends N {
|
|
|
556
560
|
}
|
|
557
561
|
_initClick() {
|
|
558
562
|
this.disposeWithMe(
|
|
559
|
-
this._docEventManagerService.clickCustomRanges$.subscribe((
|
|
560
|
-
const
|
|
561
|
-
|
|
563
|
+
this._docEventManagerService.clickCustomRanges$.subscribe((n) => {
|
|
564
|
+
const e = n.range;
|
|
565
|
+
e && this._commandService.executeCommand(
|
|
562
566
|
Te.id,
|
|
563
567
|
{
|
|
564
568
|
unitId: this._context.unitId,
|
|
565
|
-
linkId:
|
|
566
|
-
segmentId:
|
|
569
|
+
linkId: e.rangeId,
|
|
570
|
+
segmentId: n.segmentId
|
|
567
571
|
}
|
|
568
572
|
);
|
|
569
573
|
})
|
|
570
574
|
);
|
|
571
575
|
}
|
|
572
576
|
};
|
|
573
|
-
ie =
|
|
574
|
-
w(1,
|
|
577
|
+
ie = ct([
|
|
578
|
+
w(1, _(dn)),
|
|
575
579
|
w(2, O),
|
|
576
|
-
w(3,
|
|
577
|
-
w(4,
|
|
578
|
-
w(5,
|
|
580
|
+
w(3, _(L)),
|
|
581
|
+
w(4, _(rn)),
|
|
582
|
+
w(5, _(b))
|
|
579
583
|
], ie);
|
|
580
|
-
var
|
|
581
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
582
|
-
(s =
|
|
583
|
-
return r;
|
|
584
|
-
}, X = (
|
|
584
|
+
var dt = Object.defineProperty, at = Object.getOwnPropertyDescriptor, lt = (n, e, t, i) => {
|
|
585
|
+
for (var r = i > 1 ? void 0 : i ? at(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
586
|
+
(s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
|
|
587
|
+
return i && r && dt(e, t, r), r;
|
|
588
|
+
}, X = (n, e) => (t, i) => e(t, i, n);
|
|
585
589
|
let re = class extends N {
|
|
586
|
-
constructor(
|
|
587
|
-
super(), this._context =
|
|
590
|
+
constructor(n, e, t, i) {
|
|
591
|
+
super(), this._context = n, this._docInterceptorService = e, this._hyperLinkService = t, this._docRenderController = i, this._init(), this._initReRender();
|
|
588
592
|
}
|
|
589
593
|
_init() {
|
|
590
|
-
this._docInterceptorService.intercept(
|
|
591
|
-
handler: (
|
|
592
|
-
if (!
|
|
593
|
-
return t(
|
|
594
|
-
const { unitId: i, index: r } =
|
|
594
|
+
this._docInterceptorService.intercept(sn.CUSTOM_RANGE, {
|
|
595
|
+
handler: (n, e, t) => {
|
|
596
|
+
if (!n)
|
|
597
|
+
return t(n);
|
|
598
|
+
const { unitId: i, index: r } = e, o = this._hyperLinkService.showing;
|
|
595
599
|
if (!o)
|
|
596
600
|
return t({
|
|
597
|
-
...
|
|
601
|
+
...n,
|
|
598
602
|
active: !1
|
|
599
603
|
});
|
|
600
|
-
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o,
|
|
604
|
+
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o, h = c === i && n.rangeId === s && r >= l && r <= u;
|
|
601
605
|
return t({
|
|
602
|
-
...
|
|
603
|
-
active:
|
|
606
|
+
...n,
|
|
607
|
+
active: h
|
|
604
608
|
});
|
|
605
609
|
}
|
|
606
610
|
});
|
|
607
611
|
}
|
|
608
612
|
_initReRender() {
|
|
609
613
|
this.disposeWithMe(this._hyperLinkService.showingLink$.pipe(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
).subscribe(([
|
|
613
|
-
|
|
614
|
+
un((n, e) => (n == null ? void 0 : n.linkId) === (e == null ? void 0 : e.linkId) && (n == null ? void 0 : n.unitId) === (e == null ? void 0 : e.unitId) && (n == null ? void 0 : n.startIndex) === (e == null ? void 0 : e.startIndex)),
|
|
615
|
+
pn()
|
|
616
|
+
).subscribe(([n, e]) => {
|
|
617
|
+
e ? e.unitId === this._context.unitId && this._docRenderController.reRender(e.unitId) : n && n.unitId === this._context.unitId && this._docRenderController.reRender(n.unitId);
|
|
614
618
|
}));
|
|
615
619
|
}
|
|
616
620
|
};
|
|
617
|
-
re =
|
|
618
|
-
X(1,
|
|
619
|
-
X(2,
|
|
620
|
-
X(3,
|
|
621
|
+
re = lt([
|
|
622
|
+
X(1, _(on)),
|
|
623
|
+
X(2, _(L)),
|
|
624
|
+
X(3, _(an))
|
|
621
625
|
], re);
|
|
622
626
|
const $e = "doc-hyper-link-icon";
|
|
623
|
-
function
|
|
627
|
+
function ke(n) {
|
|
624
628
|
return {
|
|
625
|
-
id:
|
|
626
|
-
type:
|
|
629
|
+
id: R.id,
|
|
630
|
+
type: _n.BUTTON,
|
|
627
631
|
icon: $e,
|
|
628
632
|
title: "docLink.menu.tooltip",
|
|
629
633
|
tooltip: "docLink.menu.tooltip",
|
|
630
|
-
hidden$:
|
|
631
|
-
disabled$: new
|
|
632
|
-
const i =
|
|
633
|
-
|
|
634
|
+
hidden$: In(n, I.UNIVER_DOC),
|
|
635
|
+
disabled$: new fn(function(e) {
|
|
636
|
+
const i = n.get(b).textSelection$.pipe(gn(16)).subscribe(() => {
|
|
637
|
+
e.next(Ue(n));
|
|
634
638
|
});
|
|
635
639
|
return () => {
|
|
636
640
|
i.unsubscribe();
|
|
@@ -638,95 +642,95 @@ function ye(e) {
|
|
|
638
642
|
})
|
|
639
643
|
};
|
|
640
644
|
}
|
|
641
|
-
const
|
|
642
|
-
id:
|
|
643
|
-
binding:
|
|
645
|
+
const ut = {
|
|
646
|
+
id: R.id,
|
|
647
|
+
binding: vn.CTRL_COMMAND | ne.K,
|
|
644
648
|
description: "docLink.menu.tooltip",
|
|
645
|
-
preconditions:
|
|
646
|
-
},
|
|
647
|
-
[
|
|
648
|
-
[
|
|
649
|
+
preconditions: ln
|
|
650
|
+
}, pt = {
|
|
651
|
+
[Cn.OTHERS]: {
|
|
652
|
+
[R.id]: {
|
|
649
653
|
order: 0,
|
|
650
|
-
menuItemFactory:
|
|
654
|
+
menuItemFactory: ke
|
|
651
655
|
}
|
|
652
656
|
},
|
|
653
|
-
[
|
|
654
|
-
[
|
|
655
|
-
[
|
|
657
|
+
[Sn.MAIN_AREA]: {
|
|
658
|
+
[Ln.DATA]: {
|
|
659
|
+
[R.id]: {
|
|
656
660
|
order: 0,
|
|
657
|
-
menuItemFactory:
|
|
661
|
+
menuItemFactory: ke
|
|
658
662
|
}
|
|
659
663
|
}
|
|
660
664
|
}
|
|
661
665
|
};
|
|
662
|
-
var
|
|
663
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
664
|
-
(s =
|
|
665
|
-
return r;
|
|
666
|
-
}, F = (
|
|
666
|
+
var ft = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, ht = (n, e, t, i) => {
|
|
667
|
+
for (var r = i > 1 ? void 0 : i ? gt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
668
|
+
(s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
|
|
669
|
+
return i && r && ft(e, t, r), r;
|
|
670
|
+
}, F = (n, e) => (t, i) => e(t, i, n);
|
|
667
671
|
let W = class extends N {
|
|
668
|
-
constructor(
|
|
669
|
-
super(), this._componentManager =
|
|
672
|
+
constructor(n, e, t, i) {
|
|
673
|
+
super(), this._componentManager = n, this._commandService = e, this._menuManagerService = t, this._shortcutService = i, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortcut();
|
|
670
674
|
}
|
|
671
675
|
_initComponents() {
|
|
672
676
|
[
|
|
673
677
|
[V, V.componentKey],
|
|
674
678
|
[Y, Y.componentKey],
|
|
675
679
|
[oe, $e]
|
|
676
|
-
].forEach(([
|
|
677
|
-
this._componentManager.register(
|
|
680
|
+
].forEach(([n, e]) => {
|
|
681
|
+
this._componentManager.register(e, n);
|
|
678
682
|
});
|
|
679
683
|
}
|
|
680
684
|
_initCommands() {
|
|
681
685
|
[
|
|
682
686
|
Pe,
|
|
683
|
-
|
|
687
|
+
Ee,
|
|
684
688
|
Ne,
|
|
685
|
-
|
|
689
|
+
R,
|
|
686
690
|
te,
|
|
687
691
|
Te
|
|
688
|
-
].forEach((
|
|
689
|
-
this._commandService.registerCommand(
|
|
692
|
+
].forEach((n) => {
|
|
693
|
+
this._commandService.registerCommand(n);
|
|
690
694
|
});
|
|
691
695
|
}
|
|
692
696
|
_initShortcut() {
|
|
693
|
-
[
|
|
694
|
-
this._shortcutService.registerShortcut(
|
|
697
|
+
[ut].forEach((n) => {
|
|
698
|
+
this._shortcutService.registerShortcut(n);
|
|
695
699
|
});
|
|
696
700
|
}
|
|
697
701
|
_initMenus() {
|
|
698
|
-
this._menuManagerService.mergeMenu(
|
|
702
|
+
this._menuManagerService.mergeMenu(pt);
|
|
699
703
|
}
|
|
700
704
|
};
|
|
701
|
-
W =
|
|
702
|
-
F(0,
|
|
705
|
+
W = ht([
|
|
706
|
+
F(0, _(kn)),
|
|
703
707
|
F(1, O),
|
|
704
708
|
F(2, yn),
|
|
705
|
-
F(3,
|
|
709
|
+
F(3, On)
|
|
706
710
|
], W);
|
|
707
|
-
const
|
|
708
|
-
var
|
|
709
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
710
|
-
(s =
|
|
711
|
-
return r;
|
|
712
|
-
}, ee = (
|
|
711
|
+
const mt = "DOC_HYPER_LINK_UI_PLUGIN";
|
|
712
|
+
var He = Object.defineProperty, vt = Object.getOwnPropertyDescriptor, _t = (n, e, t) => e in n ? He(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, It = (n, e, t, i) => {
|
|
713
|
+
for (var r = i > 1 ? void 0 : i ? vt(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
714
|
+
(s = n[o]) && (r = (i ? s(e, t, r) : s(r)) || r);
|
|
715
|
+
return i && r && He(e, t, r), r;
|
|
716
|
+
}, ee = (n, e) => (t, i) => e(t, i, n), je = (n, e, t) => _t(n, typeof e != "symbol" ? e + "" : e, t);
|
|
713
717
|
let G = class extends Ge {
|
|
714
|
-
constructor(
|
|
715
|
-
super(), this._config =
|
|
718
|
+
constructor(n = Se, e, t, i) {
|
|
719
|
+
super(), this._config = n, this._injector = e, this._renderManagerSrv = t, this._configService = i;
|
|
716
720
|
const { menu: r, ...o } = ze(
|
|
717
721
|
{},
|
|
718
722
|
Se,
|
|
719
723
|
this._config
|
|
720
724
|
);
|
|
721
|
-
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(
|
|
725
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(En, o);
|
|
722
726
|
}
|
|
723
727
|
onStarting() {
|
|
724
728
|
[
|
|
725
|
-
[
|
|
729
|
+
[L],
|
|
726
730
|
[W],
|
|
727
731
|
[Z]
|
|
728
|
-
].forEach((
|
|
729
|
-
this._injector.add(
|
|
732
|
+
].forEach((e) => {
|
|
733
|
+
this._injector.add(e);
|
|
730
734
|
}), this._injector.get(W);
|
|
731
735
|
}
|
|
732
736
|
onReady() {
|
|
@@ -739,18 +743,18 @@ let G = class extends Ge {
|
|
|
739
743
|
[
|
|
740
744
|
[re],
|
|
741
745
|
[ie]
|
|
742
|
-
].forEach((
|
|
743
|
-
this._renderManagerSrv.registerRenderModule(
|
|
746
|
+
].forEach((n) => {
|
|
747
|
+
this._renderManagerSrv.registerRenderModule(I.UNIVER_DOC, n);
|
|
744
748
|
});
|
|
745
749
|
}
|
|
746
750
|
};
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
G =
|
|
750
|
-
|
|
751
|
-
ee(1,
|
|
752
|
-
ee(2,
|
|
753
|
-
ee(3,
|
|
751
|
+
je(G, "pluginName", mt);
|
|
752
|
+
je(G, "type", I.UNIVER_DOC);
|
|
753
|
+
G = It([
|
|
754
|
+
Ze(Je),
|
|
755
|
+
ee(1, _(We)),
|
|
756
|
+
ee(2, Qe),
|
|
757
|
+
ee(3, qe)
|
|
754
758
|
], G);
|
|
755
759
|
export {
|
|
756
760
|
G as UniverDocsHyperLinkUIPlugin
|