@daisychainapp/maily-to-core 0.4.0 → 0.4.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.
@@ -8658,89 +8658,30 @@ function getVariableSuggestions(char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
8658
8658
  // src/editor/nodes/html/html.tsx
8659
8659
  var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
8660
8660
  var import_state5 = require("@tiptap/pm/state");
8661
- var import_react37 = require("@tiptap/react");
8661
+ var import_react36 = require("@tiptap/react");
8662
8662
  var import_xml = __toESM(require("highlight.js/lib/languages/xml"), 1);
8663
8663
  var import_lowlight = require("lowlight");
8664
8664
 
8665
8665
  // src/editor/nodes/html/html-view.tsx
8666
8666
  var import_react35 = require("@tiptap/react");
8667
- var import_react36 = require("react");
8668
8667
  var import_jsx_runtime37 = require("react/jsx-runtime");
8669
8668
  function HTMLCodeBlockView(props) {
8670
- const { node, updateAttributes: updateAttributes2 } = props;
8671
- let { language, activeTab = "code" } = node.attrs;
8672
- activeTab || (activeTab = "code");
8669
+ const { node } = props;
8670
+ const { language } = node.attrs;
8673
8671
  const languageClass = language ? `language-${language}` : "";
8674
- const html2 = (0, import_react36.useMemo)(() => {
8675
- const text2 = node.content.content.reduce((acc, cur) => {
8676
- if (cur.type.name === "text") {
8677
- return acc + cur.text;
8678
- } else if (cur.type.name === "variable") {
8679
- const { id: variable, fallback } = (cur == null ? void 0 : cur.attrs) || {};
8680
- const formattedVariable = fallback ? `{{${variable},fallback=${fallback}}}` : `{{${variable}}}`;
8681
- return acc + formattedVariable;
8682
- }
8683
- return acc;
8684
- }, "");
8685
- const htmlParser = new DOMParser();
8686
- const htmlDoc = htmlParser.parseFromString(text2, "text/html");
8687
- const style = htmlDoc.querySelectorAll("style");
8688
- const body = htmlDoc.body;
8689
- const combinedStyle = Array.from(style).map((s) => s.innerHTML).join("\n");
8690
- return `<style>${combinedStyle}</style>${body.innerHTML}`;
8691
- }, [activeTab]);
8692
- const isEmpty = html2 === "";
8693
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
8672
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8694
8673
  import_react35.NodeViewWrapper,
8695
8674
  {
8696
8675
  draggable: false,
8697
8676
  "data-drag-handle": false,
8698
8677
  "data-type": "htmlCodeBlock",
8699
- children: [
8700
- activeTab === "code" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "mly:my-0 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-2 mly:text-black", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8701
- import_react35.NodeViewContent,
8702
- {
8703
- as: "code",
8704
- className: cn("is-editable", languageClass)
8705
- }
8706
- ) }),
8707
- activeTab === "preview" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8708
- "div",
8709
- {
8710
- className: cn(
8711
- "mly:not-prose mly:rounded-lg mly:border mly:border-gray-200 mly:p-2",
8712
- isEmpty && "mly:min-h-[42px]"
8713
- ),
8714
- ref: (node2) => {
8715
- if (!node2 || (node2 == null ? void 0 : node2.shadowRoot)) {
8716
- return;
8717
- }
8718
- const shadow = node2.attachShadow({ mode: "open" });
8719
- const sheet = new CSSStyleSheet();
8720
- sheet.replaceSync(`
8721
- * { font-family: 'Inter', sans-serif; }
8722
- blockquote, h1, h2, h3, img, li, ol, p, ul {
8723
- margin-top: 0;
8724
- margin-bottom: 0;
8725
- }
8726
- `);
8727
- shadow.adoptedStyleSheets = [sheet];
8728
- const container = document.createElement("div");
8729
- container.innerHTML = html2;
8730
- shadow.appendChild(container);
8731
- },
8732
- contentEditable: false,
8733
- onClick: () => {
8734
- if (!isEmpty) {
8735
- return;
8736
- }
8737
- updateAttributes2({
8738
- activeTab: "code"
8739
- });
8740
- }
8741
- }
8742
- )
8743
- ]
8678
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "mly-html-code-pre", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8679
+ import_react35.NodeViewContent,
8680
+ {
8681
+ as: "code",
8682
+ className: cn("is-editable", languageClass)
8683
+ }
8684
+ ) })
8744
8685
  }
8745
8686
  );
8746
8687
  }
@@ -8772,7 +8713,7 @@ var HTMLCodeBlockExtension = import_extension_code_block_lowlight.default.extend
8772
8713
  });
8773
8714
  },
8774
8715
  addNodeView() {
8775
- return (0, import_react37.ReactNodeViewRenderer)(HTMLCodeBlockView, {
8716
+ return (0, import_react36.ReactNodeViewRenderer)(HTMLCodeBlockView, {
8776
8717
  className: "mly:relative",
8777
8718
  attrs: ({ node }) => {
8778
8719
  var _a;