@scrider/formatter 1.6.0 → 1.6.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.d.cts CHANGED
@@ -1010,7 +1010,12 @@ declare const blockFormat: Format<Record<string, unknown>>;
1010
1010
  * during HTML → Delta (see videoFormat.match guard).
1011
1011
  *
1012
1012
  * Markdown: ![Widget](url)
1013
- * HTML: <iframe data-code-widget src="<embed-url>" frameborder="0" allowfullscreen>
1013
+ * HTML: <iframe data-code-widget src="<embed-url>" frameborder="0" allowfullscreen
1014
+ * allow="…; cross-origin-isolated">
1015
+ *
1016
+ * The `allow="…; cross-origin-isolated"` list (see CODE_WIDGET_IFRAME_ALLOW)
1017
+ * delegates the cross-origin-isolated capability so StackBlitz WebContainer
1018
+ * embeds can boot SharedArrayBuffer; without it those embeds render blank.
1014
1019
  *
1015
1020
  * The src is run through `toCodeWidgetEmbedUrl` at render time, which is
1016
1021
  * idempotent, so resize/float attributes and the Delta ↔ HTML round-trip stay
package/dist/index.d.ts CHANGED
@@ -1010,7 +1010,12 @@ declare const blockFormat: Format<Record<string, unknown>>;
1010
1010
  * during HTML → Delta (see videoFormat.match guard).
1011
1011
  *
1012
1012
  * Markdown: ![Widget](url)
1013
- * HTML: <iframe data-code-widget src="<embed-url>" frameborder="0" allowfullscreen>
1013
+ * HTML: <iframe data-code-widget src="<embed-url>" frameborder="0" allowfullscreen
1014
+ * allow="…; cross-origin-isolated">
1015
+ *
1016
+ * The `allow="…; cross-origin-isolated"` list (see CODE_WIDGET_IFRAME_ALLOW)
1017
+ * delegates the cross-origin-isolated capability so StackBlitz WebContainer
1018
+ * embeds can boot SharedArrayBuffer; without it those embeds render blank.
1014
1019
  *
1015
1020
  * The src is run through `toCodeWidgetEmbedUrl` at render time, which is
1016
1021
  * idempotent, so resize/float attributes and the Delta ↔ HTML round-trip stay
package/dist/index.js CHANGED
@@ -1914,7 +1914,7 @@ var EMBED_RENDERERS = {
1914
1914
  }
1915
1915
  const style = styles.length > 0 ? ` style="${styles.join("; ")}"` : "";
1916
1916
  const embedSrc = toCodeWidgetEmbedUrl(src);
1917
- return `<iframe data-code-widget src="${escapeHtml(embedSrc)}" frameborder="0" allowfullscreen${float}${style}></iframe>`;
1917
+ return `<iframe data-code-widget src="${escapeHtml(embedSrc)}" frameborder="0" allowfullscreen allow="${CODE_WIDGET_IFRAME_ALLOW}"${float}${style}></iframe>`;
1918
1918
  },
1919
1919
  formula: (value) => {
1920
1920
  const latex = typeof value === "string" ? value : "";
@@ -2034,6 +2034,7 @@ function appendQueryParam(url, key, value) {
2034
2034
  const next = query ? `${query}&${key}=${value}` : `?${key}=${value}`;
2035
2035
  return `${base}${next}${hash}`;
2036
2036
  }
2037
+ var CODE_WIDGET_IFRAME_ALLOW = "accelerometer; camera; encrypted-media; geolocation; gyroscope; microphone; midi; payment; usb; vr; xr-spatial-tracking; cross-origin-isolated";
2037
2038
  function toCodeWidgetEmbedUrl(url) {
2038
2039
  const u = typeof url === "string" ? url.trim() : "";
2039
2040
  if (!u) return "";
@@ -2102,7 +2103,7 @@ var codeWidgetFormat = {
2102
2103
  }
2103
2104
  const style = styles.length > 0 ? ` style="${styles.join("; ")}"` : "";
2104
2105
  const embedSrc = toCodeWidgetEmbedUrl(src);
2105
- return `<iframe data-code-widget src="${escapeHtml(embedSrc)}" frameborder="0" allowfullscreen${float}${style}></iframe>`;
2106
+ return `<iframe data-code-widget src="${escapeHtml(embedSrc)}" frameborder="0" allowfullscreen allow="${CODE_WIDGET_IFRAME_ALLOW}"${float}${style}></iframe>`;
2106
2107
  },
2107
2108
  match(element) {
2108
2109
  if (element.tagName.toLowerCase() !== "iframe") return null;