@stll/folio-react 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { d as containedHandler } from "./renderAsync-BjqXaR0h.js";
1
+ import { d as containedHandler } from "./renderAsync-DFwDFNB9.js";
2
2
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { CheckIcon, MoreVerticalIcon } from "lucide-react";
4
4
  import { useLocale, useTranslations } from "use-intl";
@@ -174,7 +174,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
174
174
  };
175
175
  for (const comment of visibleComments) {
176
176
  const cardId = `comment-${comment.id}`;
177
- const el = pagesEl.querySelector(`[data-comment-id="${comment.id}"]`);
177
+ const el = pagesEl.querySelector(`[data-comment-id="${CSS.escape(String(comment.id))}"]`);
178
178
  if (el) {
179
179
  pushPosition(cardId, el.getBoundingClientRect().top - containerRect.top + scrollTop, cardRefs.current.get(cardId)?.offsetHeight || DEFAULT_CARD_HEIGHT);
180
180
  continue;
@@ -1,4 +1,4 @@
1
- import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-CDdppueC.js";
1
+ import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-D2OJupOm.js";
2
2
  import { ReactNode } from "react";
3
3
  import { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
4
4
 
@@ -1,4 +1,4 @@
1
- import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-BjqXaR0h.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-DFwDFNB9.js";
2
2
  import { t as messages_exports } from "../messages.js";
3
3
  import { c } from "react-compiler-runtime";
4
4
  import { forwardRef } from "react";
@@ -4,6 +4,7 @@ import { c } from "react-compiler-runtime";
4
4
  import { useEffect, useId, useState } from "react";
5
5
  import { useTranslations } from "use-intl";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { isAllowedExternalWatermarkImageUrl } from "@stll/folio-core/watermark";
7
8
  //#region src/components/dialogs/HyperlinkDialog.tsx
8
9
  function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, currentData, selectedText, bookmarks = [] }) {
9
10
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
@@ -754,7 +755,7 @@ function clampInteger(value) {
754
755
  //#region src/components/dialogs/WatermarkDialog.tsx
755
756
  const DEFAULT_TEXT_COLOR = "#C0C0C0";
756
757
  function WatermarkDialog(t0) {
757
- const $ = c(127);
758
+ const $ = c(133);
758
759
  const { isOpen, onClose, onApply, currentWatermark } = t0;
759
760
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
760
761
  const handleOpenChange = useCloseOnDialogOpenChange(onClose);
@@ -856,17 +857,27 @@ function WatermarkDialog(t0) {
856
857
  } else t14 = $[15];
857
858
  const fieldIds = t14;
858
859
  let t15;
859
- if ($[16] !== imageRId || $[17] !== mode || $[18] !== text) {
860
- t15 = mode === "none" || mode === "text" && text.trim().length > 0 || mode === "picture" && imageRId.trim().length > 0;
861
- $[16] = imageRId;
862
- $[17] = mode;
863
- $[18] = text;
860
+ if ($[16] !== imageTarget || $[17] !== imageTargetExternal || $[18] !== mode) {
861
+ t15 = mode === "picture" && imageTargetExternal && imageTarget.trim().length > 0 ? getExternalImageTargetError(imageTarget.trim()) : "";
862
+ $[16] = imageTarget;
863
+ $[17] = imageTargetExternal;
864
+ $[18] = mode;
864
865
  $[19] = t15;
865
866
  } else t15 = $[19];
866
- const canApply = t15;
867
+ const imageTargetError = t15;
867
868
  let t16;
868
- if ($[20] !== canApply || $[21] !== color || $[22] !== diagonal || $[23] !== font || $[24] !== imageRId || $[25] !== imageTarget || $[26] !== imageTargetExternal || $[27] !== mode || $[28] !== onApply || $[29] !== onClose || $[30] !== opacityPercent || $[31] !== scalePercent || $[32] !== text || $[33] !== washout) {
869
- t16 = () => {
869
+ if ($[20] !== imageRId || $[21] !== imageTargetError || $[22] !== mode || $[23] !== text) {
870
+ t16 = mode === "none" || mode === "text" && text.trim().length > 0 || mode === "picture" && imageRId.trim().length > 0 && imageTargetError.length === 0;
871
+ $[20] = imageRId;
872
+ $[21] = imageTargetError;
873
+ $[22] = mode;
874
+ $[23] = text;
875
+ $[24] = t16;
876
+ } else t16 = $[24];
877
+ const canApply = t16;
878
+ let t17;
879
+ if ($[25] !== canApply || $[26] !== color || $[27] !== diagonal || $[28] !== font || $[29] !== imageRId || $[30] !== imageTarget || $[31] !== imageTargetExternal || $[32] !== mode || $[33] !== onApply || $[34] !== onClose || $[35] !== opacityPercent || $[36] !== scalePercent || $[37] !== text || $[38] !== washout) {
880
+ t17 = () => {
870
881
  if (!canApply) return;
871
882
  if (mode === "none") {
872
883
  onApply(void 0);
@@ -895,147 +906,147 @@ function WatermarkDialog(t0) {
895
906
  });
896
907
  onClose();
897
908
  };
898
- $[20] = canApply;
899
- $[21] = color;
900
- $[22] = diagonal;
901
- $[23] = font;
902
- $[24] = imageRId;
903
- $[25] = imageTarget;
904
- $[26] = imageTargetExternal;
905
- $[27] = mode;
906
- $[28] = onApply;
907
- $[29] = onClose;
908
- $[30] = opacityPercent;
909
- $[31] = scalePercent;
910
- $[32] = text;
911
- $[33] = washout;
912
- $[34] = t16;
913
- } else t16 = $[34];
914
- const handleApply = t16;
915
- let t17;
916
- if ($[35] !== DialogBackdrop) {
917
- t17 = /* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS });
918
- $[35] = DialogBackdrop;
919
- $[36] = t17;
920
- } else t17 = $[36];
909
+ $[25] = canApply;
910
+ $[26] = color;
911
+ $[27] = diagonal;
912
+ $[28] = font;
913
+ $[29] = imageRId;
914
+ $[30] = imageTarget;
915
+ $[31] = imageTargetExternal;
916
+ $[32] = mode;
917
+ $[33] = onApply;
918
+ $[34] = onClose;
919
+ $[35] = opacityPercent;
920
+ $[36] = scalePercent;
921
+ $[37] = text;
922
+ $[38] = washout;
923
+ $[39] = t17;
924
+ } else t17 = $[39];
925
+ const handleApply = t17;
921
926
  let t18;
922
- if ($[37] !== t) {
923
- t18 = t("dialogs.watermark.title");
924
- $[37] = t;
925
- $[38] = t18;
926
- } else t18 = $[38];
927
+ if ($[40] !== DialogBackdrop) {
928
+ t18 = /* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS });
929
+ $[40] = DialogBackdrop;
930
+ $[41] = t18;
931
+ } else t18 = $[41];
927
932
  let t19;
928
- if ($[39] !== DialogTitle || $[40] !== t18) {
929
- t19 = /* @__PURE__ */ jsx(DialogTitle, {
930
- className: DIALOG_TITLE_CLASS,
931
- children: t18
932
- });
933
- $[39] = DialogTitle;
934
- $[40] = t18;
935
- $[41] = t19;
936
- } else t19 = $[41];
937
- const t20 = fieldIds.mode;
938
- let t21;
939
933
  if ($[42] !== t) {
940
- t21 = t("dialogs.watermark.type");
934
+ t19 = t("dialogs.watermark.title");
941
935
  $[42] = t;
942
- $[43] = t21;
943
- } else t21 = $[43];
936
+ $[43] = t19;
937
+ } else t19 = $[43];
938
+ let t20;
939
+ if ($[44] !== DialogTitle || $[45] !== t19) {
940
+ t20 = /* @__PURE__ */ jsx(DialogTitle, {
941
+ className: DIALOG_TITLE_CLASS,
942
+ children: t19
943
+ });
944
+ $[44] = DialogTitle;
945
+ $[45] = t19;
946
+ $[46] = t20;
947
+ } else t20 = $[46];
948
+ const t21 = fieldIds.mode;
944
949
  let t22;
945
- if ($[44] !== t21) {
946
- t22 = /* @__PURE__ */ jsx("span", {
950
+ if ($[47] !== t) {
951
+ t22 = t("dialogs.watermark.type");
952
+ $[47] = t;
953
+ $[48] = t22;
954
+ } else t22 = $[48];
955
+ let t23;
956
+ if ($[49] !== t22) {
957
+ t23 = /* @__PURE__ */ jsx("span", {
947
958
  className: DIALOG_LABEL_CLASS,
948
- children: t21
959
+ children: t22
949
960
  });
950
- $[44] = t21;
951
- $[45] = t22;
952
- } else t22 = $[45];
953
- const t23 = fieldIds.mode;
954
- let t24;
955
- if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
956
- t24 = (e) => setMode(toWatermarkMode(e.target.value));
957
- $[46] = t24;
958
- } else t24 = $[46];
961
+ $[49] = t22;
962
+ $[50] = t23;
963
+ } else t23 = $[50];
964
+ const t24 = fieldIds.mode;
959
965
  let t25;
960
- if ($[47] !== t) {
961
- t25 = t("dialogs.watermark.textWatermark");
962
- $[47] = t;
963
- $[48] = t25;
964
- } else t25 = $[48];
966
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
967
+ t25 = (e) => setMode(toWatermarkMode(e.target.value));
968
+ $[51] = t25;
969
+ } else t25 = $[51];
965
970
  let t26;
966
- if ($[49] !== t25) {
967
- t26 = /* @__PURE__ */ jsx("option", {
971
+ if ($[52] !== t) {
972
+ t26 = t("dialogs.watermark.textWatermark");
973
+ $[52] = t;
974
+ $[53] = t26;
975
+ } else t26 = $[53];
976
+ let t27;
977
+ if ($[54] !== t26) {
978
+ t27 = /* @__PURE__ */ jsx("option", {
968
979
  value: "text",
969
- children: t25
980
+ children: t26
970
981
  });
971
- $[49] = t25;
972
- $[50] = t26;
973
- } else t26 = $[50];
974
- let t27;
975
- if ($[51] !== t) {
976
- t27 = t("dialogs.watermark.pictureWatermark");
977
- $[51] = t;
978
- $[52] = t27;
979
- } else t27 = $[52];
982
+ $[54] = t26;
983
+ $[55] = t27;
984
+ } else t27 = $[55];
980
985
  let t28;
981
- if ($[53] !== t27) {
982
- t28 = /* @__PURE__ */ jsx("option", {
986
+ if ($[56] !== t) {
987
+ t28 = t("dialogs.watermark.pictureWatermark");
988
+ $[56] = t;
989
+ $[57] = t28;
990
+ } else t28 = $[57];
991
+ let t29;
992
+ if ($[58] !== t28) {
993
+ t29 = /* @__PURE__ */ jsx("option", {
983
994
  value: "picture",
984
- children: t27
995
+ children: t28
985
996
  });
986
- $[53] = t27;
987
- $[54] = t28;
988
- } else t28 = $[54];
989
- let t29;
990
- if ($[55] !== t) {
991
- t29 = t("dialogs.watermark.noWatermark");
992
- $[55] = t;
993
- $[56] = t29;
994
- } else t29 = $[56];
997
+ $[58] = t28;
998
+ $[59] = t29;
999
+ } else t29 = $[59];
995
1000
  let t30;
996
- if ($[57] !== t29) {
997
- t30 = /* @__PURE__ */ jsx("option", {
1001
+ if ($[60] !== t) {
1002
+ t30 = t("dialogs.watermark.noWatermark");
1003
+ $[60] = t;
1004
+ $[61] = t30;
1005
+ } else t30 = $[61];
1006
+ let t31;
1007
+ if ($[62] !== t30) {
1008
+ t31 = /* @__PURE__ */ jsx("option", {
998
1009
  value: "none",
999
- children: t29
1010
+ children: t30
1000
1011
  });
1001
- $[57] = t29;
1002
- $[58] = t30;
1003
- } else t30 = $[58];
1004
- let t31;
1005
- if ($[59] !== fieldIds.mode || $[60] !== mode || $[61] !== t26 || $[62] !== t28 || $[63] !== t30) {
1006
- t31 = /* @__PURE__ */ jsxs("select", {
1012
+ $[62] = t30;
1013
+ $[63] = t31;
1014
+ } else t31 = $[63];
1015
+ let t32;
1016
+ if ($[64] !== fieldIds.mode || $[65] !== mode || $[66] !== t27 || $[67] !== t29 || $[68] !== t31) {
1017
+ t32 = /* @__PURE__ */ jsxs("select", {
1007
1018
  className: DIALOG_INPUT_CLASS,
1008
- id: t23,
1009
- onChange: t24,
1019
+ id: t24,
1020
+ onChange: t25,
1010
1021
  value: mode,
1011
1022
  children: [
1012
- t26,
1013
- t28,
1014
- t30
1023
+ t27,
1024
+ t29,
1025
+ t31
1015
1026
  ]
1016
1027
  });
1017
- $[59] = fieldIds.mode;
1018
- $[60] = mode;
1019
- $[61] = t26;
1020
- $[62] = t28;
1021
- $[63] = t30;
1022
- $[64] = t31;
1023
- } else t31 = $[64];
1024
- let t32;
1025
- if ($[65] !== fieldIds.mode || $[66] !== t22 || $[67] !== t31) {
1026
- t32 = /* @__PURE__ */ jsxs("label", {
1028
+ $[64] = fieldIds.mode;
1029
+ $[65] = mode;
1030
+ $[66] = t27;
1031
+ $[67] = t29;
1032
+ $[68] = t31;
1033
+ $[69] = t32;
1034
+ } else t32 = $[69];
1035
+ let t33;
1036
+ if ($[70] !== fieldIds.mode || $[71] !== t23 || $[72] !== t32) {
1037
+ t33 = /* @__PURE__ */ jsxs("label", {
1027
1038
  className: "flex flex-col gap-1",
1028
- htmlFor: t20,
1029
- children: [t22, t31]
1039
+ htmlFor: t21,
1040
+ children: [t23, t32]
1030
1041
  });
1031
- $[65] = fieldIds.mode;
1032
- $[66] = t22;
1033
- $[67] = t31;
1034
- $[68] = t32;
1035
- } else t32 = $[68];
1036
- let t33;
1037
- if ($[69] !== color || $[70] !== diagonal || $[71] !== fieldIds.color || $[72] !== fieldIds.diagonal || $[73] !== fieldIds.font || $[74] !== fieldIds.opacity || $[75] !== fieldIds.text || $[76] !== font || $[77] !== mode || $[78] !== opacityPercent || $[79] !== t || $[80] !== text) {
1038
- t33 = mode === "text" && /* @__PURE__ */ jsxs("div", {
1042
+ $[70] = fieldIds.mode;
1043
+ $[71] = t23;
1044
+ $[72] = t32;
1045
+ $[73] = t33;
1046
+ } else t33 = $[73];
1047
+ let t34;
1048
+ if ($[74] !== color || $[75] !== diagonal || $[76] !== fieldIds.color || $[77] !== fieldIds.diagonal || $[78] !== fieldIds.font || $[79] !== fieldIds.opacity || $[80] !== fieldIds.text || $[81] !== font || $[82] !== mode || $[83] !== opacityPercent || $[84] !== t || $[85] !== text) {
1049
+ t34 = mode === "text" && /* @__PURE__ */ jsxs("div", {
1039
1050
  className: "grid grid-cols-2 gap-3",
1040
1051
  children: [
1041
1052
  /* @__PURE__ */ jsxs("label", {
@@ -1109,23 +1120,23 @@ function WatermarkDialog(t0) {
1109
1120
  })
1110
1121
  ]
1111
1122
  });
1112
- $[69] = color;
1113
- $[70] = diagonal;
1114
- $[71] = fieldIds.color;
1115
- $[72] = fieldIds.diagonal;
1116
- $[73] = fieldIds.font;
1117
- $[74] = fieldIds.opacity;
1118
- $[75] = fieldIds.text;
1119
- $[76] = font;
1120
- $[77] = mode;
1121
- $[78] = opacityPercent;
1122
- $[79] = t;
1123
- $[80] = text;
1124
- $[81] = t33;
1125
- } else t33 = $[81];
1126
- let t34;
1127
- if ($[82] !== fieldIds.imageRId || $[83] !== fieldIds.imageTarget || $[84] !== fieldIds.imageTargetExternal || $[85] !== fieldIds.scale || $[86] !== fieldIds.washout || $[87] !== imageRId || $[88] !== imageTarget || $[89] !== imageTargetExternal || $[90] !== mode || $[91] !== scalePercent || $[92] !== t || $[93] !== washout) {
1128
- t34 = mode === "picture" && /* @__PURE__ */ jsxs("div", {
1123
+ $[74] = color;
1124
+ $[75] = diagonal;
1125
+ $[76] = fieldIds.color;
1126
+ $[77] = fieldIds.diagonal;
1127
+ $[78] = fieldIds.font;
1128
+ $[79] = fieldIds.opacity;
1129
+ $[80] = fieldIds.text;
1130
+ $[81] = font;
1131
+ $[82] = mode;
1132
+ $[83] = opacityPercent;
1133
+ $[84] = t;
1134
+ $[85] = text;
1135
+ $[86] = t34;
1136
+ } else t34 = $[86];
1137
+ let t35;
1138
+ if ($[87] !== fieldIds.imageRId || $[88] !== fieldIds.imageTarget || $[89] !== fieldIds.imageTargetExternal || $[90] !== fieldIds.scale || $[91] !== fieldIds.washout || $[92] !== imageRId || $[93] !== imageTarget || $[94] !== imageTargetError || $[95] !== imageTargetExternal || $[96] !== mode || $[97] !== scalePercent || $[98] !== t || $[99] !== washout) {
1139
+ t35 = mode === "picture" && /* @__PURE__ */ jsxs("div", {
1129
1140
  className: "grid grid-cols-2 gap-3",
1130
1141
  children: [
1131
1142
  /* @__PURE__ */ jsxs("label", {
@@ -1145,16 +1156,24 @@ function WatermarkDialog(t0) {
1145
1156
  /* @__PURE__ */ jsxs("label", {
1146
1157
  className: "col-span-2 flex flex-col gap-1",
1147
1158
  htmlFor: fieldIds.imageTarget,
1148
- children: [/* @__PURE__ */ jsx("span", {
1149
- className: "text-muted-foreground text-[13px]",
1150
- children: t("dialogs.watermark.imageTarget")
1151
- }), /* @__PURE__ */ jsx("input", {
1152
- className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1153
- id: fieldIds.imageTarget,
1154
- onChange: (e_6) => setImageTarget(e_6.target.value),
1155
- placeholder: "word/media/image1.png",
1156
- value: imageTarget
1157
- })]
1159
+ children: [
1160
+ /* @__PURE__ */ jsx("span", {
1161
+ className: "text-muted-foreground text-[13px]",
1162
+ children: t("dialogs.watermark.imageTarget")
1163
+ }),
1164
+ /* @__PURE__ */ jsx("input", {
1165
+ "aria-invalid": imageTargetError.length > 0,
1166
+ className: "border-input bg-background text-foreground rounded border px-2 py-1.5 text-[13px] outline-none",
1167
+ id: fieldIds.imageTarget,
1168
+ onChange: (e_6) => setImageTarget(e_6.target.value),
1169
+ placeholder: "word/media/image1.png",
1170
+ value: imageTarget
1171
+ }),
1172
+ imageTargetError.length > 0 && /* @__PURE__ */ jsx("span", {
1173
+ className: "text-destructive text-xs",
1174
+ children: imageTargetError
1175
+ })
1176
+ ]
1158
1177
  }),
1159
1178
  /* @__PURE__ */ jsxs("label", {
1160
1179
  className: "flex flex-col gap-1",
@@ -1200,120 +1219,121 @@ function WatermarkDialog(t0) {
1200
1219
  })
1201
1220
  ]
1202
1221
  });
1203
- $[82] = fieldIds.imageRId;
1204
- $[83] = fieldIds.imageTarget;
1205
- $[84] = fieldIds.imageTargetExternal;
1206
- $[85] = fieldIds.scale;
1207
- $[86] = fieldIds.washout;
1208
- $[87] = imageRId;
1209
- $[88] = imageTarget;
1210
- $[89] = imageTargetExternal;
1211
- $[90] = mode;
1212
- $[91] = scalePercent;
1213
- $[92] = t;
1214
- $[93] = washout;
1215
- $[94] = t34;
1216
- } else t34 = $[94];
1217
- let t35;
1218
- if ($[95] !== t32 || $[96] !== t33 || $[97] !== t34) {
1219
- t35 = /* @__PURE__ */ jsxs("div", {
1222
+ $[87] = fieldIds.imageRId;
1223
+ $[88] = fieldIds.imageTarget;
1224
+ $[89] = fieldIds.imageTargetExternal;
1225
+ $[90] = fieldIds.scale;
1226
+ $[91] = fieldIds.washout;
1227
+ $[92] = imageRId;
1228
+ $[93] = imageTarget;
1229
+ $[94] = imageTargetError;
1230
+ $[95] = imageTargetExternal;
1231
+ $[96] = mode;
1232
+ $[97] = scalePercent;
1233
+ $[98] = t;
1234
+ $[99] = washout;
1235
+ $[100] = t35;
1236
+ } else t35 = $[100];
1237
+ let t36;
1238
+ if ($[101] !== t33 || $[102] !== t34 || $[103] !== t35) {
1239
+ t36 = /* @__PURE__ */ jsxs("div", {
1220
1240
  className: DIALOG_BODY_CLASS,
1221
1241
  children: [
1222
- t32,
1223
1242
  t33,
1224
- t34
1243
+ t34,
1244
+ t35
1225
1245
  ]
1226
1246
  });
1227
- $[95] = t32;
1228
- $[96] = t33;
1229
- $[97] = t34;
1230
- $[98] = t35;
1231
- } else t35 = $[98];
1232
- let t36;
1233
- if ($[99] !== t) {
1234
- t36 = t("common.cancel");
1235
- $[99] = t;
1236
- $[100] = t36;
1237
- } else t36 = $[100];
1247
+ $[101] = t33;
1248
+ $[102] = t34;
1249
+ $[103] = t35;
1250
+ $[104] = t36;
1251
+ } else t36 = $[104];
1238
1252
  let t37;
1239
- if ($[101] !== DialogClose || $[102] !== t36) {
1240
- t37 = /* @__PURE__ */ jsx(DialogClose, {
1253
+ if ($[105] !== t) {
1254
+ t37 = t("common.cancel");
1255
+ $[105] = t;
1256
+ $[106] = t37;
1257
+ } else t37 = $[106];
1258
+ let t38;
1259
+ if ($[107] !== DialogClose || $[108] !== t37) {
1260
+ t38 = /* @__PURE__ */ jsx(DialogClose, {
1241
1261
  className: DIALOG_SECONDARY_BUTTON_CLASS,
1242
- children: t36
1262
+ children: t37
1243
1263
  });
1244
- $[101] = DialogClose;
1245
- $[102] = t36;
1246
- $[103] = t37;
1247
- } else t37 = $[103];
1248
- const t38 = !canApply;
1249
- let t39;
1250
- if ($[104] !== t) {
1251
- t39 = t("common.apply");
1252
- $[104] = t;
1253
- $[105] = t39;
1254
- } else t39 = $[105];
1264
+ $[107] = DialogClose;
1265
+ $[108] = t37;
1266
+ $[109] = t38;
1267
+ } else t38 = $[109];
1268
+ const t39 = !canApply;
1255
1269
  let t40;
1256
- if ($[106] !== handleApply || $[107] !== t38 || $[108] !== t39) {
1257
- t40 = /* @__PURE__ */ jsx("button", {
1270
+ if ($[110] !== t) {
1271
+ t40 = t("common.apply");
1272
+ $[110] = t;
1273
+ $[111] = t40;
1274
+ } else t40 = $[111];
1275
+ let t41;
1276
+ if ($[112] !== handleApply || $[113] !== t39 || $[114] !== t40) {
1277
+ t41 = /* @__PURE__ */ jsx("button", {
1258
1278
  className: DIALOG_PRIMARY_BUTTON_CLASS,
1259
- disabled: t38,
1279
+ disabled: t39,
1260
1280
  onClick: handleApply,
1261
1281
  type: "button",
1262
- children: t39
1282
+ children: t40
1263
1283
  });
1264
- $[106] = handleApply;
1265
- $[107] = t38;
1266
- $[108] = t39;
1267
- $[109] = t40;
1268
- } else t40 = $[109];
1269
- let t41;
1270
- if ($[110] !== t37 || $[111] !== t40) {
1271
- t41 = /* @__PURE__ */ jsxs("div", {
1284
+ $[112] = handleApply;
1285
+ $[113] = t39;
1286
+ $[114] = t40;
1287
+ $[115] = t41;
1288
+ } else t41 = $[115];
1289
+ let t42;
1290
+ if ($[116] !== t38 || $[117] !== t41) {
1291
+ t42 = /* @__PURE__ */ jsxs("div", {
1272
1292
  className: DIALOG_FOOTER_CLASS,
1273
- children: [t37, t40]
1293
+ children: [t38, t41]
1274
1294
  });
1275
- $[110] = t37;
1276
- $[111] = t40;
1277
- $[112] = t41;
1278
- } else t41 = $[112];
1279
- let t42;
1280
- if ($[113] !== DialogPopup || $[114] !== t19 || $[115] !== t35 || $[116] !== t41) {
1281
- t42 = /* @__PURE__ */ jsxs(DialogPopup, {
1295
+ $[116] = t38;
1296
+ $[117] = t41;
1297
+ $[118] = t42;
1298
+ } else t42 = $[118];
1299
+ let t43;
1300
+ if ($[119] !== DialogPopup || $[120] !== t20 || $[121] !== t36 || $[122] !== t42) {
1301
+ t43 = /* @__PURE__ */ jsxs(DialogPopup, {
1282
1302
  className: DIALOG_POPUP_CLASS,
1283
1303
  children: [
1284
- t19,
1285
- t35,
1286
- t41
1304
+ t20,
1305
+ t36,
1306
+ t42
1287
1307
  ]
1288
1308
  });
1289
- $[113] = DialogPopup;
1290
- $[114] = t19;
1291
- $[115] = t35;
1292
- $[116] = t41;
1293
- $[117] = t42;
1294
- } else t42 = $[117];
1295
- let t43;
1296
- if ($[118] !== DialogPortal || $[119] !== t17 || $[120] !== t42) {
1297
- t43 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t17, t42] });
1298
- $[118] = DialogPortal;
1299
- $[119] = t17;
1300
- $[120] = t42;
1301
- $[121] = t43;
1302
- } else t43 = $[121];
1309
+ $[119] = DialogPopup;
1310
+ $[120] = t20;
1311
+ $[121] = t36;
1312
+ $[122] = t42;
1313
+ $[123] = t43;
1314
+ } else t43 = $[123];
1303
1315
  let t44;
1304
- if ($[122] !== Dialog || $[123] !== handleOpenChange || $[124] !== isOpen || $[125] !== t43) {
1305
- t44 = /* @__PURE__ */ jsx(Dialog, {
1316
+ if ($[124] !== DialogPortal || $[125] !== t18 || $[126] !== t43) {
1317
+ t44 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t18, t43] });
1318
+ $[124] = DialogPortal;
1319
+ $[125] = t18;
1320
+ $[126] = t43;
1321
+ $[127] = t44;
1322
+ } else t44 = $[127];
1323
+ let t45;
1324
+ if ($[128] !== Dialog || $[129] !== handleOpenChange || $[130] !== isOpen || $[131] !== t44) {
1325
+ t45 = /* @__PURE__ */ jsx(Dialog, {
1306
1326
  open: isOpen,
1307
1327
  onOpenChange: handleOpenChange,
1308
- children: t43
1328
+ children: t44
1309
1329
  });
1310
- $[122] = Dialog;
1311
- $[123] = handleOpenChange;
1312
- $[124] = isOpen;
1313
- $[125] = t43;
1314
- $[126] = t44;
1315
- } else t44 = $[126];
1316
- return t44;
1330
+ $[128] = Dialog;
1331
+ $[129] = handleOpenChange;
1332
+ $[130] = isOpen;
1333
+ $[131] = t44;
1334
+ $[132] = t45;
1335
+ } else t45 = $[132];
1336
+ return t45;
1317
1337
  }
1318
1338
  function toWatermarkMode(value) {
1319
1339
  if (value === "none" || value === "picture" || value === "text") return value;
@@ -1328,6 +1348,12 @@ function clampScalePercent(value) {
1328
1348
  function stripHash(value) {
1329
1349
  return value.startsWith("#") ? value.slice(1) : value;
1330
1350
  }
1351
+ /** Mirrors `HyperlinkDialog.tsx`'s `getUrlError` — a plain-English, untranslated
1352
+ * field-level validation message (existing convention for this kind of inline
1353
+ * error in this dialog family). */
1354
+ function getExternalImageTargetError(value) {
1355
+ return isAllowedExternalWatermarkImageUrl(value) ? "" : "Use a web address (http/https).";
1356
+ }
1331
1357
  function toColorInputValue(value) {
1332
1358
  if (!value || value === "auto") return DEFAULT_TEXT_COLOR;
1333
1359
  return value.startsWith("#") ? value : `#${value}`;
package/dist/dialogs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as FindReplaceDialog } from "./FindReplaceDialog-CqKK82nE.js";
2
2
  import { t as FootnotePropertiesDialog } from "./FootnotePropertiesDialog-CixRdIiT.js";
3
- import { a as InsertImageDialog, i as InsertTableDialog, n as SplitCellDialog, o as HyperlinkDialog, r as PasteSpecialDialog, t as WatermarkDialog } from "./dialogs-Bj2PdycR.js";
3
+ import { a as InsertImageDialog, i as InsertTableDialog, n as SplitCellDialog, o as HyperlinkDialog, r as PasteSpecialDialog, t as WatermarkDialog } from "./dialogs-CB49Gr8j.js";
4
4
  import { t as ImagePositionDialog } from "./ImagePositionDialog-DNodkoI2.js";
5
5
  import { t as ImagePropertiesDialog } from "./ImagePropertiesDialog-CLsDIUWb.js";
6
6
  import { t as InsertSymbolDialog } from "./InsertSymbolDialog-DCFLmfzn.js";