@ampless/runtime 1.0.0-beta.78 → 1.0.0-beta.79

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 -2
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -261,6 +261,7 @@ import {
261
261
  } from "react";
262
262
  import { marked } from "marked";
263
263
  import { parseDocument, ElementType } from "htmlparser2";
264
+ import { isValidCustomClassId, tableCustomClassName } from "ampless";
264
265
  function escape(s) {
265
266
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
266
267
  }
@@ -327,7 +328,7 @@ function renderTiptapString(node, opts) {
327
328
  return `<img src="${src}" alt="${alt}"${title}${display} loading="lazy" />`;
328
329
  }
329
330
  case "table":
330
- return `<table class="tiptap-table"><tbody>${children}</tbody></table>`;
331
+ return `<table class="${tableClassName(node.attrs)}"><tbody>${children}</tbody></table>`;
331
332
  case "tableRow":
332
333
  return `<tr>${children}</tr>`;
333
334
  case "tableHeader":
@@ -344,6 +345,10 @@ function renderTiptapString(node, opts) {
344
345
  return children;
345
346
  }
346
347
  }
348
+ function tableClassName(attrs) {
349
+ const id = attrs?.customClass;
350
+ return isValidCustomClassId(id) ? `tiptap-table ${tableCustomClassName(id)}` : "tiptap-table";
351
+ }
347
352
  function tableCellAttrs(attrs) {
348
353
  let out = "";
349
354
  const colspan = Number(attrs?.colspan ?? 1);
@@ -503,7 +508,7 @@ function renderTiptapNode(node, opts, key) {
503
508
  case "table":
504
509
  return createElement(
505
510
  "table",
506
- { key, className: "tiptap-table" },
511
+ { key, className: tableClassName(node.attrs) },
507
512
  createElement("tbody", null, ...children)
508
513
  );
509
514
  case "tableRow":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampless/runtime",
3
- "version": "1.0.0-beta.78",
3
+ "version": "1.0.0-beta.79",
4
4
  "description": "Public-side runtime for ampless: post fetching, theme dispatch, middleware, public route handlers",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,9 +51,9 @@
51
51
  "marked": "^18.0.4",
52
52
  "sanitize-html": "^2.18.1",
53
53
  "tailwind-merge": "^3.6.0",
54
- "@ampless/mcp-server": "1.0.0-beta.70",
55
- "@ampless/plugin-og-image": "0.2.0-beta.63",
56
- "ampless": "1.0.0-beta.63"
54
+ "@ampless/mcp-server": "1.0.0-beta.71",
55
+ "@ampless/plugin-og-image": "0.2.0-beta.64",
56
+ "ampless": "1.0.0-beta.64"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@aws-amplify/adapter-nextjs": "^1",