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