@trafica/editor 1.0.57 → 1.0.58

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.mjs CHANGED
@@ -1728,10 +1728,11 @@ function serializeBlock(node, idCounts = /* @__PURE__ */ new Map(), inCell = fal
1728
1728
  const caption = ((_o = node.attrs) == null ? void 0 : _o.caption) ? escapeHTML(node.attrs.caption) : "";
1729
1729
  const x = (_p = node.attrs) == null ? void 0 : _p.x;
1730
1730
  const y = (_q = node.attrs) == null ? void 0 : _q.y;
1731
- const alignStyle = alignVal === "center" ? "display:block;margin-left:auto;margin-right:auto;text-align:center;" : alignVal === "right" ? "display:block;margin-left:auto;text-align:right;" : alignVal === "left" ? "display:block;margin-right:auto;text-align:left;" : "";
1732
- const posStyle = x !== void 0 ? `position:absolute;left:${Math.round(x)}px;top:${Math.round(y != null ? y : 0)}px;` : "";
1733
- const posAttrs = x !== void 0 ? ` data-x="${Math.round(x)}" data-y="${Math.round(y != null ? y : 0)}"` : "";
1734
- const figStyle = alignStyle || posStyle ? ` style="${alignStyle}${posStyle}"` : "";
1731
+ const isDraggable = x !== void 0;
1732
+ const effectiveAlign = alignVal != null ? alignVal : isDraggable ? "left" : void 0;
1733
+ const alignStyle = effectiveAlign === "center" ? "display:block;margin-left:auto;margin-right:auto;text-align:center;" : effectiveAlign === "right" ? "display:block;margin-left:auto;text-align:right;" : effectiveAlign === "left" ? "display:block;margin-right:auto;text-align:left;" : "";
1734
+ const posAttrs = isDraggable ? ` data-x="${Math.round(x)}" data-y="${Math.round(y != null ? y : 0)}"` : "";
1735
+ const figStyle = alignStyle ? ` style="${alignStyle}"` : "";
1735
1736
  if (caption) {
1736
1737
  return `<figure${alignAttr}${posAttrs}${figStyle}><img src="${src}" alt="${alt}"${width} style="max-width:100%;height:auto;" /><figcaption>${caption}</figcaption></figure>`;
1737
1738
  }