@maily-to/core 2.0.0-beta.21 → 2.0.0-beta.23

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { B as MAX_SPACER_HEIGHT, G as getVariableSuggestions, H as SPACER_SPACING, I as addColumn, J as Document, L as getColumnWidths, M as VISIBILITY_SUPPORTED_TYPES, Q as getShellNodes, R as removeColumn, U as SPACING_PRESETS, V as MIN_SPACER_HEIGHT, W as VariableExtension, X as getNodeStyleState, Z as getNodeTheme, at as TooltipTrigger, ct as FloatingElement, dt as FLOATING_ELEMENT_ORDER, et as Tooltip, ft as useOnSelectionUpdate, g as VisuallyHidden, gt as useValueAsRef, ht as ArrowIcon, i as mergeExtensions, it as TooltipProvider, j as ProtectVariableTrigger, lt as clearInitialNodeSelection, mt as useEditorInstance, n as useMailyEditor, nt as TooltipPopup, ot as FLOATING_ELEMENT_HEIGHT, pt as useFloatingStore, q as filterVariableSuggestions, r as getNormalizedHtml, rt as TooltipPositioner, st as FLOATING_ELEMENT_PADDING, t as DEFAULT_EXTENSIONS, tt as TooltipArrow, ut as FLOATING_ELEMENT_IDS, z as updateColumnWidth } from "./use-maily-editor-BrlfN_JG.mjs";
1
+ import { B as MAX_SPACER_HEIGHT, G as getVariableSuggestions, H as SPACER_SPACING, I as addColumn, J as Document, L as getColumnWidths, M as VISIBILITY_SUPPORTED_TYPES, Q as getShellNodes, R as removeColumn, U as SPACING_PRESETS, V as MIN_SPACER_HEIGHT, W as VariableExtension, X as getNodeStyleState, Z as getNodeTheme, at as TooltipTrigger, ct as FloatingElement, dt as FLOATING_ELEMENT_ORDER, et as Tooltip, ft as useOnSelectionUpdate, g as VisuallyHidden, gt as useValueAsRef, ht as ArrowIcon, i as mergeExtensions, it as TooltipProvider, j as ProtectVariableTrigger, lt as clearInitialNodeSelection, mt as useEditorInstance, n as useMailyEditor, nt as TooltipPopup, ot as FLOATING_ELEMENT_HEIGHT, pt as useFloatingStore, q as filterVariableSuggestions, r as getNormalizedHtml, rt as TooltipPositioner, st as FLOATING_ELEMENT_PADDING, t as DEFAULT_EXTENSIONS, tt as TooltipArrow, ut as FLOATING_ELEMENT_IDS, z as updateColumnWidth } from "./use-maily-editor-DJgV489s.mjs";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { ColorPicker as ColorPicker$1 } from "cromia";
4
4
  import { Fragment, createContext, forwardRef, use, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
@@ -3362,7 +3362,7 @@ const PHRASING_TAGS = /* @__PURE__ */ new Set([
3362
3362
  "SUP",
3363
3363
  "U"
3364
3364
  ]);
3365
- const HIDDEN_SELECTORS = ["[data-skip-in-text=\"true\"]", ".preheader"].join(",");
3365
+ const TEXT_SKIPPED_SELECTOR = "[data-skip-in-text=\"true\"]";
3366
3366
  const INHERITED_PROPERTIES = /* @__PURE__ */ new Set([
3367
3367
  "color",
3368
3368
  "direction",
@@ -3418,7 +3418,8 @@ function setRuleStyles(document) {
3418
3418
  }
3419
3419
  }
3420
3420
  function removeHidden(document) {
3421
- for (const element of document.querySelectorAll(HIDDEN_SELECTORS)) element.remove();
3421
+ for (const element of document.querySelectorAll(".preheader")) element.remove();
3422
+ for (const element of document.querySelectorAll(TEXT_SKIPPED_SELECTOR)) if (!element.querySelector("img")) element.remove();
3422
3423
  for (const element of document.querySelectorAll("[style]")) if (element.style.display === "none") element.remove();
3423
3424
  }
3424
3425
  function isPhrasing(node) {
@@ -3493,6 +3494,8 @@ function setLinkedImages(document) {
3493
3494
  }
3494
3495
  image.setAttribute("data-external-link", anchor.getAttribute("href") ?? "");
3495
3496
  anchor.removeAttribute("href");
3497
+ const parent = anchor.parentElement;
3498
+ if (parent?.childElementCount === 1 && !parent.textContent?.trim()) anchor.replaceWith(image);
3496
3499
  }
3497
3500
  }
3498
3501
  function getBodyWrapper(document) {
@@ -4299,7 +4299,7 @@ const PHRASING_TAGS = /* @__PURE__ */ new Set([
4299
4299
  "SUP",
4300
4300
  "U"
4301
4301
  ]);
4302
- const HIDDEN_SELECTORS = ["[data-skip-in-text=\"true\"]", ".preheader"].join(",");
4302
+ const TEXT_SKIPPED_SELECTOR = "[data-skip-in-text=\"true\"]";
4303
4303
  const INHERITED_PROPERTIES = /* @__PURE__ */ new Set([
4304
4304
  "color",
4305
4305
  "direction",
@@ -4355,7 +4355,8 @@ function setRuleStyles(document) {
4355
4355
  }
4356
4356
  }
4357
4357
  function removeHidden(document) {
4358
- for (const element of document.querySelectorAll(HIDDEN_SELECTORS)) element.remove();
4358
+ for (const element of document.querySelectorAll(".preheader")) element.remove();
4359
+ for (const element of document.querySelectorAll(TEXT_SKIPPED_SELECTOR)) if (!element.querySelector("img")) element.remove();
4359
4360
  for (const element of document.querySelectorAll("[style]")) if (element.style.display === "none") element.remove();
4360
4361
  }
4361
4362
  function isPhrasing(node) {
@@ -4430,6 +4431,8 @@ function setLinkedImages(document) {
4430
4431
  }
4431
4432
  image.setAttribute("data-external-link", anchor.getAttribute("href") ?? "");
4432
4433
  anchor.removeAttribute("href");
4434
+ const parent = anchor.parentElement;
4435
+ if (parent?.childElementCount === 1 && !parent.textContent?.trim()) anchor.replaceWith(image);
4433
4436
  }
4434
4437
  }
4435
4438
  function getBodyWrapper(document) {
@@ -4267,7 +4267,7 @@ const PHRASING_TAGS = /* @__PURE__ */ new Set([
4267
4267
  "SUP",
4268
4268
  "U"
4269
4269
  ]);
4270
- const HIDDEN_SELECTORS = ["[data-skip-in-text=\"true\"]", ".preheader"].join(",");
4270
+ const TEXT_SKIPPED_SELECTOR = "[data-skip-in-text=\"true\"]";
4271
4271
  const INHERITED_PROPERTIES = /* @__PURE__ */ new Set([
4272
4272
  "color",
4273
4273
  "direction",
@@ -4323,7 +4323,8 @@ function setRuleStyles(document) {
4323
4323
  }
4324
4324
  }
4325
4325
  function removeHidden(document) {
4326
- for (const element of document.querySelectorAll(HIDDEN_SELECTORS)) element.remove();
4326
+ for (const element of document.querySelectorAll(".preheader")) element.remove();
4327
+ for (const element of document.querySelectorAll(TEXT_SKIPPED_SELECTOR)) if (!element.querySelector("img")) element.remove();
4327
4328
  for (const element of document.querySelectorAll("[style]")) if (element.style.display === "none") element.remove();
4328
4329
  }
4329
4330
  function isPhrasing(node) {
@@ -4398,6 +4399,8 @@ function setLinkedImages(document) {
4398
4399
  }
4399
4400
  image.setAttribute("data-external-link", anchor.getAttribute("href") ?? "");
4400
4401
  anchor.removeAttribute("href");
4402
+ const parent = anchor.parentElement;
4403
+ if (parent?.childElementCount === 1 && !parent.textContent?.trim()) anchor.replaceWith(image);
4401
4404
  }
4402
4405
  }
4403
4406
  function getBodyWrapper(document) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/core",
3
- "version": "2.0.0-beta.21",
3
+ "version": "2.0.0-beta.23",
4
4
  "private": false,
5
5
  "description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
6
6
  "keywords": [
@@ -87,7 +87,7 @@
87
87
  "lucide-react": "^1.28.0",
88
88
  "unit-field": "^0.0.3",
89
89
  "zustand": "^5.0.14",
90
- "@maily-to/shared": "2.0.0-beta.21"
90
+ "@maily-to/shared": "2.0.0-beta.23"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@react-email/components": "^1.0.12",
@@ -110,7 +110,7 @@
110
110
  "@maily-to/extension-inline-suggestion": "0.0.1",
111
111
  "@maily-to/extension-ai-actions": "0.0.1",
112
112
  "@maily-to/extension-variable": "0.0.1",
113
- "@maily-to/render": "2.0.0-beta.21",
113
+ "@maily-to/render": "2.0.0-beta.23",
114
114
  "@maily-to/tsconfig": "0.0.0"
115
115
  },
116
116
  "peerDependencies": {