@pixldocs/canvas-renderer 0.5.251 → 0.5.253

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.
@@ -11848,11 +11848,10 @@ const PageCanvas = forwardRef(
11848
11848
  const selectAllActiveTextbox = (textbox) => {
11849
11849
  var _a2;
11850
11850
  try {
11851
- textbox.selectAll();
11852
- } catch {
11853
11851
  const len = ((_a2 = textbox.text) == null ? void 0 : _a2.length) ?? 0;
11854
- textbox.selectionStart = 0;
11852
+ textbox.selectionStart = len;
11855
11853
  textbox.selectionEnd = len;
11854
+ } catch {
11856
11855
  }
11857
11856
  fabricCanvas.requestRenderAll();
11858
11857
  };
@@ -12034,7 +12033,7 @@ const PageCanvas = forwardRef(
12034
12033
  }
12035
12034
  });
12036
12035
  fabricCanvas.on("object:scaling", () => {
12037
- var _a2;
12036
+ var _a2, _b2;
12038
12037
  fabricCanvas.__isUserTransforming = true;
12039
12038
  if (drilledGroupIdRef.current) {
12040
12039
  try {
@@ -12042,6 +12041,38 @@ const PageCanvas = forwardRef(
12042
12041
  } catch {
12043
12042
  }
12044
12043
  }
12044
+ const active = fabricCanvas.getActiveObject();
12045
+ if (!active) return;
12046
+ const state = useEditorStore.getState();
12047
+ const canvasPage = (_b2 = state.canvas.pages) == null ? void 0 : _b2.find((p) => p.id === pageId);
12048
+ const children = (canvasPage == null ? void 0 : canvasPage.children) ?? [];
12049
+ if (!canvasPage) return;
12050
+ const ids = state.canvas.selectedIds ?? [];
12051
+ let selectedGroup2 = null;
12052
+ for (const id of ids) {
12053
+ const node = findNodeById(children, id);
12054
+ if (node && isGroup(node)) {
12055
+ selectedGroup2 = node;
12056
+ break;
12057
+ }
12058
+ }
12059
+ if (!selectedGroup2) {
12060
+ const firstId = ids[0];
12061
+ const parent = firstId ? findParentGroup(children, firstId) : null;
12062
+ if (parent) {
12063
+ const memberIds = new Set(getAllElementIds(parent.children ?? []));
12064
+ const allSelectedInGroup = ids.every((id) => memberIds.has(id) || id === parent.id);
12065
+ if (allSelectedInGroup) selectedGroup2 = parent;
12066
+ }
12067
+ }
12068
+ if (!selectedGroup2) return;
12069
+ const rect = active.getBoundingRect();
12070
+ if (rect.width > 0 && rect.height > 0) {
12071
+ const bounds = { left: rect.left, top: rect.top, width: rect.width, height: rect.height };
12072
+ flushSync(() => {
12073
+ setGroupOverlayLiveBoundsRef.current(bounds);
12074
+ });
12075
+ }
12045
12076
  });
12046
12077
  fabricCanvas.on("object:moving", () => {
12047
12078
  var _a2, _b2;
@@ -13215,6 +13246,21 @@ const PageCanvas = forwardRef(
13215
13246
  onDynamicFieldClick(clickedId);
13216
13247
  }
13217
13248
  }
13249
+ try {
13250
+ if (allowEditing && !didTransformRef.current) {
13251
+ const active = fabricCanvas.getActiveObject();
13252
+ const tb = active instanceof fabric.Textbox ? active : active instanceof fabric.ActiveSelection && active.getObjects().length === 1 && active.getObjects()[0] instanceof fabric.Textbox ? active.getObjects()[0] : null;
13253
+ if (tb && !tb.isEditing && (tb.text ?? "") === "" && tb.editable !== false && !tb.__formattingEnabled && !tb.__pixldocsSuppressNextEdit && Date.now() >= suppressTextDoubleClickUntilRef.current) {
13254
+ const tbId = getObjectId(tb);
13255
+ if (tbId) editingTextIdRef.current = tbId;
13256
+ tb.enterEditing();
13257
+ tb.selectionStart = 0;
13258
+ tb.selectionEnd = 0;
13259
+ fabricCanvas.requestRenderAll();
13260
+ }
13261
+ }
13262
+ } catch {
13263
+ }
13218
13264
  });
13219
13265
  const markSimpleTransform = (e) => {
13220
13266
  if (!isActiveRef.current) return;
@@ -14507,7 +14553,13 @@ const PageCanvas = forwardRef(
14507
14553
  }
14508
14554
  editingTextIdRef.current = elementId || null;
14509
14555
  target.enterEditing();
14510
- target.selectAll();
14556
+ try {
14557
+ const len = (target.text ?? "").length;
14558
+ target.selectionStart = len;
14559
+ target.selectionEnd = len;
14560
+ } catch {
14561
+ }
14562
+ fabricCanvas.requestRenderAll();
14511
14563
  }
14512
14564
  });
14513
14565
  fabricCanvas.on("text:editing:entered", (e) => {
@@ -23439,9 +23491,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23439
23491
  }
23440
23492
  return svgString;
23441
23493
  }
23442
- const resolvedPackageVersion = "0.5.251";
23494
+ const resolvedPackageVersion = "0.5.253";
23443
23495
  const PACKAGE_VERSION = resolvedPackageVersion;
23444
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.251";
23496
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.253";
23445
23497
  const roundParityValue = (value) => {
23446
23498
  if (typeof value !== "number") return value;
23447
23499
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24255,7 +24307,7 @@ class PixldocsRenderer {
24255
24307
  await this.waitForCanvasScene(container, cloned, i);
24256
24308
  }
24257
24309
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24258
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CaBuNR6t.js");
24310
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DyfBSeYs.js");
24259
24311
  const prepared = preparePagesForExport(
24260
24312
  cloned.pages,
24261
24313
  canvasWidth,
@@ -26575,7 +26627,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26575
26627
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26576
26628
  sanitizeSvgTreeForPdf(svgToDraw);
26577
26629
  try {
26578
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CaBuNR6t.js");
26630
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DyfBSeYs.js");
26579
26631
  try {
26580
26632
  await logTextMeasurementDiagnostic(svgToDraw);
26581
26633
  } catch {
@@ -26975,4 +27027,4 @@ export {
26975
27027
  buildTeaserBlurFlatKeys as y,
26976
27028
  collectFontDescriptorsFromConfig as z
26977
27029
  };
26978
- //# sourceMappingURL=index-jYZgiC9h.js.map
27030
+ //# sourceMappingURL=index-BsuNRFPC.js.map