@pixldocs/canvas-renderer 0.5.245 → 0.5.246
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.
- package/dist/{index-o3TKXqkj.cjs → index-DtQblfr0.cjs} +82 -13
- package/dist/index-DtQblfr0.cjs.map +1 -0
- package/dist/{index-FE8QLDiA.js → index-krO2Qm7P.js} +82 -13
- package/dist/index-krO2Qm7P.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-qzZ0kZCI.js → vectorPdfExport-D91zbb8z.js} +4 -4
- package/dist/{vectorPdfExport-qzZ0kZCI.js.map → vectorPdfExport-D91zbb8z.js.map} +1 -1
- package/dist/{vectorPdfExport-00z0fojJ.cjs → vectorPdfExport-g3JJf7fm.cjs} +4 -4
- package/dist/{vectorPdfExport-00z0fojJ.cjs.map → vectorPdfExport-g3JJf7fm.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-FE8QLDiA.js.map +0 -1
- package/dist/index-o3TKXqkj.cjs.map +0 -1
|
@@ -11120,7 +11120,9 @@ const PageCanvas = react.forwardRef(
|
|
|
11120
11120
|
const isSyncingSelectionToFabricRef = react.useRef(false);
|
|
11121
11121
|
const suppressGroupMemberBordersRef = react.useRef([]);
|
|
11122
11122
|
const editingTextIdRef = react.useRef(null);
|
|
11123
|
-
const
|
|
11123
|
+
const selectAllTextOnEditingEnterRef = react.useRef(null);
|
|
11124
|
+
const suppressedTextEditObjectsRef = react.useRef([]);
|
|
11125
|
+
const suppressTextDoubleClickUntilRef = react.useRef(0);
|
|
11124
11126
|
const syncLockedRef = react.useRef(false);
|
|
11125
11127
|
const editLockRef = react.useRef(false);
|
|
11126
11128
|
const editLockCountRef = react.useRef(0);
|
|
@@ -11829,6 +11831,44 @@ const PageCanvas = react.forwardRef(
|
|
|
11829
11831
|
});
|
|
11830
11832
|
fabricCanvas.hoverCursor = "default";
|
|
11831
11833
|
fabricCanvas.moveCursor = "move";
|
|
11834
|
+
const suppressTextEditForClick = (textbox) => {
|
|
11835
|
+
if (!textbox) return;
|
|
11836
|
+
textbox.selected = false;
|
|
11837
|
+
textbox.__lastSelected = false;
|
|
11838
|
+
textbox.__corner = void 0;
|
|
11839
|
+
textbox.__pixldocsSuppressNextEdit = true;
|
|
11840
|
+
suppressTextDoubleClickUntilRef.current = Date.now() + 350;
|
|
11841
|
+
if (!suppressedTextEditObjectsRef.current.some((entry) => entry.textbox === textbox)) {
|
|
11842
|
+
suppressedTextEditObjectsRef.current.push({ textbox, editable: textbox.editable });
|
|
11843
|
+
}
|
|
11844
|
+
textbox.editable = false;
|
|
11845
|
+
};
|
|
11846
|
+
const restoreSuppressedTextEditObjects = () => {
|
|
11847
|
+
const entries = suppressedTextEditObjectsRef.current.splice(0);
|
|
11848
|
+
for (const { textbox, editable } of entries) {
|
|
11849
|
+
try {
|
|
11850
|
+
textbox.editable = editable;
|
|
11851
|
+
delete textbox.__pixldocsSuppressNextEdit;
|
|
11852
|
+
} catch {
|
|
11853
|
+
}
|
|
11854
|
+
}
|
|
11855
|
+
};
|
|
11856
|
+
const restoreSuppressedTextEditObjectsSoon = () => {
|
|
11857
|
+
requestAnimationFrame(() => {
|
|
11858
|
+
restoreSuppressedTextEditObjects();
|
|
11859
|
+
});
|
|
11860
|
+
};
|
|
11861
|
+
const selectAllActiveTextbox = (textbox) => {
|
|
11862
|
+
var _a2;
|
|
11863
|
+
try {
|
|
11864
|
+
textbox.selectAll();
|
|
11865
|
+
} catch {
|
|
11866
|
+
const len = ((_a2 = textbox.text) == null ? void 0 : _a2.length) ?? 0;
|
|
11867
|
+
textbox.selectionStart = 0;
|
|
11868
|
+
textbox.selectionEnd = len;
|
|
11869
|
+
}
|
|
11870
|
+
fabricCanvas.requestRenderAll();
|
|
11871
|
+
};
|
|
11832
11872
|
if (!allowSelection) {
|
|
11833
11873
|
fabricCanvas.selection = false;
|
|
11834
11874
|
fabricCanvas.on("selection:created", () => {
|
|
@@ -12818,6 +12858,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12818
12858
|
fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
|
|
12819
12859
|
fabricCanvas.on("mouse:down:before", (opt) => {
|
|
12820
12860
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
12861
|
+
const activeBeforeMouseDown = fabricCanvas.getActiveObject();
|
|
12821
12862
|
if (editLockRef.current) {
|
|
12822
12863
|
const active = fabricCanvas.getActiveObject();
|
|
12823
12864
|
if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
|
|
@@ -12843,6 +12884,9 @@ const PageCanvas = react.forwardRef(
|
|
|
12843
12884
|
targetId = childId;
|
|
12844
12885
|
}
|
|
12845
12886
|
}
|
|
12887
|
+
if (target instanceof fabric__namespace.Textbox && targetId && targetId !== "__background__" && activeBeforeMouseDown === target && !target.isEditing && !target.__corner && !isMultiSelectModifier(opt.e)) {
|
|
12888
|
+
selectAllTextOnEditingEnterRef.current = targetId;
|
|
12889
|
+
}
|
|
12846
12890
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
12847
12891
|
const pageNow = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId);
|
|
12848
12892
|
const childrenNow = (pageNow == null ? void 0 : pageNow.children) ?? [];
|
|
@@ -12950,9 +12994,13 @@ const PageCanvas = react.forwardRef(
|
|
|
12950
12994
|
opt.target = effectiveTarget;
|
|
12951
12995
|
pendingGroupPromotionRef.current = null;
|
|
12952
12996
|
pendingGroupDrillInRef.current = { groupId: drillGroup.id, childId: effectiveTargetId, target: effectiveTarget };
|
|
12953
|
-
effectiveTarget.
|
|
12954
|
-
|
|
12955
|
-
|
|
12997
|
+
if (effectiveTarget instanceof fabric__namespace.Textbox) {
|
|
12998
|
+
suppressTextEditForClick(effectiveTarget);
|
|
12999
|
+
} else {
|
|
13000
|
+
effectiveTarget.selected = false;
|
|
13001
|
+
effectiveTarget.__lastSelected = false;
|
|
13002
|
+
effectiveTarget.__corner = void 0;
|
|
13003
|
+
}
|
|
12956
13004
|
selectElements([effectiveTargetId], false, false);
|
|
12957
13005
|
updateDrilledGroupOutline();
|
|
12958
13006
|
fabricCanvas.requestRenderAll();
|
|
@@ -13095,7 +13143,6 @@ const PageCanvas = react.forwardRef(
|
|
|
13095
13143
|
lockEdits();
|
|
13096
13144
|
}
|
|
13097
13145
|
const o = fabricCanvas.getActiveObject();
|
|
13098
|
-
pendingTextEditOnUpRef.current = null;
|
|
13099
13146
|
if (!o) return;
|
|
13100
13147
|
o.__lockScaleDuringCrop = false;
|
|
13101
13148
|
});
|
|
@@ -13122,9 +13169,13 @@ const PageCanvas = react.forwardRef(
|
|
|
13122
13169
|
(_b2 = (_a2 = pendingDrillIn.target).set) == null ? void 0 : _b2.call(_a2, { selectable: true, evented: true, hasBorders: true, hasControls: true });
|
|
13123
13170
|
fabricCanvas.setActiveObject(pendingDrillIn.target);
|
|
13124
13171
|
pendingDrillIn.target.setCoords();
|
|
13125
|
-
pendingDrillIn.target.
|
|
13126
|
-
|
|
13127
|
-
|
|
13172
|
+
if (pendingDrillIn.target instanceof fabric__namespace.Textbox) {
|
|
13173
|
+
suppressTextEditForClick(pendingDrillIn.target);
|
|
13174
|
+
} else {
|
|
13175
|
+
pendingDrillIn.target.selected = false;
|
|
13176
|
+
pendingDrillIn.target.__lastSelected = false;
|
|
13177
|
+
pendingDrillIn.target.__corner = void 0;
|
|
13178
|
+
}
|
|
13128
13179
|
fabricCanvas.requestRenderAll();
|
|
13129
13180
|
} finally {
|
|
13130
13181
|
requestAnimationFrame(() => {
|
|
@@ -13197,6 +13248,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13197
13248
|
syncLockedRef.current = false;
|
|
13198
13249
|
}, 0);
|
|
13199
13250
|
unlockEditsSoon();
|
|
13251
|
+
restoreSuppressedTextEditObjectsSoon();
|
|
13200
13252
|
if (allowDynamicFieldClick && onDynamicFieldClick && e.target) {
|
|
13201
13253
|
const clickedId = getObjectId(e.target);
|
|
13202
13254
|
if (clickedId && dynamicFieldIds.includes(clickedId)) {
|
|
@@ -14483,6 +14535,9 @@ const PageCanvas = react.forwardRef(
|
|
|
14483
14535
|
else if (active instanceof fabric__namespace.ActiveSelection && active.getObjects().length === 1 && active.getObjects()[0] instanceof fabric__namespace.Textbox) target = active.getObjects()[0];
|
|
14484
14536
|
}
|
|
14485
14537
|
if (target && target instanceof fabric__namespace.Textbox) {
|
|
14538
|
+
if (Date.now() < suppressTextDoubleClickUntilRef.current || target.__pixldocsSuppressNextEdit) {
|
|
14539
|
+
return;
|
|
14540
|
+
}
|
|
14486
14541
|
const elementId = getObjectId(target);
|
|
14487
14542
|
if (target.__formattingEnabled === true || target.editable === false) {
|
|
14488
14543
|
sonner.toast.info("Inline formatting is on — edit the text in the right panel.", {
|
|
@@ -14499,7 +14554,21 @@ const PageCanvas = react.forwardRef(
|
|
|
14499
14554
|
const target = e.target;
|
|
14500
14555
|
if (target && target instanceof fabric__namespace.Textbox) {
|
|
14501
14556
|
const elementId = getObjectId(target);
|
|
14557
|
+
if (target.__pixldocsSuppressNextEdit) {
|
|
14558
|
+
try {
|
|
14559
|
+
target.exitEditing();
|
|
14560
|
+
} catch {
|
|
14561
|
+
}
|
|
14562
|
+
editingTextIdRef.current = null;
|
|
14563
|
+
setEditingText(false);
|
|
14564
|
+
fabricCanvas.requestRenderAll();
|
|
14565
|
+
return;
|
|
14566
|
+
}
|
|
14502
14567
|
editingTextIdRef.current = elementId || null;
|
|
14568
|
+
if (elementId && selectAllTextOnEditingEnterRef.current === elementId) {
|
|
14569
|
+
selectAllTextOnEditingEnterRef.current = null;
|
|
14570
|
+
selectAllActiveTextbox(target);
|
|
14571
|
+
}
|
|
14503
14572
|
setEditingText(true);
|
|
14504
14573
|
}
|
|
14505
14574
|
});
|
|
@@ -23394,9 +23463,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23394
23463
|
}
|
|
23395
23464
|
return svgString;
|
|
23396
23465
|
}
|
|
23397
|
-
const resolvedPackageVersion = "0.5.
|
|
23466
|
+
const resolvedPackageVersion = "0.5.246";
|
|
23398
23467
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23399
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23468
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.246";
|
|
23400
23469
|
const roundParityValue = (value) => {
|
|
23401
23470
|
if (typeof value !== "number") return value;
|
|
23402
23471
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24210,7 +24279,7 @@ class PixldocsRenderer {
|
|
|
24210
24279
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24211
24280
|
}
|
|
24212
24281
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24213
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24282
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-g3JJf7fm.cjs"));
|
|
24214
24283
|
const prepared = preparePagesForExport(
|
|
24215
24284
|
cloned.pages,
|
|
24216
24285
|
canvasWidth,
|
|
@@ -26530,7 +26599,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26530
26599
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26531
26600
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26532
26601
|
try {
|
|
26533
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26602
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-g3JJf7fm.cjs"));
|
|
26534
26603
|
try {
|
|
26535
26604
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26536
26605
|
} catch {
|
|
@@ -26927,4 +26996,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
26927
26996
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
26928
26997
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
26929
26998
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
26930
|
-
//# sourceMappingURL=index-
|
|
26999
|
+
//# sourceMappingURL=index-DtQblfr0.cjs.map
|