@univerjs/docs-hyper-link-ui 0.2.0
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/LICENSE +176 -0
- package/README.md +28 -0
- package/lib/cjs/index.js +1 -0
- package/lib/es/index.js +644 -0
- package/lib/index.css +1 -0
- package/lib/locale/en-US.json +21 -0
- package/lib/locale/ru-RU.json +21 -0
- package/lib/locale/zh-CN.json +21 -0
- package/lib/types/commands/commands/add-link.command.d.ts +7 -0
- package/lib/types/commands/commands/delete-link.command.d.ts +7 -0
- package/lib/types/commands/commands/update-link.command.d.ts +8 -0
- package/lib/types/commands/operations/popup.operation.d.ts +12 -0
- package/lib/types/controllers/doc-hyper-link-clipboard.controller.d.ts +13 -0
- package/lib/types/controllers/doc-hyper-link-selection.controller.d.ts +12 -0
- package/lib/types/controllers/menu.d.ts +6 -0
- package/lib/types/controllers/render-controllers/render.controller.d.ts +12 -0
- package/lib/types/controllers/ui.controller.d.ts +20 -0
- package/lib/types/index.d.ts +16 -0
- package/lib/types/locale/en-US.d.ts +4 -0
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +37 -0
- package/lib/types/plugin.d.ts +16 -0
- package/lib/types/services/hyper-link-popup.service.d.ts +31 -0
- package/lib/types/types/const/index.d.ts +16 -0
- package/lib/types/views/hyper-link-edit/index.d.ts +6 -0
- package/lib/types/views/hyper-link-popup/index.d.ts +6 -0
- package/lib/umd/index.js +1 -0
- package/package.json +100 -0
package/lib/es/index.js
ADDED
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
var be = Object.defineProperty;
|
|
2
|
+
var we = (e, t, i) => t in e ? be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var E = (e, t, i) => we(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import { CommandType as z, ICommandService as O, IUniverInstanceService as T, UniverInstanceType as _, LocaleService as ve, Disposable as $, Tools as J, CustomRangeType as M, sequenceExecuteAsync as De, OnLifecycle as Q, LifecycleStages as ee, updateAttributeByDelete as Ne, DependentOn as Ue, Plugin as Te } from "@univerjs/core";
|
|
5
|
+
import { Inject as m, Injector as me } from "@wendellhu/redi";
|
|
6
|
+
import { DocHyperLinkModel as H, AddDocHyperLinkMutation as $e, UpdateDocHyperLinkMutation as He, UniverDocsHyperLinkPlugin as Ae } from "@univerjs/docs-hyper-link";
|
|
7
|
+
import { IRenderManagerService as te, DocumentEditArea as q, ITextSelectionRenderManager as je } from "@univerjs/engine-render";
|
|
8
|
+
import { IMessageService as Be, useObservable as Ke, MetaKeys as Ve, KeyCode as Fe, MenuGroup as Ye, MenuItemType as Ze, MenuPosition as ae, getMenuHiddenObservable as We, ComponentManager as ze, IMenuService as Ge, IShortcutService as qe } from "@univerjs/ui";
|
|
9
|
+
import { Tooltip as j, MessageType as Xe, FormLayout as Je, Input as Qe, Button as de } from "@univerjs/design";
|
|
10
|
+
import d, { forwardRef as x, useRef as et, createElement as R, useState as le, useEffect as ue } from "react";
|
|
11
|
+
import { useDependency as g, useObservable as tt } from "@wendellhu/redi/react-bindings";
|
|
12
|
+
import { deleteCustomRangeFactory as nt, TextSelectionManagerService as A, DocSkeletonManagerService as Le, addCustomRangeBySelectionFactory as it, SetTextSelectionsOperation as rt, DocInterceptorService as ot, DOC_INTERCEPTOR_POINT as ct } from "@univerjs/docs";
|
|
13
|
+
import { DocCanvasPopManagerService as st, whenDocAndEditorFocused as at, IDocClipboardService as dt } from "@univerjs/docs-ui";
|
|
14
|
+
import { BehaviorSubject as pe, Observable as lt, debounceTime as ut } from "rxjs";
|
|
15
|
+
import fe from "clsx";
|
|
16
|
+
const pt = "DOC_HYPER_LINK_UI_PLUGIN";
|
|
17
|
+
var v = function() {
|
|
18
|
+
return v = Object.assign || function(e) {
|
|
19
|
+
for (var t, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
t = arguments[i];
|
|
21
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
|
|
22
|
+
}
|
|
23
|
+
return e;
|
|
24
|
+
}, v.apply(this, arguments);
|
|
25
|
+
}, ft = function(e, t) {
|
|
26
|
+
var i = {};
|
|
27
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (i[n] = e[n]);
|
|
28
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
29
|
+
for (var r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
|
|
30
|
+
t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (i[n[r]] = e[n[r]]);
|
|
31
|
+
return i;
|
|
32
|
+
}, b = x(function(e, t) {
|
|
33
|
+
var i = e.icon, n = e.id, r = e.className, o = e.extend, c = ft(e, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), a = et("_".concat(vt()));
|
|
34
|
+
return _e(i, "".concat(n), { defIds: i.defIds, idSuffix: a.current }, v({ ref: t, className: s }, c), o);
|
|
35
|
+
});
|
|
36
|
+
function _e(e, t, i, n, r) {
|
|
37
|
+
return R(e.tag, v(v({ key: t }, ht(e, i, r)), n), (gt(e, i).children || []).map(function(o, c) {
|
|
38
|
+
return _e(o, "".concat(t, "-").concat(e.tag, "-").concat(c), i, void 0, r);
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
function ht(e, t, i) {
|
|
42
|
+
var n = v({}, e.attrs);
|
|
43
|
+
i != null && i.colorChannel1 && n.fill === "colorChannel1" && (n.fill = i.colorChannel1);
|
|
44
|
+
var r = t.defIds;
|
|
45
|
+
return !r || r.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(o) {
|
|
46
|
+
var c = o[0], s = o[1];
|
|
47
|
+
typeof s == "string" && (n[c] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
48
|
+
})), n;
|
|
49
|
+
}
|
|
50
|
+
function gt(e, t) {
|
|
51
|
+
var i, n = t.defIds;
|
|
52
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && (!((i = e.children) === null || i === void 0) && i.length) ? v(v({}, e), { children: e.children.map(function(r) {
|
|
53
|
+
return typeof r.attrs.id == "string" && n && n.indexOf(r.attrs.id) > -1 ? v(v({}, r), { attrs: v(v({}, r.attrs), { id: r.attrs.id + t.idSuffix }) }) : r;
|
|
54
|
+
}) }) : e;
|
|
55
|
+
}
|
|
56
|
+
function vt() {
|
|
57
|
+
return Math.random().toString(36).substring(2, 8);
|
|
58
|
+
}
|
|
59
|
+
b.displayName = "UniverIcon";
|
|
60
|
+
var mt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, Ce = x(function(e, t) {
|
|
61
|
+
return R(b, Object.assign({}, e, {
|
|
62
|
+
id: "close-single",
|
|
63
|
+
ref: t,
|
|
64
|
+
icon: mt
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
Ce.displayName = "CloseSingle";
|
|
68
|
+
var Lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ie = x(function(e, t) {
|
|
69
|
+
return R(b, Object.assign({}, e, {
|
|
70
|
+
id: "copy-single",
|
|
71
|
+
ref: t,
|
|
72
|
+
icon: Lt
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
Ie.displayName = "CopySingle";
|
|
76
|
+
var _t = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332", fillRule: "evenodd", clipRule: "evenodd" } }] }, ne = x(function(e, t) {
|
|
77
|
+
return R(b, Object.assign({}, e, {
|
|
78
|
+
id: "link-single",
|
|
79
|
+
ref: t,
|
|
80
|
+
icon: _t
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
ne.displayName = "LinkSingle";
|
|
84
|
+
var Ct = { 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" } }] }, ke = x(function(e, t) {
|
|
85
|
+
return R(b, Object.assign({}, e, {
|
|
86
|
+
id: "unlink-single",
|
|
87
|
+
ref: t,
|
|
88
|
+
icon: Ct
|
|
89
|
+
}));
|
|
90
|
+
});
|
|
91
|
+
ke.displayName = "UnlinkSingle";
|
|
92
|
+
var It = { 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" } }] }, ye = x(function(e, t) {
|
|
93
|
+
return R(b, Object.assign({}, e, {
|
|
94
|
+
id: "write-single",
|
|
95
|
+
ref: t,
|
|
96
|
+
icon: It
|
|
97
|
+
}));
|
|
98
|
+
});
|
|
99
|
+
ye.displayName = "WriteSingle";
|
|
100
|
+
const Se = {
|
|
101
|
+
type: z.COMMAND,
|
|
102
|
+
id: "docs.command.delete-hyper-link",
|
|
103
|
+
handler(e, t) {
|
|
104
|
+
if (!t)
|
|
105
|
+
return !1;
|
|
106
|
+
const { unitId: i, linkId: n } = t, r = e.get(O);
|
|
107
|
+
if (!e.get(H).getLink(i, n))
|
|
108
|
+
return !1;
|
|
109
|
+
const s = nt(e, { unitId: i, rangeId: n });
|
|
110
|
+
return s ? r.executeCommand(s.id, s.params) : !1;
|
|
111
|
+
}
|
|
112
|
+
}, Oe = (e) => {
|
|
113
|
+
var p;
|
|
114
|
+
const t = e.get(A), i = e.get(T), n = t.getActiveRange(), o = e.get(te).getCurrent(), c = o == null ? void 0 : o.with(Le).getSkeleton(), s = c == null ? void 0 : c.getViewModel().getEditArea();
|
|
115
|
+
if (s === q.FOOTER || s === q.HEADER)
|
|
116
|
+
return !0;
|
|
117
|
+
const a = i.getCurrentUnitForType(_.UNIVER_DOC);
|
|
118
|
+
if (!a || !n || n.collapsed)
|
|
119
|
+
return !0;
|
|
120
|
+
const u = (p = a.getBody()) == null ? void 0 : p.paragraphs;
|
|
121
|
+
if (!u)
|
|
122
|
+
return !0;
|
|
123
|
+
for (let f = 0, l = u.length; f < l; f++) {
|
|
124
|
+
const h = u[f];
|
|
125
|
+
if (n.startOffset <= h.startIndex && n.endOffset > h.startIndex)
|
|
126
|
+
return !0;
|
|
127
|
+
if (h.startIndex > n.endOffset)
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
return !1;
|
|
131
|
+
}, G = {
|
|
132
|
+
type: z.OPERATION,
|
|
133
|
+
id: "docs.operation.show-hyper-link-edit-popup",
|
|
134
|
+
handler(e, t) {
|
|
135
|
+
const i = t == null ? void 0 : t.link;
|
|
136
|
+
return Oe(e) && !i ? !1 : (e.get(S).showEditPopup(i), !0);
|
|
137
|
+
}
|
|
138
|
+
}, kt = "univer-doc-link", yt = "univer-doc-link-type", St = "univer-doc-link-content", Ot = "univer-doc-link-content-error", Et = "univer-doc-link-url", Pt = "univer-doc-link-operations", Mt = "univer-doc-link-operation", xt = "univer-doc-link-operation-error", y = {
|
|
139
|
+
docLink: kt,
|
|
140
|
+
docLinkType: yt,
|
|
141
|
+
docLinkContent: St,
|
|
142
|
+
docLinkContentError: Ot,
|
|
143
|
+
docLinkUrl: Et,
|
|
144
|
+
docLinkOperations: Pt,
|
|
145
|
+
docLinkOperation: Mt,
|
|
146
|
+
docLinkOperationError: xt
|
|
147
|
+
}, Y = () => {
|
|
148
|
+
const e = g(S), t = g(H), i = g(O), n = g(Be), r = g(ve), o = Ke(e.showingLink$);
|
|
149
|
+
if (!o)
|
|
150
|
+
return null;
|
|
151
|
+
const { unitId: c, linkId: s } = o, a = t.getLink(c, s);
|
|
152
|
+
return a ? /* @__PURE__ */ d.createElement(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: y.docLink,
|
|
156
|
+
onClick: () => {
|
|
157
|
+
e.hideInfoPopup();
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
/* @__PURE__ */ d.createElement("div", { className: fe(y.docLinkContent), onClick: () => window.open(a.payload) }, /* @__PURE__ */ d.createElement("div", { className: y.docLinkType }, /* @__PURE__ */ d.createElement(ne, null)), /* @__PURE__ */ d.createElement(j, { showIfEllipsis: !0, title: a.payload }, /* @__PURE__ */ d.createElement("span", { className: y.docLinkUrl }, a.payload))),
|
|
161
|
+
/* @__PURE__ */ d.createElement("div", { className: y.docLinkOperations }, /* @__PURE__ */ d.createElement(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
className: fe(y.docLinkOperation),
|
|
165
|
+
onClick: () => {
|
|
166
|
+
navigator.clipboard.writeText(a.payload), n.show({
|
|
167
|
+
content: r.t("docLink.info.coped"),
|
|
168
|
+
type: Xe.Info
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
/* @__PURE__ */ d.createElement(j, { placement: "bottom", title: r.t("docLink.info.copy") }, /* @__PURE__ */ d.createElement(Ie, null))
|
|
173
|
+
), /* @__PURE__ */ d.createElement(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: y.docLinkOperation,
|
|
177
|
+
onClick: () => {
|
|
178
|
+
i.executeCommand(G.id, {
|
|
179
|
+
link: o
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
/* @__PURE__ */ d.createElement(j, { placement: "bottom", title: r.t("docLink.info.edit") }, /* @__PURE__ */ d.createElement(ye, null))
|
|
184
|
+
), /* @__PURE__ */ d.createElement(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
className: y.docLinkOperation,
|
|
188
|
+
onClick: () => {
|
|
189
|
+
i.executeCommand(Se.id, {
|
|
190
|
+
unitId: c,
|
|
191
|
+
linkId: a.id
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
/* @__PURE__ */ d.createElement(j, { placement: "bottom", title: r.t("docLink.info.cancel") }, /* @__PURE__ */ d.createElement(ke, null))
|
|
196
|
+
))
|
|
197
|
+
) : null;
|
|
198
|
+
};
|
|
199
|
+
Y.componentKey = "univer.doc.link-info-popup";
|
|
200
|
+
var Rt = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, wt = (e, t, i, n) => {
|
|
201
|
+
for (var r = n > 1 ? void 0 : n ? bt(t, i) : t, o = e.length - 1, c; o >= 0; o--)
|
|
202
|
+
(c = e[o]) && (r = (n ? c(t, i, r) : c(r)) || r);
|
|
203
|
+
return n && r && Rt(t, i, r), r;
|
|
204
|
+
}, D = (e, t) => (i, n) => t(i, n, e);
|
|
205
|
+
let S = class extends $ {
|
|
206
|
+
constructor(t, i, n, r, o) {
|
|
207
|
+
super();
|
|
208
|
+
E(this, "_editingLink$", new pe(null));
|
|
209
|
+
E(this, "_showingLink$", new pe(null));
|
|
210
|
+
E(this, "editingLink$", this._editingLink$.asObservable());
|
|
211
|
+
E(this, "showingLink$", this._showingLink$.asObservable());
|
|
212
|
+
E(this, "_editPopup", null);
|
|
213
|
+
E(this, "_infoPopup", null);
|
|
214
|
+
this._docCanvasPopupManagerService = t, this._textSelectionManagerService = i, this._docHyperLinkModel = n, this._univerInstanceService = r, this._commandService = o;
|
|
215
|
+
}
|
|
216
|
+
get editing() {
|
|
217
|
+
return this._editingLink$.value;
|
|
218
|
+
}
|
|
219
|
+
get showing() {
|
|
220
|
+
return this._showingLink$.value;
|
|
221
|
+
}
|
|
222
|
+
showEditPopup(t) {
|
|
223
|
+
var n, r;
|
|
224
|
+
this._editPopup && this._editPopup.dispose(), this._editingLink$.next(t);
|
|
225
|
+
let i = this._textSelectionManagerService.getActiveRange();
|
|
226
|
+
if (t) {
|
|
227
|
+
const { unitId: o, rangeIndex: c } = t, s = this._univerInstanceService.getUnit(o, _.UNIVER_DOC), a = (r = (n = s == null ? void 0 : s.getBody()) == null ? void 0 : n.customRanges) == null ? void 0 : r[c];
|
|
228
|
+
a && (i = {
|
|
229
|
+
collapsed: !1,
|
|
230
|
+
startOffset: a.startIndex,
|
|
231
|
+
endOffset: a.endIndex + 1
|
|
232
|
+
}, this._textSelectionManagerService.replaceTextRanges([{
|
|
233
|
+
startOffset: a.startIndex,
|
|
234
|
+
endOffset: a.endIndex + 1
|
|
235
|
+
}]));
|
|
236
|
+
}
|
|
237
|
+
return i ? (this._editPopup = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
238
|
+
i,
|
|
239
|
+
{
|
|
240
|
+
componentKey: Z.componentKey,
|
|
241
|
+
direction: "bottom"
|
|
242
|
+
}
|
|
243
|
+
), this._editPopup) : null;
|
|
244
|
+
}
|
|
245
|
+
hideEditPopup() {
|
|
246
|
+
var t;
|
|
247
|
+
this._editingLink$.next(null), (t = this._editPopup) == null || t.dispose();
|
|
248
|
+
}
|
|
249
|
+
showInfoPopup(t) {
|
|
250
|
+
var a, u, p, f;
|
|
251
|
+
const { linkId: i, unitId: n, rangeIndex: r } = t;
|
|
252
|
+
if (((a = this.showing) == null ? void 0 : a.linkId) === i && ((u = this.showing) == null ? void 0 : u.unitId) === n && this.showing.rangeIndex === r)
|
|
253
|
+
return;
|
|
254
|
+
this._infoPopup && this._infoPopup.dispose();
|
|
255
|
+
const o = this._docHyperLinkModel.getLink(n, i), c = this._univerInstanceService.getUnit(n, _.UNIVER_DOC);
|
|
256
|
+
if (!c || !o)
|
|
257
|
+
return;
|
|
258
|
+
const s = (f = (p = c.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f[r];
|
|
259
|
+
if (this._showingLink$.next({ unitId: n, linkId: i, rangeIndex: r }), !!s)
|
|
260
|
+
return this._infoPopup = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
261
|
+
{
|
|
262
|
+
collapsed: !1,
|
|
263
|
+
startOffset: s.startIndex,
|
|
264
|
+
endOffset: s.endIndex + 1
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
componentKey: Y.componentKey,
|
|
268
|
+
direction: "top",
|
|
269
|
+
closeOnSelfTarget: !0,
|
|
270
|
+
onClickOutside: () => {
|
|
271
|
+
this.hideInfoPopup();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
), this._infoPopup;
|
|
275
|
+
}
|
|
276
|
+
hideInfoPopup() {
|
|
277
|
+
var t;
|
|
278
|
+
this._showingLink$.next(null), (t = this._infoPopup) == null || t.dispose();
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
S = wt([
|
|
282
|
+
D(0, m(st)),
|
|
283
|
+
D(1, m(A)),
|
|
284
|
+
D(2, m(H)),
|
|
285
|
+
D(3, T),
|
|
286
|
+
D(4, O)
|
|
287
|
+
], S);
|
|
288
|
+
const Ee = {
|
|
289
|
+
type: z.COMMAND,
|
|
290
|
+
id: "docs.command.add-hyper-link",
|
|
291
|
+
async handler(e, t) {
|
|
292
|
+
if (!t)
|
|
293
|
+
return !1;
|
|
294
|
+
const { payload: i, unitId: n } = t, r = e.get(O), o = J.generateRandomId(), c = it(
|
|
295
|
+
e,
|
|
296
|
+
{
|
|
297
|
+
rangeId: o,
|
|
298
|
+
rangeType: M.HYPERLINK
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
if (c) {
|
|
302
|
+
const s = {
|
|
303
|
+
id: $e.id,
|
|
304
|
+
params: {
|
|
305
|
+
unitId: n,
|
|
306
|
+
link: {
|
|
307
|
+
payload: i,
|
|
308
|
+
id: o
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
return (await De([s, c], r)).result;
|
|
313
|
+
}
|
|
314
|
+
return !1;
|
|
315
|
+
}
|
|
316
|
+
}, Pe = {
|
|
317
|
+
id: "docs.command.update-hyper-link",
|
|
318
|
+
type: z.COMMAND,
|
|
319
|
+
handler(e, t) {
|
|
320
|
+
return t ? e.get(O).executeCommand(He.id, t) : !1;
|
|
321
|
+
}
|
|
322
|
+
}, Dt = "univer-docs-link-edit", Nt = "univer-docs-link-edit-title", Ut = "univer-docs-link-edit-close", Tt = "univer-docs-link-edit-buttons", $t = "univer-docs-link-edit-button", P = {
|
|
323
|
+
docsLinkEdit: Dt,
|
|
324
|
+
docsLinkEditTitle: Nt,
|
|
325
|
+
docsLinkEditClose: Ut,
|
|
326
|
+
docsLinkEditButtons: Tt,
|
|
327
|
+
docsLinkEditButton: $t
|
|
328
|
+
};
|
|
329
|
+
function Ht(e) {
|
|
330
|
+
return /^[a-zA-Z]+:\/\//.test(e);
|
|
331
|
+
}
|
|
332
|
+
function At(e) {
|
|
333
|
+
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e);
|
|
334
|
+
}
|
|
335
|
+
function jt(e) {
|
|
336
|
+
return Ht(e) ? e : At(e) ? `mailto://${e}` : `https://${e}`;
|
|
337
|
+
}
|
|
338
|
+
const Z = () => {
|
|
339
|
+
const e = g(S), t = g(ve), i = g(H), n = tt(e.editingLink$), r = g(O), o = g(T), c = g(je), s = g(A), [a, u] = le(""), [p, f] = le(!1), l = J.isLegalUrl(a), h = n ? o.getUnit(n.unitId, _.UNIVER_DOC) : o.getCurrentUnitForType(_.UNIVER_DOC);
|
|
340
|
+
ue(() => {
|
|
341
|
+
var re, oe, ce, se;
|
|
342
|
+
if (n) {
|
|
343
|
+
const I = n ? i.getLink(n.unitId, n.linkId) : null;
|
|
344
|
+
u((re = I == null ? void 0 : I.payload) != null ? re : "");
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const L = s.getActiveRange();
|
|
348
|
+
if (!L)
|
|
349
|
+
return;
|
|
350
|
+
const w = o.getCurrentUnitForType(_.UNIVER_DOC), ie = (ce = (oe = w == null ? void 0 : w.getBody()) == null ? void 0 : oe.customRanges) == null ? void 0 : ce.find((I) => Math.max(L.startOffset, I.startIndex) <= Math.min(L.endOffset - 1, I.endIndex));
|
|
351
|
+
if (w && ie) {
|
|
352
|
+
const I = i.getLink(w.getUnitId(), ie.rangeId);
|
|
353
|
+
u((se = I == null ? void 0 : I.payload) != null ? se : "");
|
|
354
|
+
}
|
|
355
|
+
}, [n, i, s, o]), ue(() => (c.blur(), () => {
|
|
356
|
+
c.focus();
|
|
357
|
+
}), [c]);
|
|
358
|
+
const C = () => {
|
|
359
|
+
e.hideEditPopup();
|
|
360
|
+
}, k = () => {
|
|
361
|
+
if (f(!0), !l || !h)
|
|
362
|
+
return;
|
|
363
|
+
const L = jt(a);
|
|
364
|
+
n ? r.executeCommand(Pe.id, {
|
|
365
|
+
unitId: h.getUnitId(),
|
|
366
|
+
payload: L,
|
|
367
|
+
linkId: n.linkId
|
|
368
|
+
}) : r.executeCommand(Ee.id, {
|
|
369
|
+
unitId: h.getUnitId(),
|
|
370
|
+
payload: L
|
|
371
|
+
}), e.hideEditPopup();
|
|
372
|
+
};
|
|
373
|
+
if (h)
|
|
374
|
+
return /* @__PURE__ */ d.createElement("div", { className: P.docsLinkEdit }, /* @__PURE__ */ d.createElement("div", { className: P.docsLinkEditTitle }, /* @__PURE__ */ d.createElement("span", null, t.t("docLink.edit.title")), /* @__PURE__ */ d.createElement(Ce, { className: P.docsLinkEditClose, onClick: C })), /* @__PURE__ */ d.createElement("div", null, /* @__PURE__ */ d.createElement(
|
|
375
|
+
Je,
|
|
376
|
+
{
|
|
377
|
+
label: t.t("docLink.edit.address"),
|
|
378
|
+
error: p && !l ? t.t("docLink.edit.addressError") : ""
|
|
379
|
+
},
|
|
380
|
+
/* @__PURE__ */ d.createElement(Qe, { value: a, onChange: u, autoFocus: !0 })
|
|
381
|
+
)), /* @__PURE__ */ d.createElement("div", { className: P.docsLinkEditButtons }, /* @__PURE__ */ d.createElement(
|
|
382
|
+
de,
|
|
383
|
+
{
|
|
384
|
+
className: P.docsLinkEditButton,
|
|
385
|
+
onClick: C
|
|
386
|
+
},
|
|
387
|
+
t.t("docLink.edit.cancel")
|
|
388
|
+
), /* @__PURE__ */ d.createElement(
|
|
389
|
+
de,
|
|
390
|
+
{
|
|
391
|
+
disabled: !a,
|
|
392
|
+
className: P.docsLinkEditButton,
|
|
393
|
+
type: "primary",
|
|
394
|
+
onClick: k
|
|
395
|
+
},
|
|
396
|
+
t.t("docLink.edit.confirm")
|
|
397
|
+
)));
|
|
398
|
+
};
|
|
399
|
+
Z.componentKey = "docs-hyper-link-edit";
|
|
400
|
+
const Me = "doc-hyper-link-icon";
|
|
401
|
+
function Bt(e) {
|
|
402
|
+
return {
|
|
403
|
+
id: G.id,
|
|
404
|
+
group: Ye.TOOLBAR_LAYOUT,
|
|
405
|
+
type: Ze.BUTTON,
|
|
406
|
+
icon: Me,
|
|
407
|
+
title: "docLink.menu.tooltip",
|
|
408
|
+
tooltip: "docLink.menu.tooltip",
|
|
409
|
+
positions: [ae.TOOLBAR_START, ae.CONTEXT_MENU],
|
|
410
|
+
hidden$: We(e, _.UNIVER_DOC),
|
|
411
|
+
disabled$: new lt(function(t) {
|
|
412
|
+
const n = e.get(A).textSelection$.pipe(ut(16)).subscribe(() => {
|
|
413
|
+
t.next(Oe(e));
|
|
414
|
+
});
|
|
415
|
+
return () => {
|
|
416
|
+
n.unsubscribe();
|
|
417
|
+
};
|
|
418
|
+
})
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const Kt = {
|
|
422
|
+
id: G.id,
|
|
423
|
+
binding: Ve.CTRL_COMMAND | Fe.K,
|
|
424
|
+
description: "docLink.menu.tooltip",
|
|
425
|
+
preconditions: at
|
|
426
|
+
};
|
|
427
|
+
var Vt = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, Yt = (e, t, i, n) => {
|
|
428
|
+
for (var r = n > 1 ? void 0 : n ? Ft(t, i) : t, o = e.length - 1, c; o >= 0; o--)
|
|
429
|
+
(c = e[o]) && (r = (n ? c(t, i, r) : c(r)) || r);
|
|
430
|
+
return n && r && Vt(t, i, r), r;
|
|
431
|
+
}, N = (e, t) => (i, n) => t(i, n, e);
|
|
432
|
+
let U = class extends $ {
|
|
433
|
+
constructor(e, t, i, n, r, o) {
|
|
434
|
+
super(), this._config = e, this._componentManager = t, this._commandService = i, this._menuService = n, this._injector = r, this._shortcutService = o, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortcut();
|
|
435
|
+
}
|
|
436
|
+
_initComponents() {
|
|
437
|
+
[
|
|
438
|
+
[Z, Z.componentKey],
|
|
439
|
+
[Y, Y.componentKey],
|
|
440
|
+
[ne, Me]
|
|
441
|
+
].forEach(([e, t]) => {
|
|
442
|
+
this._componentManager.register(t, e);
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
_initCommands() {
|
|
446
|
+
[
|
|
447
|
+
Ee,
|
|
448
|
+
Pe,
|
|
449
|
+
Se,
|
|
450
|
+
G
|
|
451
|
+
].forEach((e) => {
|
|
452
|
+
this._commandService.registerCommand(e);
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
_initShortcut() {
|
|
456
|
+
[Kt].forEach((e) => {
|
|
457
|
+
this._shortcutService.registerShortcut(e);
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
_initMenus() {
|
|
461
|
+
[Bt].forEach((e) => {
|
|
462
|
+
this.disposeWithMe(this._menuService.addMenuItem(e(this._injector), {}));
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
U = Yt([
|
|
467
|
+
Q(ee.Starting, U),
|
|
468
|
+
N(1, m(ze)),
|
|
469
|
+
N(2, O),
|
|
470
|
+
N(3, Ge),
|
|
471
|
+
N(4, m(me)),
|
|
472
|
+
N(5, qe)
|
|
473
|
+
], U);
|
|
474
|
+
var Zt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, zt = (e, t, i, n) => {
|
|
475
|
+
for (var r = n > 1 ? void 0 : n ? Wt(t, i) : t, o = e.length - 1, c; o >= 0; o--)
|
|
476
|
+
(c = e[o]) && (r = (n ? c(t, i, r) : c(r)) || r);
|
|
477
|
+
return n && r && Zt(t, i, r), r;
|
|
478
|
+
}, B = (e, t) => (i, n) => t(i, n, e);
|
|
479
|
+
let V = class extends $ {
|
|
480
|
+
constructor(e, t, i, n) {
|
|
481
|
+
super(), this._commandService = e, this._univerInstanceService = t, this._docHyperLinkService = i, this._renderMangerService = n, this._initSelectionChange();
|
|
482
|
+
}
|
|
483
|
+
_initSelectionChange() {
|
|
484
|
+
this.disposeWithMe(
|
|
485
|
+
this._commandService.onCommandExecuted((e) => {
|
|
486
|
+
var t, i;
|
|
487
|
+
if (e.id === rt.id) {
|
|
488
|
+
const n = e.params, { unitId: r, ranges: o } = n, c = this._renderMangerService.getRenderById(r), s = c == null ? void 0 : c.with(Le).getSkeleton();
|
|
489
|
+
if ((s == null ? void 0 : s.getViewModel().getEditArea()) !== q.BODY) {
|
|
490
|
+
this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const u = this._univerInstanceService.getUnit(r, _.UNIVER_DOC), p = o[0];
|
|
494
|
+
if (p && u) {
|
|
495
|
+
const { startOffset: f, endOffset: l, collapsed: h } = p, C = (t = u.getBody()) == null ? void 0 : t.customRanges;
|
|
496
|
+
if (h) {
|
|
497
|
+
const k = (i = C == null ? void 0 : C.findIndex((L) => L.startIndex < f && L.endIndex > l - 1)) != null ? i : -1;
|
|
498
|
+
if (k > -1) {
|
|
499
|
+
const L = C[k];
|
|
500
|
+
this._docHyperLinkService.showInfoPopup({ unitId: r, linkId: L.rangeId, rangeIndex: k });
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
} else if (C != null && C.find((k) => k.startIndex <= f && k.endIndex >= l - 1))
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this._docHyperLinkService.hideInfoPopup(), this._docHyperLinkService.hideEditPopup();
|
|
507
|
+
}
|
|
508
|
+
})
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
V = zt([
|
|
513
|
+
Q(ee.Ready, V),
|
|
514
|
+
B(0, O),
|
|
515
|
+
B(1, T),
|
|
516
|
+
B(2, m(S)),
|
|
517
|
+
B(3, te)
|
|
518
|
+
], V);
|
|
519
|
+
var Gt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Xt = (e, t, i, n) => {
|
|
520
|
+
for (var r = n > 1 ? void 0 : n ? qt(t, i) : t, o = e.length - 1, c; o >= 0; o--)
|
|
521
|
+
(c = e[o]) && (r = (n ? c(t, i, r) : c(r)) || r);
|
|
522
|
+
return n && r && Gt(t, i, r), r;
|
|
523
|
+
}, he = (e, t) => (i, n) => t(i, n, e);
|
|
524
|
+
let X = class extends $ {
|
|
525
|
+
constructor(e, t, i) {
|
|
526
|
+
super(), this._context = e, this._docInterceptorService = t, this._hyperLinkService = i, this._init();
|
|
527
|
+
}
|
|
528
|
+
_init() {
|
|
529
|
+
this._docInterceptorService.intercept(ct.CUSTOM_RANGE, {
|
|
530
|
+
handler: (e, t, i) => {
|
|
531
|
+
if (!e)
|
|
532
|
+
return i(e);
|
|
533
|
+
const { unitId: n } = t, r = this._hyperLinkService.editing, { linkId: o, unitId: c } = r || {}, s = c === n && e.rangeId === o;
|
|
534
|
+
return i({
|
|
535
|
+
...e,
|
|
536
|
+
active: s
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
X = Xt([
|
|
543
|
+
he(1, m(ot)),
|
|
544
|
+
he(2, m(S))
|
|
545
|
+
], X);
|
|
546
|
+
var Jt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, en = (e, t, i, n) => {
|
|
547
|
+
for (var r = n > 1 ? void 0 : n ? Qt(t, i) : t, o = e.length - 1, c; o >= 0; o--)
|
|
548
|
+
(c = e[o]) && (r = (n ? c(t, i, r) : c(r)) || r);
|
|
549
|
+
return n && r && Jt(t, i, r), r;
|
|
550
|
+
}, K = (e, t) => (i, n) => t(i, n, e);
|
|
551
|
+
let F = class extends $ {
|
|
552
|
+
constructor(e, t, i, n) {
|
|
553
|
+
super(), this._docClipboardService = e, this._univerInstanceService = t, this._hyperLinkModel = i, this._textSelectionManagerService = n, this._initClipboard();
|
|
554
|
+
}
|
|
555
|
+
_initClipboard() {
|
|
556
|
+
this.disposeWithMe(this._docClipboardService.addClipboardHook({
|
|
557
|
+
onBeforePaste: (e) => {
|
|
558
|
+
var o, c;
|
|
559
|
+
const t = this._univerInstanceService.getCurrentUnitForType(_.UNIVER_DOC);
|
|
560
|
+
if (!t)
|
|
561
|
+
return e;
|
|
562
|
+
const i = this._textSelectionManagerService.getActiveRange(), n = (o = t.getBody()) == null ? void 0 : o.customRanges;
|
|
563
|
+
if (!(n != null && n.length))
|
|
564
|
+
return e;
|
|
565
|
+
if (i ? n.find(
|
|
566
|
+
(s) => s.rangeType === M.HYPERLINK && s.startIndex <= i.startOffset && s.endIndex >= i.endOffset - 1
|
|
567
|
+
) : null) {
|
|
568
|
+
const { customRanges: s = [], ...a } = e, p = s.filter((l) => l.rangeType === M.HYPERLINK).map((l) => [l.startIndex, l.endIndex]).flat().sort((l, h) => l - h), f = {
|
|
569
|
+
...a,
|
|
570
|
+
customRanges: s.filter((l) => l.rangeType !== M.HYPERLINK)
|
|
571
|
+
};
|
|
572
|
+
for (let l = 0; l < p.length; l++)
|
|
573
|
+
Ne(f, 1, p[l] - l);
|
|
574
|
+
return f;
|
|
575
|
+
} else {
|
|
576
|
+
const s = new Set(n.map((a) => a.rangeType === M.HYPERLINK && a.rangeId));
|
|
577
|
+
(c = e.customRanges) == null || c.forEach((a) => {
|
|
578
|
+
if (a.rangeType === M.HYPERLINK && s.has(a.rangeId)) {
|
|
579
|
+
const u = this._hyperLinkModel.getLink(t.getUnitId(), a.rangeId);
|
|
580
|
+
if (u) {
|
|
581
|
+
const p = J.generateRandomId();
|
|
582
|
+
this._hyperLinkModel.addLink(t.getUnitId(), {
|
|
583
|
+
payload: u.payload,
|
|
584
|
+
id: p
|
|
585
|
+
}), a.rangeId = p;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
return e;
|
|
591
|
+
}
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
F = en([
|
|
596
|
+
Q(ee.Ready, F),
|
|
597
|
+
K(0, m(dt)),
|
|
598
|
+
K(1, T),
|
|
599
|
+
K(2, m(H)),
|
|
600
|
+
K(3, m(A))
|
|
601
|
+
], F);
|
|
602
|
+
var xe = Object.defineProperty, tn = Object.getOwnPropertyDescriptor, nn = (e, t, i) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, rn = (e, t, i, n) => {
|
|
603
|
+
for (var r = n > 1 ? void 0 : n ? tn(t, i) : t, o = e.length - 1, c; o >= 0; o--)
|
|
604
|
+
(c = e[o]) && (r = (n ? c(t, i, r) : c(r)) || r);
|
|
605
|
+
return n && r && xe(t, i, r), r;
|
|
606
|
+
}, ge = (e, t) => (i, n) => t(i, n, e), Re = (e, t, i) => nn(e, typeof t != "symbol" ? t + "" : t, i);
|
|
607
|
+
let W = class extends Te {
|
|
608
|
+
constructor(e = { menu: {} }, t, i) {
|
|
609
|
+
super(), this._config = e, this._injector = t, this._renderManagerSrv = i;
|
|
610
|
+
}
|
|
611
|
+
onStarting(e) {
|
|
612
|
+
[
|
|
613
|
+
[S],
|
|
614
|
+
[
|
|
615
|
+
U,
|
|
616
|
+
{
|
|
617
|
+
useFactory: () => this._injector.createInstance(U, this._config)
|
|
618
|
+
}
|
|
619
|
+
],
|
|
620
|
+
[V],
|
|
621
|
+
[F]
|
|
622
|
+
].forEach((i) => {
|
|
623
|
+
e.add(i);
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
onRendered() {
|
|
627
|
+
this._initRenderModule();
|
|
628
|
+
}
|
|
629
|
+
_initRenderModule() {
|
|
630
|
+
[X].forEach((e) => {
|
|
631
|
+
this._renderManagerSrv.registerRenderModule(_.UNIVER_DOC, e);
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
Re(W, "pluginName", pt);
|
|
636
|
+
Re(W, "type", _.UNIVER_DOC);
|
|
637
|
+
W = rn([
|
|
638
|
+
Ue(Ae),
|
|
639
|
+
ge(1, m(me)),
|
|
640
|
+
ge(2, te)
|
|
641
|
+
], W);
|
|
642
|
+
export {
|
|
643
|
+
W as UniverDocsHyperLinkUIPlugin
|
|
644
|
+
};
|
package/lib/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.univer-doc-link{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:12px;box-shadow:var(--box-shadow-base);border-radius:8px;border:1px solid rgb(var(--grey-200));background:rgb(var(--color-white));max-width:328px;overflow:hidden}.univer-doc-link-type{height:20px;width:20px;font-size:16px;margin-right:8px;display:flex;align-items:center;justify-content:center;flex:0 0 auto;color:rgb(var(--color-black))}.univer-doc-link-content{height:24px;display:flex;flex-direction:row;align-items:center;font-size:13px;line-height:20px;color:rgb(var(--blue-500));cursor:pointer;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.univer-doc-link-content-error{color:rgb(var(--grey-500))}.univer-doc-link-url{flex:1;overflow:hidden;text-overflow:ellipsis}.univer-doc-link-operations{display:flex;flex-direction:row;justify-content:center;align-items:center;height:24px;flex-basis:auto;flex-grow:0;flex-shrink:0}.univer-doc-link-operation{width:24px;height:24px;margin-left:8px;font-size:16px;display:flex;flex-direction:row;justify-content:center;align-items:center;cursor:pointer;border-radius:4px}.univer-doc-link-operation-error{color:rgb(var(--grey-500))}.univer-doc-link-operation:hover{background:#ccc}.univer-docs-link-edit{border-radius:12px;border:1px solid rgb(var(--grey-200));background:rgb(var(--color-white));box-shadow:var(--box-shadow-base);padding:20px 24px;width:328px}.univer-docs-link-edit-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:24px;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:16px;color:rgb(var(--color-black))}.univer-docs-link-edit-close{width:16px;height:16px;font-size:16px;color:rgb(var(--grey-600));cursor:pointer}.univer-docs-link-edit-buttons{display:flex;flex-direction:row;justify-content:flex-end}.univer-docs-link-edit-button{margin-left:12px}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"docLink": {
|
|
3
|
+
"edit": {
|
|
4
|
+
"confirm": "Confirm",
|
|
5
|
+
"cancel": "Cancel",
|
|
6
|
+
"title": "Link",
|
|
7
|
+
"address": "Link address",
|
|
8
|
+
"placeholder": "Please input a link url",
|
|
9
|
+
"addressError": "Url is illegal!"
|
|
10
|
+
},
|
|
11
|
+
"info": {
|
|
12
|
+
"copy": "Copy",
|
|
13
|
+
"edit": "Edit",
|
|
14
|
+
"cancel": "Cancel link",
|
|
15
|
+
"coped": "Link copied to clipboard"
|
|
16
|
+
},
|
|
17
|
+
"menu": {
|
|
18
|
+
"tooltip": "Add link"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|