@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.
Files changed (83) hide show
  1. package/lib/cjs/index.js +14 -15
  2. package/lib/cjs/locale/ar-SA.js +0 -2
  3. package/lib/cjs/locale/ca-ES.js +0 -2
  4. package/lib/cjs/locale/de-DE.js +0 -2
  5. package/lib/cjs/locale/en-US.js +0 -2
  6. package/lib/cjs/locale/es-ES.js +0 -2
  7. package/lib/cjs/locale/fa-IR.js +0 -2
  8. package/lib/cjs/locale/fr-FR.js +0 -2
  9. package/lib/cjs/locale/id-ID.js +0 -2
  10. package/lib/cjs/locale/it-IT.js +0 -2
  11. package/lib/cjs/locale/ja-JP.js +0 -2
  12. package/lib/cjs/locale/ko-KR.js +0 -2
  13. package/lib/cjs/locale/pl-PL.js +0 -2
  14. package/lib/cjs/locale/pt-BR.js +0 -2
  15. package/lib/cjs/locale/ru-RU.js +0 -2
  16. package/lib/cjs/locale/sk-SK.js +0 -2
  17. package/lib/cjs/locale/vi-VN.js +0 -2
  18. package/lib/cjs/locale/zh-CN.js +0 -2
  19. package/lib/cjs/locale/zh-HK.js +2 -4
  20. package/lib/cjs/locale/zh-TW.js +2 -4
  21. package/lib/es/index.js +15 -16
  22. package/lib/es/locale/ar-SA.js +0 -2
  23. package/lib/es/locale/ca-ES.js +0 -2
  24. package/lib/es/locale/de-DE.js +0 -2
  25. package/lib/es/locale/en-US.js +0 -2
  26. package/lib/es/locale/es-ES.js +0 -2
  27. package/lib/es/locale/fa-IR.js +0 -2
  28. package/lib/es/locale/fr-FR.js +0 -2
  29. package/lib/es/locale/id-ID.js +0 -2
  30. package/lib/es/locale/it-IT.js +0 -2
  31. package/lib/es/locale/ja-JP.js +0 -2
  32. package/lib/es/locale/ko-KR.js +0 -2
  33. package/lib/es/locale/pl-PL.js +0 -2
  34. package/lib/es/locale/pt-BR.js +0 -2
  35. package/lib/es/locale/ru-RU.js +0 -2
  36. package/lib/es/locale/sk-SK.js +0 -2
  37. package/lib/es/locale/vi-VN.js +0 -2
  38. package/lib/es/locale/zh-CN.js +0 -2
  39. package/lib/es/locale/zh-HK.js +2 -4
  40. package/lib/es/locale/zh-TW.js +2 -4
  41. package/lib/index.css +4 -4
  42. package/lib/index.js +15 -16
  43. package/lib/locale/ar-SA.js +0 -2
  44. package/lib/locale/ca-ES.js +0 -2
  45. package/lib/locale/de-DE.js +0 -2
  46. package/lib/locale/en-US.js +0 -2
  47. package/lib/locale/es-ES.js +0 -2
  48. package/lib/locale/fa-IR.js +0 -2
  49. package/lib/locale/fr-FR.js +0 -2
  50. package/lib/locale/id-ID.js +0 -2
  51. package/lib/locale/it-IT.js +0 -2
  52. package/lib/locale/ja-JP.js +0 -2
  53. package/lib/locale/ko-KR.js +0 -2
  54. package/lib/locale/pl-PL.js +0 -2
  55. package/lib/locale/pt-BR.js +0 -2
  56. package/lib/locale/ru-RU.js +0 -2
  57. package/lib/locale/sk-SK.js +0 -2
  58. package/lib/locale/vi-VN.js +0 -2
  59. package/lib/locale/zh-CN.js +0 -2
  60. package/lib/locale/zh-HK.js +2 -4
  61. package/lib/locale/zh-TW.js +2 -4
  62. package/lib/types/locale/en-US.d.ts +0 -2
  63. package/lib/umd/index.js +1 -1
  64. package/lib/umd/locale/ar-SA.js +1 -1
  65. package/lib/umd/locale/ca-ES.js +1 -1
  66. package/lib/umd/locale/de-DE.js +1 -1
  67. package/lib/umd/locale/en-US.js +1 -1
  68. package/lib/umd/locale/es-ES.js +1 -1
  69. package/lib/umd/locale/fa-IR.js +1 -1
  70. package/lib/umd/locale/fr-FR.js +1 -1
  71. package/lib/umd/locale/id-ID.js +1 -1
  72. package/lib/umd/locale/it-IT.js +1 -1
  73. package/lib/umd/locale/ja-JP.js +1 -1
  74. package/lib/umd/locale/ko-KR.js +1 -1
  75. package/lib/umd/locale/pl-PL.js +1 -1
  76. package/lib/umd/locale/pt-BR.js +1 -1
  77. package/lib/umd/locale/ru-RU.js +1 -1
  78. package/lib/umd/locale/sk-SK.js +1 -1
  79. package/lib/umd/locale/vi-VN.js +1 -1
  80. package/lib/umd/locale/zh-CN.js +1 -1
  81. package/lib/umd/locale/zh-HK.js +1 -1
  82. package/lib/umd/locale/zh-TW.js +1 -1
  83. package/package.json +11 -11
package/lib/cjs/index.js CHANGED
@@ -119,7 +119,7 @@ const DocHyperLinkEdit = () => {
119
119
  const isLegal = _univerjs_core.Tools.isLegalUrl(link);
120
120
  const doc = editing ? univerInstanceService.getUnit(editing.unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC) : univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
121
121
  (0, react.useEffect)(() => {
122
- var _doc$getSelfOrHeaderF2, _BuildTextUtils$custo, _body$customRanges2;
122
+ var _doc$getSelfOrHeaderF2, _BuildTextUtils$custo;
123
123
  const activeRange = docSelectionManagerService.getActiveTextRange();
124
124
  if (!activeRange) return;
125
125
  if (editing) {
@@ -127,18 +127,18 @@ const DocHyperLinkEdit = () => {
127
127
  const body = doc === null || doc === void 0 || (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(editing.segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody();
128
128
  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);
129
129
  if (doc && matchedRange) {
130
- var _matchedRange$propert, _matchedRange$propert2;
131
- setLink((_matchedRange$propert = (_matchedRange$propert2 = matchedRange.properties) === null || _matchedRange$propert2 === void 0 ? void 0 : _matchedRange$propert2.url) !== null && _matchedRange$propert !== void 0 ? _matchedRange$propert : "");
130
+ var _matchedRange$propert;
131
+ setLink(((_matchedRange$propert = matchedRange.properties) === null || _matchedRange$propert === void 0 ? void 0 : _matchedRange$propert.url) ?? "");
132
132
  setLabel(_univerjs_core.BuildTextUtils.transform.getPlainText((0, _univerjs_core.getBodySlice)(body, matchedRange.startIndex, matchedRange.endIndex + 1).dataStream));
133
133
  }
134
134
  return;
135
135
  }
136
136
  const body = doc === null || doc === void 0 || (_doc$getSelfOrHeaderF2 = doc.getSelfOrHeaderFooterModel(activeRange.segmentId)) === null || _doc$getSelfOrHeaderF2 === void 0 ? void 0 : _doc$getSelfOrHeaderF2.getBody();
137
137
  const selection = body ? activeRange : null;
138
- const matchedRange = selection && ((_BuildTextUtils$custo = _univerjs_core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (_body$customRanges2 = body === null || body === void 0 ? void 0 : body.customRanges) !== null && _body$customRanges2 !== void 0 ? _body$customRanges2 : [])) === null || _BuildTextUtils$custo === void 0 ? void 0 : _BuildTextUtils$custo[0]);
138
+ const matchedRange = selection && ((_BuildTextUtils$custo = _univerjs_core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (body === null || body === void 0 ? void 0 : body.customRanges) ?? [])) === null || _BuildTextUtils$custo === void 0 ? void 0 : _BuildTextUtils$custo[0]);
139
139
  if (doc && matchedRange) {
140
- var _matchedRange$propert3, _matchedRange$propert4;
141
- setLink((_matchedRange$propert3 = matchedRange === null || matchedRange === void 0 || (_matchedRange$propert4 = matchedRange.properties) === null || _matchedRange$propert4 === void 0 ? void 0 : _matchedRange$propert4.url) !== null && _matchedRange$propert3 !== void 0 ? _matchedRange$propert3 : "");
140
+ var _matchedRange$propert2;
141
+ setLink((matchedRange === null || matchedRange === void 0 || (_matchedRange$propert2 = matchedRange.properties) === null || _matchedRange$propert2 === void 0 ? void 0 : _matchedRange$propert2.url) ?? "");
142
142
  }
143
143
  }, [
144
144
  doc,
@@ -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-white univer-px-6 univer-py-5 univer-shadow dark:!univer-bg-gray-900", _univerjs_design.borderClassName),
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-white univer-p-3 univer-shadow dark:!univer-bg-gray-900", _univerjs_design.borderClassName),
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-white",
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,
@@ -589,7 +589,7 @@ const menuSchema = {
589
589
  //#endregion
590
590
  //#region package.json
591
591
  var name = "@univerjs/docs-hyper-link-ui";
592
- var version = "1.0.0-alpha.8";
592
+ var version = "1.0.0-beta.1";
593
593
 
594
594
  //#endregion
595
595
  //#region src/config/config.ts
@@ -654,8 +654,7 @@ let DocHyperLinkSelectionController = class DocHyperLinkSelectionController exte
654
654
  const { startOffset, endOffset, collapsed, segmentPage } = primary;
655
655
  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;
656
656
  if (collapsed) {
657
- var _customRanges$findInd;
658
- 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;
657
+ const index = (customRanges === null || customRanges === void 0 ? void 0 : customRanges.findIndex((value) => value.startIndex < startOffset && value.endIndex > endOffset - 1)) ?? -1;
659
658
  if (index > -1) {
660
659
  const customRange = customRanges[index];
661
660
  this._docHyperLinkService.showInfoPopup({
@@ -705,11 +704,11 @@ let DocHyperLinkEventRenderController = class DocHyperLinkEventRenderController
705
704
  }
706
705
  _initHover() {
707
706
  this.disposeWithMe(this._docEventManagerService.hoverCustomRanges$.subscribe((ranges) => {
708
- var _activeRanges$, _link$segmentId;
707
+ var _activeRanges$;
709
708
  const link = ranges.find((range) => range.range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK);
710
709
  const activeRanges = this._docSelectionManagerService.getTextRanges();
711
710
  const currentSegmentId = activeRanges === null || activeRanges === void 0 || (_activeRanges$ = activeRanges[0]) === null || _activeRanges$ === void 0 ? void 0 : _activeRanges$.segmentId;
712
- if (((_link$segmentId = link === null || link === void 0 ? void 0 : link.segmentId) !== null && _link$segmentId !== void 0 ? _link$segmentId : "") !== currentSegmentId) {
711
+ if (((link === null || link === void 0 ? void 0 : link.segmentId) ?? "") !== currentSegmentId) {
713
712
  this._hideInfoPopup();
714
713
  return;
715
714
  }
@@ -888,7 +887,7 @@ _defineProperty(UniverDocsHyperLinkUIPlugin, "packageName", name);
888
887
  _defineProperty(UniverDocsHyperLinkUIPlugin, "version", version);
889
888
  _defineProperty(UniverDocsHyperLinkUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_DOC);
890
889
  UniverDocsHyperLinkUIPlugin = __decorate([
891
- (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_docs_hyper_link.UniverDocsHyperLinkPlugin, _univerjs_ui.UniverUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
890
+ (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_docs_hyper_link.UniverDocsHyperLinkPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
892
891
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
893
892
  __decorateParam(2, _univerjs_engine_render.IRenderManagerService),
894
893
  __decorateParam(3, _univerjs_core.IConfigService)
@@ -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: "يُرجى إدخال تسمية الارتباط"
@@ -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ç"
@@ -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"
@@ -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"
@@ -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"
@@ -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: "لطفا برچسب لینک را وارد کنید"
@@ -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"
@@ -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"
@@ -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"
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
4
4
  edit: {
5
5
  confirm: "OK",
6
6
  cancel: "キャンセル",
7
- title: "リンク",
8
7
  address: "アドレス",
9
- placeholder: "リンクのURLを入力してください",
10
8
  addressError: "URLが正しくありません!",
11
9
  label: "表示文字列",
12
10
  labelError: "リンクの表示文字列を入力してください"
@@ -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: "링크 라벨을 입력해주세요"
@@ -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"
@@ -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"
@@ -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: {
@@ -4,9 +4,7 @@ const locale = { "docs-hyper-link-ui": {
4
4
  edit: {
5
5
  confirm: "Potvrdiť",
6
6
  cancel: "Zrušiť",
7
- title: "Odkaz",
8
7
  address: "Odkaz",
9
- placeholder: "Zadajte URL odkazu",
10
8
  addressError: "URL je neplatná!",
11
9
  label: "Popisok",
12
10
  labelError: "Zadajte popis odkazu"
@@ -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: {
@@ -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: {
@@ -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
- label: "文本",
10
- labelError: "请输入链接文本",
11
- placeholder: "請輸入合法的連結",
8
+ label: "文字",
9
+ labelError: "請輸入連結文字",
12
10
  addressError: "請輸入合法的連結"
13
11
  },
14
12
  info: {
@@ -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
- label: "文本",
10
- labelError: "请输入链接文本",
11
- placeholder: "請輸入合法的連結",
8
+ label: "文字",
9
+ labelError: "請輸入連結文字",
12
10
  addressError: "請輸入合法的連結"
13
11
  },
14
12
  info: {
package/lib/es/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, UniverUIPlugin, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
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, _body$customRanges2;
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, _matchedRange$propert2;
130
- setLink((_matchedRange$propert = (_matchedRange$propert2 = matchedRange.properties) === null || _matchedRange$propert2 === void 0 ? void 0 : _matchedRange$propert2.url) !== null && _matchedRange$propert !== void 0 ? _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, (_body$customRanges2 = body === null || body === void 0 ? void 0 : body.customRanges) !== null && _body$customRanges2 !== void 0 ? _body$customRanges2 : [])) === null || _BuildTextUtils$custo === void 0 ? void 0 : _BuildTextUtils$custo[0]);
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$propert3, _matchedRange$propert4;
140
- setLink((_matchedRange$propert3 = matchedRange === null || matchedRange === void 0 || (_matchedRange$propert4 = matchedRange.properties) === null || _matchedRange$propert4 === void 0 ? void 0 : _matchedRange$propert4.url) !== null && _matchedRange$propert3 !== void 0 ? _matchedRange$propert3 : "");
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-white univer-px-6 univer-py-5 univer-shadow dark:!univer-bg-gray-900", borderClassName),
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-white univer-p-3 univer-shadow dark:!univer-bg-gray-900", borderClassName),
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-white",
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-alpha.8";
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
- var _customRanges$findInd;
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$, _link$segmentId;
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 (((_link$segmentId = link === null || link === void 0 ? void 0 : link.segmentId) !== null && _link$segmentId !== void 0 ? _link$segmentId : "") !== currentSegmentId) {
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, UniverUIPlugin, UniverDocsUIPlugin),
889
+ DependentOn(UniverDocsPlugin, UniverRenderEnginePlugin, UniverDocsHyperLinkPlugin, UniverDocsUIPlugin),
891
890
  __decorateParam(1, Inject(Injector)),
892
891
  __decorateParam(2, IRenderManagerService),
893
892
  __decorateParam(3, IConfigService)
@@ -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: "يُرجى إدخال تسمية الارتباط"
@@ -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ç"
@@ -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"
@@ -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"
@@ -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"
@@ -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: "لطفا برچسب لینک را وارد کنید"
@@ -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"
@@ -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"
@@ -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"
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
3
3
  edit: {
4
4
  confirm: "OK",
5
5
  cancel: "キャンセル",
6
- title: "リンク",
7
6
  address: "アドレス",
8
- placeholder: "リンクのURLを入力してください",
9
7
  addressError: "URLが正しくありません!",
10
8
  label: "表示文字列",
11
9
  labelError: "リンクの表示文字列を入力してください"
@@ -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: "링크 라벨을 입력해주세요"
@@ -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"
@@ -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"
@@ -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: {
@@ -3,9 +3,7 @@ const locale = { "docs-hyper-link-ui": {
3
3
  edit: {
4
4
  confirm: "Potvrdiť",
5
5
  cancel: "Zrušiť",
6
- title: "Odkaz",
7
6
  address: "Odkaz",
8
- placeholder: "Zadajte URL odkazu",
9
7
  addressError: "URL je neplatná!",
10
8
  label: "Popisok",
11
9
  labelError: "Zadajte popis odkazu"
@@ -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: {