@univerjs/docs-hyper-link-ui 1.0.0-alpha.8 → 1.0.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 +14 -15
- package/lib/cjs/locale/ar-SA.js +0 -2
- package/lib/cjs/locale/ca-ES.js +0 -2
- package/lib/cjs/locale/de-DE.js +0 -2
- package/lib/cjs/locale/en-US.js +0 -2
- package/lib/cjs/locale/es-ES.js +0 -2
- package/lib/cjs/locale/fa-IR.js +0 -2
- package/lib/cjs/locale/fr-FR.js +0 -2
- package/lib/cjs/locale/id-ID.js +0 -2
- package/lib/cjs/locale/it-IT.js +0 -2
- package/lib/cjs/locale/ja-JP.js +0 -2
- package/lib/cjs/locale/ko-KR.js +0 -2
- package/lib/cjs/locale/pl-PL.js +0 -2
- package/lib/cjs/locale/pt-BR.js +0 -2
- package/lib/cjs/locale/ru-RU.js +0 -2
- package/lib/cjs/locale/sk-SK.js +0 -2
- package/lib/cjs/locale/vi-VN.js +0 -2
- package/lib/cjs/locale/zh-CN.js +0 -2
- package/lib/cjs/locale/zh-HK.js +2 -4
- package/lib/cjs/locale/zh-TW.js +2 -4
- package/lib/es/index.js +15 -16
- package/lib/es/locale/ar-SA.js +0 -2
- package/lib/es/locale/ca-ES.js +0 -2
- package/lib/es/locale/de-DE.js +0 -2
- package/lib/es/locale/en-US.js +0 -2
- package/lib/es/locale/es-ES.js +0 -2
- package/lib/es/locale/fa-IR.js +0 -2
- package/lib/es/locale/fr-FR.js +0 -2
- package/lib/es/locale/id-ID.js +0 -2
- package/lib/es/locale/it-IT.js +0 -2
- package/lib/es/locale/ja-JP.js +0 -2
- package/lib/es/locale/ko-KR.js +0 -2
- package/lib/es/locale/pl-PL.js +0 -2
- package/lib/es/locale/pt-BR.js +0 -2
- package/lib/es/locale/ru-RU.js +0 -2
- package/lib/es/locale/sk-SK.js +0 -2
- package/lib/es/locale/vi-VN.js +0 -2
- package/lib/es/locale/zh-CN.js +0 -2
- package/lib/es/locale/zh-HK.js +2 -4
- package/lib/es/locale/zh-TW.js +2 -4
- package/lib/index.css +4 -4
- package/lib/index.js +15 -16
- package/lib/locale/ar-SA.js +0 -2
- package/lib/locale/ca-ES.js +0 -2
- package/lib/locale/de-DE.js +0 -2
- package/lib/locale/en-US.js +0 -2
- package/lib/locale/es-ES.js +0 -2
- package/lib/locale/fa-IR.js +0 -2
- package/lib/locale/fr-FR.js +0 -2
- package/lib/locale/id-ID.js +0 -2
- package/lib/locale/it-IT.js +0 -2
- package/lib/locale/ja-JP.js +0 -2
- package/lib/locale/ko-KR.js +0 -2
- package/lib/locale/pl-PL.js +0 -2
- package/lib/locale/pt-BR.js +0 -2
- package/lib/locale/ru-RU.js +0 -2
- package/lib/locale/sk-SK.js +0 -2
- package/lib/locale/vi-VN.js +0 -2
- package/lib/locale/zh-CN.js +0 -2
- package/lib/locale/zh-HK.js +2 -4
- package/lib/locale/zh-TW.js +2 -4
- package/lib/types/locale/en-US.d.ts +0 -2
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +11 -11
package/lib/es/locale/zh-CN.js
CHANGED
package/lib/es/locale/zh-HK.js
CHANGED
|
@@ -3,11 +3,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "確認",
|
|
5
5
|
cancel: "取消",
|
|
6
|
-
title: "連結",
|
|
7
6
|
address: "連結",
|
|
8
|
-
label: "
|
|
9
|
-
labelError: "
|
|
10
|
-
placeholder: "請輸入合法的連結",
|
|
7
|
+
label: "文字",
|
|
8
|
+
labelError: "請輸入連結文字",
|
|
11
9
|
addressError: "請輸入合法的連結"
|
|
12
10
|
},
|
|
13
11
|
info: {
|
package/lib/es/locale/zh-TW.js
CHANGED
|
@@ -3,11 +3,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "確認",
|
|
5
5
|
cancel: "取消",
|
|
6
|
-
title: "連結",
|
|
7
6
|
address: "連結",
|
|
8
|
-
label: "
|
|
9
|
-
labelError: "
|
|
10
|
-
placeholder: "請輸入合法的連結",
|
|
7
|
+
label: "文字",
|
|
8
|
+
labelError: "請輸入連結文字",
|
|
11
9
|
addressError: "請輸入合法的連結"
|
|
12
10
|
},
|
|
13
11
|
info: {
|
package/lib/index.css
CHANGED
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
border-radius: .75rem;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
.univer-bg-
|
|
94
|
-
background-color: var(--univer-
|
|
93
|
+
.univer-bg-gray-0 {
|
|
94
|
+
background-color: var(--univer-gray-0);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.univer-p-3 {
|
|
@@ -141,6 +141,6 @@
|
|
|
141
141
|
background-color: var(--univer-gray-900) !important;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
.dark\:\!univer-text-
|
|
145
|
-
color: var(--univer-
|
|
144
|
+
.dark\:\!univer-text-gray-0:where(.univer-dark, .univer-dark *) {
|
|
145
|
+
color: var(--univer-gray-0) !important;
|
|
146
146
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DocCanvasPopManagerService, DocEventManagerService, DocRenderController, EMPTY_PARAGRAPH_MENU_ID, FLOAT_TOOLBAR_MENU_POSITION, INSERT_BELLOW_MENU_ID, UniverDocsUIPlugin, whenDocAndEditorFocused } from "@univerjs/docs-ui";
|
|
2
|
-
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, IMessageService, IShortcutService, IconManager, KeyCode, MenuItemType, MetaKeys, RibbonInsertGroup,
|
|
2
|
+
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, IMessageService, IShortcutService, IconManager, KeyCode, MenuItemType, MetaKeys, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
3
3
|
import { BuildTextUtils, CommandType, CustomRangeType, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DependentOn, Disposable, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, LocaleService, Plugin, Tools, UniverInstanceType, generateRandomId, getBodySlice, isSafeUrl, merge } from "@univerjs/core";
|
|
4
4
|
import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, SetTextSelectionsOperation, UniverDocsPlugin, addCustomRangeBySelectionFactory, deleteCustomRangeFactory, replaceSelectionFactory } from "@univerjs/docs";
|
|
5
5
|
import { BehaviorSubject, Observable, debounceTime, distinctUntilChanged, pairwise } from "rxjs";
|
|
@@ -118,7 +118,7 @@ const DocHyperLinkEdit = () => {
|
|
|
118
118
|
const isLegal = Tools.isLegalUrl(link);
|
|
119
119
|
const doc = editing ? univerInstanceService.getUnit(editing.unitId, UniverInstanceType.UNIVER_DOC) : univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
120
120
|
useEffect(() => {
|
|
121
|
-
var _doc$getSelfOrHeaderF2, _BuildTextUtils$custo
|
|
121
|
+
var _doc$getSelfOrHeaderF2, _BuildTextUtils$custo;
|
|
122
122
|
const activeRange = docSelectionManagerService.getActiveTextRange();
|
|
123
123
|
if (!activeRange) return;
|
|
124
124
|
if (editing) {
|
|
@@ -126,18 +126,18 @@ const DocHyperLinkEdit = () => {
|
|
|
126
126
|
const body = doc === null || doc === void 0 || (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(editing.segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody();
|
|
127
127
|
const matchedRange = body === null || body === void 0 || (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((i) => (editing === null || editing === void 0 ? void 0 : editing.linkId) === i.rangeId && i.startIndex === editing.startIndex && i.endIndex === editing.endIndex);
|
|
128
128
|
if (doc && matchedRange) {
|
|
129
|
-
var _matchedRange$propert
|
|
130
|
-
setLink((_matchedRange$propert =
|
|
129
|
+
var _matchedRange$propert;
|
|
130
|
+
setLink(((_matchedRange$propert = matchedRange.properties) === null || _matchedRange$propert === void 0 ? void 0 : _matchedRange$propert.url) ?? "");
|
|
131
131
|
setLabel(BuildTextUtils.transform.getPlainText(getBodySlice(body, matchedRange.startIndex, matchedRange.endIndex + 1).dataStream));
|
|
132
132
|
}
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
const body = doc === null || doc === void 0 || (_doc$getSelfOrHeaderF2 = doc.getSelfOrHeaderFooterModel(activeRange.segmentId)) === null || _doc$getSelfOrHeaderF2 === void 0 ? void 0 : _doc$getSelfOrHeaderF2.getBody();
|
|
136
136
|
const selection = body ? activeRange : null;
|
|
137
|
-
const matchedRange = selection && ((_BuildTextUtils$custo = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (
|
|
137
|
+
const matchedRange = selection && ((_BuildTextUtils$custo = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (body === null || body === void 0 ? void 0 : body.customRanges) ?? [])) === null || _BuildTextUtils$custo === void 0 ? void 0 : _BuildTextUtils$custo[0]);
|
|
138
138
|
if (doc && matchedRange) {
|
|
139
|
-
var _matchedRange$
|
|
140
|
-
setLink((
|
|
139
|
+
var _matchedRange$propert2;
|
|
140
|
+
setLink((matchedRange === null || matchedRange === void 0 || (_matchedRange$propert2 = matchedRange.properties) === null || _matchedRange$propert2 === void 0 ? void 0 : _matchedRange$propert2.url) ?? "");
|
|
141
141
|
}
|
|
142
142
|
}, [
|
|
143
143
|
doc,
|
|
@@ -170,7 +170,7 @@ const DocHyperLinkEdit = () => {
|
|
|
170
170
|
};
|
|
171
171
|
if (!doc) return;
|
|
172
172
|
return /* @__PURE__ */ jsxs("div", {
|
|
173
|
-
className: clsx("univer-box-border univer-w-[328px] univer-rounded-xl univer-bg-
|
|
173
|
+
className: clsx("univer-box-border univer-w-[328px] univer-rounded-xl univer-bg-gray-0 univer-px-6 univer-py-5 univer-shadow dark:!univer-bg-gray-900", borderClassName),
|
|
174
174
|
children: [/* @__PURE__ */ jsxs("div", { children: [editing ? /* @__PURE__ */ jsx(FormLayout, {
|
|
175
175
|
label: localeService.t("docs-hyper-link-ui.edit.label"),
|
|
176
176
|
error: showError && isBlankInput(label) ? localeService.t("docs-hyper-link-ui.edit.labelError") : "",
|
|
@@ -246,7 +246,7 @@ const DocLinkPopup = () => {
|
|
|
246
246
|
if (!link) return null;
|
|
247
247
|
const url = (_link$properties = link.properties) === null || _link$properties === void 0 ? void 0 : _link$properties.url;
|
|
248
248
|
return /* @__PURE__ */ jsxs("div", {
|
|
249
|
-
className: clsx("univer-box-border univer-flex univer-max-w-80 univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-
|
|
249
|
+
className: clsx("univer-box-border univer-flex univer-max-w-80 univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-3 univer-shadow dark:!univer-bg-gray-900", borderClassName),
|
|
250
250
|
onClick: () => {
|
|
251
251
|
hyperLinkService.hideInfoPopup();
|
|
252
252
|
},
|
|
@@ -254,7 +254,7 @@ const DocLinkPopup = () => {
|
|
|
254
254
|
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",
|
|
255
255
|
onClick: () => window.open(url, void 0, "noopener noreferrer"),
|
|
256
256
|
children: [/* @__PURE__ */ jsx("div", {
|
|
257
|
-
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-
|
|
257
|
+
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-gray-0",
|
|
258
258
|
children: /* @__PURE__ */ jsx(LinkIcon, {})
|
|
259
259
|
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
260
260
|
showIfEllipsis: true,
|
|
@@ -588,7 +588,7 @@ const menuSchema = {
|
|
|
588
588
|
//#endregion
|
|
589
589
|
//#region package.json
|
|
590
590
|
var name = "@univerjs/docs-hyper-link-ui";
|
|
591
|
-
var version = "1.0.0-
|
|
591
|
+
var version = "1.0.0-beta.1";
|
|
592
592
|
|
|
593
593
|
//#endregion
|
|
594
594
|
//#region src/config/config.ts
|
|
@@ -653,8 +653,7 @@ let DocHyperLinkSelectionController = class DocHyperLinkSelectionController exte
|
|
|
653
653
|
const { startOffset, endOffset, collapsed, segmentPage } = primary;
|
|
654
654
|
const customRanges = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.getBody()) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.customRanges;
|
|
655
655
|
if (collapsed) {
|
|
656
|
-
|
|
657
|
-
const index = (_customRanges$findInd = customRanges === null || customRanges === void 0 ? void 0 : customRanges.findIndex((value) => value.startIndex < startOffset && value.endIndex > endOffset - 1)) !== null && _customRanges$findInd !== void 0 ? _customRanges$findInd : -1;
|
|
656
|
+
const index = (customRanges === null || customRanges === void 0 ? void 0 : customRanges.findIndex((value) => value.startIndex < startOffset && value.endIndex > endOffset - 1)) ?? -1;
|
|
658
657
|
if (index > -1) {
|
|
659
658
|
const customRange = customRanges[index];
|
|
660
659
|
this._docHyperLinkService.showInfoPopup({
|
|
@@ -704,11 +703,11 @@ let DocHyperLinkEventRenderController = class DocHyperLinkEventRenderController
|
|
|
704
703
|
}
|
|
705
704
|
_initHover() {
|
|
706
705
|
this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe((ranges) => {
|
|
707
|
-
var _activeRanges
|
|
706
|
+
var _activeRanges$;
|
|
708
707
|
const link = ranges.find((range) => range.range.rangeType === CustomRangeType.HYPERLINK);
|
|
709
708
|
const activeRanges = this._docSelectionManagerService.getTextRanges();
|
|
710
709
|
const currentSegmentId = activeRanges === null || activeRanges === void 0 || (_activeRanges$ = activeRanges[0]) === null || _activeRanges$ === void 0 ? void 0 : _activeRanges$.segmentId;
|
|
711
|
-
if (((
|
|
710
|
+
if (((link === null || link === void 0 ? void 0 : link.segmentId) ?? "") !== currentSegmentId) {
|
|
712
711
|
this._hideInfoPopup();
|
|
713
712
|
return;
|
|
714
713
|
}
|
|
@@ -887,7 +886,7 @@ _defineProperty(UniverDocsHyperLinkUIPlugin, "packageName", name);
|
|
|
887
886
|
_defineProperty(UniverDocsHyperLinkUIPlugin, "version", version);
|
|
888
887
|
_defineProperty(UniverDocsHyperLinkUIPlugin, "type", UniverInstanceType.UNIVER_DOC);
|
|
889
888
|
UniverDocsHyperLinkUIPlugin = __decorate([
|
|
890
|
-
DependentOn(UniverDocsPlugin, UniverRenderEnginePlugin, UniverDocsHyperLinkPlugin,
|
|
889
|
+
DependentOn(UniverDocsPlugin, UniverRenderEnginePlugin, UniverDocsHyperLinkPlugin, UniverDocsUIPlugin),
|
|
891
890
|
__decorateParam(1, Inject(Injector)),
|
|
892
891
|
__decorateParam(2, IRenderManagerService),
|
|
893
892
|
__decorateParam(3, IConfigService)
|
package/lib/locale/ar-SA.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "تأكيد",
|
|
5
5
|
cancel: "إلغاء",
|
|
6
|
-
title: "ارتباط",
|
|
7
6
|
address: "ارتباط",
|
|
8
|
-
placeholder: "يُرجى إدخال عنوان URL للارتباط",
|
|
9
7
|
addressError: "عنوان URL غير قانوني!",
|
|
10
8
|
label: "تسمية",
|
|
11
9
|
labelError: "يُرجى إدخال تسمية الارتباط"
|
package/lib/locale/ca-ES.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Confirma",
|
|
5
5
|
cancel: "Cancel·la",
|
|
6
|
-
title: "Enllaç",
|
|
7
6
|
address: "Enllaç",
|
|
8
|
-
placeholder: "Si us plau, introdueix una URL",
|
|
9
7
|
addressError: "La URL no és vàlida!",
|
|
10
8
|
label: "Etiqueta",
|
|
11
9
|
labelError: "Si us plau, introdueix l'etiqueta de l'enllaç"
|
package/lib/locale/de-DE.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Bestätigen",
|
|
5
5
|
cancel: "Abbrechen",
|
|
6
|
-
title: "Link",
|
|
7
6
|
address: "Link",
|
|
8
|
-
placeholder: "Bitte eine Link-URL eingeben",
|
|
9
7
|
addressError: "URL ist ungültig!",
|
|
10
8
|
label: "Bezeichnung",
|
|
11
9
|
labelError: "Bitte die Bezeichnung des Links eingeben"
|
package/lib/locale/en-US.js
CHANGED
|
@@ -18,9 +18,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
18
18
|
edit: {
|
|
19
19
|
confirm: "Confirm",
|
|
20
20
|
cancel: "Cancel",
|
|
21
|
-
title: "Link",
|
|
22
21
|
address: "Link",
|
|
23
|
-
placeholder: "Please input a link url",
|
|
24
22
|
addressError: "Url is illegal!",
|
|
25
23
|
label: "Label",
|
|
26
24
|
labelError: "Please input label of link"
|
package/lib/locale/es-ES.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Confirmar",
|
|
5
5
|
cancel: "Cancelar",
|
|
6
|
-
title: "Enlace",
|
|
7
6
|
address: "Enlace",
|
|
8
|
-
placeholder: "Por favor, introduce una URL",
|
|
9
7
|
addressError: "¡La URL no es válida!",
|
|
10
8
|
label: "Etiqueta",
|
|
11
9
|
labelError: "Por favor, introduce la etiqueta del enlace"
|
package/lib/locale/fa-IR.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "تایید",
|
|
5
5
|
cancel: "انصراف",
|
|
6
|
-
title: "لینک",
|
|
7
6
|
address: "لینک",
|
|
8
|
-
placeholder: "لطفا یک آدرس لینک وارد کنید",
|
|
9
7
|
addressError: "آدرس غیرمجاز است!",
|
|
10
8
|
label: "برچسب",
|
|
11
9
|
labelError: "لطفا برچسب لینک را وارد کنید"
|
package/lib/locale/fr-FR.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Confirmer",
|
|
5
5
|
cancel: "Annuler",
|
|
6
|
-
title: "Lien",
|
|
7
6
|
address: "Lien",
|
|
8
|
-
placeholder: "Veuillez entrer un lien",
|
|
9
7
|
addressError: "L'url est illégal!",
|
|
10
8
|
label: "Libellé",
|
|
11
9
|
labelError: "Veuillez entrer le label du lien"
|
package/lib/locale/id-ID.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Konfirmasi",
|
|
5
5
|
cancel: "Batal",
|
|
6
|
-
title: "Tautan",
|
|
7
6
|
address: "Tautan",
|
|
8
|
-
placeholder: "Silakan masukkan URL tautan",
|
|
9
7
|
addressError: "URL tidak valid!",
|
|
10
8
|
label: "Label",
|
|
11
9
|
labelError: "Silakan masukkan label tautan"
|
package/lib/locale/it-IT.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Conferma",
|
|
5
5
|
cancel: "Annulla",
|
|
6
|
-
title: "Collegamento",
|
|
7
6
|
address: "Collegamento",
|
|
8
|
-
placeholder: "Inserisci un URL di collegamento",
|
|
9
7
|
addressError: "URL non valido!",
|
|
10
8
|
label: "Etichetta",
|
|
11
9
|
labelError: "Inserisci l'etichetta del collegamento"
|
package/lib/locale/ja-JP.js
CHANGED
package/lib/locale/ko-KR.js
CHANGED
package/lib/locale/pl-PL.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Potwierdź",
|
|
5
5
|
cancel: "Anuluj",
|
|
6
|
-
title: "Łącze",
|
|
7
6
|
address: "Łącze",
|
|
8
|
-
placeholder: "Wprowadź adres URL",
|
|
9
7
|
addressError: "Adres URL jest nieprawidłowy!",
|
|
10
8
|
label: "Etykieta",
|
|
11
9
|
labelError: "Wprowadź etykietę łącza"
|
package/lib/locale/pt-BR.js
CHANGED
|
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Confirmar",
|
|
5
5
|
cancel: "Cancelar",
|
|
6
|
-
title: "Link",
|
|
7
6
|
address: "Link",
|
|
8
|
-
placeholder: "Insira uma URL de link",
|
|
9
7
|
addressError: "URL inválida!",
|
|
10
8
|
label: "Rótulo",
|
|
11
9
|
labelError: "Insira o rótulo do link"
|
package/lib/locale/ru-RU.js
CHANGED
|
@@ -3,11 +3,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Подтвердить",
|
|
5
5
|
cancel: "Отменить",
|
|
6
|
-
title: "Ссылка",
|
|
7
6
|
address: "Ссылка",
|
|
8
7
|
label: "Текст",
|
|
9
8
|
labelError: "Введите текст ссылки",
|
|
10
|
-
placeholder: "Пожалуйста, введите ссылку",
|
|
11
9
|
addressError: "Пожалуйста, введите корректную ссылку"
|
|
12
10
|
},
|
|
13
11
|
info: {
|
package/lib/locale/sk-SK.js
CHANGED
package/lib/locale/vi-VN.js
CHANGED
|
@@ -3,11 +3,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "Xác nhận",
|
|
5
5
|
cancel: "Hủy",
|
|
6
|
-
title: "Liên kết",
|
|
7
6
|
address: "Liên kết",
|
|
8
7
|
label: "Nhãn",
|
|
9
8
|
labelError: "Vui lòng nhập nhãn liên kết",
|
|
10
|
-
placeholder: "Vui lòng nhập liên kết hợp lệ",
|
|
11
9
|
addressError: "Vui lòng nhập liên kết hợp lệ"
|
|
12
10
|
},
|
|
13
11
|
info: {
|
package/lib/locale/zh-CN.js
CHANGED
package/lib/locale/zh-HK.js
CHANGED
|
@@ -3,11 +3,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "確認",
|
|
5
5
|
cancel: "取消",
|
|
6
|
-
title: "連結",
|
|
7
6
|
address: "連結",
|
|
8
|
-
label: "
|
|
9
|
-
labelError: "
|
|
10
|
-
placeholder: "請輸入合法的連結",
|
|
7
|
+
label: "文字",
|
|
8
|
+
labelError: "請輸入連結文字",
|
|
11
9
|
addressError: "請輸入合法的連結"
|
|
12
10
|
},
|
|
13
11
|
info: {
|
package/lib/locale/zh-TW.js
CHANGED
|
@@ -3,11 +3,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
3
3
|
edit: {
|
|
4
4
|
confirm: "確認",
|
|
5
5
|
cancel: "取消",
|
|
6
|
-
title: "連結",
|
|
7
6
|
address: "連結",
|
|
8
|
-
label: "
|
|
9
|
-
labelError: "
|
|
10
|
-
placeholder: "請輸入合法的連結",
|
|
7
|
+
label: "文字",
|
|
8
|
+
labelError: "請輸入連結文字",
|
|
11
9
|
addressError: "請輸入合法的連結"
|
|
12
10
|
},
|
|
13
11
|
info: {
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/docs-ui"),require("@univerjs/ui"),require("@univerjs/core"),require("@univerjs/docs"),require("rxjs"),require("@univerjs/design"),require("react"),require("react/jsx-runtime"),require("@univerjs/docs-hyper-link"),require("@univerjs/engine-render")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/docs-ui`,`@univerjs/ui`,`@univerjs/core`,`@univerjs/docs`,`rxjs`,`@univerjs/design`,`react`,`react/jsx-runtime`,`@univerjs/docs-hyper-link`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsHyperLinkUi={},e.UniverDocsUi,e.UniverUi,e.UniverCore,e.UniverDocs,e.rxjs,e.UniverDesign,e.React,e.React,e.UniverDocsHyperLink,e.UniverEngineRender))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let d={type:r.CommandType.COMMAND,id:`docs.command.add-hyper-link`,async handler(e,t){if(!t)return!1;let{payload:n,unitId:a,selections:o}=t,s=e.get(r.ICommandService),c=(0,i.addCustomRangeBySelectionFactory)(e,{rangeId:(0,r.generateRandomId)(),rangeType:r.CustomRangeType.HYPERLINK,properties:{url:n},unitId:a,selections:o});return c?s.syncExecuteCommand(c.id,c.params):!1}},f={id:`docs.command.update-hyper-link`,type:r.CommandType.COMMAND,handler(e,t){var n,a;if(!t)return!1;let{unitId:o,payload:s,segmentId:c,linkId:l}=t,u=e.get(r.ICommandService),d=e.get(r.IUniverInstanceService),f=e.get(i.DocSelectionManagerService).getActiveTextRange(),p=d.getUnit(o,r.UniverInstanceType.UNIVER_DOC);if(!f||!p)return!1;let m=(n=p.getSelfOrHeaderFooterModel(c))==null?void 0:n.getBody();if(!m)return!1;let h=(a=(0,r.getBodySlice)(m,f.startOffset,f.endOffset).textRuns)==null?void 0:a[0];h&&(h.ed=t.label.length+1);let g=(0,i.replaceSelectionFactory)(e,{unitId:o,body:{dataStream:`${t.label}`,customRanges:[{rangeId:l,rangeType:r.CustomRangeType.HYPERLINK,startIndex:0,endIndex:t.label.length+1,properties:{url:s}}],textRuns:h?[h]:void 0},selection:{startOffset:f.startOffset,endOffset:f.endOffset,collapsed:!1,segmentId:c}});return g?u.syncExecuteCommand(g.id,g.params):!1}};function p(e){return e.trim().length===0}function m(e){return/^[a-zA-Z]+:\/\//.test(e)}function h(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function g(e){return m(e)?e:h(e)?`mailto://${e}`:`https://${e}`}let _=()=>{let e=(0,n.useDependency)(L),t=(0,n.useDependency)(r.LocaleService),a=(0,n.useObservable)(e.editingLink$),l=(0,n.useDependency)(r.ICommandService),u=(0,n.useDependency)(r.IUniverInstanceService),m=(0,n.useDependency)(i.DocSelectionManagerService),[h,_]=(0,s.useState)(``),[v,y]=(0,s.useState)(``),[b,x]=(0,s.useState)(!1),S=r.Tools.isLegalUrl(h),C=a?u.getUnit(a.unitId,r.UniverInstanceType.UNIVER_DOC):u.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_DOC);(0,s.useEffect)(()=>{var e,t,n;let i=m.getActiveTextRange();if(!i)return;if(a){var o,s;let e=C==null||(o=C.getSelfOrHeaderFooterModel(a.segmentId))==null?void 0:o.getBody(),t=e==null||(s=e.customRanges)==null?void 0:s.find(e=>(a==null?void 0:a.linkId)===e.rangeId&&e.startIndex===a.startIndex&&e.endIndex===a.endIndex);if(C&&t){var c,l;_((c=(l=t.properties)==null?void 0:l.url)==null?``:c),y(r.BuildTextUtils.transform.getPlainText((0,r.getBodySlice)(e,t.startIndex,t.endIndex+1).dataStream))}return}let u=C==null||(e=C.getSelfOrHeaderFooterModel(i.segmentId))==null?void 0:e.getBody(),d=u?i:null,f=d&&((t=r.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(d,(n=u==null?void 0:u.customRanges)==null?[]:n))==null?void 0:t[0]);if(C&&f){var p,h;_((p=f==null||(h=f.properties)==null?void 0:h.url)==null?``:p)}},[C,a,m,u]);let w=()=>{e.hideEditPopup()},T=()=>{if(x(!0),!S||!C)return;let t=g(h);if(!a)l.executeCommand(d.id,{unitId:C.getUnitId(),payload:t});else{if(p(v))return;l.executeCommand(f.id,{unitId:C.getUnitId(),payload:t,linkId:a.linkId,label:v,segmentId:a.segmentId})}e.hideEditPopup()};if(C)return(0,c.jsxs)(`div`,{className:(0,o.clsx)(`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`,o.borderClassName),children:[(0,c.jsxs)(`div`,{children:[a?(0,c.jsx)(o.FormLayout,{label:t.t(`docs-hyper-link-ui.edit.label`),error:b&&p(v)?t.t(`docs-hyper-link-ui.edit.labelError`):``,children:(0,c.jsx)(o.Input,{value:v,onChange:y,autoFocus:!0,onKeyDown:e=>{e.keyCode===n.KeyCode.ENTER&&T()}})}):null,(0,c.jsx)(o.FormLayout,{label:t.t(`docs-hyper-link-ui.edit.address`),error:b&&!S?t.t(`docs-hyper-link-ui.edit.addressError`):``,children:(0,c.jsx)(o.Input,{value:h,onChange:_,autoFocus:!0,onKeyDown:e=>{e.keyCode===n.KeyCode.ENTER&&T()}})})]}),(0,c.jsxs)(`div`,{className:`univer-flex univer-justify-end univer-gap-3`,children:[(0,c.jsx)(o.Button,{onClick:w,children:t.t(`docs-hyper-link-ui.edit.cancel`)}),(0,c.jsx)(o.Button,{variant:`primary`,disabled:p(h),onClick:T,children:t.t(`docs-hyper-link-ui.edit.confirm`)})]})]})};_.componentKey=`docs-hyper-link-edit`;function v({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,s.useRef)(`_${S()}`);return y(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...o},a)}function y(e,t,n,r,i){return(0,s.createElement)(e.tag,{key:t,...b(e,n,i),...r},(x(e,n).children||[]).map((r,a)=>y(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function b(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function x(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function S(){return Math.random().toString(36).substring(2,8)}v.displayName=`UniverIcon`;let C={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`}}]},w=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`copy-icon`,ref:t,icon:C}))});w.displayName=`CopyIcon`;let T={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`}}]},E=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`link-icon`,ref:t,icon:T}))});E.displayName=`LinkIcon`;let ee={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`}}]},D=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`unlink-icon`,ref:t,icon:ee}))});D.displayName=`UnlinkIcon`;let O={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`}}]},k=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`write-icon`,ref:t,icon:O}))});k.displayName=`WriteIcon`;let A={type:r.CommandType.COMMAND,id:`docs.command.delete-hyper-link`,async handler(e,t){if(!t)return!1;let{unitId:n,linkId:a,segmentId:o}=t,s=e.get(r.ICommandService),c=(0,i.deleteCustomRangeFactory)(e,{unitId:n,rangeId:a,segmentId:o});return c?await s.syncExecuteCommand(c.id,c.params):!1}},j=()=>{var e,t,i;let a=(0,n.useDependency)(L),s=(0,n.useDependency)(r.ICommandService),l=(0,n.useDependency)(n.IMessageService),u=(0,n.useDependency)(r.LocaleService),d=(0,n.useObservable)(a.showingLink$),f=(0,n.useDependency)(r.IUniverInstanceService);if(!d)return null;let{unitId:p,linkId:m,segmentId:h,startIndex:g,endIndex:_}=d,v=f.getUnit(p,r.UniverInstanceType.UNIVER_DOC),y=v==null||(e=v.getSelfOrHeaderFooterModel(h))==null?void 0:e.getBody(),b=y==null||(t=y.customRanges)==null?void 0:t.find(e=>e.rangeId===m&&e.rangeType===r.CustomRangeType.HYPERLINK&&e.startIndex===g&&e.endIndex===_);if(!b)return null;let x=(i=b.properties)==null?void 0:i.url;return(0,c.jsxs)(`div`,{className:(0,o.clsx)(`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`,o.borderClassName),onClick:()=>{a.hideInfoPopup()},children:[(0,c.jsxs)(`div`,{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`,onClick:()=>window.open(x,void 0,`noopener noreferrer`),children:[(0,c.jsx)(`div`,{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`,children:(0,c.jsx)(E,{})}),(0,c.jsx)(o.Tooltip,{showIfEllipsis:!0,title:x,children:(0,c.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:x})})]}),(0,c.jsxs)(`div`,{className:`univer-flex univer-h-6 univer-flex-[0_0_auto] univer-items-center univer-justify-center`,children:[(0,c.jsx)(`div`,{className:`univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base`,onClick:()=>{navigator.clipboard.writeText(x),l.show({content:u.t(`docs-hyper-link-ui.info.coped`),type:o.MessageType.Info})},children:(0,c.jsx)(o.Tooltip,{placement:`bottom`,title:u.t(`docs-hyper-link-ui.info.copy`),children:(0,c.jsx)(w,{})})}),(0,c.jsx)(`div`,{className:`univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base`,onClick:()=>{s.executeCommand(z.id,{link:d})},children:(0,c.jsx)(o.Tooltip,{placement:`bottom`,title:u.t(`docs-hyper-link-ui.info.edit`),children:(0,c.jsx)(k,{})})}),(0,c.jsx)(`div`,{className:`univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base`,onClick:()=>{s.executeCommand(A.id,{unitId:p,linkId:b.rangeId,segmentId:h})},children:(0,c.jsx)(o.Tooltip,{placement:`bottom`,title:u.t(`docs-hyper-link-ui.info.cancel`),children:(0,c.jsx)(D,{})})})]})]})};j.componentKey=`univer.doc.link-info-popup`;function M(e){"@babel/helpers - typeof";return M=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},M(e)}function te(e,t){if(M(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(M(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function N(e){var t=te(e,`string`);return M(t)==`symbol`?t:t+``}function P(e,t,n){return(t=N(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){return function(n,r){t(n,r,e)}}function I(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let L=class extends r.Disposable{constructor(e,t,n){super(),this._docCanvasPopupManagerService=e,this._textSelectionManagerService=t,this._univerInstanceService=n,P(this,`_editingLink$`,new a.BehaviorSubject(null)),P(this,`_showingLink$`,new a.BehaviorSubject(null)),P(this,`editingLink$`,this._editingLink$.asObservable()),P(this,`showingLink$`,this._showingLink$.asObservable()),P(this,`_editPopup`,null),P(this,`_infoPopup`,null),this.disposeWithMe(()=>{this._editingLink$.complete(),this._showingLink$.complete()})}get editing(){return this._editingLink$.value}get showing(){return this._showingLink$.value}showEditPopup(e,t){this._editPopup&&this._editPopup.dispose(),this._editingLink$.next(t);let n=this._textSelectionManagerService.getTextRanges({unitId:e,subUnitId:e}),r=n==null?void 0:n[n.length-1];if(t){let{segmentId:e,segmentPage:n,startIndex:i,endIndex:a}=t;r={collapsed:!1,startOffset:i,endOffset:a+1,segmentId:e,segmentPage:n},this._textSelectionManagerService.replaceDocRanges([{startOffset:i,endOffset:a+1}])}return r?(this._editPopup=this._docCanvasPopupManagerService.attachPopupToRange(r,{componentKey:_.componentKey,direction:`bottom`},e),this._editPopup):null}hideEditPopup(){var e;this._editingLink$.next(null),(e=this._editPopup)==null||e.dispose()}showInfoPopup(e){var t,n,i,a,o,s;let{linkId:c,unitId:l,segmentId:u,segmentPage:d,startIndex:f,endIndex:p}=e;if((((t=this.showing)==null?void 0:t.linkId)!==c||((n=this.showing)==null?void 0:n.unitId)!==l||((i=this.showing)==null?void 0:i.segmentId)!==u||((a=this.showing)==null?void 0:a.segmentPage)!==d||((o=this.showing)==null?void 0:o.startIndex)!==f||((s=this.showing)==null?void 0:s.endIndex)!==p)&&(this._infoPopup&&this._infoPopup.dispose(),this._univerInstanceService.getUnit(l,r.UniverInstanceType.UNIVER_DOC)))return this._showingLink$.next({unitId:l,linkId:c,segmentId:u,segmentPage:d,startIndex:f,endIndex:p}),this._infoPopup=this._docCanvasPopupManagerService.attachPopupToRange({collapsed:!1,startOffset:f,endOffset:p+1,segmentId:u,segmentPage:d},{componentKey:j.componentKey,direction:`top-center`,multipleDirection:`top`,onClickOutside:()=>{this.hideInfoPopup()}},l),this._infoPopup}hideInfoPopup(){var e;this._showingLink$.next(null),(e=this._infoPopup)==null||e.dispose()}};L=I([F(0,(0,r.Inject)(t.DocCanvasPopManagerService)),F(1,(0,r.Inject)(i.DocSelectionManagerService)),F(2,r.IUniverInstanceService)],L);let R=e=>{let t=e.get(i.DocSelectionManagerService),n=e.get(r.IUniverInstanceService),a=t.getTextRanges();if(!(a!=null&&a.length))return!0;let o=a[0];return!!(!n.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_DOC)||!o||o.collapsed)},z={type:r.CommandType.OPERATION,id:`doc.operation.show-hyper-link-edit-popup`,handler(e,t){var n;let i=t==null?void 0:t.link,a=e.get(r.IUniverInstanceService);if(R(e)&&!i)return!1;let o=e.get(L),s=(i==null?void 0:i.unitId)||((n=a.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_DOC))==null?void 0:n.getUnitId());return s?(o.showEditPopup(s,i),!0):!1}},B={type:r.CommandType.OPERATION,id:`doc.operation.toggle-hyper-link-info-popup`,handler(e,t){let n=e.get(L);return t?(n.showInfoPopup(t),!0):(n.hideInfoPopup(),!0)}},V={type:r.CommandType.OPERATION,id:`doc.operation.click-hyper-link`,handler(e,t){var n,i;if(!t)return!1;let{unitId:a,linkId:o,segmentId:s}=t,c=e.get(r.IUniverInstanceService).getUnit(a,r.UniverInstanceType.UNIVER_DOC),l=c==null||(n=c.getSelfOrHeaderFooterModel(s))==null?void 0:n.getBody(),u=l==null||(i=l.customRanges)==null||(i=i.find(e=>e.rangeId===o&&e.rangeType===r.CustomRangeType.HYPERLINK))==null||(i=i.properties)==null?void 0:i.url;return(0,r.isSafeUrl)(u)?(window.open(u,`_blank`,`noopener noreferrer`),!0):!1}};function H(e){return{id:z.id,type:n.MenuItemType.BUTTON,icon:`LinkIcon`,title:`docs-hyper-link-ui.menu.tooltip`,tooltip:`docs-hyper-link-ui.menu.tooltip`,hidden$:(0,n.getMenuHiddenObservable)(e,r.UniverInstanceType.UNIVER_DOC),disabled$:new a.Observable(function(t){let n=e.get(i.DocSelectionManagerService).textSelection$.pipe((0,a.debounceTime)(16)).subscribe(()=>{t.next(R(e))});return()=>{n.unsubscribe()}})}}let U={id:z.id,binding:n.MetaKeys.CTRL_COMMAND|n.KeyCode.K,description:`docs-hyper-link-ui.menu.tooltip`,preconditions:t.whenDocAndEditorFocused},W={[n.RibbonInsertGroup.MEDIA]:{[z.id]:{order:1,menuItemFactory:H}},[t.FLOAT_TOOLBAR_MENU_POSITION]:{[z.id]:{order:20,menuItemFactory:H}},[n.ContextMenuPosition.MAIN_AREA]:{[n.ContextMenuGroup.DATA]:{[z.id]:{order:0,menuItemFactory:H}}},[n.ContextMenuPosition.PARAGRAPH]:{[n.ContextMenuGroup.LAYOUT]:{[t.INSERT_BELLOW_MENU_ID]:{[z.id]:{order:6,menuItemFactory:H}}},[t.EMPTY_PARAGRAPH_MENU_ID]:{[n.ContextMenuGroup.LAYOUT]:{[z.id]:{order:6,menuItemFactory:H}}}}};var G=`@univerjs/docs-hyper-link-ui`,K=`1.0.0-alpha.8`;let q={},J=class extends r.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){[[_.componentKey,_],[j.componentKey,j]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_registerIcons(){this.disposeWithMe(this._iconManager.register({LinkIcon:E}))}};J=I([F(0,(0,r.Inject)(n.ComponentManager)),F(1,(0,r.Inject)(n.IconManager))],J);let Y=class extends r.Disposable{constructor(e,t,n){super(),this._commandService=e,this._univerInstanceService=t,this._docHyperLinkService=n,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===i.SetTextSelectionsOperation.id){let{unitId:i,ranges:a,segmentId:o}=e.params,s=this._univerInstanceService.getUnit(i,r.UniverInstanceType.UNIVER_DOC),c=a[0];if(c&&s){var t;let{startOffset:e,endOffset:r,collapsed:a,segmentPage:l}=c,u=(t=s.getSelfOrHeaderFooterModel(o))==null||(t=t.getBody())==null?void 0:t.customRanges;if(a){var n;let t=(n=u==null?void 0:u.findIndex(t=>t.startIndex<e&&t.endIndex>r-1))==null?-1:n;if(t>-1){let e=u[t];this._docHyperLinkService.showInfoPopup({unitId:i,linkId:e.rangeId,segmentId:o,segmentPage:l,startIndex:e.startIndex,endIndex:e.endIndex});return}}else if(u!=null&&u.find(t=>t.startIndex<=e&&t.endIndex>=r-1))return}this._docHyperLinkService.hideInfoPopup(),this._docHyperLinkService.hideEditPopup()}}))}};Y=I([F(0,r.ICommandService),F(1,r.IUniverInstanceService),F(2,(0,r.Inject)(L))],Y);let X=class extends r.Disposable{get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}constructor(e,t,n,i,a,o){super(),this._context=e,this._docEventManagerService=t,this._commandService=n,this._hyperLinkPopupService=i,this._docSkeletonManagerService=a,this._docSelectionManagerService=o,this._context.unitId!==r.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&(this._initHover(),this._initClick())}_hideInfoPopup(){this._hyperLinkPopupService.showing&&this._commandService.executeCommand(B.id)}_initHover(){this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe(e=>{var t,n;let i=e.find(e=>e.range.rangeType===r.CustomRangeType.HYPERLINK),a=this._docSelectionManagerService.getTextRanges(),o=a==null||(t=a[0])==null?void 0:t.segmentId;if(((n=i==null?void 0:i.segmentId)==null?``:n)!==o){this._hideInfoPopup();return}i?this._commandService.executeCommand(B.id,{unitId:this._context.unitId,linkId:i.range.rangeId,segmentId:i.segmentId,segmentPage:i.segmentPageIndex,rangeId:i.range.rangeId,startIndex:i.range.startIndex,endIndex:i.range.endIndex}):this._hideInfoPopup()}))}_initClick(){this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(e=>{let t=e.range;t&&this._commandService.executeCommand(V.id,{unitId:this._context.unitId,linkId:t.rangeId,segmentId:e.segmentId})}))}};X=I([F(1,(0,r.Inject)(t.DocEventManagerService)),F(2,r.ICommandService),F(3,(0,r.Inject)(L)),F(4,(0,r.Inject)(i.DocSkeletonManagerService)),F(5,(0,r.Inject)(i.DocSelectionManagerService))],X);let Z=class extends r.Disposable{constructor(e,t,n,r){super(),this._context=e,this._docInterceptorService=t,this._hyperLinkService=n,this._docRenderController=r,this._init(),this._initReRender()}_init(){this._docInterceptorService.intercept(i.DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{handler:(e,t,n)=>{if(!e)return n(e);let{unitId:r,index:i}=t,a=this._hyperLinkService.showing;if(!a)return n({...e,active:!1});let{linkId:o,unitId:s,startIndex:c,endIndex:l}=a,u=s===r&&e.rangeId===o&&i>=c&&i<=l;return n({...e,active:u})}})}_initReRender(){this.disposeWithMe(this._hyperLinkService.showingLink$.pipe((0,a.distinctUntilChanged)((e,t)=>(e==null?void 0:e.linkId)===(t==null?void 0:t.linkId)&&(e==null?void 0:e.unitId)===(t==null?void 0:t.unitId)&&(e==null?void 0:e.startIndex)===(t==null?void 0:t.startIndex)),(0,a.pairwise)()).subscribe(([e,t])=>{t?t.unitId===this._context.unitId&&this._docRenderController.reRender(t.unitId):e&&e.unitId===this._context.unitId&&this._docRenderController.reRender(e.unitId)}))}};Z=I([F(1,(0,r.Inject)(i.DocInterceptorService)),F(2,(0,r.Inject)(L)),F(3,(0,r.Inject)(t.DocRenderController))],Z);let Q=class extends r.Disposable{constructor(e,t,n){super(),this._commandService=e,this._menuManagerService=t,this._shortcutService=n,this._initCommands(),this._initMenus(),this._initShortcut()}_initCommands(){[d,f,A,z,B,V].forEach(e=>{this._commandService.registerCommand(e)})}_initShortcut(){[U].forEach(e=>{this._shortcutService.registerShortcut(e)})}_initMenus(){this._menuManagerService.appendRootMenu({[t.FLOAT_TOOLBAR_MENU_POSITION]:{}}),this._menuManagerService.mergeMenu(W)}};Q=I([F(0,r.ICommandService),F(1,n.IMenuManagerService),F(2,n.IShortcutService)],Q);let $=class extends r.Plugin{constructor(e=q,t,n,i){super(),this._config=e,this._injector=t,this._renderManagerSrv=n,this._configService=i;let{menu:a,...o}=(0,r.merge)({},q,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`docs-hyper-link-ui.config`,o)}onStarting(){this._injector.add([J]),this._injector.get(J),[[L],[Q],[Y]].forEach(e=>{this._injector.add(e)}),this._injector.get(Q)}onReady(){this._injector.get(Y)}onRendered(){this._initRenderModule()}_initRenderModule(){[[Z],[X]].forEach(e=>{this._renderManagerSrv.registerRenderModule(r.UniverInstanceType.UNIVER_DOC,e)})}};P($,`pluginName`,`DOC_HYPER_LINK_UI_PLUGIN`),P($,`packageName`,G),P($,`version`,K),P($,`type`,r.UniverInstanceType.UNIVER_DOC),$=I([(0,r.DependentOn)(i.UniverDocsPlugin,u.UniverRenderEnginePlugin,l.UniverDocsHyperLinkPlugin,n.UniverUIPlugin,t.UniverDocsUIPlugin),F(1,(0,r.Inject)(r.Injector)),F(2,u.IRenderManagerService),F(3,r.IConfigService)],$),e.DocsHyperLinkUIMenuSchema=W,Object.defineProperty(e,"UniverDocsHyperLinkUIPlugin",{enumerable:!0,get:function(){return $}})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/docs-ui"),require("@univerjs/ui"),require("@univerjs/core"),require("@univerjs/docs"),require("rxjs"),require("@univerjs/design"),require("react"),require("react/jsx-runtime"),require("@univerjs/docs-hyper-link"),require("@univerjs/engine-render")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/docs-ui`,`@univerjs/ui`,`@univerjs/core`,`@univerjs/docs`,`rxjs`,`@univerjs/design`,`react`,`react/jsx-runtime`,`@univerjs/docs-hyper-link`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsHyperLinkUi={},e.UniverDocsUi,e.UniverUi,e.UniverCore,e.UniverDocs,e.rxjs,e.UniverDesign,e.React,e.React,e.UniverDocsHyperLink,e.UniverEngineRender))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let d={type:r.CommandType.COMMAND,id:`docs.command.add-hyper-link`,async handler(e,t){if(!t)return!1;let{payload:n,unitId:a,selections:o}=t,s=e.get(r.ICommandService),c=(0,i.addCustomRangeBySelectionFactory)(e,{rangeId:(0,r.generateRandomId)(),rangeType:r.CustomRangeType.HYPERLINK,properties:{url:n},unitId:a,selections:o});return c?s.syncExecuteCommand(c.id,c.params):!1}},f={id:`docs.command.update-hyper-link`,type:r.CommandType.COMMAND,handler(e,t){var n,a;if(!t)return!1;let{unitId:o,payload:s,segmentId:c,linkId:l}=t,u=e.get(r.ICommandService),d=e.get(r.IUniverInstanceService),f=e.get(i.DocSelectionManagerService).getActiveTextRange(),p=d.getUnit(o,r.UniverInstanceType.UNIVER_DOC);if(!f||!p)return!1;let m=(n=p.getSelfOrHeaderFooterModel(c))==null?void 0:n.getBody();if(!m)return!1;let h=(a=(0,r.getBodySlice)(m,f.startOffset,f.endOffset).textRuns)==null?void 0:a[0];h&&(h.ed=t.label.length+1);let g=(0,i.replaceSelectionFactory)(e,{unitId:o,body:{dataStream:`${t.label}`,customRanges:[{rangeId:l,rangeType:r.CustomRangeType.HYPERLINK,startIndex:0,endIndex:t.label.length+1,properties:{url:s}}],textRuns:h?[h]:void 0},selection:{startOffset:f.startOffset,endOffset:f.endOffset,collapsed:!1,segmentId:c}});return g?u.syncExecuteCommand(g.id,g.params):!1}};function p(e){return e.trim().length===0}function m(e){return/^[a-zA-Z]+:\/\//.test(e)}function h(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function g(e){return m(e)?e:h(e)?`mailto://${e}`:`https://${e}`}let _=()=>{let e=(0,n.useDependency)(L),t=(0,n.useDependency)(r.LocaleService),a=(0,n.useObservable)(e.editingLink$),l=(0,n.useDependency)(r.ICommandService),u=(0,n.useDependency)(r.IUniverInstanceService),m=(0,n.useDependency)(i.DocSelectionManagerService),[h,_]=(0,s.useState)(``),[v,y]=(0,s.useState)(``),[b,x]=(0,s.useState)(!1),S=r.Tools.isLegalUrl(h),C=a?u.getUnit(a.unitId,r.UniverInstanceType.UNIVER_DOC):u.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_DOC);(0,s.useEffect)(()=>{var e,t;let n=m.getActiveTextRange();if(!n)return;if(a){var i,o;let e=C==null||(i=C.getSelfOrHeaderFooterModel(a.segmentId))==null?void 0:i.getBody(),t=e==null||(o=e.customRanges)==null?void 0:o.find(e=>(a==null?void 0:a.linkId)===e.rangeId&&e.startIndex===a.startIndex&&e.endIndex===a.endIndex);if(C&&t){var s;_(((s=t.properties)==null?void 0:s.url)??``),y(r.BuildTextUtils.transform.getPlainText((0,r.getBodySlice)(e,t.startIndex,t.endIndex+1).dataStream))}return}let c=C==null||(e=C.getSelfOrHeaderFooterModel(n.segmentId))==null?void 0:e.getBody(),l=c?n:null,u=l&&((t=r.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(l,(c==null?void 0:c.customRanges)??[]))==null?void 0:t[0]);if(C&&u){var d;_((u==null||(d=u.properties)==null?void 0:d.url)??``)}},[C,a,m,u]);let w=()=>{e.hideEditPopup()},T=()=>{if(x(!0),!S||!C)return;let t=g(h);if(!a)l.executeCommand(d.id,{unitId:C.getUnitId(),payload:t});else{if(p(v))return;l.executeCommand(f.id,{unitId:C.getUnitId(),payload:t,linkId:a.linkId,label:v,segmentId:a.segmentId})}e.hideEditPopup()};if(C)return(0,c.jsxs)(`div`,{className:(0,o.clsx)(`univer-box-border univer-w-[328px] univer-rounded-xl univer-bg-gray-0 univer-px-6 univer-py-5 univer-shadow dark:!univer-bg-gray-900`,o.borderClassName),children:[(0,c.jsxs)(`div`,{children:[a?(0,c.jsx)(o.FormLayout,{label:t.t(`docs-hyper-link-ui.edit.label`),error:b&&p(v)?t.t(`docs-hyper-link-ui.edit.labelError`):``,children:(0,c.jsx)(o.Input,{value:v,onChange:y,autoFocus:!0,onKeyDown:e=>{e.keyCode===n.KeyCode.ENTER&&T()}})}):null,(0,c.jsx)(o.FormLayout,{label:t.t(`docs-hyper-link-ui.edit.address`),error:b&&!S?t.t(`docs-hyper-link-ui.edit.addressError`):``,children:(0,c.jsx)(o.Input,{value:h,onChange:_,autoFocus:!0,onKeyDown:e=>{e.keyCode===n.KeyCode.ENTER&&T()}})})]}),(0,c.jsxs)(`div`,{className:`univer-flex univer-justify-end univer-gap-3`,children:[(0,c.jsx)(o.Button,{onClick:w,children:t.t(`docs-hyper-link-ui.edit.cancel`)}),(0,c.jsx)(o.Button,{variant:`primary`,disabled:p(h),onClick:T,children:t.t(`docs-hyper-link-ui.edit.confirm`)})]})]})};_.componentKey=`docs-hyper-link-edit`;function v({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,s.useRef)(`_${S()}`);return y(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...o},a)}function y(e,t,n,r,i){return(0,s.createElement)(e.tag,{key:t,...b(e,n,i),...r},(x(e,n).children||[]).map((r,a)=>y(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function b(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function x(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function S(){return Math.random().toString(36).substring(2,8)}v.displayName=`UniverIcon`;let C={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`}}]},w=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`copy-icon`,ref:t,icon:C}))});w.displayName=`CopyIcon`;let T={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`}}]},E=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`link-icon`,ref:t,icon:T}))});E.displayName=`LinkIcon`;let ee={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`}}]},D=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`unlink-icon`,ref:t,icon:ee}))});D.displayName=`UnlinkIcon`;let O={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`}}]},k=(0,s.forwardRef)(function(e,t){return(0,s.createElement)(v,Object.assign({},e,{id:`write-icon`,ref:t,icon:O}))});k.displayName=`WriteIcon`;let A={type:r.CommandType.COMMAND,id:`docs.command.delete-hyper-link`,async handler(e,t){if(!t)return!1;let{unitId:n,linkId:a,segmentId:o}=t,s=e.get(r.ICommandService),c=(0,i.deleteCustomRangeFactory)(e,{unitId:n,rangeId:a,segmentId:o});return c?await s.syncExecuteCommand(c.id,c.params):!1}},j=()=>{var e,t,i;let a=(0,n.useDependency)(L),s=(0,n.useDependency)(r.ICommandService),l=(0,n.useDependency)(n.IMessageService),u=(0,n.useDependency)(r.LocaleService),d=(0,n.useObservable)(a.showingLink$),f=(0,n.useDependency)(r.IUniverInstanceService);if(!d)return null;let{unitId:p,linkId:m,segmentId:h,startIndex:g,endIndex:_}=d,v=f.getUnit(p,r.UniverInstanceType.UNIVER_DOC),y=v==null||(e=v.getSelfOrHeaderFooterModel(h))==null?void 0:e.getBody(),b=y==null||(t=y.customRanges)==null?void 0:t.find(e=>e.rangeId===m&&e.rangeType===r.CustomRangeType.HYPERLINK&&e.startIndex===g&&e.endIndex===_);if(!b)return null;let x=(i=b.properties)==null?void 0:i.url;return(0,c.jsxs)(`div`,{className:(0,o.clsx)(`univer-box-border univer-flex univer-max-w-80 univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-3 univer-shadow dark:!univer-bg-gray-900`,o.borderClassName),onClick:()=>{a.hideInfoPopup()},children:[(0,c.jsxs)(`div`,{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`,onClick:()=>window.open(x,void 0,`noopener noreferrer`),children:[(0,c.jsx)(`div`,{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-gray-0`,children:(0,c.jsx)(E,{})}),(0,c.jsx)(o.Tooltip,{showIfEllipsis:!0,title:x,children:(0,c.jsx)(`span`,{className:`univer-flex-1 univer-truncate`,children:x})})]}),(0,c.jsxs)(`div`,{className:`univer-flex univer-h-6 univer-flex-[0_0_auto] univer-items-center univer-justify-center`,children:[(0,c.jsx)(`div`,{className:`univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base`,onClick:()=>{navigator.clipboard.writeText(x),l.show({content:u.t(`docs-hyper-link-ui.info.coped`),type:o.MessageType.Info})},children:(0,c.jsx)(o.Tooltip,{placement:`bottom`,title:u.t(`docs-hyper-link-ui.info.copy`),children:(0,c.jsx)(w,{})})}),(0,c.jsx)(`div`,{className:`univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base`,onClick:()=>{s.executeCommand(z.id,{link:d})},children:(0,c.jsx)(o.Tooltip,{placement:`bottom`,title:u.t(`docs-hyper-link-ui.info.edit`),children:(0,c.jsx)(k,{})})}),(0,c.jsx)(`div`,{className:`univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base`,onClick:()=>{s.executeCommand(A.id,{unitId:p,linkId:b.rangeId,segmentId:h})},children:(0,c.jsx)(o.Tooltip,{placement:`bottom`,title:u.t(`docs-hyper-link-ui.info.cancel`),children:(0,c.jsx)(D,{})})})]})]})};j.componentKey=`univer.doc.link-info-popup`;function M(e){"@babel/helpers - typeof";return M=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},M(e)}function te(e,t){if(M(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(M(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function N(e){var t=te(e,`string`);return M(t)==`symbol`?t:t+``}function P(e,t,n){return(t=N(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){return function(n,r){t(n,r,e)}}function I(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let L=class extends r.Disposable{constructor(e,t,n){super(),this._docCanvasPopupManagerService=e,this._textSelectionManagerService=t,this._univerInstanceService=n,P(this,`_editingLink$`,new a.BehaviorSubject(null)),P(this,`_showingLink$`,new a.BehaviorSubject(null)),P(this,`editingLink$`,this._editingLink$.asObservable()),P(this,`showingLink$`,this._showingLink$.asObservable()),P(this,`_editPopup`,null),P(this,`_infoPopup`,null),this.disposeWithMe(()=>{this._editingLink$.complete(),this._showingLink$.complete()})}get editing(){return this._editingLink$.value}get showing(){return this._showingLink$.value}showEditPopup(e,t){this._editPopup&&this._editPopup.dispose(),this._editingLink$.next(t);let n=this._textSelectionManagerService.getTextRanges({unitId:e,subUnitId:e}),r=n==null?void 0:n[n.length-1];if(t){let{segmentId:e,segmentPage:n,startIndex:i,endIndex:a}=t;r={collapsed:!1,startOffset:i,endOffset:a+1,segmentId:e,segmentPage:n},this._textSelectionManagerService.replaceDocRanges([{startOffset:i,endOffset:a+1}])}return r?(this._editPopup=this._docCanvasPopupManagerService.attachPopupToRange(r,{componentKey:_.componentKey,direction:`bottom`},e),this._editPopup):null}hideEditPopup(){var e;this._editingLink$.next(null),(e=this._editPopup)==null||e.dispose()}showInfoPopup(e){var t,n,i,a,o,s;let{linkId:c,unitId:l,segmentId:u,segmentPage:d,startIndex:f,endIndex:p}=e;if((((t=this.showing)==null?void 0:t.linkId)!==c||((n=this.showing)==null?void 0:n.unitId)!==l||((i=this.showing)==null?void 0:i.segmentId)!==u||((a=this.showing)==null?void 0:a.segmentPage)!==d||((o=this.showing)==null?void 0:o.startIndex)!==f||((s=this.showing)==null?void 0:s.endIndex)!==p)&&(this._infoPopup&&this._infoPopup.dispose(),this._univerInstanceService.getUnit(l,r.UniverInstanceType.UNIVER_DOC)))return this._showingLink$.next({unitId:l,linkId:c,segmentId:u,segmentPage:d,startIndex:f,endIndex:p}),this._infoPopup=this._docCanvasPopupManagerService.attachPopupToRange({collapsed:!1,startOffset:f,endOffset:p+1,segmentId:u,segmentPage:d},{componentKey:j.componentKey,direction:`top-center`,multipleDirection:`top`,onClickOutside:()=>{this.hideInfoPopup()}},l),this._infoPopup}hideInfoPopup(){var e;this._showingLink$.next(null),(e=this._infoPopup)==null||e.dispose()}};L=I([F(0,(0,r.Inject)(t.DocCanvasPopManagerService)),F(1,(0,r.Inject)(i.DocSelectionManagerService)),F(2,r.IUniverInstanceService)],L);let R=e=>{let t=e.get(i.DocSelectionManagerService),n=e.get(r.IUniverInstanceService),a=t.getTextRanges();if(!(a!=null&&a.length))return!0;let o=a[0];return!!(!n.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_DOC)||!o||o.collapsed)},z={type:r.CommandType.OPERATION,id:`doc.operation.show-hyper-link-edit-popup`,handler(e,t){var n;let i=t==null?void 0:t.link,a=e.get(r.IUniverInstanceService);if(R(e)&&!i)return!1;let o=e.get(L),s=(i==null?void 0:i.unitId)||((n=a.getCurrentUnitOfType(r.UniverInstanceType.UNIVER_DOC))==null?void 0:n.getUnitId());return s?(o.showEditPopup(s,i),!0):!1}},B={type:r.CommandType.OPERATION,id:`doc.operation.toggle-hyper-link-info-popup`,handler(e,t){let n=e.get(L);return t?(n.showInfoPopup(t),!0):(n.hideInfoPopup(),!0)}},V={type:r.CommandType.OPERATION,id:`doc.operation.click-hyper-link`,handler(e,t){var n,i;if(!t)return!1;let{unitId:a,linkId:o,segmentId:s}=t,c=e.get(r.IUniverInstanceService).getUnit(a,r.UniverInstanceType.UNIVER_DOC),l=c==null||(n=c.getSelfOrHeaderFooterModel(s))==null?void 0:n.getBody(),u=l==null||(i=l.customRanges)==null||(i=i.find(e=>e.rangeId===o&&e.rangeType===r.CustomRangeType.HYPERLINK))==null||(i=i.properties)==null?void 0:i.url;return(0,r.isSafeUrl)(u)?(window.open(u,`_blank`,`noopener noreferrer`),!0):!1}};function H(e){return{id:z.id,type:n.MenuItemType.BUTTON,icon:`LinkIcon`,title:`docs-hyper-link-ui.menu.tooltip`,tooltip:`docs-hyper-link-ui.menu.tooltip`,hidden$:(0,n.getMenuHiddenObservable)(e,r.UniverInstanceType.UNIVER_DOC),disabled$:new a.Observable(function(t){let n=e.get(i.DocSelectionManagerService).textSelection$.pipe((0,a.debounceTime)(16)).subscribe(()=>{t.next(R(e))});return()=>{n.unsubscribe()}})}}let U={id:z.id,binding:n.MetaKeys.CTRL_COMMAND|n.KeyCode.K,description:`docs-hyper-link-ui.menu.tooltip`,preconditions:t.whenDocAndEditorFocused},W={[n.RibbonInsertGroup.MEDIA]:{[z.id]:{order:1,menuItemFactory:H}},[t.FLOAT_TOOLBAR_MENU_POSITION]:{[z.id]:{order:20,menuItemFactory:H}},[n.ContextMenuPosition.MAIN_AREA]:{[n.ContextMenuGroup.DATA]:{[z.id]:{order:0,menuItemFactory:H}}},[n.ContextMenuPosition.PARAGRAPH]:{[n.ContextMenuGroup.LAYOUT]:{[t.INSERT_BELLOW_MENU_ID]:{[z.id]:{order:6,menuItemFactory:H}}},[t.EMPTY_PARAGRAPH_MENU_ID]:{[n.ContextMenuGroup.LAYOUT]:{[z.id]:{order:6,menuItemFactory:H}}}}};var G=`@univerjs/docs-hyper-link-ui`,K=`1.0.0-beta.1`;let q={},J=class extends r.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){[[_.componentKey,_],[j.componentKey,j]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_registerIcons(){this.disposeWithMe(this._iconManager.register({LinkIcon:E}))}};J=I([F(0,(0,r.Inject)(n.ComponentManager)),F(1,(0,r.Inject)(n.IconManager))],J);let Y=class extends r.Disposable{constructor(e,t,n){super(),this._commandService=e,this._univerInstanceService=t,this._docHyperLinkService=n,this._initSelectionChange()}_initSelectionChange(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===i.SetTextSelectionsOperation.id){let{unitId:n,ranges:i,segmentId:a}=e.params,o=this._univerInstanceService.getUnit(n,r.UniverInstanceType.UNIVER_DOC),s=i[0];if(s&&o){var t;let{startOffset:e,endOffset:r,collapsed:i,segmentPage:c}=s,l=(t=o.getSelfOrHeaderFooterModel(a))==null||(t=t.getBody())==null?void 0:t.customRanges;if(i){let t=(l==null?void 0:l.findIndex(t=>t.startIndex<e&&t.endIndex>r-1))??-1;if(t>-1){let e=l[t];this._docHyperLinkService.showInfoPopup({unitId:n,linkId:e.rangeId,segmentId:a,segmentPage:c,startIndex:e.startIndex,endIndex:e.endIndex});return}}else if(l!=null&&l.find(t=>t.startIndex<=e&&t.endIndex>=r-1))return}this._docHyperLinkService.hideInfoPopup(),this._docHyperLinkService.hideEditPopup()}}))}};Y=I([F(0,r.ICommandService),F(1,r.IUniverInstanceService),F(2,(0,r.Inject)(L))],Y);let X=class extends r.Disposable{get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}constructor(e,t,n,i,a,o){super(),this._context=e,this._docEventManagerService=t,this._commandService=n,this._hyperLinkPopupService=i,this._docSkeletonManagerService=a,this._docSelectionManagerService=o,this._context.unitId!==r.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&(this._initHover(),this._initClick())}_hideInfoPopup(){this._hyperLinkPopupService.showing&&this._commandService.executeCommand(B.id)}_initHover(){this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe(e=>{var t;let n=e.find(e=>e.range.rangeType===r.CustomRangeType.HYPERLINK),i=this._docSelectionManagerService.getTextRanges(),a=i==null||(t=i[0])==null?void 0:t.segmentId;if(((n==null?void 0:n.segmentId)??``)!==a){this._hideInfoPopup();return}n?this._commandService.executeCommand(B.id,{unitId:this._context.unitId,linkId:n.range.rangeId,segmentId:n.segmentId,segmentPage:n.segmentPageIndex,rangeId:n.range.rangeId,startIndex:n.range.startIndex,endIndex:n.range.endIndex}):this._hideInfoPopup()}))}_initClick(){this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(e=>{let t=e.range;t&&this._commandService.executeCommand(V.id,{unitId:this._context.unitId,linkId:t.rangeId,segmentId:e.segmentId})}))}};X=I([F(1,(0,r.Inject)(t.DocEventManagerService)),F(2,r.ICommandService),F(3,(0,r.Inject)(L)),F(4,(0,r.Inject)(i.DocSkeletonManagerService)),F(5,(0,r.Inject)(i.DocSelectionManagerService))],X);let Z=class extends r.Disposable{constructor(e,t,n,r){super(),this._context=e,this._docInterceptorService=t,this._hyperLinkService=n,this._docRenderController=r,this._init(),this._initReRender()}_init(){this._docInterceptorService.intercept(i.DOC_INTERCEPTOR_POINT.CUSTOM_RANGE,{handler:(e,t,n)=>{if(!e)return n(e);let{unitId:r,index:i}=t,a=this._hyperLinkService.showing;if(!a)return n({...e,active:!1});let{linkId:o,unitId:s,startIndex:c,endIndex:l}=a,u=s===r&&e.rangeId===o&&i>=c&&i<=l;return n({...e,active:u})}})}_initReRender(){this.disposeWithMe(this._hyperLinkService.showingLink$.pipe((0,a.distinctUntilChanged)((e,t)=>(e==null?void 0:e.linkId)===(t==null?void 0:t.linkId)&&(e==null?void 0:e.unitId)===(t==null?void 0:t.unitId)&&(e==null?void 0:e.startIndex)===(t==null?void 0:t.startIndex)),(0,a.pairwise)()).subscribe(([e,t])=>{t?t.unitId===this._context.unitId&&this._docRenderController.reRender(t.unitId):e&&e.unitId===this._context.unitId&&this._docRenderController.reRender(e.unitId)}))}};Z=I([F(1,(0,r.Inject)(i.DocInterceptorService)),F(2,(0,r.Inject)(L)),F(3,(0,r.Inject)(t.DocRenderController))],Z);let Q=class extends r.Disposable{constructor(e,t,n){super(),this._commandService=e,this._menuManagerService=t,this._shortcutService=n,this._initCommands(),this._initMenus(),this._initShortcut()}_initCommands(){[d,f,A,z,B,V].forEach(e=>{this._commandService.registerCommand(e)})}_initShortcut(){[U].forEach(e=>{this._shortcutService.registerShortcut(e)})}_initMenus(){this._menuManagerService.appendRootMenu({[t.FLOAT_TOOLBAR_MENU_POSITION]:{}}),this._menuManagerService.mergeMenu(W)}};Q=I([F(0,r.ICommandService),F(1,n.IMenuManagerService),F(2,n.IShortcutService)],Q);let $=class extends r.Plugin{constructor(e=q,t,n,i){super(),this._config=e,this._injector=t,this._renderManagerSrv=n,this._configService=i;let{menu:a,...o}=(0,r.merge)({},q,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`docs-hyper-link-ui.config`,o)}onStarting(){this._injector.add([J]),this._injector.get(J),[[L],[Q],[Y]].forEach(e=>{this._injector.add(e)}),this._injector.get(Q)}onReady(){this._injector.get(Y)}onRendered(){this._initRenderModule()}_initRenderModule(){[[Z],[X]].forEach(e=>{this._renderManagerSrv.registerRenderModule(r.UniverInstanceType.UNIVER_DOC,e)})}};P($,`pluginName`,`DOC_HYPER_LINK_UI_PLUGIN`),P($,`packageName`,G),P($,`version`,K),P($,`type`,r.UniverInstanceType.UNIVER_DOC),$=I([(0,r.DependentOn)(i.UniverDocsPlugin,u.UniverRenderEnginePlugin,l.UniverDocsHyperLinkPlugin,t.UniverDocsUIPlugin),F(1,(0,r.Inject)(r.Injector)),F(2,u.IRenderManagerService),F(3,r.IConfigService)],$),e.DocsHyperLinkUIMenuSchema=W,Object.defineProperty(e,"UniverDocsHyperLinkUIPlugin",{enumerable:!0,get:function(){return $}})});
|
package/lib/umd/locale/ar-SA.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiArSA=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`تأكيد`,cancel:`إلغاء`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiArSA=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`تأكيد`,cancel:`إلغاء`,address:`ارتباط`,addressError:`عنوان URL غير قانوني!`,label:`تسمية`,labelError:`يُرجى إدخال تسمية الارتباط`},info:{copy:`نسخ`,edit:`تحرير`,cancel:`إلغاء الارتباط`,coped:`تم نسخ الارتباط إلى الحافظة`},menu:{tooltip:`إضافة ارتباط`}}}});
|
package/lib/umd/locale/ca-ES.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiCaES=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirma`,cancel:`Cancel·la`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiCaES=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirma`,cancel:`Cancel·la`,address:`Enllaç`,addressError:`La URL no és vàlida!`,label:`Etiqueta`,labelError:`Si us plau, introdueix l'etiqueta de l'enllaç`},info:{copy:`Copia`,edit:`Edita`,cancel:`Elimina l'enllaç`,coped:`Enllaç copiat al porta-retalls`},menu:{tooltip:`Afegeix enllaç`}}}});
|
package/lib/umd/locale/de-DE.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiDeDE=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Bestätigen`,cancel:`Abbrechen`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiDeDE=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Bestätigen`,cancel:`Abbrechen`,address:`Link`,addressError:`URL ist ungültig!`,label:`Bezeichnung`,labelError:`Bitte die Bezeichnung des Links eingeben`},info:{copy:`Kopieren`,edit:`Bearbeiten`,cancel:`Link abbrechen`,coped:`Link in die Zwischenablage kopiert`},menu:{tooltip:`Link hinzufügen`}}}});
|
package/lib/umd/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiEnUS=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirm`,cancel:`Cancel`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiEnUS=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirm`,cancel:`Cancel`,address:`Link`,addressError:`Url is illegal!`,label:`Label`,labelError:`Please input label of link`},info:{copy:`Copy`,edit:`Edit`,cancel:`Cancel link`,coped:`Link copied to clipboard`},menu:{tooltip:`Add link`}}}});
|
package/lib/umd/locale/es-ES.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiEsES=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirmar`,cancel:`Cancelar`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiEsES=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirmar`,cancel:`Cancelar`,address:`Enlace`,addressError:`¡La URL no es válida!`,label:`Etiqueta`,labelError:`Por favor, introduce la etiqueta del enlace`},info:{copy:`Copiar`,edit:`Editar`,cancel:`Eliminar enlace`,coped:`Enlace copiado al portapapeles`},menu:{tooltip:`Añadir enlace`}}}});
|
package/lib/umd/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiFaIR=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`تایید`,cancel:`انصراف`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiFaIR=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`تایید`,cancel:`انصراف`,address:`لینک`,addressError:`آدرس غیرمجاز است!`,label:`برچسب`,labelError:`لطفا برچسب لینک را وارد کنید`},info:{copy:`کپی`,edit:`ویرایش`,cancel:`لینک را لغو کنید`,coped:`لینک به کلیپ بورد کپی شد`},menu:{tooltip:`افزودن لینک`}}}});
|
package/lib/umd/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiFrFR=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirmer`,cancel:`Annuler`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiFrFR=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Confirmer`,cancel:`Annuler`,address:`Lien`,addressError:`L'url est illégal!`,label:`Libellé`,labelError:`Veuillez entrer le label du lien`},info:{copy:`Copier`,edit:`Modifier`,cancel:`Supprimer le lien`,coped:`Lien copié dans le presse-papiers`},menu:{tooltip:`Ajouter un lien`}}}});
|
package/lib/umd/locale/id-ID.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiIdID=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Konfirmasi`,cancel:`Batal`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiIdID=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Konfirmasi`,cancel:`Batal`,address:`Tautan`,addressError:`URL tidak valid!`,label:`Label`,labelError:`Silakan masukkan label tautan`},info:{copy:`Salin`,edit:`Edit`,cancel:`Batalkan tautan`,coped:`Tautan disalin ke clipboard`},menu:{tooltip:`Tambah tautan`}}}});
|
package/lib/umd/locale/it-IT.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiItIT=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Conferma`,cancel:`Annulla`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiItIT=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`Conferma`,cancel:`Annulla`,address:`Collegamento`,addressError:`URL non valido!`,label:`Etichetta`,labelError:`Inserisci l'etichetta del collegamento`},info:{copy:`Copia`,edit:`Modifica`,cancel:`Annulla collegamento`,coped:`Collegamento copiato negli appunti`},menu:{tooltip:`Aggiungi collegamento`}}}});
|
package/lib/umd/locale/ja-JP.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiJaJP=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`OK`,cancel:`キャンセル`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiJaJP=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`OK`,cancel:`キャンセル`,address:`アドレス`,addressError:`URLが正しくありません!`,label:`表示文字列`,labelError:`リンクの表示文字列を入力してください`},info:{copy:`コピー`,edit:`編集`,cancel:`リンク解除`,coped:`リンクがクリップボードにコピーされました`},menu:{tooltip:`ハイパーリンクの挿入`}}}});
|
package/lib/umd/locale/ko-KR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiKoKR=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`확인`,cancel:`취소`,
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverDocsHyperLinkUiKoKR=t())})(this,function(){return{"docs-hyper-link-ui":{edit:{confirm:`확인`,cancel:`취소`,address:`링크`,addressError:`URL이 올바르지 않습니다!`,label:`라벨`,labelError:`링크 라벨을 입력해주세요`},info:{copy:`복사`,edit:`편집`,cancel:`링크 취소`,coped:`링크가 클립보드에 복사되었습니다`},menu:{tooltip:`링크 추가`}}}});
|