@stll/folio-react 0.20.1 → 0.20.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.
@@ -1,4 +1,4 @@
1
- import { d as containedHandler } from "./renderAsync-B4R5bi9J.js";
1
+ import { d as containedHandler } from "./renderAsync-dUCMzc_W.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";
@@ -1,4 +1,4 @@
1
- import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-B4R5bi9J.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-dUCMzc_W.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";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as formatZoom, c as FormattingBar, i as clampZoom, l as ZoomControl, n as DocxEditor, o as parseZoom, r as ZOOM_PRESETS, s as useWheelZoom, t as renderAsync, u as AutocompleteCaretOverlay } from "./renderAsync-B4R5bi9J.js";
1
+ import { a as formatZoom, c as FormattingBar, i as clampZoom, l as ZoomControl, n as DocxEditor, o as parseZoom, r as ZOOM_PRESETS, s as useWheelZoom, t as renderAsync, u as AutocompleteCaretOverlay } from "./renderAsync-dUCMzc_W.js";
2
2
  import { n as FolioUIProvider } from "./folio-ui-BgDDRsUX.js";
3
3
  import { t as FindReplaceDialog } from "./FindReplaceDialog-CqKK82nE.js";
4
4
  import { t as FootnotePropertiesDialog } from "./FootnotePropertiesDialog-CixRdIiT.js";
@@ -103,7 +103,7 @@ import { DISPLAY_MODES, EditorModeManager, isReadOnlyMode, isTrackChangesMode, t
103
103
  import { FindReplaceManager } from "@stll/folio-core/managers/FindReplaceManager";
104
104
  import { createEmptyHeaderFooter, pickActiveHeaderFooterRId, removeHeaderFooter, resolveEffectiveSectionProperties, resolveHeaderFooterContent, saveHeaderFooterContent } from "@stll/folio-core/utils/headerFooter";
105
105
  import { editHyperlinkAtCursor, removeHyperlinkAtCursor } from "@stll/folio-core/prosemirror/commands/hyperlink";
106
- import { sanitizeExternalUrl } from "@stll/folio-core/utils/urlSecurity";
106
+ import { anchorTargetAttrs, sanitizeExternalUrl, windowFeaturesFor } from "@stll/folio-core/utils/urlSecurity";
107
107
  import { applyImagePosition, applyImageProperties, applyImageTransform, applyImageWrapType, insertImageFromFile } from "@stll/folio-core/prosemirror/commands/image";
108
108
  import { classifyEditorKeydown, deleteSelectedTable, isFocusInInputLike, isKeydownInShortcutScope, isMacPlatform } from "@stll/folio-core/managers/editorShortcuts";
109
109
  import { getScrollTopForZoomAnchor, getViewportCenterZoomAnchorForZoomChange } from "@stll/folio-core/paged-layout/zoomScrollAnchor";
@@ -10350,7 +10350,10 @@ const useHyperlinkHandlers = (t0) => {
10350
10350
  };
10351
10351
  function _temp$3(href) {
10352
10352
  const safeHref = sanitizeExternalUrl(href);
10353
- if (safeHref) window.open(safeHref, "_blank", "noopener,noreferrer");
10353
+ if (safeHref) {
10354
+ const anchor = anchorTargetAttrs(void 0);
10355
+ window.open(safeHref, anchor.target, windowFeaturesFor(anchor));
10356
+ }
10354
10357
  }
10355
10358
  function _temp2$2(href_0) {
10356
10359
  navigator.clipboard.writeText(href_0);
@@ -11321,7 +11324,7 @@ function areSelectionFormattingEqual(a, b) {
11321
11324
  * Edit mode: text + URL inputs with Apply.
11322
11325
  */
11323
11326
  function HyperlinkPopup(t0) {
11324
- const $ = c(88);
11327
+ const $ = c(89);
11325
11328
  const { data, onNavigate, onCopy, onEdit, onRemove, onClose, readOnly } = t0;
11326
11329
  const t = useTranslations("folio");
11327
11330
  const [mode, setMode] = useState("view");
@@ -11641,70 +11644,75 @@ function HyperlinkPopup(t0) {
11641
11644
  t15 = /* @__PURE__ */ jsx(GlobeIcon, { className: "text-muted-foreground size-4.5 shrink-0" });
11642
11645
  $[60] = t15;
11643
11646
  } else t15 = $[60];
11644
- let t16;
11647
+ const t16 = data.href;
11648
+ let t17;
11645
11649
  if ($[61] !== data.href || $[62] !== onNavigate) {
11646
- t16 = (e_6) => {
11650
+ t17 = (e_6) => {
11647
11651
  e_6.preventDefault();
11648
11652
  onNavigate(data.href);
11649
11653
  };
11650
11654
  $[61] = data.href;
11651
11655
  $[62] = onNavigate;
11652
- $[63] = t16;
11653
- } else t16 = $[63];
11654
- let t17;
11655
- if ($[64] !== data.href || $[65] !== t16) {
11656
- t17 = /* @__PURE__ */ jsx("a", {
11656
+ $[63] = t17;
11657
+ } else t17 = $[63];
11658
+ let t18;
11659
+ if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
11660
+ t18 = anchorTargetAttrs(void 0);
11661
+ $[64] = t18;
11662
+ } else t18 = $[64];
11663
+ let t19;
11664
+ if ($[65] !== data.href || $[66] !== t17) {
11665
+ t19 = /* @__PURE__ */ jsx("a", {
11657
11666
  className: "text-primary truncate text-sm hover:underline",
11658
- href: data.href,
11659
- onClick: t16,
11660
- rel: "noopener noreferrer",
11661
- target: "_blank",
11667
+ href: t16,
11668
+ onClick: t17,
11669
+ ...t18,
11662
11670
  title: data.href,
11663
11671
  children: data.href
11664
11672
  });
11665
- $[64] = data.href;
11666
- $[65] = t16;
11673
+ $[65] = data.href;
11667
11674
  $[66] = t17;
11668
- } else t17 = $[66];
11669
- let t18;
11670
- if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
11671
- t18 = /* @__PURE__ */ jsx("span", { className: "bg-border h-5 w-px shrink-0" });
11672
- $[67] = t18;
11673
- } else t18 = $[67];
11674
- let t19;
11675
- if ($[68] !== data.href || $[69] !== onCopy) {
11676
- t19 = () => onCopy(data.href);
11677
- $[68] = data.href;
11678
- $[69] = onCopy;
11679
- $[70] = t19;
11680
- } else t19 = $[70];
11675
+ $[67] = t19;
11676
+ } else t19 = $[67];
11681
11677
  let t20;
11682
- if ($[71] !== t) {
11683
- t20 = t("copyLink");
11684
- $[71] = t;
11685
- $[72] = t20;
11686
- } else t20 = $[72];
11678
+ if ($[68] === Symbol.for("react.memo_cache_sentinel")) {
11679
+ t20 = /* @__PURE__ */ jsx("span", { className: "bg-border h-5 w-px shrink-0" });
11680
+ $[68] = t20;
11681
+ } else t20 = $[68];
11687
11682
  let t21;
11688
- if ($[73] === Symbol.for("react.memo_cache_sentinel")) {
11689
- t21 = /* @__PURE__ */ jsx(ClipboardCopyIcon, { size: 16 });
11690
- $[73] = t21;
11691
- } else t21 = $[73];
11683
+ if ($[69] !== data.href || $[70] !== onCopy) {
11684
+ t21 = () => onCopy(data.href);
11685
+ $[69] = data.href;
11686
+ $[70] = onCopy;
11687
+ $[71] = t21;
11688
+ } else t21 = $[71];
11692
11689
  let t22;
11693
- if ($[74] !== t19 || $[75] !== t20) {
11694
- t22 = /* @__PURE__ */ jsx("button", {
11690
+ if ($[72] !== t) {
11691
+ t22 = t("copyLink");
11692
+ $[72] = t;
11693
+ $[73] = t22;
11694
+ } else t22 = $[73];
11695
+ let t23;
11696
+ if ($[74] === Symbol.for("react.memo_cache_sentinel")) {
11697
+ t23 = /* @__PURE__ */ jsx(ClipboardCopyIcon, { size: 16 });
11698
+ $[74] = t23;
11699
+ } else t23 = $[74];
11700
+ let t24;
11701
+ if ($[75] !== t21 || $[76] !== t22) {
11702
+ t24 = /* @__PURE__ */ jsx("button", {
11695
11703
  className: "flex size-7 items-center justify-center rounded text-[var(--doc-text-muted)] hover:bg-[var(--doc-bg-hover)] transition-colors",
11696
- onClick: t19,
11697
- title: t20,
11704
+ onClick: t21,
11705
+ title: t22,
11698
11706
  type: "button",
11699
- children: t21
11707
+ children: t23
11700
11708
  });
11701
- $[74] = t19;
11702
- $[75] = t20;
11709
+ $[75] = t21;
11703
11710
  $[76] = t22;
11704
- } else t22 = $[76];
11705
- let t23;
11706
- if ($[77] !== data.displayText || $[78] !== data.href || $[79] !== onRemove || $[80] !== readOnly || $[81] !== t) {
11707
- t23 = !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
11711
+ $[77] = t24;
11712
+ } else t24 = $[77];
11713
+ let t25;
11714
+ if ($[78] !== data.displayText || $[79] !== data.href || $[80] !== onRemove || $[81] !== readOnly || $[82] !== t) {
11715
+ t25 = !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
11708
11716
  className: "flex size-7 items-center justify-center rounded text-[var(--doc-text-muted)] hover:bg-[var(--doc-bg-hover)] transition-colors",
11709
11717
  onClick: () => {
11710
11718
  setEditText(data.displayText);
@@ -11721,16 +11729,16 @@ function HyperlinkPopup(t0) {
11721
11729
  type: "button",
11722
11730
  children: /* @__PURE__ */ jsx(UnlinkIcon, { size: 16 })
11723
11731
  })] });
11724
- $[77] = data.displayText;
11725
- $[78] = data.href;
11726
- $[79] = onRemove;
11727
- $[80] = readOnly;
11728
- $[81] = t;
11729
- $[82] = t23;
11730
- } else t23 = $[82];
11731
- let t24;
11732
- if ($[83] !== t14 || $[84] !== t17 || $[85] !== t22 || $[86] !== t23) {
11733
- t24 = /* @__PURE__ */ jsxs("div", {
11732
+ $[78] = data.displayText;
11733
+ $[79] = data.href;
11734
+ $[80] = onRemove;
11735
+ $[81] = readOnly;
11736
+ $[82] = t;
11737
+ $[83] = t25;
11738
+ } else t25 = $[83];
11739
+ let t26;
11740
+ if ($[84] !== t14 || $[85] !== t19 || $[86] !== t24 || $[87] !== t25) {
11741
+ t26 = /* @__PURE__ */ jsxs("div", {
11734
11742
  ref: popupRef,
11735
11743
  className: "fixed z-[10000] flex max-w-[400px] items-center gap-2 rounded-lg border border-[var(--doc-border)] bg-[var(--doc-page)] px-3 py-2 shadow-lg",
11736
11744
  onMouseDown: t13,
@@ -11738,19 +11746,19 @@ function HyperlinkPopup(t0) {
11738
11746
  style: t14,
11739
11747
  children: [
11740
11748
  t15,
11741
- t17,
11742
- t18,
11743
- t22,
11744
- t23
11749
+ t19,
11750
+ t20,
11751
+ t24,
11752
+ t25
11745
11753
  ]
11746
11754
  });
11747
- $[83] = t14;
11748
- $[84] = t17;
11749
- $[85] = t22;
11750
- $[86] = t23;
11751
- $[87] = t24;
11752
- } else t24 = $[87];
11753
- return t24;
11755
+ $[84] = t14;
11756
+ $[85] = t19;
11757
+ $[86] = t24;
11758
+ $[87] = t25;
11759
+ $[88] = t26;
11760
+ } else t26 = $[88];
11761
+ return t26;
11754
11762
  }
11755
11763
  function _temp2(e_5) {
11756
11764
  return e_5.stopPropagation();
@@ -12271,7 +12279,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
12271
12279
  * - Error boundary
12272
12280
  * - Loading states
12273
12281
  */
12274
- const CommentsSidebar = lazy(() => import("./CommentsSidebar-BBbiecN2.js").then((m) => ({ default: m.CommentsSidebar })));
12282
+ const CommentsSidebar = lazy(() => import("./CommentsSidebar-D6n3ifAJ.js").then((m) => ({ default: m.CommentsSidebar })));
12275
12283
  const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
12276
12284
  const loadAttemptSelectiveSave = async () => {
12277
12285
  const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-react",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "React editor for folio: a Word-document (.docx) editor for the browser, built on @stll/folio-core and ProseMirror.",
5
5
  "keywords": [
6
6
  "document-editor",
@@ -68,7 +68,7 @@
68
68
  "@fontsource/noto-sans-arabic": "^5.2.7",
69
69
  "@fontsource/source-sans-3": "^5.2.9",
70
70
  "@fontsource/tinos": "^5.2.7",
71
- "@stll/folio-core": "^0.44.0",
71
+ "@stll/folio-core": "^0.45.0",
72
72
  "better-result": "3.0.1",
73
73
  "lucide-react": "1.24.0",
74
74
  "prosemirror-history": "^1.5.0",