@ampless/runtime 1.0.0-beta.62 → 1.0.0-beta.63

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -403,7 +403,10 @@ function htmlPassthrough(html) {
403
403
  return createElement("span", { dangerouslySetInnerHTML: { __html: html } });
404
404
  }
405
405
  function htmlPassthroughBlock(html, key) {
406
- const props = { dangerouslySetInnerHTML: { __html: html } };
406
+ const props = {
407
+ dangerouslySetInnerHTML: { __html: html },
408
+ suppressHydrationWarning: true
409
+ };
407
410
  if (key !== void 0) props.key = key;
408
411
  return createElement("div", props);
409
412
  }
@@ -427,6 +430,9 @@ function renderTiptapNode(node, opts, key) {
427
430
  if (node.type === "text") {
428
431
  return htmlPassthrough(renderTiptapString(node));
429
432
  }
433
+ if (node.type === "codeBlock") {
434
+ return htmlPassthroughBlock(renderTiptapString(node), key);
435
+ }
430
436
  const childNodes = node.content ?? [];
431
437
  const children = childNodes.map(
432
438
  (c, i) => renderTiptapNode(c, opts, `${key}.${i}`)
@@ -450,17 +456,6 @@ function renderTiptapNode(node, opts, key) {
450
456
  return createElement("ol", { key }, ...children);
451
457
  case "listItem":
452
458
  return createElement("li", { key }, ...children);
453
- case "codeBlock": {
454
- const codeProps = {};
455
- if (node.attrs?.language) {
456
- codeProps.className = `language-${String(node.attrs.language)}`;
457
- }
458
- return createElement(
459
- "pre",
460
- { key },
461
- createElement("code", codeProps, ...children)
462
- );
463
- }
464
459
  case "blockquote":
465
460
  return createElement("blockquote", { key }, ...children);
466
461
  case "hardBreak":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampless/runtime",
3
- "version": "1.0.0-beta.62",
3
+ "version": "1.0.0-beta.63",
4
4
  "description": "Public-side runtime for ampless: post fetching, theme dispatch, middleware, public route handlers",
5
5
  "license": "MIT",
6
6
  "type": "module",