@univerjs/docs-hyper-link-ui 0.7.0 → 0.8.0-beta.1
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 +177 -175
- package/lib/index.css +1 -1
- package/lib/index.js +177 -175
- package/lib/types/locale/fa-IR.d.ts +2 -2
- package/lib/types/locale/vi-VN.d.ts +2 -2
- package/lib/types/locale/zh-TW.d.ts +2 -2
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var He = (n, e, t) => e in n ?
|
|
1
|
+
var Te = Object.defineProperty;
|
|
2
|
+
var He = (n, e, t) => e in n ? Te(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var O = (n, e, t) => He(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { CommandType as b, ICommandService as k, generateRandomId as je, CustomRangeType as
|
|
5
|
-
import { UniverDocsHyperLinkPlugin as
|
|
6
|
-
import { IRenderManagerService as
|
|
7
|
-
import { addCustomRangeBySelectionFactory as qe, DocSelectionManagerService as
|
|
4
|
+
import { CommandType as b, ICommandService as k, generateRandomId as je, CustomRangeType as D, IUniverInstanceService as L, UniverInstanceType as _, getBodySlice as ye, LocaleService as Se, Tools as Ae, BuildTextUtils as he, Inject as I, Disposable as E, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Ke, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Fe, DependentOn as Be, Injector as Ve, IConfigService as Ze, Plugin as Ye, merge as We } from "@univerjs/core";
|
|
5
|
+
import { UniverDocsHyperLinkPlugin as Ge } from "@univerjs/docs-hyper-link";
|
|
6
|
+
import { IRenderManagerService as ze } from "@univerjs/engine-render";
|
|
7
|
+
import { addCustomRangeBySelectionFactory as qe, DocSelectionManagerService as R, replaceSelectionFactory as Je, deleteCustomRangeFactory as Qe, SetTextSelectionsOperation as Xe, DocSkeletonManagerService as en, DocInterceptorService as nn, DOC_INTERCEPTOR_POINT as tn } from "@univerjs/docs";
|
|
8
8
|
import { DocCanvasPopManagerService as rn, DocEventManagerService as on, DocRenderController as sn, whenDocAndEditorFocused as cn } from "@univerjs/docs-ui";
|
|
9
|
-
import { BehaviorSubject as
|
|
10
|
-
import { jsxs as
|
|
11
|
-
import { clsx as xe, FormLayout as
|
|
12
|
-
import { useDependency as
|
|
13
|
-
import { useState as
|
|
9
|
+
import { BehaviorSubject as ve, distinctUntilChanged as dn, pairwise as an, Observable as ln, debounceTime as un } from "rxjs";
|
|
10
|
+
import { jsxs as w, jsx as h } from "react/jsx-runtime";
|
|
11
|
+
import { clsx as xe, FormLayout as fe, Input as me, Button as Ie, borderClassName as ke, Tooltip as A, MessageType as pn } from "@univerjs/design";
|
|
12
|
+
import { useDependency as y, useObservable as Le, KeyCode as X, IMessageService as gn, MetaKeys as hn, getMenuHiddenObservable as vn, MenuItemType as fn, ContextMenuPosition as mn, ContextMenuGroup as In, RibbonInsertGroup as _n, ComponentManager as Cn, IMenuManagerService as yn, IShortcutService as Sn } from "@univerjs/ui";
|
|
13
|
+
import { useState as G, useEffect as xn, forwardRef as N, useRef as kn, createElement as U } from "react";
|
|
14
14
|
const Ln = "docs-hyper-link-ui.config", _e = {}, Oe = {
|
|
15
15
|
type: b.COMMAND,
|
|
16
16
|
id: "docs.command.add-hyper-link",
|
|
@@ -21,7 +21,7 @@ const Ln = "docs-hyper-link-ui.config", _e = {}, Oe = {
|
|
|
21
21
|
n,
|
|
22
22
|
{
|
|
23
23
|
rangeId: s,
|
|
24
|
-
rangeType:
|
|
24
|
+
rangeType: D.HYPERLINK,
|
|
25
25
|
properties: {
|
|
26
26
|
url: t
|
|
27
27
|
},
|
|
@@ -31,17 +31,17 @@ const Ln = "docs-hyper-link-ui.config", _e = {}, Oe = {
|
|
|
31
31
|
);
|
|
32
32
|
return c ? o.syncExecuteCommand(c.id, c.params) : !1;
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, we = {
|
|
35
35
|
id: "docs.command.update-hyper-link",
|
|
36
36
|
type: b.COMMAND,
|
|
37
37
|
handler(n, e) {
|
|
38
38
|
var p;
|
|
39
39
|
if (!e)
|
|
40
40
|
return !1;
|
|
41
|
-
const { unitId: t, payload: i, segmentId: r, linkId: o } = e, s = n.get(k), c = n.get(L), u = n.get(
|
|
42
|
-
if (!u || !
|
|
41
|
+
const { unitId: t, payload: i, segmentId: r, linkId: o } = e, s = n.get(k), c = n.get(L), u = n.get(R).getActiveTextRange(), v = c.getUnit(t, _.UNIVER_DOC);
|
|
42
|
+
if (!u || !v)
|
|
43
43
|
return !1;
|
|
44
|
-
const g = (p =
|
|
44
|
+
const g = (p = ye(v.getSelfOrHeaderFooterModel(r).getBody(), u.startOffset, u.endOffset).textRuns) == null ? void 0 : p[0];
|
|
45
45
|
g && (g.ed = e.label.length + 1);
|
|
46
46
|
const d = Je(n, {
|
|
47
47
|
unitId: t,
|
|
@@ -49,7 +49,7 @@ const Ln = "docs-hyper-link-ui.config", _e = {}, Oe = {
|
|
|
49
49
|
dataStream: `${e.label}`,
|
|
50
50
|
customRanges: [{
|
|
51
51
|
rangeId: o,
|
|
52
|
-
rangeType:
|
|
52
|
+
rangeType: D.HYPERLINK,
|
|
53
53
|
startIndex: 0,
|
|
54
54
|
endIndex: e.label.length + 1,
|
|
55
55
|
properties: {
|
|
@@ -71,33 +71,33 @@ const Ln = "docs-hyper-link-ui.config", _e = {}, Oe = {
|
|
|
71
71
|
function On(n) {
|
|
72
72
|
return /^[a-zA-Z]+:\/\//.test(n);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function wn(n) {
|
|
75
75
|
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(n);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return On(n) ? n :
|
|
77
|
+
function Pn(n) {
|
|
78
|
+
return On(n) ? n : wn(n) ? `mailto://${n}` : `https://${n}`;
|
|
79
79
|
}
|
|
80
80
|
const F = () => {
|
|
81
|
-
const n = S
|
|
81
|
+
const n = y(S), e = y(Se), t = Le(n.editingLink$), i = y(k), r = y(L), o = y(R), [s, c] = G(""), [l, u] = G(""), [v, f] = G(!1), g = Ae.isLegalUrl(s), d = t ? r.getUnit(t.unitId, _.UNIVER_DOC) : r.getCurrentUnitForType(_.UNIVER_DOC);
|
|
82
82
|
xn(() => {
|
|
83
83
|
var oe, se, ce, de, ae, le, ue, pe, ge;
|
|
84
84
|
const a = o.getActiveTextRange();
|
|
85
85
|
if (!a)
|
|
86
86
|
return;
|
|
87
87
|
if (t) {
|
|
88
|
-
const H = (oe = d == null ? void 0 : d.getSelfOrHeaderFooterModel(t.segmentId)) == null ? void 0 : oe.getBody(), j = (se = H == null ? void 0 : H.customRanges) == null ? void 0 : se.find((
|
|
89
|
-
d && j && (c((de = (ce = j.properties) == null ? void 0 : ce.url) != null ? de : ""), u(
|
|
88
|
+
const H = (oe = d == null ? void 0 : d.getSelfOrHeaderFooterModel(t.segmentId)) == null ? void 0 : oe.getBody(), j = (se = H == null ? void 0 : H.customRanges) == null ? void 0 : se.find((W) => (t == null ? void 0 : t.linkId) === W.rangeId && W.startIndex === t.startIndex && W.endIndex === t.endIndex);
|
|
89
|
+
d && j && (c((de = (ce = j.properties) == null ? void 0 : ce.url) != null ? de : ""), u(he.transform.getPlainText(ye(H, j.startIndex, j.endIndex + 1).dataStream)));
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
const x = (ae = d == null ? void 0 : d.getSelfOrHeaderFooterModel(a.segmentId)) == null ? void 0 : ae.getBody(), re = x ? a : null,
|
|
93
|
-
d &&
|
|
92
|
+
const x = (ae = d == null ? void 0 : d.getSelfOrHeaderFooterModel(a.segmentId)) == null ? void 0 : ae.getBody(), re = x ? a : null, T = re && ((ue = he.customRange.getCustomRangesInterestsWithSelection(re, (le = x == null ? void 0 : x.customRanges) != null ? le : [])) == null ? void 0 : ue[0]);
|
|
93
|
+
d && T && c((ge = (pe = T == null ? void 0 : T.properties) == null ? void 0 : pe.url) != null ? ge : "");
|
|
94
94
|
}, [d, t, o, r]);
|
|
95
95
|
const p = () => {
|
|
96
96
|
n.hideEditPopup();
|
|
97
97
|
}, C = () => {
|
|
98
|
-
if (
|
|
98
|
+
if (f(!0), !g || !d)
|
|
99
99
|
return;
|
|
100
|
-
const a =
|
|
100
|
+
const a = Pn(s);
|
|
101
101
|
if (!t)
|
|
102
102
|
i.executeCommand(Oe.id, {
|
|
103
103
|
unitId: d.getUnitId(),
|
|
@@ -106,7 +106,7 @@ const F = () => {
|
|
|
106
106
|
else {
|
|
107
107
|
if (!l)
|
|
108
108
|
return;
|
|
109
|
-
i.executeCommand(
|
|
109
|
+
i.executeCommand(we.id, {
|
|
110
110
|
unitId: d.getUnitId(),
|
|
111
111
|
payload: a,
|
|
112
112
|
linkId: t.linkId,
|
|
@@ -117,18 +117,18 @@ const F = () => {
|
|
|
117
117
|
n.hideEditPopup();
|
|
118
118
|
};
|
|
119
119
|
if (d)
|
|
120
|
-
return /* @__PURE__ */
|
|
120
|
+
return /* @__PURE__ */ w(
|
|
121
121
|
"div",
|
|
122
122
|
{
|
|
123
|
-
className: xe("univer-box-border univer-w-[328px] univer-rounded-xl univer-bg-white univer-px-6 univer-py-5 univer-shadow", ke),
|
|
123
|
+
className: xe("univer-box-border univer-w-[328px] univer-rounded-xl univer-bg-white univer-px-6 univer-py-5 univer-shadow dark:!univer-bg-gray-900", ke),
|
|
124
124
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
t ? /* @__PURE__ */
|
|
127
|
-
|
|
125
|
+
/* @__PURE__ */ w("div", { children: [
|
|
126
|
+
t ? /* @__PURE__ */ h(
|
|
127
|
+
fe,
|
|
128
128
|
{
|
|
129
129
|
label: e.t("docLink.edit.label"),
|
|
130
|
-
error:
|
|
131
|
-
children: /* @__PURE__ */
|
|
130
|
+
error: v && !l ? e.t("docLink.edit.labelError") : "",
|
|
131
|
+
children: /* @__PURE__ */ h(
|
|
132
132
|
me,
|
|
133
133
|
{
|
|
134
134
|
value: l,
|
|
@@ -141,12 +141,12 @@ const F = () => {
|
|
|
141
141
|
)
|
|
142
142
|
}
|
|
143
143
|
) : null,
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
144
|
+
/* @__PURE__ */ h(
|
|
145
|
+
fe,
|
|
146
146
|
{
|
|
147
147
|
label: e.t("docLink.edit.address"),
|
|
148
|
-
error:
|
|
149
|
-
children: /* @__PURE__ */
|
|
148
|
+
error: v && !g ? e.t("docLink.edit.addressError") : "",
|
|
149
|
+
children: /* @__PURE__ */ h(
|
|
150
150
|
me,
|
|
151
151
|
{
|
|
152
152
|
value: s,
|
|
@@ -160,9 +160,9 @@ const F = () => {
|
|
|
160
160
|
}
|
|
161
161
|
)
|
|
162
162
|
] }),
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ w("div", { className: "univer-flex univer-justify-end univer-gap-3", children: [
|
|
164
|
+
/* @__PURE__ */ h(Ie, { onClick: p, children: e.t("docLink.edit.cancel") }),
|
|
165
|
+
/* @__PURE__ */ h(
|
|
166
166
|
Ie,
|
|
167
167
|
{
|
|
168
168
|
variant: "primary",
|
|
@@ -192,16 +192,16 @@ var m = function() {
|
|
|
192
192
|
for (var r = 0, i = Object.getOwnPropertySymbols(n); r < i.length; r++)
|
|
193
193
|
e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, i[r]) && (t[i[r]] = n[i[r]]);
|
|
194
194
|
return t;
|
|
195
|
-
},
|
|
196
|
-
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 = kn("_".concat(
|
|
197
|
-
return
|
|
195
|
+
}, $ = N(function(n, e) {
|
|
196
|
+
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 = kn("_".concat(Dn()));
|
|
197
|
+
return Pe(t, "".concat(i), { defIds: t.defIds, idSuffix: l.current }, m({ ref: e, className: c }, s), o);
|
|
198
198
|
});
|
|
199
|
-
function
|
|
200
|
-
return U(n.tag, m(m({ key: e },
|
|
201
|
-
return
|
|
199
|
+
function Pe(n, e, t, i, r) {
|
|
200
|
+
return U(n.tag, m(m({ key: e }, Rn(n, t, r)), i), (Mn(n, t).children || []).map(function(o, s) {
|
|
201
|
+
return Pe(o, "".concat(e, "-").concat(n.tag, "-").concat(s), t, void 0, r);
|
|
202
202
|
}));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function Rn(n, e, t) {
|
|
205
205
|
var i = m({}, n.attrs);
|
|
206
206
|
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) {
|
|
207
207
|
var s = o[0], c = o[1];
|
|
@@ -216,46 +216,46 @@ function wn(n, e, t) {
|
|
|
216
216
|
function Mn(n, e) {
|
|
217
217
|
var t, i = e.defIds;
|
|
218
218
|
return !i || i.length === 0 ? n : n.tag === "defs" && (!((t = n.children) === null || t === void 0) && t.length) ? m(m({}, n), { children: n.children.map(function(r) {
|
|
219
|
-
return typeof r.attrs.id == "string" && i && i.
|
|
219
|
+
return typeof r.attrs.id == "string" && i && i.includes(r.attrs.id) ? m(m({}, r), { attrs: m(m({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
220
220
|
}) }) : n;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Dn() {
|
|
223
223
|
return Math.random().toString(36).substring(2, 8);
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
var
|
|
227
|
-
return U(
|
|
228
|
-
id: "copy-
|
|
225
|
+
$.displayName = "UniverIcon";
|
|
226
|
+
var En = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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" } }] }, be = N(function(n, e) {
|
|
227
|
+
return U($, Object.assign({}, n, {
|
|
228
|
+
id: "copy-icon",
|
|
229
229
|
ref: e,
|
|
230
|
-
icon:
|
|
230
|
+
icon: En
|
|
231
231
|
}));
|
|
232
232
|
});
|
|
233
|
-
be.displayName = "
|
|
234
|
-
var Nn = { 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" } }] }, ie = N(function(n, e) {
|
|
235
|
-
return U(
|
|
236
|
-
id: "link-
|
|
233
|
+
be.displayName = "CopyIcon";
|
|
234
|
+
var Nn = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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" } }] }, ie = N(function(n, e) {
|
|
235
|
+
return U($, Object.assign({}, n, {
|
|
236
|
+
id: "link-icon",
|
|
237
237
|
ref: e,
|
|
238
238
|
icon: Nn
|
|
239
239
|
}));
|
|
240
240
|
});
|
|
241
|
-
ie.displayName = "
|
|
242
|
-
var Un = { 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.
|
|
243
|
-
return U(
|
|
244
|
-
id: "unlink-
|
|
241
|
+
ie.displayName = "LinkIcon";
|
|
242
|
+
var Un = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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.76157C6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449C14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797C11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.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.05395C4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092C3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721C8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332C2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302C13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332Z" } }] }, Re = N(function(n, e) {
|
|
243
|
+
return U($, Object.assign({}, n, {
|
|
244
|
+
id: "unlink-icon",
|
|
245
245
|
ref: e,
|
|
246
246
|
icon: Un
|
|
247
247
|
}));
|
|
248
248
|
});
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
return U(
|
|
252
|
-
id: "write-
|
|
249
|
+
Re.displayName = "UnlinkIcon";
|
|
250
|
+
var $n = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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" } }] }, Me = N(function(n, e) {
|
|
251
|
+
return U($, Object.assign({}, n, {
|
|
252
|
+
id: "write-icon",
|
|
253
253
|
ref: e,
|
|
254
|
-
icon:
|
|
254
|
+
icon: $n
|
|
255
255
|
}));
|
|
256
256
|
});
|
|
257
|
-
Me.displayName = "
|
|
258
|
-
const
|
|
257
|
+
Me.displayName = "WriteIcon";
|
|
258
|
+
const De = {
|
|
259
259
|
type: b.COMMAND,
|
|
260
260
|
id: "docs.command.delete-hyper-link",
|
|
261
261
|
async handler(n, e) {
|
|
@@ -264,76 +264,76 @@ const Ee = {
|
|
|
264
264
|
const { unitId: t, linkId: i, segmentId: r } = e, o = n.get(k), s = Qe(n, { unitId: t, rangeId: i, segmentId: r });
|
|
265
265
|
return s ? await o.syncExecuteCommand(s.id, s.params) : !1;
|
|
266
266
|
}
|
|
267
|
-
},
|
|
268
|
-
const e = n.get(
|
|
267
|
+
}, Ee = (n) => {
|
|
268
|
+
const e = n.get(R), t = n.get(L), i = e.getTextRanges();
|
|
269
269
|
if (!(i != null && i.length))
|
|
270
270
|
return !0;
|
|
271
271
|
const r = i[0];
|
|
272
272
|
return !!(!t.getCurrentUnitForType(_.UNIVER_DOC) || !r || r.collapsed);
|
|
273
|
-
},
|
|
273
|
+
}, P = {
|
|
274
274
|
type: b.OPERATION,
|
|
275
275
|
id: "doc.operation.show-hyper-link-edit-popup",
|
|
276
276
|
handler(n, e) {
|
|
277
277
|
var s;
|
|
278
278
|
const t = e == null ? void 0 : e.link, i = n.get(L);
|
|
279
|
-
if (
|
|
279
|
+
if (Ee(n) && !t)
|
|
280
280
|
return !1;
|
|
281
|
-
const r = n.get(
|
|
281
|
+
const r = n.get(S), o = (t == null ? void 0 : t.unitId) || ((s = i.getCurrentUnitForType(_.UNIVER_DOC)) == null ? void 0 : s.getUnitId());
|
|
282
282
|
return o ? (r.showEditPopup(o, t), !0) : !1;
|
|
283
283
|
}
|
|
284
284
|
}, ee = {
|
|
285
285
|
type: b.OPERATION,
|
|
286
286
|
id: "doc.operation.toggle-hyper-link-info-popup",
|
|
287
287
|
handler(n, e) {
|
|
288
|
-
const t = n.get(
|
|
288
|
+
const t = n.get(S);
|
|
289
289
|
return e ? (t.showInfoPopup(e), !0) : (t.hideInfoPopup(), !0);
|
|
290
290
|
}
|
|
291
291
|
}, Ne = {
|
|
292
292
|
type: b.OPERATION,
|
|
293
293
|
id: "doc.operation.click-hyper-link",
|
|
294
294
|
handler(n, e) {
|
|
295
|
-
var u,
|
|
295
|
+
var u, v, f;
|
|
296
296
|
if (!e)
|
|
297
297
|
return !1;
|
|
298
|
-
const { unitId: t, linkId: i, segmentId: r } = e, s = n.get(L).getUnit(t, _.UNIVER_DOC), c = s == null ? void 0 : s.getSelfOrHeaderFooterModel(r).getBody(), l = (
|
|
298
|
+
const { unitId: t, linkId: i, segmentId: r } = e, s = n.get(L).getUnit(t, _.UNIVER_DOC), c = s == null ? void 0 : s.getSelfOrHeaderFooterModel(r).getBody(), l = (f = (v = (u = c == null ? void 0 : c.customRanges) == null ? void 0 : u.find((g) => g.rangeId === i && g.rangeType === D.HYPERLINK)) == null ? void 0 : v.properties) == null ? void 0 : f.url;
|
|
299
299
|
return l && window.open(l, "_blank", "noopener noreferrer"), !0;
|
|
300
300
|
}
|
|
301
301
|
}, B = () => {
|
|
302
302
|
var C, a;
|
|
303
|
-
const n = S
|
|
303
|
+
const n = y(S), e = y(k), t = y(gn), i = y(Se), r = Le(n.showingLink$), o = y(L);
|
|
304
304
|
if (!r)
|
|
305
305
|
return null;
|
|
306
|
-
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex:
|
|
306
|
+
const { unitId: s, linkId: c, segmentId: l, startIndex: u, endIndex: v } = r, f = o.getUnit(s, _.UNIVER_DOC), g = f == null ? void 0 : f.getSelfOrHeaderFooterModel(l).getBody(), d = (C = g == null ? void 0 : g.customRanges) == null ? void 0 : C.find((x) => x.rangeId === c && x.rangeType === D.HYPERLINK && x.startIndex === u && x.endIndex === v);
|
|
307
307
|
if (!d)
|
|
308
308
|
return null;
|
|
309
309
|
const p = (a = d.properties) == null ? void 0 : a.url;
|
|
310
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ w(
|
|
311
311
|
"div",
|
|
312
312
|
{
|
|
313
|
-
className: xe("univer-box-border univer-flex univer-max-w-80 univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-white univer-p-3 univer-shadow dark
|
|
313
|
+
className: xe("univer-box-border univer-flex univer-max-w-80 univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-white univer-p-3 univer-shadow dark:!univer-bg-gray-900", ke),
|
|
314
314
|
onClick: () => {
|
|
315
315
|
n.hideInfoPopup();
|
|
316
316
|
},
|
|
317
317
|
children: [
|
|
318
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ w(
|
|
319
319
|
"div",
|
|
320
320
|
{
|
|
321
321
|
className: "univer-flex univer-h-6 univer-flex-1 univer-cursor-pointer univer-items-center univer-truncate univer-text-sm univer-leading-5 univer-text-primary-500",
|
|
322
322
|
onClick: () => window.open(p, void 0, "noopener noreferrer"),
|
|
323
323
|
children: [
|
|
324
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ h(
|
|
325
325
|
"div",
|
|
326
326
|
{
|
|
327
|
-
className: "univer-mr-2 univer-flex univer-size-5 univer-flex-[0_0_auto] univer-items-center univer-justify-center univer-text-base univer-text-gray-900 dark
|
|
328
|
-
children: /* @__PURE__ */
|
|
327
|
+
className: "univer-mr-2 univer-flex univer-size-5 univer-flex-[0_0_auto] univer-items-center univer-justify-center univer-text-base univer-text-gray-900 dark:!univer-text-white",
|
|
328
|
+
children: /* @__PURE__ */ h(ie, {})
|
|
329
329
|
}
|
|
330
330
|
),
|
|
331
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ h(A, { showIfEllipsis: !0, title: p, children: /* @__PURE__ */ h("span", { className: "univer-flex-1 univer-truncate", children: p }) })
|
|
332
332
|
]
|
|
333
333
|
}
|
|
334
334
|
),
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ w("div", { className: "univer-flex univer-h-6 univer-flex-[0_0_auto] univer-items-center univer-justify-center", children: [
|
|
336
|
+
/* @__PURE__ */ h(
|
|
337
337
|
"div",
|
|
338
338
|
{
|
|
339
339
|
className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base",
|
|
@@ -343,33 +343,33 @@ const Ee = {
|
|
|
343
343
|
type: pn.Info
|
|
344
344
|
});
|
|
345
345
|
},
|
|
346
|
-
children: /* @__PURE__ */
|
|
346
|
+
children: /* @__PURE__ */ h(A, { placement: "bottom", title: i.t("docLink.info.copy"), children: /* @__PURE__ */ h(be, {}) })
|
|
347
347
|
}
|
|
348
348
|
),
|
|
349
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ h(
|
|
350
350
|
"div",
|
|
351
351
|
{
|
|
352
352
|
className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base",
|
|
353
353
|
onClick: () => {
|
|
354
|
-
e.executeCommand(
|
|
354
|
+
e.executeCommand(P.id, {
|
|
355
355
|
link: r
|
|
356
356
|
});
|
|
357
357
|
},
|
|
358
|
-
children: /* @__PURE__ */
|
|
358
|
+
children: /* @__PURE__ */ h(A, { placement: "bottom", title: i.t("docLink.info.edit"), children: /* @__PURE__ */ h(Me, {}) })
|
|
359
359
|
}
|
|
360
360
|
),
|
|
361
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ h(
|
|
362
362
|
"div",
|
|
363
363
|
{
|
|
364
364
|
className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base",
|
|
365
365
|
onClick: () => {
|
|
366
|
-
e.executeCommand(
|
|
366
|
+
e.executeCommand(De.id, {
|
|
367
367
|
unitId: s,
|
|
368
368
|
linkId: d.rangeId,
|
|
369
369
|
segmentId: l
|
|
370
370
|
});
|
|
371
371
|
},
|
|
372
|
-
children: /* @__PURE__ */
|
|
372
|
+
children: /* @__PURE__ */ h(A, { placement: "bottom", title: i.t("docLink.info.cancel"), children: /* @__PURE__ */ h(Re, {}) })
|
|
373
373
|
}
|
|
374
374
|
)
|
|
375
375
|
] })
|
|
@@ -378,16 +378,16 @@ const Ee = {
|
|
|
378
378
|
);
|
|
379
379
|
};
|
|
380
380
|
B.componentKey = "univer.doc.link-info-popup";
|
|
381
|
-
var
|
|
382
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
381
|
+
var Tn = Object.getOwnPropertyDescriptor, Hn = (n, e, t, i) => {
|
|
382
|
+
for (var r = i > 1 ? void 0 : i ? Tn(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
383
383
|
(s = n[o]) && (r = s(r) || r);
|
|
384
384
|
return r;
|
|
385
|
-
},
|
|
386
|
-
let
|
|
385
|
+
}, z = (n, e) => (t, i) => e(t, i, n);
|
|
386
|
+
let S = class extends E {
|
|
387
387
|
constructor(e, t, i) {
|
|
388
388
|
super();
|
|
389
|
-
O(this, "_editingLink$", new
|
|
390
|
-
O(this, "_showingLink$", new
|
|
389
|
+
O(this, "_editingLink$", new ve(null));
|
|
390
|
+
O(this, "_showingLink$", new ve(null));
|
|
391
391
|
O(this, "editingLink$", this._editingLink$.asObservable());
|
|
392
392
|
O(this, "showingLink$", this._showingLink$.asObservable());
|
|
393
393
|
O(this, "_editPopup", null);
|
|
@@ -433,9 +433,9 @@ let y = class extends D {
|
|
|
433
433
|
this._editingLink$.next(null), (e = this._editPopup) == null || e.dispose();
|
|
434
434
|
}
|
|
435
435
|
showInfoPopup(e) {
|
|
436
|
-
var u,
|
|
436
|
+
var u, v, f, g, d, p;
|
|
437
437
|
const { linkId: t, unitId: i, segmentId: r, segmentPage: o, startIndex: s, endIndex: c } = e;
|
|
438
|
-
if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((
|
|
438
|
+
if (!(((u = this.showing) == null ? void 0 : u.linkId) === t && ((v = this.showing) == null ? void 0 : v.unitId) === i && ((f = this.showing) == null ? void 0 : f.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))))
|
|
439
439
|
return this._showingLink$.next({ unitId: i, linkId: t, segmentId: r, segmentPage: o, startIndex: s, endIndex: c }), this._infoPopup = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
440
440
|
{
|
|
441
441
|
collapsed: !1,
|
|
@@ -460,17 +460,17 @@ let y = class extends D {
|
|
|
460
460
|
this._showingLink$.next(null), (e = this._infoPopup) == null || e.dispose();
|
|
461
461
|
}
|
|
462
462
|
};
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
],
|
|
468
|
-
var jn = Object.getOwnPropertyDescriptor,
|
|
463
|
+
S = Hn([
|
|
464
|
+
z(0, I(rn)),
|
|
465
|
+
z(1, I(R)),
|
|
466
|
+
z(2, L)
|
|
467
|
+
], S);
|
|
468
|
+
var jn = Object.getOwnPropertyDescriptor, An = (n, e, t, i) => {
|
|
469
469
|
for (var r = i > 1 ? void 0 : i ? jn(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
470
470
|
(s = n[o]) && (r = s(r) || r);
|
|
471
471
|
return r;
|
|
472
472
|
}, q = (n, e) => (t, i) => e(t, i, n);
|
|
473
|
-
let V = class extends
|
|
473
|
+
let V = class extends E {
|
|
474
474
|
constructor(n, e, t) {
|
|
475
475
|
super(), this._commandService = n, this._univerInstanceService = e, this._docHyperLinkService = t, this._initSelectionChange();
|
|
476
476
|
}
|
|
@@ -481,15 +481,15 @@ let V = class extends D {
|
|
|
481
481
|
if (n.id === Xe.id) {
|
|
482
482
|
const r = n.params, { unitId: o, ranges: s, segmentId: c } = r, l = this._univerInstanceService.getUnit(o, _.UNIVER_DOC), u = s[0];
|
|
483
483
|
if (u && l) {
|
|
484
|
-
const { startOffset:
|
|
484
|
+
const { startOffset: v, endOffset: f, collapsed: g, segmentPage: d } = u, p = (t = (e = l.getSelfOrHeaderFooterModel(c)) == null ? void 0 : e.getBody()) == null ? void 0 : t.customRanges;
|
|
485
485
|
if (g) {
|
|
486
|
-
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex <
|
|
486
|
+
const C = (i = p == null ? void 0 : p.findIndex((a) => a.startIndex < v && a.endIndex > f - 1)) != null ? i : -1;
|
|
487
487
|
if (C > -1) {
|
|
488
488
|
const a = p[C];
|
|
489
489
|
this._docHyperLinkService.showInfoPopup({ unitId: o, linkId: a.rangeId, segmentId: c, segmentPage: d, startIndex: a.startIndex, endIndex: a.endIndex });
|
|
490
490
|
return;
|
|
491
491
|
}
|
|
492
|
-
} else if (p == null ? void 0 : p.find((a) => a.startIndex <=
|
|
492
|
+
} else if (p == null ? void 0 : p.find((a) => a.startIndex <= v && a.endIndex >= f - 1))
|
|
493
493
|
return;
|
|
494
494
|
}
|
|
495
495
|
this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
|
|
@@ -498,19 +498,19 @@ let V = class extends D {
|
|
|
498
498
|
);
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
|
-
V =
|
|
501
|
+
V = An([
|
|
502
502
|
q(0, k),
|
|
503
503
|
q(1, L),
|
|
504
|
-
q(2, I(
|
|
504
|
+
q(2, I(S))
|
|
505
505
|
], V);
|
|
506
|
-
var
|
|
507
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
506
|
+
var Kn = Object.getOwnPropertyDescriptor, Fn = (n, e, t, i) => {
|
|
507
|
+
for (var r = i > 1 ? void 0 : i ? Kn(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
508
508
|
(s = n[o]) && (r = s(r) || r);
|
|
509
509
|
return r;
|
|
510
510
|
}, M = (n, e) => (t, i) => e(t, i, n);
|
|
511
|
-
let ne = class extends
|
|
511
|
+
let ne = class extends E {
|
|
512
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 ===
|
|
513
|
+
super(), this._context = n, this._docEventManagerService = e, this._commandService = t, this._hyperLinkPopupService = i, this._docSkeletonManagerService = r, this._docSelectionManagerService = o, !(this._context.unitId === Ke || this._context.unitId === Fe) && (this._initHover(), this._initClick());
|
|
514
514
|
}
|
|
515
515
|
get _skeleton() {
|
|
516
516
|
return this._docSkeletonManagerService.getSkeleton();
|
|
@@ -524,7 +524,7 @@ let ne = class extends D {
|
|
|
524
524
|
this.disposeWithMe(
|
|
525
525
|
this._docEventManagerService.hoverCustomRanges$.subscribe((n) => {
|
|
526
526
|
var r;
|
|
527
|
-
const e = n.find((o) => o.range.rangeType ===
|
|
527
|
+
const e = n.find((o) => o.range.rangeType === D.HYPERLINK), t = this._docSelectionManagerService.getTextRanges(), i = t == null ? void 0 : t[0].segmentId;
|
|
528
528
|
if (((r = e == null ? void 0 : e.segmentId) != null ? r : "") !== i) {
|
|
529
529
|
this._hideInfoPopup();
|
|
530
530
|
return;
|
|
@@ -563,16 +563,16 @@ let ne = class extends D {
|
|
|
563
563
|
ne = Fn([
|
|
564
564
|
M(1, I(on)),
|
|
565
565
|
M(2, k),
|
|
566
|
-
M(3, I(
|
|
566
|
+
M(3, I(S)),
|
|
567
567
|
M(4, I(en)),
|
|
568
|
-
M(5, I(
|
|
568
|
+
M(5, I(R))
|
|
569
569
|
], ne);
|
|
570
570
|
var Bn = Object.getOwnPropertyDescriptor, Vn = (n, e, t, i) => {
|
|
571
571
|
for (var r = i > 1 ? void 0 : i ? Bn(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
572
572
|
(s = n[o]) && (r = s(r) || r);
|
|
573
573
|
return r;
|
|
574
574
|
}, J = (n, e) => (t, i) => e(t, i, n);
|
|
575
|
-
let te = class extends
|
|
575
|
+
let te = class extends E {
|
|
576
576
|
constructor(n, e, t, i) {
|
|
577
577
|
super(), this._context = n, this._docInterceptorService = e, this._hyperLinkService = t, this._docRenderController = i, this._init(), this._initReRender();
|
|
578
578
|
}
|
|
@@ -587,10 +587,10 @@ let te = class extends D {
|
|
|
587
587
|
...n,
|
|
588
588
|
active: !1
|
|
589
589
|
});
|
|
590
|
-
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o,
|
|
590
|
+
const { linkId: s, unitId: c, startIndex: l, endIndex: u } = o, v = c === i && n.rangeId === s && r >= l && r <= u;
|
|
591
591
|
return t({
|
|
592
592
|
...n,
|
|
593
|
-
active:
|
|
593
|
+
active: v
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
596
|
});
|
|
@@ -606,21 +606,21 @@ let te = class extends D {
|
|
|
606
606
|
};
|
|
607
607
|
te = Vn([
|
|
608
608
|
J(1, I(nn)),
|
|
609
|
-
J(2, I(
|
|
609
|
+
J(2, I(S)),
|
|
610
610
|
J(3, I(sn))
|
|
611
611
|
], te);
|
|
612
612
|
const Ue = "doc-hyper-link-icon";
|
|
613
613
|
function Ce(n) {
|
|
614
614
|
return {
|
|
615
|
-
id:
|
|
616
|
-
type:
|
|
615
|
+
id: P.id,
|
|
616
|
+
type: fn.BUTTON,
|
|
617
617
|
icon: Ue,
|
|
618
618
|
title: "docLink.menu.tooltip",
|
|
619
619
|
tooltip: "docLink.menu.tooltip",
|
|
620
|
-
hidden$:
|
|
620
|
+
hidden$: vn(n, _.UNIVER_DOC),
|
|
621
621
|
disabled$: new ln(function(e) {
|
|
622
|
-
const i = n.get(
|
|
623
|
-
e.next(
|
|
622
|
+
const i = n.get(R).textSelection$.pipe(un(16)).subscribe(() => {
|
|
623
|
+
e.next(Ee(n));
|
|
624
624
|
});
|
|
625
625
|
return () => {
|
|
626
626
|
i.unsubscribe();
|
|
@@ -628,51 +628,53 @@ function Ce(n) {
|
|
|
628
628
|
})
|
|
629
629
|
};
|
|
630
630
|
}
|
|
631
|
-
const
|
|
632
|
-
id:
|
|
633
|
-
binding:
|
|
631
|
+
const Zn = {
|
|
632
|
+
id: P.id,
|
|
633
|
+
binding: hn.CTRL_COMMAND | X.K,
|
|
634
634
|
description: "docLink.menu.tooltip",
|
|
635
635
|
preconditions: cn
|
|
636
|
-
},
|
|
637
|
-
[_n.
|
|
638
|
-
[
|
|
639
|
-
order:
|
|
636
|
+
}, Yn = {
|
|
637
|
+
[_n.MEDIA]: {
|
|
638
|
+
[P.id]: {
|
|
639
|
+
order: 1,
|
|
640
640
|
menuItemFactory: Ce
|
|
641
641
|
}
|
|
642
642
|
},
|
|
643
643
|
[mn.MAIN_AREA]: {
|
|
644
644
|
[In.DATA]: {
|
|
645
|
-
[
|
|
645
|
+
[P.id]: {
|
|
646
646
|
order: 0,
|
|
647
647
|
menuItemFactory: Ce
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
};
|
|
652
|
-
var
|
|
653
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
652
|
+
var Wn = Object.getOwnPropertyDescriptor, Gn = (n, e, t, i) => {
|
|
653
|
+
for (var r = i > 1 ? void 0 : i ? Wn(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
654
654
|
(s = n[o]) && (r = s(r) || r);
|
|
655
655
|
return r;
|
|
656
|
-
},
|
|
657
|
-
let
|
|
656
|
+
}, K = (n, e) => (t, i) => e(t, i, n);
|
|
657
|
+
let Z = class extends E {
|
|
658
658
|
constructor(n, e, t, i) {
|
|
659
659
|
super(), this._componentManager = n, this._commandService = e, this._menuManagerService = t, this._shortcutService = i, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortcut();
|
|
660
660
|
}
|
|
661
661
|
_initComponents() {
|
|
662
662
|
[
|
|
663
|
-
[F, F
|
|
664
|
-
[B, B
|
|
665
|
-
[
|
|
663
|
+
[F.componentKey, F],
|
|
664
|
+
[B.componentKey, B],
|
|
665
|
+
[Ue, ie]
|
|
666
666
|
].forEach(([n, e]) => {
|
|
667
|
-
this.
|
|
667
|
+
this.disposeWithMe(
|
|
668
|
+
this._componentManager.register(n, e)
|
|
669
|
+
);
|
|
668
670
|
});
|
|
669
671
|
}
|
|
670
672
|
_initCommands() {
|
|
671
673
|
[
|
|
672
674
|
Oe,
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
675
|
+
we,
|
|
676
|
+
De,
|
|
677
|
+
P,
|
|
676
678
|
ee,
|
|
677
679
|
Ne
|
|
678
680
|
].forEach((n) => {
|
|
@@ -680,30 +682,30 @@ let Y = class extends D {
|
|
|
680
682
|
});
|
|
681
683
|
}
|
|
682
684
|
_initShortcut() {
|
|
683
|
-
[
|
|
685
|
+
[Zn].forEach((n) => {
|
|
684
686
|
this._shortcutService.registerShortcut(n);
|
|
685
687
|
});
|
|
686
688
|
}
|
|
687
689
|
_initMenus() {
|
|
688
|
-
this._menuManagerService.mergeMenu(
|
|
690
|
+
this._menuManagerService.mergeMenu(Yn);
|
|
689
691
|
}
|
|
690
692
|
};
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
],
|
|
697
|
-
const
|
|
693
|
+
Z = Gn([
|
|
694
|
+
K(0, I(Cn)),
|
|
695
|
+
K(1, k),
|
|
696
|
+
K(2, yn),
|
|
697
|
+
K(3, Sn)
|
|
698
|
+
], Z);
|
|
699
|
+
const zn = "DOC_HYPER_LINK_UI_PLUGIN";
|
|
698
700
|
var qn = Object.defineProperty, Jn = Object.getOwnPropertyDescriptor, Qn = (n, e, t) => e in n ? qn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Xn = (n, e, t, i) => {
|
|
699
701
|
for (var r = i > 1 ? void 0 : i ? Jn(e, t) : e, o = n.length - 1, s; o >= 0; o--)
|
|
700
702
|
(s = n[o]) && (r = s(r) || r);
|
|
701
703
|
return r;
|
|
702
|
-
}, Q = (n, e) => (t, i) => e(t, i, n),
|
|
703
|
-
let
|
|
704
|
+
}, Q = (n, e) => (t, i) => e(t, i, n), $e = (n, e, t) => Qn(n, typeof e != "symbol" ? e + "" : e, t);
|
|
705
|
+
let Y = class extends Ye {
|
|
704
706
|
constructor(n = _e, e, t, i) {
|
|
705
707
|
super(), this._config = n, this._injector = e, this._renderManagerSrv = t, this._configService = i;
|
|
706
|
-
const { menu: r, ...o } =
|
|
708
|
+
const { menu: r, ...o } = We(
|
|
707
709
|
{},
|
|
708
710
|
_e,
|
|
709
711
|
this._config
|
|
@@ -712,12 +714,12 @@ let Z = class extends Ze {
|
|
|
712
714
|
}
|
|
713
715
|
onStarting() {
|
|
714
716
|
[
|
|
715
|
-
[
|
|
716
|
-
[
|
|
717
|
+
[S],
|
|
718
|
+
[Z],
|
|
717
719
|
[V]
|
|
718
720
|
].forEach((e) => {
|
|
719
721
|
this._injector.add(e);
|
|
720
|
-
}), this._injector.get(
|
|
722
|
+
}), this._injector.get(Z);
|
|
721
723
|
}
|
|
722
724
|
onReady() {
|
|
723
725
|
this._injector.get(V);
|
|
@@ -734,14 +736,14 @@ let Z = class extends Ze {
|
|
|
734
736
|
});
|
|
735
737
|
}
|
|
736
738
|
};
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
Be(
|
|
739
|
+
$e(Y, "pluginName", zn);
|
|
740
|
+
$e(Y, "type", _.UNIVER_DOC);
|
|
741
|
+
Y = Xn([
|
|
742
|
+
Be(Ge),
|
|
741
743
|
Q(1, I(Ve)),
|
|
742
|
-
Q(2,
|
|
743
|
-
Q(3,
|
|
744
|
-
],
|
|
744
|
+
Q(2, ze),
|
|
745
|
+
Q(3, Ze)
|
|
746
|
+
], Y);
|
|
745
747
|
export {
|
|
746
|
-
|
|
748
|
+
Y as UniverDocsHyperLinkUIPlugin
|
|
747
749
|
};
|