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