@pixldocs/canvas-renderer 0.5.250 → 0.5.252

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.
@@ -11866,11 +11866,10 @@ const PageCanvas = react.forwardRef(
11866
11866
  const selectAllActiveTextbox = (textbox) => {
11867
11867
  var _a2;
11868
11868
  try {
11869
- textbox.selectAll();
11870
- } catch {
11871
11869
  const len = ((_a2 = textbox.text) == null ? void 0 : _a2.length) ?? 0;
11872
- textbox.selectionStart = 0;
11870
+ textbox.selectionStart = len;
11873
11871
  textbox.selectionEnd = len;
11872
+ } catch {
11874
11873
  }
11875
11874
  fabricCanvas.requestRenderAll();
11876
11875
  };
@@ -13233,6 +13232,21 @@ const PageCanvas = react.forwardRef(
13233
13232
  onDynamicFieldClick(clickedId);
13234
13233
  }
13235
13234
  }
13235
+ try {
13236
+ if (allowEditing && !didTransformRef.current) {
13237
+ const active = fabricCanvas.getActiveObject();
13238
+ const tb = active instanceof fabric__namespace.Textbox ? active : active instanceof fabric__namespace.ActiveSelection && active.getObjects().length === 1 && active.getObjects()[0] instanceof fabric__namespace.Textbox ? active.getObjects()[0] : null;
13239
+ if (tb && !tb.isEditing && (tb.text ?? "") === "" && tb.editable !== false && !tb.__formattingEnabled && !tb.__pixldocsSuppressNextEdit && Date.now() >= suppressTextDoubleClickUntilRef.current) {
13240
+ const tbId = getObjectId(tb);
13241
+ if (tbId) editingTextIdRef.current = tbId;
13242
+ tb.enterEditing();
13243
+ tb.selectionStart = 0;
13244
+ tb.selectionEnd = 0;
13245
+ fabricCanvas.requestRenderAll();
13246
+ }
13247
+ }
13248
+ } catch {
13249
+ }
13236
13250
  });
13237
13251
  const markSimpleTransform = (e) => {
13238
13252
  if (!isActiveRef.current) return;
@@ -14525,7 +14539,13 @@ const PageCanvas = react.forwardRef(
14525
14539
  }
14526
14540
  editingTextIdRef.current = elementId || null;
14527
14541
  target.enterEditing();
14528
- target.selectAll();
14542
+ try {
14543
+ const len = (target.text ?? "").length;
14544
+ target.selectionStart = len;
14545
+ target.selectionEnd = len;
14546
+ } catch {
14547
+ }
14548
+ fabricCanvas.requestRenderAll();
14529
14549
  }
14530
14550
  });
14531
14551
  fabricCanvas.on("text:editing:entered", (e) => {
@@ -15541,11 +15561,11 @@ const PageCanvas = react.forwardRef(
15541
15561
  if (canvasUpdateVersion !== prevCanvasUpdateVersionRef.current) {
15542
15562
  justModifiedIdsRef.current.clear();
15543
15563
  prevCanvasUpdateVersionRef.current = canvasUpdateVersion;
15544
- syncTriggeredByPanelRef.current = true;
15564
+ syncTriggeredByPanelRef.current = !editingTextIdRef.current;
15545
15565
  } else {
15546
15566
  syncTriggeredByPanelRef.current = false;
15547
15567
  }
15548
- const shouldSkipUpdates = syncLockedRef.current || editLockRef.current;
15568
+ const shouldSkipUpdates = syncLockedRef.current || editLockRef.current || !!editingTextIdRef.current;
15549
15569
  if (shouldSkipUpdates) {
15550
15570
  pendingSyncRef.current = true;
15551
15571
  return;
@@ -23457,9 +23477,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23457
23477
  }
23458
23478
  return svgString;
23459
23479
  }
23460
- const resolvedPackageVersion = "0.5.250";
23480
+ const resolvedPackageVersion = "0.5.252";
23461
23481
  const PACKAGE_VERSION = resolvedPackageVersion;
23462
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.250";
23482
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.252";
23463
23483
  const roundParityValue = (value) => {
23464
23484
  if (typeof value !== "number") return value;
23465
23485
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24273,7 +24293,7 @@ class PixldocsRenderer {
24273
24293
  await this.waitForCanvasScene(container, cloned, i);
24274
24294
  }
24275
24295
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24276
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-FNQGiaqg.cjs"));
24296
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CLXGLXKP.cjs"));
24277
24297
  const prepared = preparePagesForExport(
24278
24298
  cloned.pages,
24279
24299
  canvasWidth,
@@ -26593,7 +26613,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26593
26613
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26594
26614
  sanitizeSvgTreeForPdf(svgToDraw);
26595
26615
  try {
26596
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-FNQGiaqg.cjs"));
26616
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CLXGLXKP.cjs"));
26597
26617
  try {
26598
26618
  await logTextMeasurementDiagnostic(svgToDraw);
26599
26619
  } catch {
@@ -26990,4 +27010,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
26990
27010
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
26991
27011
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
26992
27012
  exports.warmTemplateFromForm = warmTemplateFromForm;
26993
- //# sourceMappingURL=index-uwIqqY-8.cjs.map
27013
+ //# sourceMappingURL=index-DifGYkqE.cjs.map