@univerjs/docs-hyper-link-ui 1.0.0-beta.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +42 -24
- 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 +0 -2
- package/lib/cjs/locale/zh-TW.js +0 -2
- package/lib/es/index.js +42 -24
- 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 +0 -2
- package/lib/es/locale/zh-TW.js +0 -2
- package/lib/index.css +4 -4
- package/lib/index.js +42 -24
- 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 +0 -2
- package/lib/locale/zh-TW.js +0 -2
- package/lib/types/controllers/render-controllers/hyper-link-event.render-controller.d.ts +1 -0
- package/lib/types/locale/en-US.d.ts +0 -2
- package/lib/types/services/hyper-link-popup.service.d.ts +3 -0
- 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 +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -171,7 +171,7 @@ const DocHyperLinkEdit = () => {
|
|
|
171
171
|
};
|
|
172
172
|
if (!doc) return;
|
|
173
173
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
174
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-w-[328px] univer-rounded-xl univer-bg-
|
|
174
|
+
className: (0, _univerjs_design.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", _univerjs_design.borderClassName),
|
|
175
175
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [editing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
176
176
|
label: localeService.t("docs-hyper-link-ui.edit.label"),
|
|
177
177
|
error: showError && isBlankInput(label) ? localeService.t("docs-hyper-link-ui.edit.labelError") : "",
|
|
@@ -247,7 +247,7 @@ const DocLinkPopup = () => {
|
|
|
247
247
|
if (!link) return null;
|
|
248
248
|
const url = (_link$properties = link.properties) === null || _link$properties === void 0 ? void 0 : _link$properties.url;
|
|
249
249
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
250
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-max-w-80 univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-lg univer-bg-
|
|
250
|
+
className: (0, _univerjs_design.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", _univerjs_design.borderClassName),
|
|
251
251
|
onClick: () => {
|
|
252
252
|
hyperLinkService.hideInfoPopup();
|
|
253
253
|
},
|
|
@@ -255,7 +255,7 @@ const DocLinkPopup = () => {
|
|
|
255
255
|
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",
|
|
256
256
|
onClick: () => window.open(url, void 0, "noopener noreferrer"),
|
|
257
257
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
258
|
-
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-
|
|
258
|
+
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",
|
|
259
259
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LinkIcon, {})
|
|
260
260
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
261
261
|
showIfEllipsis: true,
|
|
@@ -388,7 +388,10 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends _univerjs_
|
|
|
388
388
|
_defineProperty(this, "showingLink$", this._showingLink$.asObservable());
|
|
389
389
|
_defineProperty(this, "_editPopup", null);
|
|
390
390
|
_defineProperty(this, "_infoPopup", null);
|
|
391
|
+
_defineProperty(this, "_infoPopupSuppressed", false);
|
|
392
|
+
_defineProperty(this, "_infoPopupSuppressionTimer", null);
|
|
391
393
|
this.disposeWithMe(() => {
|
|
394
|
+
if (this._infoPopupSuppressionTimer !== null) clearTimeout(this._infoPopupSuppressionTimer);
|
|
392
395
|
this._editingLink$.complete();
|
|
393
396
|
this._showingLink$.complete();
|
|
394
397
|
});
|
|
@@ -424,7 +427,8 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends _univerjs_
|
|
|
424
427
|
if (activeRange) {
|
|
425
428
|
this._editPopup = this._docCanvasPopupManagerService.attachPopupToRange(activeRange, {
|
|
426
429
|
componentKey: DocHyperLinkEdit.componentKey,
|
|
427
|
-
direction: "bottom"
|
|
430
|
+
direction: "bottom",
|
|
431
|
+
offset: [0, 10]
|
|
428
432
|
}, unitId);
|
|
429
433
|
return this._editPopup;
|
|
430
434
|
}
|
|
@@ -437,6 +441,7 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends _univerjs_
|
|
|
437
441
|
}
|
|
438
442
|
showInfoPopup(info) {
|
|
439
443
|
var _this$showing, _this$showing2, _this$showing3, _this$showing4, _this$showing5, _this$showing6;
|
|
444
|
+
if (this._infoPopupSuppressed) return;
|
|
440
445
|
const { linkId, unitId, segmentId, segmentPage, startIndex, endIndex } = info;
|
|
441
446
|
if (((_this$showing = this.showing) === null || _this$showing === void 0 ? void 0 : _this$showing.linkId) === linkId && ((_this$showing2 = this.showing) === null || _this$showing2 === void 0 ? void 0 : _this$showing2.unitId) === unitId && ((_this$showing3 = this.showing) === null || _this$showing3 === void 0 ? void 0 : _this$showing3.segmentId) === segmentId && ((_this$showing4 = this.showing) === null || _this$showing4 === void 0 ? void 0 : _this$showing4.segmentPage) === segmentPage && ((_this$showing5 = this.showing) === null || _this$showing5 === void 0 ? void 0 : _this$showing5.startIndex) === startIndex && ((_this$showing6 = this.showing) === null || _this$showing6 === void 0 ? void 0 : _this$showing6.endIndex) === endIndex) return;
|
|
442
447
|
if (this._infoPopup) this._infoPopup.dispose();
|
|
@@ -459,6 +464,7 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends _univerjs_
|
|
|
459
464
|
componentKey: DocLinkPopup.componentKey,
|
|
460
465
|
direction: "top-center",
|
|
461
466
|
multipleDirection: "top",
|
|
467
|
+
offset: [0, 10],
|
|
462
468
|
onClickOutside: () => {
|
|
463
469
|
this.hideInfoPopup();
|
|
464
470
|
}
|
|
@@ -470,6 +476,15 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends _univerjs_
|
|
|
470
476
|
this._showingLink$.next(null);
|
|
471
477
|
(_this$_infoPopup = this._infoPopup) === null || _this$_infoPopup === void 0 || _this$_infoPopup.dispose();
|
|
472
478
|
}
|
|
479
|
+
hideInfoPopupOnPointerDown() {
|
|
480
|
+
this._infoPopupSuppressed = true;
|
|
481
|
+
if (this._infoPopupSuppressionTimer !== null) clearTimeout(this._infoPopupSuppressionTimer);
|
|
482
|
+
this.hideInfoPopup();
|
|
483
|
+
this._infoPopupSuppressionTimer = setTimeout(() => {
|
|
484
|
+
this._infoPopupSuppressed = false;
|
|
485
|
+
this._infoPopupSuppressionTimer = null;
|
|
486
|
+
}, 0);
|
|
487
|
+
}
|
|
473
488
|
};
|
|
474
489
|
DocHyperLinkPopupService = __decorate([
|
|
475
490
|
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_docs_ui.DocCanvasPopManagerService)),
|
|
@@ -589,7 +604,7 @@ const menuSchema = {
|
|
|
589
604
|
//#endregion
|
|
590
605
|
//#region package.json
|
|
591
606
|
var name = "@univerjs/docs-hyper-link-ui";
|
|
592
|
-
var version = "1.0.0-beta.
|
|
607
|
+
var version = "1.0.0-beta.2";
|
|
593
608
|
|
|
594
609
|
//#endregion
|
|
595
610
|
//#region src/config/config.ts
|
|
@@ -649,25 +664,21 @@ let DocHyperLinkSelectionController = class DocHyperLinkSelectionController exte
|
|
|
649
664
|
const { unitId, ranges, segmentId } = commandInfo.params;
|
|
650
665
|
const doc = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
651
666
|
const primary = ranges[0];
|
|
652
|
-
if (primary && doc) {
|
|
667
|
+
if ((primary === null || primary === void 0 ? void 0 : primary.collapsed) && doc) {
|
|
653
668
|
var _doc$getSelfOrHeaderF;
|
|
654
|
-
const { startOffset, endOffset,
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
});
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
} else if (customRanges === null || customRanges === void 0 ? void 0 : customRanges.find((value) => value.startIndex <= startOffset && value.endIndex >= endOffset - 1)) return;
|
|
669
|
+
const { startOffset, endOffset, segmentPage } = primary;
|
|
670
|
+
const customRange = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.getBody()) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.customRanges) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.find((value) => value.rangeType === _univerjs_core.CustomRangeType.HYPERLINK && value.startIndex < startOffset && value.endIndex > endOffset - 1);
|
|
671
|
+
if (customRange) {
|
|
672
|
+
this._docHyperLinkService.showInfoPopup({
|
|
673
|
+
unitId,
|
|
674
|
+
linkId: customRange.rangeId,
|
|
675
|
+
segmentId,
|
|
676
|
+
segmentPage,
|
|
677
|
+
startIndex: customRange.startIndex,
|
|
678
|
+
endIndex: customRange.endIndex
|
|
679
|
+
});
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
671
682
|
}
|
|
672
683
|
this._docHyperLinkService.hideInfoPopup();
|
|
673
684
|
this._docHyperLinkService.hideEditPopup();
|
|
@@ -696,12 +707,18 @@ let DocHyperLinkEventRenderController = class DocHyperLinkEventRenderController
|
|
|
696
707
|
this._docSkeletonManagerService = _docSkeletonManagerService;
|
|
697
708
|
this._docSelectionManagerService = _docSelectionManagerService;
|
|
698
709
|
if (this._context.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
710
|
+
this._initPointerDown();
|
|
699
711
|
this._initHover();
|
|
700
712
|
this._initClick();
|
|
701
713
|
}
|
|
702
714
|
_hideInfoPopup() {
|
|
703
715
|
if (this._hyperLinkPopupService.showing) this._commandService.executeCommand(ToggleDocHyperLinkInfoPopupOperation.id);
|
|
704
716
|
}
|
|
717
|
+
_initPointerDown() {
|
|
718
|
+
this.disposeWithMe(this._docEventManagerService.pointerDownCustomRanges$.subscribe((ranges) => {
|
|
719
|
+
if (!ranges.some((range) => range.range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK)) this._hyperLinkPopupService.hideInfoPopupOnPointerDown();
|
|
720
|
+
}));
|
|
721
|
+
}
|
|
705
722
|
_initHover() {
|
|
706
723
|
this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe((ranges) => {
|
|
707
724
|
var _activeRanges$;
|
|
@@ -727,7 +744,8 @@ let DocHyperLinkEventRenderController = class DocHyperLinkEventRenderController
|
|
|
727
744
|
_initClick() {
|
|
728
745
|
this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe((range) => {
|
|
729
746
|
const link = range.range;
|
|
730
|
-
if (link
|
|
747
|
+
if (link.rangeType !== _univerjs_core.CustomRangeType.HYPERLINK || !range.ctrlKey && !range.metaKey) return;
|
|
748
|
+
this._commandService.executeCommand(ClickDocHyperLinkOperation.id, {
|
|
731
749
|
unitId: this._context.unitId,
|
|
732
750
|
linkId: link.rangeId,
|
|
733
751
|
segmentId: range.segmentId
|
package/lib/cjs/locale/ar-SA.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "تأكيد",
|
|
6
6
|
cancel: "إلغاء",
|
|
7
|
-
title: "ارتباط",
|
|
8
7
|
address: "ارتباط",
|
|
9
|
-
placeholder: "يُرجى إدخال عنوان URL للارتباط",
|
|
10
8
|
addressError: "عنوان URL غير قانوني!",
|
|
11
9
|
label: "تسمية",
|
|
12
10
|
labelError: "يُرجى إدخال تسمية الارتباط"
|
package/lib/cjs/locale/ca-ES.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Confirma",
|
|
6
6
|
cancel: "Cancel·la",
|
|
7
|
-
title: "Enllaç",
|
|
8
7
|
address: "Enllaç",
|
|
9
|
-
placeholder: "Si us plau, introdueix una URL",
|
|
10
8
|
addressError: "La URL no és vàlida!",
|
|
11
9
|
label: "Etiqueta",
|
|
12
10
|
labelError: "Si us plau, introdueix l'etiqueta de l'enllaç"
|
package/lib/cjs/locale/de-DE.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Bestätigen",
|
|
6
6
|
cancel: "Abbrechen",
|
|
7
|
-
title: "Link",
|
|
8
7
|
address: "Link",
|
|
9
|
-
placeholder: "Bitte eine Link-URL eingeben",
|
|
10
8
|
addressError: "URL ist ungültig!",
|
|
11
9
|
label: "Bezeichnung",
|
|
12
10
|
labelError: "Bitte die Bezeichnung des Links eingeben"
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -19,9 +19,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
19
19
|
edit: {
|
|
20
20
|
confirm: "Confirm",
|
|
21
21
|
cancel: "Cancel",
|
|
22
|
-
title: "Link",
|
|
23
22
|
address: "Link",
|
|
24
|
-
placeholder: "Please input a link url",
|
|
25
23
|
addressError: "Url is illegal!",
|
|
26
24
|
label: "Label",
|
|
27
25
|
labelError: "Please input label of link"
|
package/lib/cjs/locale/es-ES.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Confirmar",
|
|
6
6
|
cancel: "Cancelar",
|
|
7
|
-
title: "Enlace",
|
|
8
7
|
address: "Enlace",
|
|
9
|
-
placeholder: "Por favor, introduce una URL",
|
|
10
8
|
addressError: "¡La URL no es válida!",
|
|
11
9
|
label: "Etiqueta",
|
|
12
10
|
labelError: "Por favor, introduce la etiqueta del enlace"
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "تایید",
|
|
6
6
|
cancel: "انصراف",
|
|
7
|
-
title: "لینک",
|
|
8
7
|
address: "لینک",
|
|
9
|
-
placeholder: "لطفا یک آدرس لینک وارد کنید",
|
|
10
8
|
addressError: "آدرس غیرمجاز است!",
|
|
11
9
|
label: "برچسب",
|
|
12
10
|
labelError: "لطفا برچسب لینک را وارد کنید"
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Confirmer",
|
|
6
6
|
cancel: "Annuler",
|
|
7
|
-
title: "Lien",
|
|
8
7
|
address: "Lien",
|
|
9
|
-
placeholder: "Veuillez entrer un lien",
|
|
10
8
|
addressError: "L'url est illégal!",
|
|
11
9
|
label: "Libellé",
|
|
12
10
|
labelError: "Veuillez entrer le label du lien"
|
package/lib/cjs/locale/id-ID.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Konfirmasi",
|
|
6
6
|
cancel: "Batal",
|
|
7
|
-
title: "Tautan",
|
|
8
7
|
address: "Tautan",
|
|
9
|
-
placeholder: "Silakan masukkan URL tautan",
|
|
10
8
|
addressError: "URL tidak valid!",
|
|
11
9
|
label: "Label",
|
|
12
10
|
labelError: "Silakan masukkan label tautan"
|
package/lib/cjs/locale/it-IT.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Conferma",
|
|
6
6
|
cancel: "Annulla",
|
|
7
|
-
title: "Collegamento",
|
|
8
7
|
address: "Collegamento",
|
|
9
|
-
placeholder: "Inserisci un URL di collegamento",
|
|
10
8
|
addressError: "URL non valido!",
|
|
11
9
|
label: "Etichetta",
|
|
12
10
|
labelError: "Inserisci l'etichetta del collegamento"
|
package/lib/cjs/locale/ja-JP.js
CHANGED
package/lib/cjs/locale/ko-KR.js
CHANGED
package/lib/cjs/locale/pl-PL.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Potwierdź",
|
|
6
6
|
cancel: "Anuluj",
|
|
7
|
-
title: "Łącze",
|
|
8
7
|
address: "Łącze",
|
|
9
|
-
placeholder: "Wprowadź adres URL",
|
|
10
8
|
addressError: "Adres URL jest nieprawidłowy!",
|
|
11
9
|
label: "Etykieta",
|
|
12
10
|
labelError: "Wprowadź etykietę łącza"
|
package/lib/cjs/locale/pt-BR.js
CHANGED
|
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Confirmar",
|
|
6
6
|
cancel: "Cancelar",
|
|
7
|
-
title: "Link",
|
|
8
7
|
address: "Link",
|
|
9
|
-
placeholder: "Insira uma URL de link",
|
|
10
8
|
addressError: "URL inválida!",
|
|
11
9
|
label: "Rótulo",
|
|
12
10
|
labelError: "Insira o rótulo do link"
|
package/lib/cjs/locale/ru-RU.js
CHANGED
|
@@ -4,11 +4,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Подтвердить",
|
|
6
6
|
cancel: "Отменить",
|
|
7
|
-
title: "Ссылка",
|
|
8
7
|
address: "Ссылка",
|
|
9
8
|
label: "Текст",
|
|
10
9
|
labelError: "Введите текст ссылки",
|
|
11
|
-
placeholder: "Пожалуйста, введите ссылку",
|
|
12
10
|
addressError: "Пожалуйста, введите корректную ссылку"
|
|
13
11
|
},
|
|
14
12
|
info: {
|
package/lib/cjs/locale/sk-SK.js
CHANGED
package/lib/cjs/locale/vi-VN.js
CHANGED
|
@@ -4,11 +4,9 @@ const locale = { "docs-hyper-link-ui": {
|
|
|
4
4
|
edit: {
|
|
5
5
|
confirm: "Xác nhận",
|
|
6
6
|
cancel: "Hủy",
|
|
7
|
-
title: "Liên kết",
|
|
8
7
|
address: "Liên kết",
|
|
9
8
|
label: "Nhãn",
|
|
10
9
|
labelError: "Vui lòng nhập nhãn liên kết",
|
|
11
|
-
placeholder: "Vui lòng nhập liên kết hợp lệ",
|
|
12
10
|
addressError: "Vui lòng nhập liên kết hợp lệ"
|
|
13
11
|
},
|
|
14
12
|
info: {
|
package/lib/cjs/locale/zh-CN.js
CHANGED
package/lib/cjs/locale/zh-HK.js
CHANGED
package/lib/cjs/locale/zh-TW.js
CHANGED
package/lib/es/index.js
CHANGED
|
@@ -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,
|
|
@@ -387,7 +387,10 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends Disposable
|
|
|
387
387
|
_defineProperty(this, "showingLink$", this._showingLink$.asObservable());
|
|
388
388
|
_defineProperty(this, "_editPopup", null);
|
|
389
389
|
_defineProperty(this, "_infoPopup", null);
|
|
390
|
+
_defineProperty(this, "_infoPopupSuppressed", false);
|
|
391
|
+
_defineProperty(this, "_infoPopupSuppressionTimer", null);
|
|
390
392
|
this.disposeWithMe(() => {
|
|
393
|
+
if (this._infoPopupSuppressionTimer !== null) clearTimeout(this._infoPopupSuppressionTimer);
|
|
391
394
|
this._editingLink$.complete();
|
|
392
395
|
this._showingLink$.complete();
|
|
393
396
|
});
|
|
@@ -423,7 +426,8 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends Disposable
|
|
|
423
426
|
if (activeRange) {
|
|
424
427
|
this._editPopup = this._docCanvasPopupManagerService.attachPopupToRange(activeRange, {
|
|
425
428
|
componentKey: DocHyperLinkEdit.componentKey,
|
|
426
|
-
direction: "bottom"
|
|
429
|
+
direction: "bottom",
|
|
430
|
+
offset: [0, 10]
|
|
427
431
|
}, unitId);
|
|
428
432
|
return this._editPopup;
|
|
429
433
|
}
|
|
@@ -436,6 +440,7 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends Disposable
|
|
|
436
440
|
}
|
|
437
441
|
showInfoPopup(info) {
|
|
438
442
|
var _this$showing, _this$showing2, _this$showing3, _this$showing4, _this$showing5, _this$showing6;
|
|
443
|
+
if (this._infoPopupSuppressed) return;
|
|
439
444
|
const { linkId, unitId, segmentId, segmentPage, startIndex, endIndex } = info;
|
|
440
445
|
if (((_this$showing = this.showing) === null || _this$showing === void 0 ? void 0 : _this$showing.linkId) === linkId && ((_this$showing2 = this.showing) === null || _this$showing2 === void 0 ? void 0 : _this$showing2.unitId) === unitId && ((_this$showing3 = this.showing) === null || _this$showing3 === void 0 ? void 0 : _this$showing3.segmentId) === segmentId && ((_this$showing4 = this.showing) === null || _this$showing4 === void 0 ? void 0 : _this$showing4.segmentPage) === segmentPage && ((_this$showing5 = this.showing) === null || _this$showing5 === void 0 ? void 0 : _this$showing5.startIndex) === startIndex && ((_this$showing6 = this.showing) === null || _this$showing6 === void 0 ? void 0 : _this$showing6.endIndex) === endIndex) return;
|
|
441
446
|
if (this._infoPopup) this._infoPopup.dispose();
|
|
@@ -458,6 +463,7 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends Disposable
|
|
|
458
463
|
componentKey: DocLinkPopup.componentKey,
|
|
459
464
|
direction: "top-center",
|
|
460
465
|
multipleDirection: "top",
|
|
466
|
+
offset: [0, 10],
|
|
461
467
|
onClickOutside: () => {
|
|
462
468
|
this.hideInfoPopup();
|
|
463
469
|
}
|
|
@@ -469,6 +475,15 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends Disposable
|
|
|
469
475
|
this._showingLink$.next(null);
|
|
470
476
|
(_this$_infoPopup = this._infoPopup) === null || _this$_infoPopup === void 0 || _this$_infoPopup.dispose();
|
|
471
477
|
}
|
|
478
|
+
hideInfoPopupOnPointerDown() {
|
|
479
|
+
this._infoPopupSuppressed = true;
|
|
480
|
+
if (this._infoPopupSuppressionTimer !== null) clearTimeout(this._infoPopupSuppressionTimer);
|
|
481
|
+
this.hideInfoPopup();
|
|
482
|
+
this._infoPopupSuppressionTimer = setTimeout(() => {
|
|
483
|
+
this._infoPopupSuppressed = false;
|
|
484
|
+
this._infoPopupSuppressionTimer = null;
|
|
485
|
+
}, 0);
|
|
486
|
+
}
|
|
472
487
|
};
|
|
473
488
|
DocHyperLinkPopupService = __decorate([
|
|
474
489
|
__decorateParam(0, Inject(DocCanvasPopManagerService)),
|
|
@@ -588,7 +603,7 @@ const menuSchema = {
|
|
|
588
603
|
//#endregion
|
|
589
604
|
//#region package.json
|
|
590
605
|
var name = "@univerjs/docs-hyper-link-ui";
|
|
591
|
-
var version = "1.0.0-beta.
|
|
606
|
+
var version = "1.0.0-beta.2";
|
|
592
607
|
|
|
593
608
|
//#endregion
|
|
594
609
|
//#region src/config/config.ts
|
|
@@ -648,25 +663,21 @@ let DocHyperLinkSelectionController = class DocHyperLinkSelectionController exte
|
|
|
648
663
|
const { unitId, ranges, segmentId } = commandInfo.params;
|
|
649
664
|
const doc = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
650
665
|
const primary = ranges[0];
|
|
651
|
-
if (primary && doc) {
|
|
666
|
+
if ((primary === null || primary === void 0 ? void 0 : primary.collapsed) && doc) {
|
|
652
667
|
var _doc$getSelfOrHeaderF;
|
|
653
|
-
const { startOffset, endOffset,
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
});
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
} else if (customRanges === null || customRanges === void 0 ? void 0 : customRanges.find((value) => value.startIndex <= startOffset && value.endIndex >= endOffset - 1)) return;
|
|
668
|
+
const { startOffset, endOffset, segmentPage } = primary;
|
|
669
|
+
const customRange = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.getBody()) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.customRanges) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.find((value) => value.rangeType === CustomRangeType.HYPERLINK && value.startIndex < startOffset && value.endIndex > endOffset - 1);
|
|
670
|
+
if (customRange) {
|
|
671
|
+
this._docHyperLinkService.showInfoPopup({
|
|
672
|
+
unitId,
|
|
673
|
+
linkId: customRange.rangeId,
|
|
674
|
+
segmentId,
|
|
675
|
+
segmentPage,
|
|
676
|
+
startIndex: customRange.startIndex,
|
|
677
|
+
endIndex: customRange.endIndex
|
|
678
|
+
});
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
670
681
|
}
|
|
671
682
|
this._docHyperLinkService.hideInfoPopup();
|
|
672
683
|
this._docHyperLinkService.hideEditPopup();
|
|
@@ -695,12 +706,18 @@ let DocHyperLinkEventRenderController = class DocHyperLinkEventRenderController
|
|
|
695
706
|
this._docSkeletonManagerService = _docSkeletonManagerService;
|
|
696
707
|
this._docSelectionManagerService = _docSelectionManagerService;
|
|
697
708
|
if (this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
709
|
+
this._initPointerDown();
|
|
698
710
|
this._initHover();
|
|
699
711
|
this._initClick();
|
|
700
712
|
}
|
|
701
713
|
_hideInfoPopup() {
|
|
702
714
|
if (this._hyperLinkPopupService.showing) this._commandService.executeCommand(ToggleDocHyperLinkInfoPopupOperation.id);
|
|
703
715
|
}
|
|
716
|
+
_initPointerDown() {
|
|
717
|
+
this.disposeWithMe(this._docEventManagerService.pointerDownCustomRanges$.subscribe((ranges) => {
|
|
718
|
+
if (!ranges.some((range) => range.range.rangeType === CustomRangeType.HYPERLINK)) this._hyperLinkPopupService.hideInfoPopupOnPointerDown();
|
|
719
|
+
}));
|
|
720
|
+
}
|
|
704
721
|
_initHover() {
|
|
705
722
|
this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe((ranges) => {
|
|
706
723
|
var _activeRanges$;
|
|
@@ -726,7 +743,8 @@ let DocHyperLinkEventRenderController = class DocHyperLinkEventRenderController
|
|
|
726
743
|
_initClick() {
|
|
727
744
|
this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe((range) => {
|
|
728
745
|
const link = range.range;
|
|
729
|
-
if (link
|
|
746
|
+
if (link.rangeType !== CustomRangeType.HYPERLINK || !range.ctrlKey && !range.metaKey) return;
|
|
747
|
+
this._commandService.executeCommand(ClickDocHyperLinkOperation.id, {
|
|
730
748
|
unitId: this._context.unitId,
|
|
731
749
|
linkId: link.rangeId,
|
|
732
750
|
segmentId: range.segmentId
|
package/lib/es/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/es/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/es/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/es/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/es/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/es/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/es/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/es/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/es/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/es/locale/ja-JP.js
CHANGED