@stll/folio-react 0.19.3 → 0.19.5
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-CkF394Ug.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-CkF394Ug.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-CkF394Ug.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";
|
|
@@ -26,7 +26,7 @@ import { resolveFindMatchRange } from "@stll/folio-core/prosemirror/findReplaceS
|
|
|
26
26
|
import { createAICitationDecorationsPlugin } from "@stll/folio-core/prosemirror/plugins/aiCitationDecorations";
|
|
27
27
|
import { AI_SUGGESTION_SEVERITY_CLASS, aiSuggestionDecorationsKey, createAISuggestionDecorationsPlugin } from "@stll/folio-core/prosemirror/plugins/aiSuggestionDecorations";
|
|
28
28
|
import { anonymizationDecorationsKey, createAnonymizationDecorationsPlugin, slugAnonymizationLabel } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
|
|
29
|
-
import { expectImageAttrs, expectTableAttrs, expectTableCellAttrs,
|
|
29
|
+
import { expectImageAttrs, expectTableAttrs, expectTableCellAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs } from "@stll/folio-core/prosemirror/attrs";
|
|
30
30
|
import { autocompleteSuggestionKey, autocompleteSuggestionPlugin } from "@stll/folio-core/prosemirror/plugins/autocompleteSuggestion";
|
|
31
31
|
import { createSuggestionModePlugin, setSuggestionMode, suggestionModeKey } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
|
|
32
32
|
import { createTemplateDirectivesPlugin, templateDirectivesKey } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
|
|
@@ -83,6 +83,8 @@ import { resizeColumnPair } from "@stll/folio-core/paged-layout/tableColumnResiz
|
|
|
83
83
|
import { tableInsertButtonOffset } from "@stll/folio-core/paged-layout/tableInsertButtonGeometry";
|
|
84
84
|
import { getTransactionsDirtyRange } from "@stll/folio-core/paged-layout/transactionDirtyRange";
|
|
85
85
|
import { findStartPosForParaId } from "@stll/folio-core/prosemirror/utils/findParagraphByParaId";
|
|
86
|
+
import { allowsDirectDrawingEdit } from "@stll/folio-core/docx/imageRawXml";
|
|
87
|
+
import { commitImageFloatMove, commitImageInlineMove, commitImageResize, isFloatingImage } from "@stll/folio-core/prosemirror/imageCommit";
|
|
86
88
|
import { buildEmbeddedFontFamilyMap, extractEmbeddedFonts } from "@stll/folio-core/fonts/embeddedFonts";
|
|
87
89
|
import { panic } from "better-result";
|
|
88
90
|
import { collectRemoteSelections, createHiddenEditorManager, createHiddenEditorState } from "@stll/folio-core/controller/hiddenEditorManager";
|
|
@@ -1697,7 +1699,7 @@ function ImageSelectionOverlay({ imageInfo, zoom, isFocused, onResize, onResizeS
|
|
|
1697
1699
|
width: width + BORDER_WIDTH * 2,
|
|
1698
1700
|
height: height + BORDER_WIDTH * 2
|
|
1699
1701
|
} }),
|
|
1700
|
-
/* @__PURE__ */ jsx("div", {
|
|
1702
|
+
imageInfo.allowsDirectEdit && /* @__PURE__ */ jsx("div", {
|
|
1701
1703
|
role: "presentation",
|
|
1702
1704
|
style: {
|
|
1703
1705
|
position: "absolute",
|
|
@@ -1711,7 +1713,7 @@ function ImageSelectionOverlay({ imageInfo, zoom, isFocused, onResize, onResizeS
|
|
|
1711
1713
|
},
|
|
1712
1714
|
onMouseDown: handleBodyMouseDown
|
|
1713
1715
|
}),
|
|
1714
|
-
HANDLES.map(({ pos, x, y }) => /* @__PURE__ */ jsx(Handle, {
|
|
1716
|
+
imageInfo.allowsDirectEdit && HANDLES.map(({ pos, x, y }) => /* @__PURE__ */ jsx(Handle, {
|
|
1715
1717
|
handle: pos,
|
|
1716
1718
|
left: left + width * x - HANDLE_HALF,
|
|
1717
1719
|
top: top + height * y - HANDLE_HALF,
|
|
@@ -2938,11 +2940,13 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
2938
2940
|
const imgTagCandidate = el.tagName === "IMG" ? el : el.querySelector("img");
|
|
2939
2941
|
const element = (imgTagCandidate instanceof HTMLElement ? imgTagCandidate : null) ?? el;
|
|
2940
2942
|
const rect = element.getBoundingClientRect();
|
|
2943
|
+
const node = hiddenPMRef.current?.getView()?.state.doc.nodeAt(pmPos);
|
|
2941
2944
|
return {
|
|
2942
2945
|
element,
|
|
2943
2946
|
pmPos,
|
|
2944
2947
|
width: Math.round(rect.width / zoom),
|
|
2945
|
-
height: Math.round(rect.height / zoom)
|
|
2948
|
+
height: Math.round(rect.height / zoom),
|
|
2949
|
+
allowsDirectEdit: node?.type.name === "image" ? allowsDirectDrawingEdit(expectImageAttrs(node)._docxRawXmlMode) : true
|
|
2946
2950
|
};
|
|
2947
2951
|
}, [zoom]);
|
|
2948
2952
|
const isDraggingRef = useRef(false);
|
|
@@ -3049,8 +3053,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3049
3053
|
const columns = useMemo(() => getColumns(sectionProperties), [sectionProperties]);
|
|
3050
3054
|
const contentWidth = pageSize.w - margins.left - margins.right;
|
|
3051
3055
|
const defaultTabStop = document?.package.settings?.defaultTabStop;
|
|
3052
|
-
const
|
|
3053
|
-
const mirrorMargins = documentSettings !== void 0 && "mirrorMargins" in documentSettings && documentSettings.mirrorMargins === true;
|
|
3056
|
+
const mirrorMargins = document?.package.settings?.mirrorMargins === true;
|
|
3054
3057
|
const sectionHeaderFooterRefs = useMemo(() => resolveSectionHeaderFooterRefs(document), [document]);
|
|
3055
3058
|
const layoutInputSignature = useMemo(() => buildLayoutInputSignature({
|
|
3056
3059
|
columns,
|
|
@@ -3317,8 +3320,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3317
3320
|
const sel = state_3.selection;
|
|
3318
3321
|
if ("$anchorCell" in sel && typeof sel.forEachCell === "function") {
|
|
3319
3322
|
const selectedRanges = [];
|
|
3320
|
-
sel.forEachCell((
|
|
3321
|
-
selectedRanges.push([pos, pos +
|
|
3323
|
+
sel.forEachCell((node_0, pos) => {
|
|
3324
|
+
selectedRanges.push([pos, pos + node_0.nodeSize]);
|
|
3322
3325
|
});
|
|
3323
3326
|
const allCells = htmlQueryAll(pagesContainerRef.current, ".layout-table-cell");
|
|
3324
3327
|
for (const cellEl of allCells) {
|
|
@@ -3960,8 +3963,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3960
3963
|
try {
|
|
3961
3964
|
const $pos = doc.resolve(pmPos_3);
|
|
3962
3965
|
for (let d = $pos.depth; d > 0; d--) {
|
|
3963
|
-
const
|
|
3964
|
-
if (
|
|
3966
|
+
const node_1 = $pos.node(d);
|
|
3967
|
+
if (node_1.type.name === "tableCell" || node_1.type.name === "tableHeader") return $pos.before(d);
|
|
3965
3968
|
}
|
|
3966
3969
|
} catch {}
|
|
3967
3970
|
return null;
|
|
@@ -4191,9 +4194,9 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4191
4194
|
if (view_9) {
|
|
4192
4195
|
const $pos_1 = view_9.state.doc.resolve(resizeTablePmStartRef.current + 1);
|
|
4193
4196
|
for (let d_0 = $pos_1.depth; d_0 >= 0; d_0--) {
|
|
4194
|
-
const
|
|
4195
|
-
if (
|
|
4196
|
-
const widths =
|
|
4197
|
+
const node_2 = $pos_1.node(d_0);
|
|
4198
|
+
if (node_2.type.name === "table") {
|
|
4199
|
+
const widths = node_2.attrs["columnWidths"];
|
|
4197
4200
|
if (widths && widths[colIndex] !== void 0 && widths[colIndex + 1] !== void 0) resizeOrigWidthsRef.current = {
|
|
4198
4201
|
left: widths[colIndex],
|
|
4199
4202
|
right: widths[colIndex + 1]
|
|
@@ -4223,10 +4226,10 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4223
4226
|
if (view_10) {
|
|
4224
4227
|
const $pos_2 = view_10.state.doc.resolve(resizeRowTablePmStartRef.current + 1);
|
|
4225
4228
|
for (let d_1 = $pos_2.depth; d_1 >= 0; d_1--) {
|
|
4226
|
-
const
|
|
4227
|
-
if (
|
|
4228
|
-
if (rowIndex <
|
|
4229
|
-
const height =
|
|
4229
|
+
const node_3 = $pos_2.node(d_1);
|
|
4230
|
+
if (node_3.type.name === "table") {
|
|
4231
|
+
if (rowIndex < node_3.childCount) {
|
|
4232
|
+
const height = node_3.child(rowIndex).attrs["height"];
|
|
4230
4233
|
if (height) resizeRowOrigHeightRef.current = height;
|
|
4231
4234
|
else {
|
|
4232
4235
|
const rowEl = target_1.closest(".layout-table")?.querySelector(`[data-row-index="${rowIndex}"]`);
|
|
@@ -4258,9 +4261,9 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4258
4261
|
if (view_11) {
|
|
4259
4262
|
const $pos_3 = view_11.state.doc.resolve(resizeRightEdgePmStartRef.current + 1);
|
|
4260
4263
|
for (let d_2 = $pos_3.depth; d_2 >= 0; d_2--) {
|
|
4261
|
-
const
|
|
4262
|
-
if (
|
|
4263
|
-
const widths_0 =
|
|
4264
|
+
const node_4 = $pos_3.node(d_2);
|
|
4265
|
+
if (node_4.type.name === "table") {
|
|
4266
|
+
const widths_0 = node_4.attrs["columnWidths"];
|
|
4264
4267
|
if (widths_0 && widths_0[colIndex_0] !== void 0) resizeRightEdgeOrigWidthRef.current = widths_0[colIndex_0];
|
|
4265
4268
|
break;
|
|
4266
4269
|
}
|
|
@@ -4463,18 +4466,18 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4463
4466
|
const { left: newLeft, right: newRight } = resizeOrigWidthsRef.current;
|
|
4464
4467
|
const $pos_5 = view_12.state.doc.resolve(pmStart_0 + 1);
|
|
4465
4468
|
for (let d_3 = $pos_5.depth; d_3 >= 0; d_3--) {
|
|
4466
|
-
const
|
|
4467
|
-
if (
|
|
4469
|
+
const node_5 = $pos_5.node(d_3);
|
|
4470
|
+
if (node_5.type.name === "table") {
|
|
4468
4471
|
const tablePos = $pos_5.before(d_3);
|
|
4469
4472
|
const tr = view_12.state.tr;
|
|
4470
|
-
const tableAttrs = expectTableAttrs(
|
|
4473
|
+
const tableAttrs = expectTableAttrs(node_5);
|
|
4471
4474
|
if (!tableAttrs.columnWidths) break;
|
|
4472
4475
|
const widths_1 = [...tableAttrs.columnWidths];
|
|
4473
4476
|
widths_1[colIdx] = newLeft;
|
|
4474
4477
|
widths_1[colIdx + 1] = newRight;
|
|
4475
|
-
tr.setNodeMarkup(tablePos, void 0, mergeTableAttrs(
|
|
4478
|
+
tr.setNodeMarkup(tablePos, void 0, mergeTableAttrs(node_5, { columnWidths: widths_1 }));
|
|
4476
4479
|
let rowOffset = tablePos + 1;
|
|
4477
|
-
|
|
4480
|
+
node_5.forEach((row) => {
|
|
4478
4481
|
let cellOffset = rowOffset + 1;
|
|
4479
4482
|
let cellColIdx = 0;
|
|
4480
4483
|
row.forEach((cell) => {
|
|
@@ -4513,13 +4516,13 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4513
4516
|
const newHeight_0 = resizeRowOrigHeightRef.current;
|
|
4514
4517
|
const $pos_6 = view_13.state.doc.resolve(pmStart_1 + 1);
|
|
4515
4518
|
for (let d_4 = $pos_6.depth; d_4 >= 0; d_4--) {
|
|
4516
|
-
const
|
|
4517
|
-
if (
|
|
4519
|
+
const node_6 = $pos_6.node(d_4);
|
|
4520
|
+
if (node_6.type.name === "table") {
|
|
4518
4521
|
const tablePos_0 = $pos_6.before(d_4);
|
|
4519
4522
|
const tr_0 = view_13.state.tr;
|
|
4520
4523
|
let rowOffset_0 = tablePos_0 + 1;
|
|
4521
4524
|
let idx = 0;
|
|
4522
|
-
|
|
4525
|
+
node_6.forEach((row_0) => {
|
|
4523
4526
|
if (idx === rowIdx) tr_0.setNodeMarkup(tr_0.mapping.map(rowOffset_0), void 0, mergeTableRowAttrs(row_0, {
|
|
4524
4527
|
height: newHeight_0,
|
|
4525
4528
|
heightRule: "atLeast"
|
|
@@ -4548,17 +4551,17 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4548
4551
|
const newWidth_1 = resizeRightEdgeOrigWidthRef.current;
|
|
4549
4552
|
const $pos_7 = view_14.state.doc.resolve(pmStart_2 + 1);
|
|
4550
4553
|
for (let d_5 = $pos_7.depth; d_5 >= 0; d_5--) {
|
|
4551
|
-
const
|
|
4552
|
-
if (
|
|
4554
|
+
const node_7 = $pos_7.node(d_5);
|
|
4555
|
+
if (node_7.type.name === "table") {
|
|
4553
4556
|
const tablePos_1 = $pos_7.before(d_5);
|
|
4554
4557
|
const tr_1 = view_14.state.tr;
|
|
4555
|
-
const tableAttrs_0 = expectTableAttrs(
|
|
4558
|
+
const tableAttrs_0 = expectTableAttrs(node_7);
|
|
4556
4559
|
if (!tableAttrs_0.columnWidths) break;
|
|
4557
4560
|
const widths_2 = [...tableAttrs_0.columnWidths];
|
|
4558
4561
|
widths_2[colIdx_0] = newWidth_1;
|
|
4559
|
-
tr_1.setNodeMarkup(tablePos_1, void 0, mergeTableAttrs(
|
|
4562
|
+
tr_1.setNodeMarkup(tablePos_1, void 0, mergeTableAttrs(node_7, { columnWidths: widths_2 }));
|
|
4560
4563
|
let rowOffset_1 = tablePos_1 + 1;
|
|
4561
|
-
|
|
4564
|
+
node_7.forEach((row_1) => {
|
|
4562
4565
|
let cellOffset_0 = rowOffset_1 + 1;
|
|
4563
4566
|
let cellColIdx_0 = 0;
|
|
4564
4567
|
row_1.forEach((cell_0) => {
|
|
@@ -4751,10 +4754,10 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4751
4754
|
const view_16 = hiddenPMRef.current.getView();
|
|
4752
4755
|
if (view_16) {
|
|
4753
4756
|
const targetPos = { value: null };
|
|
4754
|
-
view_16.state.doc.descendants((
|
|
4757
|
+
view_16.state.doc.descendants((node_8, pos_2) => {
|
|
4755
4758
|
if (targetPos.value !== null) return false;
|
|
4756
|
-
if (
|
|
4757
|
-
if (
|
|
4759
|
+
if (node_8.type.name === "paragraph") {
|
|
4760
|
+
if (node_8.attrs["bookmarks"]?.some((b) => b.name === bookmarkName)) {
|
|
4758
4761
|
targetPos.value = pos_2;
|
|
4759
4762
|
return false;
|
|
4760
4763
|
}
|
|
@@ -4816,8 +4819,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4816
4819
|
} else if (parent.isTextblock) {
|
|
4817
4820
|
const pmAlignedParts = [];
|
|
4818
4821
|
for (let i_0 = 0; i_0 < parent.content.childCount; i_0++) {
|
|
4819
|
-
const
|
|
4820
|
-
pmAlignedParts.push(
|
|
4822
|
+
const node_9 = parent.content.child(i_0);
|
|
4823
|
+
pmAlignedParts.push(node_9.isText ? node_9.text ?? "" : " ".repeat(node_9.nodeSize));
|
|
4821
4824
|
}
|
|
4822
4825
|
const pmAlignedText = pmAlignedParts.join("");
|
|
4823
4826
|
const offset = $pos_8.parentOffset;
|
|
@@ -4848,8 +4851,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4848
4851
|
if (parent_0.isTextblock) {
|
|
4849
4852
|
const pmAlignedParts_0 = [];
|
|
4850
4853
|
for (let i_1 = 0; i_1 < parent_0.content.childCount; i_1++) {
|
|
4851
|
-
const
|
|
4852
|
-
pmAlignedParts_0.push(
|
|
4854
|
+
const node_10 = parent_0.content.child(i_1);
|
|
4855
|
+
pmAlignedParts_0.push(node_10.isText ? node_10.text ?? "" : " ".repeat(node_10.nodeSize));
|
|
4853
4856
|
}
|
|
4854
4857
|
const pmAlignedText_0 = pmAlignedParts_0.join("");
|
|
4855
4858
|
const offset_0 = $pos_9.parentOffset;
|
|
@@ -4960,16 +4963,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4960
4963
|
const handleImageResize = useCallback((pmPos_16, newWidth_2, newHeight_1) => {
|
|
4961
4964
|
const view_20 = hiddenPMRef.current?.getView();
|
|
4962
4965
|
if (!view_20) return;
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
if (!node_10 || node_10.type.name !== "image") return;
|
|
4966
|
-
const tr_3 = view_20.state.tr.setNodeMarkup(pmPos_16, void 0, mergeImageAttrs(node_10, {
|
|
4967
|
-
width: newWidth_2,
|
|
4968
|
-
height: newHeight_1
|
|
4969
|
-
}));
|
|
4970
|
-
view_20.dispatch(tr_3);
|
|
4971
|
-
hiddenPMRef.current?.setNodeSelection(pmPos_16);
|
|
4972
|
-
} catch {}
|
|
4966
|
+
const committed = commitImageResize(view_20, pmPos_16, newWidth_2, newHeight_1);
|
|
4967
|
+
if (committed !== null) hiddenPMRef.current?.setNodeSelection(committed);
|
|
4973
4968
|
}, []);
|
|
4974
4969
|
/**
|
|
4975
4970
|
* Handle image resize start - prevent text selection during resize.
|
|
@@ -4993,8 +4988,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
4993
4988
|
try {
|
|
4994
4989
|
const node_11 = view_21.state.doc.nodeAt(pmPos_17);
|
|
4995
4990
|
if (!node_11 || node_11.type.name !== "image") return;
|
|
4996
|
-
|
|
4997
|
-
if (
|
|
4991
|
+
let committed_0 = null;
|
|
4992
|
+
if (isFloatingImage(node_11)) {
|
|
4998
4993
|
const pages_0 = pagesContainerRef.current?.querySelectorAll(".layout-page");
|
|
4999
4994
|
if (!pages_0 || pages_0.length === 0) return;
|
|
5000
4995
|
let contentEl = null;
|
|
@@ -5014,39 +5009,13 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
5014
5009
|
const dropX = (clientX_1 - contentRect.left) / zoom;
|
|
5015
5010
|
const dropY = (clientY_1 - contentRect.top) / zoom;
|
|
5016
5011
|
const PIXELS_TO_EMU = 914400 / 96;
|
|
5017
|
-
|
|
5018
|
-
const vOffsetEmu = Math.round(dropY * PIXELS_TO_EMU);
|
|
5019
|
-
const newPosition = {
|
|
5020
|
-
horizontal: {
|
|
5021
|
-
posOffset: hOffsetEmu,
|
|
5022
|
-
relativeTo: "margin"
|
|
5023
|
-
},
|
|
5024
|
-
vertical: {
|
|
5025
|
-
posOffset: vOffsetEmu,
|
|
5026
|
-
relativeTo: "margin"
|
|
5027
|
-
}
|
|
5028
|
-
};
|
|
5029
|
-
const tr_4 = view_21.state.tr.setNodeMarkup(pmPos_17, void 0, mergeImageAttrs(node_11, { position: newPosition }));
|
|
5030
|
-
view_21.dispatch(tr_4);
|
|
5031
|
-
hiddenPMRef.current?.setNodeSelection(pmPos_17);
|
|
5012
|
+
committed_0 = commitImageFloatMove(view_21, pmPos_17, Math.round(dropX * PIXELS_TO_EMU), Math.round(dropY * PIXELS_TO_EMU));
|
|
5032
5013
|
} else {
|
|
5033
5014
|
const dropPos = getPositionFromMouse(clientX_1, clientY_1);
|
|
5034
5015
|
if (dropPos === null) return;
|
|
5035
|
-
|
|
5036
|
-
let tr_5 = view_21.state.tr;
|
|
5037
|
-
tr_5 = tr_5.delete(pmPos_17, pmPos_17 + node_11.nodeSize);
|
|
5038
|
-
let selectionPos;
|
|
5039
|
-
if (dropPos <= pmPos_17) {
|
|
5040
|
-
tr_5 = tr_5.insert(dropPos, node_11);
|
|
5041
|
-
selectionPos = dropPos;
|
|
5042
|
-
} else {
|
|
5043
|
-
const adjusted = dropPos - node_11.nodeSize;
|
|
5044
|
-
tr_5 = tr_5.insert(Math.min(adjusted, tr_5.doc.content.size), node_11);
|
|
5045
|
-
selectionPos = Math.min(adjusted, tr_5.doc.content.size - 1);
|
|
5046
|
-
}
|
|
5047
|
-
hiddenPMRef.current?.setNodeSelection(selectionPos);
|
|
5048
|
-
view_21.dispatch(tr_5);
|
|
5016
|
+
committed_0 = commitImageInlineMove(view_21, pmPos_17, dropPos);
|
|
5049
5017
|
}
|
|
5018
|
+
if (committed_0 !== null) hiddenPMRef.current?.setNodeSelection(committed_0);
|
|
5050
5019
|
} catch {}
|
|
5051
5020
|
}, [getPositionFromMouse, zoom]);
|
|
5052
5021
|
const handleImageDragStart = useCallback(() => {
|
|
@@ -5473,8 +5442,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
5473
5442
|
isFocused() {
|
|
5474
5443
|
return getActiveEditorStory().view?.hasFocus() ?? false;
|
|
5475
5444
|
},
|
|
5476
|
-
dispatch(
|
|
5477
|
-
folioEditor.dispatch(
|
|
5445
|
+
dispatch(tr_3) {
|
|
5446
|
+
folioEditor.dispatch(tr_3);
|
|
5478
5447
|
},
|
|
5479
5448
|
undo() {
|
|
5480
5449
|
const target_5 = getActiveEditorStory();
|
|
@@ -12296,7 +12265,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
|
|
|
12296
12265
|
* - Error boundary
|
|
12297
12266
|
* - Loading states
|
|
12298
12267
|
*/
|
|
12299
|
-
const CommentsSidebar = lazy(() => import("./CommentsSidebar-
|
|
12268
|
+
const CommentsSidebar = lazy(() => import("./CommentsSidebar-tGhtc2ZH.js").then((m) => ({ default: m.CommentsSidebar })));
|
|
12300
12269
|
const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
|
|
12301
12270
|
const loadAttemptSelectiveSave = async () => {
|
|
12302
12271
|
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.19.
|
|
3
|
+
"version": "0.19.5",
|
|
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.41.0",
|
|
72
72
|
"better-result": "3.0.1",
|
|
73
73
|
"lucide-react": "1.24.0",
|
|
74
74
|
"prosemirror-history": "^1.5.0",
|