@stll/folio-react 0.20.0 → 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-
|
|
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";
|
package/dist/compat/eigenpal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-
|
|
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-
|
|
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";
|
|
@@ -13,7 +13,7 @@ import { cloneDocumentWithParagraphPropertySources } from "@stll/folio-core/docx
|
|
|
13
13
|
import { normalizeBaseDirection } from "@stll/folio-core/docx/normalizeBaseDirection";
|
|
14
14
|
import { getCachedNumberingMap } from "@stll/folio-core/docx/numberingParser";
|
|
15
15
|
import { computeScrollPageInfo, updateScrollPageTotal } from "@stll/folio-core/paged-layout/scrollPageInfo";
|
|
16
|
-
import { TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, captureFormatMarks, clearFormatting, clearTextColor, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, extractSelectionState, getSelectedText, getTableContext, increaseIndent, increaseListLevel, mergeCells, removeTabStop, removeTableBorders, schema, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableProperties, setTextColor, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "@stll/folio-core/prosemirror";
|
|
16
|
+
import { TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, captureFormatMarks, clearFormatting, clearTextColor, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, extractSelectionState, getDocumentBuiltInStyles, getSelectedText, getTableContext, increaseIndent, increaseListLevel, mergeCells, removeTabStop, removeTableBorders, schema, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableProperties, setTextColor, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "@stll/folio-core/prosemirror";
|
|
17
17
|
import { acceptAIEditRevision, acceptChange, acceptSuggestion, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectChange, rejectSuggestion } from "@stll/folio-core/prosemirror/commands/comments";
|
|
18
18
|
import { blockSdtAttrsToSdtProperties, findBlockSdtMatch, findBlockSdtMatches, removeContentControlTr, setContentControlContentTr, setContentControlValueTr } from "@stll/folio-core/prosemirror/commands/contentControls";
|
|
19
19
|
import { setContentControlContentBlocksTr } from "@stll/folio-core/prosemirror/commands/contentControlsBlockFill";
|
|
@@ -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)
|
|
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(
|
|
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
|
-
|
|
11647
|
+
const t16 = data.href;
|
|
11648
|
+
let t17;
|
|
11645
11649
|
if ($[61] !== data.href || $[62] !== onNavigate) {
|
|
11646
|
-
|
|
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] =
|
|
11653
|
-
} else
|
|
11654
|
-
let
|
|
11655
|
-
if ($[64]
|
|
11656
|
-
|
|
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:
|
|
11659
|
-
onClick:
|
|
11660
|
-
|
|
11661
|
-
target: "_blank",
|
|
11667
|
+
href: t16,
|
|
11668
|
+
onClick: t17,
|
|
11669
|
+
...t18,
|
|
11662
11670
|
title: data.href,
|
|
11663
11671
|
children: data.href
|
|
11664
11672
|
});
|
|
11665
|
-
$[
|
|
11666
|
-
$[65] = t16;
|
|
11673
|
+
$[65] = data.href;
|
|
11667
11674
|
$[66] = t17;
|
|
11668
|
-
|
|
11669
|
-
|
|
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 ($[
|
|
11683
|
-
t20 =
|
|
11684
|
-
$[
|
|
11685
|
-
|
|
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 ($[
|
|
11689
|
-
t21 =
|
|
11690
|
-
$[
|
|
11691
|
-
|
|
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 ($[
|
|
11694
|
-
t22 =
|
|
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:
|
|
11697
|
-
title:
|
|
11704
|
+
onClick: t21,
|
|
11705
|
+
title: t22,
|
|
11698
11706
|
type: "button",
|
|
11699
|
-
children:
|
|
11707
|
+
children: t23
|
|
11700
11708
|
});
|
|
11701
|
-
$[
|
|
11702
|
-
$[75] = t20;
|
|
11709
|
+
$[75] = t21;
|
|
11703
11710
|
$[76] = t22;
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
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
|
-
$[
|
|
11725
|
-
$[
|
|
11726
|
-
$[
|
|
11727
|
-
$[
|
|
11728
|
-
$[
|
|
11729
|
-
$[
|
|
11730
|
-
} else
|
|
11731
|
-
let
|
|
11732
|
-
if ($[
|
|
11733
|
-
|
|
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
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11749
|
+
t19,
|
|
11750
|
+
t20,
|
|
11751
|
+
t24,
|
|
11752
|
+
t25
|
|
11745
11753
|
]
|
|
11746
11754
|
});
|
|
11747
|
-
$[
|
|
11748
|
-
$[
|
|
11749
|
-
$[
|
|
11750
|
-
$[
|
|
11751
|
-
$[
|
|
11752
|
-
} else
|
|
11753
|
-
return
|
|
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-
|
|
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");
|
|
@@ -12503,7 +12511,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
12503
12511
|
if (!showOutline) return;
|
|
12504
12512
|
const view_2 = pagedEditorRef.current?.getView();
|
|
12505
12513
|
if (!view_2) return;
|
|
12506
|
-
const headings = collectHeadings(view_2.state.doc);
|
|
12514
|
+
const headings = collectHeadings(view_2.state.doc, getDocumentBuiltInStyles(view_2.state));
|
|
12507
12515
|
setHeadingInfos(headings);
|
|
12508
12516
|
let attempts = 0;
|
|
12509
12517
|
let timer = null;
|
|
@@ -12786,7 +12794,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
12786
12794
|
collectHeadingsTimerRef.current = setTimeout(() => {
|
|
12787
12795
|
const view_4 = pagedEditorRef.current?.getView();
|
|
12788
12796
|
if (view_4) {
|
|
12789
|
-
const headings_0 = collectHeadings(view_4.state.doc);
|
|
12797
|
+
const headings_0 = collectHeadings(view_4.state.doc, getDocumentBuiltInStyles(view_4.state));
|
|
12790
12798
|
const pagedRef_0 = pagedEditorRef.current;
|
|
12791
12799
|
for (const heading_0 of headings_0) heading_0.pageNumber = pagedRef_0?.getPageNumberForPmPos(heading_0.pmPos) ?? null;
|
|
12792
12800
|
setHeadingInfos(headings_0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-react",
|
|
3
|
-
"version": "0.20.
|
|
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.
|
|
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",
|