@scrider/formatter 1.10.0 → 1.10.1

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.cjs CHANGED
@@ -595,9 +595,13 @@ var EMBED_RENDERERS = {
595
595
  const embedSrc = toCodeWidgetEmbedUrl(src);
596
596
  return `<iframe data-code-widget src="${escapeHtml(embedSrc)}" frameborder="0" allowfullscreen${renderEmbedIframeIsolationAttrs(context, "codeWidget")}${float}${style}></iframe>`;
597
597
  },
598
+ // `data-scrider-embed` marks this span as 1 Delta char for DomBridge before
599
+ // KaTeX post-render replaces the text body with a `.katex` subtree. Without
600
+ // the marker, DomBridge counts the raw LaTeX length and drifts indices for
601
+ // everything after the formula (e.g. Simple Table chrome probe fails).
598
602
  formula: (value) => {
599
603
  const latex = typeof value === "string" ? value : "";
600
- return `<span class="formula" data-formula="${escapeHtml(latex)}">${escapeHtml(latex)}</span>`;
604
+ return `<span class="formula" data-formula="${escapeHtml(latex)}" data-scrider-embed>${escapeHtml(latex)}</span>`;
601
605
  },
602
606
  diagram: (value) => {
603
607
  const source = typeof value === "string" ? value : "";
@@ -2723,7 +2727,7 @@ var formulaFormat = {
2723
2727
  },
2724
2728
  render(value) {
2725
2729
  const latex = typeof value === "string" ? value : "";
2726
- return `<span class="formula" data-formula="${escapeHtml(latex)}">${escapeHtml(latex)}</span>`;
2730
+ return `<span class="formula" data-formula="${escapeHtml(latex)}" data-scrider-embed>${escapeHtml(latex)}</span>`;
2727
2731
  },
2728
2732
  match(element) {
2729
2733
  if (element.tagName.toLowerCase() !== "span") return null;