@parathantl/react-email-editor 0.1.5 → 0.1.7
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.cjs +1737 -877
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +283 -30
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +1733 -872
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -86,7 +86,7 @@ __export(index_exports, {
|
|
|
86
86
|
module.exports = __toCommonJS(index_exports);
|
|
87
87
|
|
|
88
88
|
// src/components/EmailEditor.tsx
|
|
89
|
-
var
|
|
89
|
+
var import_react61 = require("react");
|
|
90
90
|
|
|
91
91
|
// src/context/EditorContext.tsx
|
|
92
92
|
var import_react12 = require("react");
|
|
@@ -102,7 +102,8 @@ var DEFAULT_TEXT_PROPERTIES = {
|
|
|
102
102
|
align: "left",
|
|
103
103
|
fontWeight: "normal",
|
|
104
104
|
textTransform: "none",
|
|
105
|
-
letterSpacing: "normal"
|
|
105
|
+
letterSpacing: "normal",
|
|
106
|
+
backgroundColor: "transparent"
|
|
106
107
|
};
|
|
107
108
|
var DEFAULT_BUTTON_PROPERTIES = {
|
|
108
109
|
text: "Click me",
|
|
@@ -172,12 +173,13 @@ var DEFAULT_HEADING_PROPERTIES = {
|
|
|
172
173
|
fontFamily: "Arial, sans-serif",
|
|
173
174
|
fontSize: "28px",
|
|
174
175
|
color: "#000000",
|
|
175
|
-
lineHeight: "1.
|
|
176
|
+
lineHeight: "1.5",
|
|
176
177
|
fontWeight: "bold",
|
|
177
178
|
padding: "10px 25px",
|
|
178
179
|
align: "left",
|
|
179
180
|
textTransform: "none",
|
|
180
|
-
letterSpacing: "normal"
|
|
181
|
+
letterSpacing: "normal",
|
|
182
|
+
backgroundColor: "transparent"
|
|
181
183
|
};
|
|
182
184
|
var DEFAULT_COUNTDOWN_PROPERTIES = {
|
|
183
185
|
targetDate: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3).toISOString().slice(0, 16),
|
|
@@ -303,7 +305,7 @@ var BLOCK_DEFINITIONS = [
|
|
|
303
305
|
{
|
|
304
306
|
type: "social",
|
|
305
307
|
label: "Social",
|
|
306
|
-
icon: "\u{
|
|
308
|
+
icon: "\u{1F465}",
|
|
307
309
|
description: "Social media links"
|
|
308
310
|
},
|
|
309
311
|
{
|
|
@@ -1208,6 +1210,10 @@ function useImageAdapter() {
|
|
|
1208
1210
|
const { imageUploadAdapter } = useConfigContext();
|
|
1209
1211
|
return { imageUploadAdapter };
|
|
1210
1212
|
}
|
|
1213
|
+
function useColorPresets() {
|
|
1214
|
+
const { customColorPresets, addCustomColorPreset, removeCustomColorPreset } = useConfigContext();
|
|
1215
|
+
return { customColorPresets, addCustomColorPreset, removeCustomColorPreset };
|
|
1216
|
+
}
|
|
1211
1217
|
|
|
1212
1218
|
// src/context/EditorContext.tsx
|
|
1213
1219
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1222,6 +1228,8 @@ function EditorProvider({
|
|
|
1222
1228
|
onVariablesChange,
|
|
1223
1229
|
fontFamilies: fontFamiliesProp,
|
|
1224
1230
|
fontSizes: fontSizesProp,
|
|
1231
|
+
colorPresets: colorPresetsProp,
|
|
1232
|
+
onColorPresetsChange,
|
|
1225
1233
|
persistenceKey,
|
|
1226
1234
|
persistenceAdapter,
|
|
1227
1235
|
onBlockAdd,
|
|
@@ -1237,6 +1245,24 @@ function EditorProvider({
|
|
|
1237
1245
|
}) {
|
|
1238
1246
|
const fontFamilies = fontFamiliesProp ?? FONT_OPTIONS;
|
|
1239
1247
|
const fontSizes = fontSizesProp ?? DEFAULT_FONT_SIZES;
|
|
1248
|
+
const [customColorPresets, setCustomColorPresets] = (0, import_react12.useState)(colorPresetsProp ?? []);
|
|
1249
|
+
const onColorPresetsChangeRef = (0, import_react12.useRef)(onColorPresetsChange);
|
|
1250
|
+
onColorPresetsChangeRef.current = onColorPresetsChange;
|
|
1251
|
+
const addCustomColorPreset = (0, import_react12.useCallback)((color) => {
|
|
1252
|
+
setCustomColorPresets((prev) => {
|
|
1253
|
+
if (prev.includes(color)) return prev;
|
|
1254
|
+
const next = [...prev, color];
|
|
1255
|
+
onColorPresetsChangeRef.current?.(next);
|
|
1256
|
+
return next;
|
|
1257
|
+
});
|
|
1258
|
+
}, []);
|
|
1259
|
+
const removeCustomColorPreset = (0, import_react12.useCallback)((color) => {
|
|
1260
|
+
setCustomColorPresets((prev) => {
|
|
1261
|
+
const next = prev.filter((c) => c !== color);
|
|
1262
|
+
onColorPresetsChangeRef.current?.(next);
|
|
1263
|
+
return next;
|
|
1264
|
+
});
|
|
1265
|
+
}, []);
|
|
1240
1266
|
const resolvedInitial = (0, import_react12.useMemo)(() => {
|
|
1241
1267
|
if (persistenceKey) {
|
|
1242
1268
|
const adapter = persistenceAdapter ?? localStorageAdapter;
|
|
@@ -1451,9 +1477,12 @@ function EditorProvider({
|
|
|
1451
1477
|
updateVariableChipStyle,
|
|
1452
1478
|
fontFamilies,
|
|
1453
1479
|
fontSizes,
|
|
1454
|
-
clearPersisted
|
|
1480
|
+
clearPersisted,
|
|
1481
|
+
customColorPresets,
|
|
1482
|
+
addCustomColorPreset,
|
|
1483
|
+
removeCustomColorPreset
|
|
1455
1484
|
}),
|
|
1456
|
-
[allVariables, predefinedVariables, customVariables, imageUploadAdapter, addCustomVariable, removeCustomVariable, variableChipStyle, updateVariableChipStyle, fontFamilies, fontSizes, clearPersisted]
|
|
1485
|
+
[allVariables, predefinedVariables, customVariables, imageUploadAdapter, addCustomVariable, removeCustomVariable, variableChipStyle, updateVariableChipStyle, fontFamilies, fontSizes, clearPersisted, customColorPresets, addCustomColorPreset, removeCustomColorPreset]
|
|
1457
1486
|
);
|
|
1458
1487
|
const blockIndexValue = (0, import_react12.useMemo)(() => state.blockIndex, [state.blockIndex]);
|
|
1459
1488
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DispatchContext.Provider, { value: dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MethodsContext.Provider, { value: methodsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HistoryContext.Provider, { value: historyValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TemplateContext.Provider, { value: templateValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectionContext.Provider, { value: selectionValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, { value: configValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockIndexContext.Provider, { value: blockIndexValue, children }) }) }) }) }) }) });
|
|
@@ -1775,8 +1804,24 @@ function isSafeURL(url) {
|
|
|
1775
1804
|
if (trimmed.startsWith("/") || trimmed.startsWith("#") || trimmed.startsWith("?")) return true;
|
|
1776
1805
|
return SAFE_URL_PATTERN.test(trimmed);
|
|
1777
1806
|
}
|
|
1807
|
+
function isSafeImageSrc(url) {
|
|
1808
|
+
if (isSafeURL(url)) return true;
|
|
1809
|
+
const trimmed = url.trim();
|
|
1810
|
+
if (/^data:image\/svg/i.test(trimmed)) return false;
|
|
1811
|
+
return /^data:image\//i.test(trimmed);
|
|
1812
|
+
}
|
|
1778
1813
|
|
|
1779
1814
|
// src/mjml/generator.ts
|
|
1815
|
+
var GOOGLE_FONTS = {
|
|
1816
|
+
"Roboto": "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700",
|
|
1817
|
+
"Open Sans": "https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700",
|
|
1818
|
+
"Lato": "https://fonts.googleapis.com/css?family=Lato:300,400,700",
|
|
1819
|
+
"Montserrat": "https://fonts.googleapis.com/css?family=Montserrat:300,400,500,700",
|
|
1820
|
+
"Source Sans Pro": "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700",
|
|
1821
|
+
"Oswald": "https://fonts.googleapis.com/css?family=Oswald:300,400,700",
|
|
1822
|
+
"Raleway": "https://fonts.googleapis.com/css?family=Raleway:300,400,500,700",
|
|
1823
|
+
"Merriweather": "https://fonts.googleapis.com/css?family=Merriweather:300,400,700"
|
|
1824
|
+
};
|
|
1780
1825
|
function generateMJML(template) {
|
|
1781
1826
|
const { globalStyles, sections } = template;
|
|
1782
1827
|
const lines = [];
|
|
@@ -1789,6 +1834,23 @@ function generateMJML(template) {
|
|
|
1789
1834
|
if (headMetadata?.previewText) {
|
|
1790
1835
|
lines.push(` <mj-preview>${escapeHTML(headMetadata.previewText)}</mj-preview>`);
|
|
1791
1836
|
}
|
|
1837
|
+
const usedFonts = /* @__PURE__ */ new Set();
|
|
1838
|
+
if (globalStyles.fontFamily) usedFonts.add(globalStyles.fontFamily);
|
|
1839
|
+
for (const section of sections) {
|
|
1840
|
+
for (const column of section.columns) {
|
|
1841
|
+
for (const block of column.blocks) {
|
|
1842
|
+
if (block.properties.fontFamily) {
|
|
1843
|
+
usedFonts.add(block.properties.fontFamily);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
for (const font of usedFonts) {
|
|
1849
|
+
const family = font.split(",")[0].trim().replace(/['"]/g, "");
|
|
1850
|
+
if (GOOGLE_FONTS[family]) {
|
|
1851
|
+
lines.push(` <mj-font name="${escapeAttr(family)}" href="${escapeAttr(GOOGLE_FONTS[family])}" />`);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1792
1854
|
lines.push(" <mj-attributes>");
|
|
1793
1855
|
lines.push(` <mj-all font-family="${escapeAttr(globalStyles.fontFamily)}" />`);
|
|
1794
1856
|
lines.push(" </mj-attributes>");
|
|
@@ -1911,7 +1973,8 @@ function generateTextBlock(block, indent) {
|
|
|
1911
1973
|
align: p.align,
|
|
1912
1974
|
"font-weight": p.fontWeight && p.fontWeight !== "normal" ? p.fontWeight : void 0,
|
|
1913
1975
|
"text-transform": p.textTransform && p.textTransform !== "none" ? p.textTransform : void 0,
|
|
1914
|
-
"letter-spacing": p.letterSpacing && p.letterSpacing !== "normal" ? p.letterSpacing : void 0
|
|
1976
|
+
"letter-spacing": p.letterSpacing && p.letterSpacing !== "normal" ? p.letterSpacing : void 0,
|
|
1977
|
+
"container-background-color": p.backgroundColor && p.backgroundColor !== "transparent" ? p.backgroundColor : void 0
|
|
1915
1978
|
});
|
|
1916
1979
|
const content = resetBlockMargins(stripVariableChips(p.content || ""));
|
|
1917
1980
|
return `${indent}<mj-text${attrs}>${content}</mj-text>`;
|
|
@@ -1938,7 +2001,7 @@ function generateButtonBlock(block, indent) {
|
|
|
1938
2001
|
function generateImageBlock(block, indent) {
|
|
1939
2002
|
const p = block.properties;
|
|
1940
2003
|
const attrs = buildAttrs({
|
|
1941
|
-
src:
|
|
2004
|
+
src: safeSrc(p.src),
|
|
1942
2005
|
alt: p.alt,
|
|
1943
2006
|
href: p.href ? safeHref(p.href) : void 0,
|
|
1944
2007
|
width: p.width,
|
|
@@ -1980,12 +2043,14 @@ function generateSocialBlock(block, indent) {
|
|
|
1980
2043
|
const lines = [];
|
|
1981
2044
|
lines.push(`${indent}<mj-social${attrs}>`);
|
|
1982
2045
|
for (const element of p.elements) {
|
|
2046
|
+
const hasCustomSrc = !!element.src;
|
|
1983
2047
|
const elAttrs = buildAttrs({
|
|
1984
|
-
name: element.name,
|
|
2048
|
+
name: hasCustomSrc ? `custom-${element.name}` : element.name,
|
|
1985
2049
|
href: safeHref(element.href),
|
|
1986
|
-
src:
|
|
1987
|
-
"background-color": element.backgroundColor,
|
|
1988
|
-
color: element.color
|
|
2050
|
+
src: hasCustomSrc ? safeSrc(element.src) : void 0,
|
|
2051
|
+
"background-color": element.backgroundColor || (hasCustomSrc ? "transparent" : void 0),
|
|
2052
|
+
color: element.color,
|
|
2053
|
+
"css-class": hasCustomSrc ? `ee-social-${element.name}` : void 0
|
|
1989
2054
|
});
|
|
1990
2055
|
const content = element.content ? escapeHTML(element.content) : "";
|
|
1991
2056
|
lines.push(`${indent} <mj-social-element${elAttrs}>${content}</mj-social-element>`);
|
|
@@ -2003,7 +2068,7 @@ function generateVideoBlock(block, indent) {
|
|
|
2003
2068
|
const p = block.properties;
|
|
2004
2069
|
const thumbnailUrl = p.thumbnailUrl || getAutoThumbnail(p.src);
|
|
2005
2070
|
const attrs = buildAttrs({
|
|
2006
|
-
src:
|
|
2071
|
+
src: safeSrc(thumbnailUrl),
|
|
2007
2072
|
href: safeHref(p.src),
|
|
2008
2073
|
alt: p.alt,
|
|
2009
2074
|
padding: p.padding,
|
|
@@ -2031,6 +2096,7 @@ function generateHeadingBlock(block, indent) {
|
|
|
2031
2096
|
"font-weight": p.fontWeight && p.fontWeight !== "normal" ? p.fontWeight : void 0,
|
|
2032
2097
|
"text-transform": p.textTransform && p.textTransform !== "none" ? p.textTransform : void 0,
|
|
2033
2098
|
"letter-spacing": p.letterSpacing && p.letterSpacing !== "normal" ? p.letterSpacing : void 0,
|
|
2099
|
+
"container-background-color": p.backgroundColor && p.backgroundColor !== "transparent" ? p.backgroundColor : void 0,
|
|
2034
2100
|
"css-class": `ee-block-heading ee-heading-${level}`
|
|
2035
2101
|
});
|
|
2036
2102
|
const content = resetBlockMargins(stripVariableChips(p.content || ""));
|
|
@@ -2115,10 +2181,17 @@ function generateHeroBlock(block, indent) {
|
|
|
2115
2181
|
return `${indent}<mj-text${attrs}>${html2}</mj-text>`;
|
|
2116
2182
|
}
|
|
2117
2183
|
function stripVariableChips(html2) {
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
);
|
|
2184
|
+
if (!html2.includes("ee-variable-chip")) return html2;
|
|
2185
|
+
const div = document.createElement("div");
|
|
2186
|
+
div.innerHTML = html2;
|
|
2187
|
+
const chips = div.querySelectorAll(".ee-variable-chip");
|
|
2188
|
+
chips.forEach((chip) => {
|
|
2189
|
+
const key = chip.getAttribute("data-variable-key");
|
|
2190
|
+
if (key) {
|
|
2191
|
+
chip.replaceWith(`{{ ${key} }}`);
|
|
2192
|
+
}
|
|
2193
|
+
});
|
|
2194
|
+
return div.innerHTML;
|
|
2122
2195
|
}
|
|
2123
2196
|
function resetBlockMargins(html2) {
|
|
2124
2197
|
return html2.replace(
|
|
@@ -2145,6 +2218,10 @@ function safeHref(url) {
|
|
|
2145
2218
|
if (!url) return "#";
|
|
2146
2219
|
return isSafeURL(url) ? url : "#";
|
|
2147
2220
|
}
|
|
2221
|
+
function safeSrc(url) {
|
|
2222
|
+
if (!url) return "#";
|
|
2223
|
+
return isSafeImageSrc(url) ? url : "#";
|
|
2224
|
+
}
|
|
2148
2225
|
|
|
2149
2226
|
// src/mjml/compiler.ts
|
|
2150
2227
|
var mjmlBrowser = null;
|
|
@@ -2264,7 +2341,7 @@ var MJML_DEFAULTS = {
|
|
|
2264
2341
|
fontFamily: "Ubuntu, Helvetica, Arial, sans-serif",
|
|
2265
2342
|
fontSize: "13px",
|
|
2266
2343
|
color: "#000000",
|
|
2267
|
-
lineHeight: "1",
|
|
2344
|
+
lineHeight: "1.5",
|
|
2268
2345
|
padding: "10px 25px",
|
|
2269
2346
|
align: "left",
|
|
2270
2347
|
fontWeight: "normal",
|
|
@@ -2650,6 +2727,16 @@ function parseBlockElements(parent) {
|
|
|
2650
2727
|
const parser = blockParserRegistry[tagName];
|
|
2651
2728
|
if (parser) {
|
|
2652
2729
|
blocks.push(parser(child));
|
|
2730
|
+
} else {
|
|
2731
|
+
const serializer = new XMLSerializer();
|
|
2732
|
+
blocks.push({
|
|
2733
|
+
id: generateBlockId(),
|
|
2734
|
+
type: "html",
|
|
2735
|
+
properties: {
|
|
2736
|
+
content: serializer.serializeToString(child),
|
|
2737
|
+
padding: child.getAttribute("padding") ?? DEFAULT_BLOCK_PROPERTIES.html.padding
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2653
2740
|
}
|
|
2654
2741
|
}
|
|
2655
2742
|
return blocks;
|
|
@@ -2666,6 +2753,11 @@ function parseTextBlock(el) {
|
|
|
2666
2753
|
return parseHtmlFromMjText(el);
|
|
2667
2754
|
}
|
|
2668
2755
|
const innerHTML = el.innerHTML?.trim() ?? "";
|
|
2756
|
+
const headingMatch = innerHTML.match(/^<(h[1-4])\b[^>]*>([\s\S]*)<\/\1>\s*$/i);
|
|
2757
|
+
if (headingMatch) {
|
|
2758
|
+
const syntheticCssClass = `ee-block-heading ee-heading-${headingMatch[1].toLowerCase()}`;
|
|
2759
|
+
return parseHeadingFromMjText(el, syntheticCssClass);
|
|
2760
|
+
}
|
|
2669
2761
|
const d = MJML_DEFAULTS.text;
|
|
2670
2762
|
return {
|
|
2671
2763
|
id: generateBlockId(),
|
|
@@ -2680,7 +2772,8 @@ function parseTextBlock(el) {
|
|
|
2680
2772
|
align: el.getAttribute("align") ?? d.align,
|
|
2681
2773
|
fontWeight: el.getAttribute("font-weight") ?? d.fontWeight,
|
|
2682
2774
|
textTransform: el.getAttribute("text-transform") ?? d.textTransform,
|
|
2683
|
-
letterSpacing: el.getAttribute("letter-spacing") ?? d.letterSpacing
|
|
2775
|
+
letterSpacing: el.getAttribute("letter-spacing") ?? d.letterSpacing,
|
|
2776
|
+
backgroundColor: el.getAttribute("container-background-color") ?? "transparent"
|
|
2684
2777
|
}
|
|
2685
2778
|
};
|
|
2686
2779
|
}
|
|
@@ -2706,7 +2799,8 @@ function parseHeadingFromMjText(el, cssClass) {
|
|
|
2706
2799
|
padding: resolvePadding(el, defaults2.padding),
|
|
2707
2800
|
align: el.getAttribute("align") ?? d.align,
|
|
2708
2801
|
textTransform: el.getAttribute("text-transform") ?? defaults2.textTransform,
|
|
2709
|
-
letterSpacing: el.getAttribute("letter-spacing") ?? defaults2.letterSpacing
|
|
2802
|
+
letterSpacing: el.getAttribute("letter-spacing") ?? defaults2.letterSpacing,
|
|
2803
|
+
backgroundColor: el.getAttribute("container-background-color") ?? "transparent"
|
|
2710
2804
|
}
|
|
2711
2805
|
};
|
|
2712
2806
|
}
|
|
@@ -2847,8 +2941,16 @@ function parseSocialBlock(el) {
|
|
|
2847
2941
|
const childEls = el.querySelectorAll("mj-social-element");
|
|
2848
2942
|
for (let i = 0; i < childEls.length; i++) {
|
|
2849
2943
|
const child = childEls[i];
|
|
2944
|
+
let name = child.getAttribute("name") ?? "";
|
|
2945
|
+
if (name.startsWith("custom-")) {
|
|
2946
|
+
name = name.slice(7);
|
|
2947
|
+
} else if (!name) {
|
|
2948
|
+
const cssClass = child.getAttribute("css-class") ?? "";
|
|
2949
|
+
const nameMatch = cssClass.match(/ee-social-(\w+)/);
|
|
2950
|
+
name = nameMatch ? nameMatch[1] : "web";
|
|
2951
|
+
}
|
|
2850
2952
|
const element = {
|
|
2851
|
-
name
|
|
2953
|
+
name,
|
|
2852
2954
|
href: child.getAttribute("href") ?? "#"
|
|
2853
2955
|
};
|
|
2854
2956
|
const src = child.getAttribute("src");
|
|
@@ -2924,19 +3026,24 @@ var toolbar_default = {
|
|
|
2924
3026
|
"exportDropdown": "exportDropdown",
|
|
2925
3027
|
"exportDropdownItem": "exportDropdownItem",
|
|
2926
3028
|
"richTextToolbar": "richTextToolbar",
|
|
3029
|
+
"richTextGroup": "richTextGroup",
|
|
2927
3030
|
"richTextBtn": "richTextBtn",
|
|
2928
3031
|
"richTextBtnActive": "richTextBtnActive",
|
|
2929
|
-
"
|
|
3032
|
+
"richTextBtnWithIndicator": "richTextBtnWithIndicator richTextBtn",
|
|
2930
3033
|
"richTextSelect": "richTextSelect",
|
|
2931
3034
|
"richTextSelectSmall": "richTextSelectSmall richTextSelect",
|
|
2932
3035
|
"richTextColorWrapper": "richTextColorWrapper",
|
|
2933
|
-
"richTextColorLabel": "richTextColorLabel",
|
|
2934
3036
|
"richTextColorIndicator": "richTextColorIndicator",
|
|
2935
3037
|
"richTextColorDropdown": "richTextColorDropdown",
|
|
3038
|
+
"richTextColorSectionLabel": "richTextColorSectionLabel",
|
|
2936
3039
|
"richTextColorGrid": "richTextColorGrid",
|
|
2937
3040
|
"richTextColorSwatch": "richTextColorSwatch",
|
|
2938
|
-
"
|
|
2939
|
-
"
|
|
3041
|
+
"richTextColorSwatchActive": "richTextColorSwatchActive",
|
|
3042
|
+
"richTextColorSwatchRemove": "richTextColorSwatchRemove",
|
|
3043
|
+
"richTextColorCustomRow": "richTextColorCustomRow",
|
|
3044
|
+
"richTextColorHexInput": "richTextColorHexInput",
|
|
3045
|
+
"richTextColorApplyBtn": "richTextColorApplyBtn",
|
|
3046
|
+
"richTextColorBottomActions": "richTextColorBottomActions",
|
|
2940
3047
|
"richTextColorClearBtn": "richTextColorClearBtn",
|
|
2941
3048
|
"richTextLinkDropdown": "richTextLinkDropdown",
|
|
2942
3049
|
"richTextLinkLabel": "richTextLinkLabel",
|
|
@@ -2944,7 +3051,10 @@ var toolbar_default = {
|
|
|
2944
3051
|
"richTextLinkError": "richTextLinkError",
|
|
2945
3052
|
"richTextLinkActions": "richTextLinkActions",
|
|
2946
3053
|
"richTextLinkApply": "richTextLinkApply",
|
|
2947
|
-
"richTextLinkRemove": "richTextLinkRemove"
|
|
3054
|
+
"richTextLinkRemove": "richTextLinkRemove",
|
|
3055
|
+
"richTextTooltipWrapper": "richTextTooltipWrapper",
|
|
3056
|
+
"richTextTooltip": "richTextTooltip",
|
|
3057
|
+
"richTextTooltipShortcut": "richTextTooltipShortcut"
|
|
2948
3058
|
};
|
|
2949
3059
|
|
|
2950
3060
|
// src/styles/editor.module.css
|
|
@@ -3520,19 +3630,19 @@ function Sidebar({ blockDefinitions }) {
|
|
|
3520
3630
|
}
|
|
3521
3631
|
|
|
3522
3632
|
// src/components/Canvas/Canvas.tsx
|
|
3523
|
-
var
|
|
3633
|
+
var import_react44 = __toESM(require("react"));
|
|
3524
3634
|
|
|
3525
3635
|
// src/components/Canvas/Section.tsx
|
|
3526
|
-
var
|
|
3636
|
+
var import_react42 = __toESM(require("react"));
|
|
3527
3637
|
|
|
3528
3638
|
// src/components/Canvas/Column.tsx
|
|
3529
|
-
var
|
|
3639
|
+
var import_react41 = __toESM(require("react"));
|
|
3530
3640
|
|
|
3531
3641
|
// src/components/Canvas/BlockRenderer.tsx
|
|
3532
|
-
var
|
|
3642
|
+
var import_react39 = __toESM(require("react"));
|
|
3533
3643
|
|
|
3534
3644
|
// src/components/Canvas/blocks/TextBlock.tsx
|
|
3535
|
-
var
|
|
3645
|
+
var import_react26 = __toESM(require("react"));
|
|
3536
3646
|
|
|
3537
3647
|
// src/tiptap/TipTapEditor.tsx
|
|
3538
3648
|
var import_react21 = require("react");
|
|
@@ -24411,6 +24521,84 @@ var FontFamily = Extension.create({
|
|
|
24411
24521
|
}
|
|
24412
24522
|
});
|
|
24413
24523
|
|
|
24524
|
+
// src/tiptap/Indent.ts
|
|
24525
|
+
var INDENT_STEP = 24;
|
|
24526
|
+
var MAX_INDENT = 240;
|
|
24527
|
+
function applyIndent(editor) {
|
|
24528
|
+
const { state, view } = editor;
|
|
24529
|
+
const { tr: tr2 } = state;
|
|
24530
|
+
const { from: from2, to } = state.selection;
|
|
24531
|
+
let changed = false;
|
|
24532
|
+
state.doc.nodesBetween(from2, to, (node, pos) => {
|
|
24533
|
+
if (node.type.name === "paragraph" || node.type.name === "heading") {
|
|
24534
|
+
const current = node.attrs.indent || 0;
|
|
24535
|
+
if (current < MAX_INDENT) {
|
|
24536
|
+
tr2.setNodeMarkup(pos, void 0, { ...node.attrs, indent: current + INDENT_STEP });
|
|
24537
|
+
changed = true;
|
|
24538
|
+
}
|
|
24539
|
+
}
|
|
24540
|
+
});
|
|
24541
|
+
if (changed) view.dispatch(tr2);
|
|
24542
|
+
return changed;
|
|
24543
|
+
}
|
|
24544
|
+
function applyOutdent(editor) {
|
|
24545
|
+
const { state, view } = editor;
|
|
24546
|
+
const { tr: tr2 } = state;
|
|
24547
|
+
const { from: from2, to } = state.selection;
|
|
24548
|
+
let changed = false;
|
|
24549
|
+
state.doc.nodesBetween(from2, to, (node, pos) => {
|
|
24550
|
+
if (node.type.name === "paragraph" || node.type.name === "heading") {
|
|
24551
|
+
const current = node.attrs.indent || 0;
|
|
24552
|
+
if (current > 0) {
|
|
24553
|
+
tr2.setNodeMarkup(pos, void 0, { ...node.attrs, indent: Math.max(0, current - INDENT_STEP) });
|
|
24554
|
+
changed = true;
|
|
24555
|
+
}
|
|
24556
|
+
}
|
|
24557
|
+
});
|
|
24558
|
+
if (changed) view.dispatch(tr2);
|
|
24559
|
+
return changed;
|
|
24560
|
+
}
|
|
24561
|
+
var Indent = Extension.create({
|
|
24562
|
+
name: "indent",
|
|
24563
|
+
addGlobalAttributes() {
|
|
24564
|
+
return [
|
|
24565
|
+
{
|
|
24566
|
+
types: ["paragraph", "heading"],
|
|
24567
|
+
attributes: {
|
|
24568
|
+
indent: {
|
|
24569
|
+
default: 0,
|
|
24570
|
+
parseHTML: (element) => parseInt(element.style.marginLeft, 10) || 0,
|
|
24571
|
+
renderHTML: (attributes) => {
|
|
24572
|
+
if (!attributes.indent) return {};
|
|
24573
|
+
return { style: `margin-left: ${attributes.indent}px` };
|
|
24574
|
+
}
|
|
24575
|
+
}
|
|
24576
|
+
}
|
|
24577
|
+
}
|
|
24578
|
+
];
|
|
24579
|
+
},
|
|
24580
|
+
addKeyboardShortcuts() {
|
|
24581
|
+
return {
|
|
24582
|
+
Tab: ({ editor }) => {
|
|
24583
|
+
if (editor.isActive("listItem")) {
|
|
24584
|
+
editor.commands.sinkListItem("listItem");
|
|
24585
|
+
return true;
|
|
24586
|
+
}
|
|
24587
|
+
applyIndent(editor);
|
|
24588
|
+
return true;
|
|
24589
|
+
},
|
|
24590
|
+
"Shift-Tab": ({ editor }) => {
|
|
24591
|
+
if (editor.isActive("listItem")) {
|
|
24592
|
+
editor.commands.liftListItem("listItem");
|
|
24593
|
+
return true;
|
|
24594
|
+
}
|
|
24595
|
+
applyOutdent(editor);
|
|
24596
|
+
return true;
|
|
24597
|
+
}
|
|
24598
|
+
};
|
|
24599
|
+
}
|
|
24600
|
+
});
|
|
24601
|
+
|
|
24414
24602
|
// src/tiptap/extensions.ts
|
|
24415
24603
|
function getExtensions(placeholder) {
|
|
24416
24604
|
return [
|
|
@@ -24426,9 +24614,23 @@ function getExtensions(placeholder) {
|
|
|
24426
24614
|
Color,
|
|
24427
24615
|
FontSize,
|
|
24428
24616
|
FontFamily,
|
|
24429
|
-
Highlight.
|
|
24430
|
-
|
|
24431
|
-
|
|
24617
|
+
Highlight.extend({
|
|
24618
|
+
renderHTML({ HTMLAttributes }) {
|
|
24619
|
+
return ["span", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
24620
|
+
},
|
|
24621
|
+
parseHTML() {
|
|
24622
|
+
return [
|
|
24623
|
+
{ tag: "mark" },
|
|
24624
|
+
{
|
|
24625
|
+
tag: "span[style]",
|
|
24626
|
+
getAttrs: (el) => {
|
|
24627
|
+
if (!el.style.backgroundColor) return false;
|
|
24628
|
+
return {};
|
|
24629
|
+
}
|
|
24630
|
+
}
|
|
24631
|
+
];
|
|
24632
|
+
}
|
|
24633
|
+
}).configure({ multicolor: true }),
|
|
24432
24634
|
Link.configure({
|
|
24433
24635
|
openOnClick: false,
|
|
24434
24636
|
HTMLAttributes: {
|
|
@@ -24439,6 +24641,7 @@ function getExtensions(placeholder) {
|
|
|
24439
24641
|
Placeholder.configure({
|
|
24440
24642
|
placeholder: placeholder ?? "Type something..."
|
|
24441
24643
|
}),
|
|
24644
|
+
Indent,
|
|
24442
24645
|
VariableNode
|
|
24443
24646
|
];
|
|
24444
24647
|
}
|
|
@@ -24455,6 +24658,7 @@ var ALLOWED_TAGS2 = /* @__PURE__ */ new Set([
|
|
|
24455
24658
|
"s",
|
|
24456
24659
|
"a",
|
|
24457
24660
|
"span",
|
|
24661
|
+
"mark",
|
|
24458
24662
|
"h1",
|
|
24459
24663
|
"h2",
|
|
24460
24664
|
"h3",
|
|
@@ -24658,222 +24862,573 @@ function TipTapEditor({
|
|
|
24658
24862
|
}
|
|
24659
24863
|
|
|
24660
24864
|
// src/components/Toolbar/RichTextToolbar.tsx
|
|
24865
|
+
var import_react25 = require("react");
|
|
24866
|
+
|
|
24867
|
+
// src/components/shared/HslColorArea.tsx
|
|
24661
24868
|
var import_react23 = require("react");
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
const
|
|
24666
|
-
if (
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24869
|
+
|
|
24870
|
+
// src/utils/colorConvert.ts
|
|
24871
|
+
function hexToHsl(hex) {
|
|
24872
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
24873
|
+
if (!result) return { h: 0, s: 0, l: 0 };
|
|
24874
|
+
const r = parseInt(result[1], 16) / 255;
|
|
24875
|
+
const g = parseInt(result[2], 16) / 255;
|
|
24876
|
+
const b = parseInt(result[3], 16) / 255;
|
|
24877
|
+
const max = Math.max(r, g, b);
|
|
24878
|
+
const min = Math.min(r, g, b);
|
|
24879
|
+
const l = (max + min) / 2;
|
|
24880
|
+
let h = 0;
|
|
24881
|
+
let s = 0;
|
|
24882
|
+
if (max !== min) {
|
|
24883
|
+
const d = max - min;
|
|
24884
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
24885
|
+
if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
24886
|
+
else if (max === g) h = ((b - r) / d + 2) / 6;
|
|
24887
|
+
else h = ((r - g) / d + 4) / 6;
|
|
24888
|
+
}
|
|
24889
|
+
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
|
|
24890
|
+
}
|
|
24891
|
+
function hslToHex(h, s, l) {
|
|
24892
|
+
const sN = s / 100;
|
|
24893
|
+
const lN = l / 100;
|
|
24894
|
+
const a = sN * Math.min(lN, 1 - lN);
|
|
24895
|
+
const f = (n) => {
|
|
24896
|
+
const k = (n + h / 30) % 12;
|
|
24897
|
+
const color = lN - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
24898
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
24899
|
+
};
|
|
24900
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
24670
24901
|
}
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24683
|
-
|
|
24684
|
-
|
|
24685
|
-
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
|
|
24689
|
-
|
|
24690
|
-
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
|
|
24722
|
-
|
|
24723
|
-
|
|
24724
|
-
|
|
24725
|
-
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24740
|
-
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
)
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
className: `ee-richtext-btn ee-richtext-align-right ${toolbar_default.richTextBtn} ${editor.isActive({ textAlign: "right" }) ? toolbar_default.richTextBtnActive : ""}`,
|
|
24768
|
-
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
24769
|
-
title: "Align Right",
|
|
24770
|
-
"aria-label": "Align Right",
|
|
24771
|
-
"aria-pressed": editor.isActive({ textAlign: "right" }),
|
|
24772
|
-
children: "R"
|
|
24773
|
-
}
|
|
24774
|
-
),
|
|
24775
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `ee-richtext-separator ${toolbar_default.richTextSeparator}` }),
|
|
24776
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
24777
|
-
"button",
|
|
24778
|
-
{
|
|
24779
|
-
className: `ee-richtext-btn ee-richtext-bullet-list ${toolbar_default.richTextBtn} ${editor.isActive("bulletList") ? toolbar_default.richTextBtnActive : ""}`,
|
|
24780
|
-
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
24781
|
-
title: "Bullet List",
|
|
24782
|
-
"aria-label": "Bullet List",
|
|
24783
|
-
"aria-pressed": editor.isActive("bulletList"),
|
|
24784
|
-
children: "\u2022"
|
|
24785
|
-
}
|
|
24786
|
-
),
|
|
24902
|
+
|
|
24903
|
+
// src/styles/colorArea.module.css
|
|
24904
|
+
var colorArea_default = {
|
|
24905
|
+
"hslPicker": "hslPicker",
|
|
24906
|
+
"hslArea": "hslArea",
|
|
24907
|
+
"hslAreaThumb": "hslAreaThumb",
|
|
24908
|
+
"hslHueBar": "hslHueBar",
|
|
24909
|
+
"hslHueThumb": "hslHueThumb"
|
|
24910
|
+
};
|
|
24911
|
+
|
|
24912
|
+
// src/components/shared/HslColorArea.tsx
|
|
24913
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
24914
|
+
function HslColorArea({ value, onChange, onChangeEnd }) {
|
|
24915
|
+
const [hsl, setHsl] = (0, import_react23.useState)(() => hexToHsl(value));
|
|
24916
|
+
const areaRef = (0, import_react23.useRef)(null);
|
|
24917
|
+
const hueRef = (0, import_react23.useRef)(null);
|
|
24918
|
+
const draggingArea = (0, import_react23.useRef)(false);
|
|
24919
|
+
const draggingHue = (0, import_react23.useRef)(false);
|
|
24920
|
+
const latestHex = (0, import_react23.useRef)(value);
|
|
24921
|
+
(0, import_react23.useEffect)(() => {
|
|
24922
|
+
const parsed = hexToHsl(value);
|
|
24923
|
+
setHsl(parsed);
|
|
24924
|
+
}, [value]);
|
|
24925
|
+
const emitColor = (0, import_react23.useCallback)(
|
|
24926
|
+
(h, s, l) => {
|
|
24927
|
+
setHsl({ h, s, l });
|
|
24928
|
+
const hex = hslToHex(h, s, l);
|
|
24929
|
+
latestHex.current = hex;
|
|
24930
|
+
onChange(hex);
|
|
24931
|
+
},
|
|
24932
|
+
[onChange]
|
|
24933
|
+
);
|
|
24934
|
+
const handleAreaPointer = (0, import_react23.useCallback)(
|
|
24935
|
+
(e) => {
|
|
24936
|
+
const rect = areaRef.current?.getBoundingClientRect();
|
|
24937
|
+
if (!rect) return;
|
|
24938
|
+
const x = Math.max(0, Math.min(e.clientX - rect.left, rect.width));
|
|
24939
|
+
const y = Math.max(0, Math.min(e.clientY - rect.top, rect.height));
|
|
24940
|
+
const s = Math.round(x / rect.width * 100);
|
|
24941
|
+
const l = Math.round(100 - y / rect.height * 100);
|
|
24942
|
+
emitColor(hsl.h, s, l);
|
|
24943
|
+
},
|
|
24944
|
+
[hsl.h, emitColor]
|
|
24945
|
+
);
|
|
24946
|
+
const onAreaPointerDown = (0, import_react23.useCallback)(
|
|
24947
|
+
(e) => {
|
|
24948
|
+
e.preventDefault();
|
|
24949
|
+
draggingArea.current = true;
|
|
24950
|
+
e.target.setPointerCapture(e.pointerId);
|
|
24951
|
+
handleAreaPointer(e);
|
|
24952
|
+
},
|
|
24953
|
+
[handleAreaPointer]
|
|
24954
|
+
);
|
|
24955
|
+
const onAreaPointerMove = (0, import_react23.useCallback)(
|
|
24956
|
+
(e) => {
|
|
24957
|
+
if (!draggingArea.current) return;
|
|
24958
|
+
handleAreaPointer(e);
|
|
24959
|
+
},
|
|
24960
|
+
[handleAreaPointer]
|
|
24961
|
+
);
|
|
24962
|
+
const onAreaPointerUp = (0, import_react23.useCallback)(() => {
|
|
24963
|
+
draggingArea.current = false;
|
|
24964
|
+
onChangeEnd?.(latestHex.current);
|
|
24965
|
+
}, [onChangeEnd]);
|
|
24966
|
+
const handleHuePointer = (0, import_react23.useCallback)(
|
|
24967
|
+
(e) => {
|
|
24968
|
+
const rect = hueRef.current?.getBoundingClientRect();
|
|
24969
|
+
if (!rect) return;
|
|
24970
|
+
const x = Math.max(0, Math.min(e.clientX - rect.left, rect.width));
|
|
24971
|
+
const h = Math.round(x / rect.width * 360);
|
|
24972
|
+
emitColor(h, hsl.s, hsl.l);
|
|
24973
|
+
},
|
|
24974
|
+
[hsl.s, hsl.l, emitColor]
|
|
24975
|
+
);
|
|
24976
|
+
const onHuePointerDown = (0, import_react23.useCallback)(
|
|
24977
|
+
(e) => {
|
|
24978
|
+
e.preventDefault();
|
|
24979
|
+
draggingHue.current = true;
|
|
24980
|
+
e.target.setPointerCapture(e.pointerId);
|
|
24981
|
+
handleHuePointer(e);
|
|
24982
|
+
},
|
|
24983
|
+
[handleHuePointer]
|
|
24984
|
+
);
|
|
24985
|
+
const onHuePointerMove = (0, import_react23.useCallback)(
|
|
24986
|
+
(e) => {
|
|
24987
|
+
if (!draggingHue.current) return;
|
|
24988
|
+
handleHuePointer(e);
|
|
24989
|
+
},
|
|
24990
|
+
[handleHuePointer]
|
|
24991
|
+
);
|
|
24992
|
+
const onHuePointerUp = (0, import_react23.useCallback)(() => {
|
|
24993
|
+
draggingHue.current = false;
|
|
24994
|
+
onChangeEnd?.(latestHex.current);
|
|
24995
|
+
}, [onChangeEnd]);
|
|
24996
|
+
const areaBackground = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${hsl.h}, 100%, 50%))`;
|
|
24997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: colorArea_default.hslPicker, children: [
|
|
24787
24998
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
24788
|
-
"
|
|
24999
|
+
"div",
|
|
24789
25000
|
{
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
25001
|
+
ref: areaRef,
|
|
25002
|
+
className: colorArea_default.hslArea,
|
|
25003
|
+
style: { background: areaBackground },
|
|
25004
|
+
onPointerDown: onAreaPointerDown,
|
|
25005
|
+
onPointerMove: onAreaPointerMove,
|
|
25006
|
+
onPointerUp: onAreaPointerUp,
|
|
25007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
25008
|
+
"div",
|
|
25009
|
+
{
|
|
25010
|
+
className: colorArea_default.hslAreaThumb,
|
|
25011
|
+
style: {
|
|
25012
|
+
left: `${hsl.s}%`,
|
|
25013
|
+
top: `${100 - hsl.l}%`,
|
|
25014
|
+
backgroundColor: value
|
|
25015
|
+
}
|
|
25016
|
+
}
|
|
25017
|
+
)
|
|
24796
25018
|
}
|
|
24797
25019
|
),
|
|
24798
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `ee-richtext-separator ${toolbar_default.richTextSeparator}` }),
|
|
24799
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InlineLinkEditor, { editor }),
|
|
24800
25020
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
24801
|
-
"
|
|
25021
|
+
"div",
|
|
24802
25022
|
{
|
|
24803
|
-
|
|
24804
|
-
|
|
24805
|
-
|
|
24806
|
-
|
|
24807
|
-
|
|
25023
|
+
ref: hueRef,
|
|
25024
|
+
className: colorArea_default.hslHueBar,
|
|
25025
|
+
onPointerDown: onHuePointerDown,
|
|
25026
|
+
onPointerMove: onHuePointerMove,
|
|
25027
|
+
onPointerUp: onHuePointerUp,
|
|
25028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
25029
|
+
"div",
|
|
25030
|
+
{
|
|
25031
|
+
className: colorArea_default.hslHueThumb,
|
|
25032
|
+
style: {
|
|
25033
|
+
left: `${hsl.h / 360 * 100}%`,
|
|
25034
|
+
backgroundColor: `hsl(${hsl.h}, 100%, 50%)`
|
|
25035
|
+
}
|
|
25036
|
+
}
|
|
25037
|
+
)
|
|
24808
25038
|
}
|
|
24809
25039
|
)
|
|
24810
25040
|
] });
|
|
24811
25041
|
}
|
|
24812
|
-
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
|
|
24816
|
-
|
|
24817
|
-
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
25042
|
+
|
|
25043
|
+
// src/components/Toolbar/toolbar-icons.tsx
|
|
25044
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
25045
|
+
var BoldIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25046
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
|
|
25047
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
|
|
25048
|
+
] });
|
|
25049
|
+
var ItalicIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25050
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
25051
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
25052
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
25053
|
+
] });
|
|
25054
|
+
var UnderlineIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25055
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3" }),
|
|
25056
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "4", y1: "21", x2: "20", y2: "21" })
|
|
25057
|
+
] });
|
|
25058
|
+
var StrikethroughIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25059
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M16 4H9a3 3 0 0 0-3 3c0 2 1.5 3 3 3" }),
|
|
25060
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M12 15c1.5 0 3 1 3 3a3 3 0 0 1-3 3H8" }),
|
|
25061
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
25062
|
+
] });
|
|
25063
|
+
var AlignLeftIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25064
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "17", y1: "10", x2: "3", y2: "10" }),
|
|
25065
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
25066
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "14", x2: "3", y2: "14" }),
|
|
25067
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
25068
|
+
] });
|
|
25069
|
+
var AlignCenterIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25070
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "18", y1: "10", x2: "6", y2: "10" }),
|
|
25071
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
25072
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "14", x2: "3", y2: "14" }),
|
|
25073
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "18", y1: "18", x2: "6", y2: "18" })
|
|
25074
|
+
] });
|
|
25075
|
+
var AlignRightIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25076
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "10", x2: "7", y2: "10" }),
|
|
25077
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
25078
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "14", x2: "3", y2: "14" }),
|
|
25079
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
25080
|
+
] });
|
|
25081
|
+
var BulletListIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25082
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
|
|
25083
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
|
|
25084
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "8", y1: "18", x2: "21", y2: "18" }),
|
|
25085
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "4", cy: "6", r: "1", fill: color }),
|
|
25086
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "4", cy: "12", r: "1", fill: color }),
|
|
25087
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "4", cy: "18", r: "1", fill: color })
|
|
25088
|
+
] });
|
|
25089
|
+
var OrderedListIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25090
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "10", y1: "6", x2: "21", y2: "6" }),
|
|
25091
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "10", y1: "12", x2: "21", y2: "12" }),
|
|
25092
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "10", y1: "18", x2: "21", y2: "18" }),
|
|
25093
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: "2", y: "8", fontSize: "8", fill: color, stroke: "none", fontFamily: "sans-serif", fontWeight: "bold", children: "1" }),
|
|
25094
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: "2", y: "14", fontSize: "8", fill: color, stroke: "none", fontFamily: "sans-serif", fontWeight: "bold", children: "2" }),
|
|
25095
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: "2", y: "20", fontSize: "8", fill: color, stroke: "none", fontFamily: "sans-serif", fontWeight: "bold", children: "3" })
|
|
25096
|
+
] });
|
|
25097
|
+
var IndentIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25098
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
25099
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "14", x2: "3", y2: "14" }),
|
|
25100
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "10", x2: "11", y2: "10" }),
|
|
25101
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "18", x2: "11", y2: "18" }),
|
|
25102
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("polyline", { points: "3 8 7 10 3 12" })
|
|
25103
|
+
] });
|
|
25104
|
+
var OutdentIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25105
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
25106
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "14", x2: "3", y2: "14" }),
|
|
25107
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "10", x2: "11", y2: "10" }),
|
|
25108
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "18", x2: "11", y2: "18" }),
|
|
25109
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("polyline", { points: "7 8 3 10 7 12" })
|
|
25110
|
+
] });
|
|
25111
|
+
var TextColorIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25112
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M5 18h14", stroke: "none" }),
|
|
25113
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M9 3L5 15h2l1-3h8l1 3h2L15 3H9z", fill: "none", stroke: color, strokeWidth: "1.5" }),
|
|
25114
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M9.5 10l2.5-6 2.5 6h-5z", fill: "none" })
|
|
25115
|
+
] });
|
|
25116
|
+
var HighlightIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25117
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M12 20h9" }),
|
|
25118
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
25119
|
+
] });
|
|
25120
|
+
var LinkIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25121
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
|
|
25122
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
|
|
25123
|
+
] });
|
|
25124
|
+
var ClearFormattingIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25125
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M6 4h12l-6 16" }),
|
|
25126
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "2", y1: "2", x2: "22", y2: "22" })
|
|
25127
|
+
] });
|
|
25128
|
+
var AlignJustifyIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
25129
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "10", x2: "3", y2: "10" }),
|
|
25130
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
25131
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "14", x2: "3", y2: "14" }),
|
|
25132
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "21", y1: "18", x2: "3", y2: "18" })
|
|
25133
|
+
] });
|
|
25134
|
+
var HorizontalRuleIcon = ({ size = 14, color = "currentColor" }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("line", { x1: "3", y1: "12", x2: "21", y2: "12" }) });
|
|
25135
|
+
|
|
25136
|
+
// src/components/Toolbar/Tooltip.tsx
|
|
25137
|
+
var import_react24 = require("react");
|
|
25138
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
25139
|
+
function Tooltip({ label, shortcut, children }) {
|
|
25140
|
+
const [visible, setVisible] = (0, import_react24.useState)(false);
|
|
25141
|
+
const timerRef = (0, import_react24.useRef)(null);
|
|
25142
|
+
const show = (0, import_react24.useCallback)(() => {
|
|
25143
|
+
timerRef.current = setTimeout(() => setVisible(true), 400);
|
|
25144
|
+
}, []);
|
|
25145
|
+
const hide = (0, import_react24.useCallback)(() => {
|
|
25146
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
25147
|
+
timerRef.current = null;
|
|
25148
|
+
setVisible(false);
|
|
25149
|
+
}, []);
|
|
25150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
25151
|
+
"span",
|
|
24821
25152
|
{
|
|
24822
|
-
className:
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24827
|
-
editor.chain().focus().setFontFamily(value).run();
|
|
24828
|
-
} else {
|
|
24829
|
-
editor.chain().focus().unsetFontFamily().run();
|
|
24830
|
-
}
|
|
24831
|
-
},
|
|
24832
|
-
title: "Font Family",
|
|
25153
|
+
className: toolbar_default.richTextTooltipWrapper,
|
|
25154
|
+
onMouseEnter: show,
|
|
25155
|
+
onMouseLeave: hide,
|
|
25156
|
+
onFocus: show,
|
|
25157
|
+
onBlur: hide,
|
|
24833
25158
|
children: [
|
|
24834
|
-
|
|
24835
|
-
|
|
25159
|
+
children,
|
|
25160
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: toolbar_default.richTextTooltip, role: "tooltip", children: [
|
|
25161
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: label }),
|
|
25162
|
+
shortcut && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("kbd", { className: toolbar_default.richTextTooltipShortcut, children: shortcut })
|
|
25163
|
+
] })
|
|
24836
25164
|
]
|
|
24837
25165
|
}
|
|
24838
25166
|
);
|
|
24839
25167
|
}
|
|
24840
|
-
|
|
24841
|
-
|
|
24842
|
-
|
|
24843
|
-
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
|
|
25168
|
+
|
|
25169
|
+
// src/components/Toolbar/RichTextToolbar.tsx
|
|
25170
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
25171
|
+
function preventBlur(e) {
|
|
25172
|
+
const target = e.target;
|
|
25173
|
+
const tag = target.tagName.toLowerCase();
|
|
25174
|
+
if (tag === "select" || tag === "option" || tag === "input") {
|
|
25175
|
+
return;
|
|
24847
25176
|
}
|
|
24848
|
-
|
|
24849
|
-
"select",
|
|
24850
|
-
{
|
|
24851
|
-
className: `ee-richtext-size-select ${toolbar_default.richTextSelectSmall}`,
|
|
24852
|
-
value: currentSize,
|
|
24853
|
-
onChange: (e) => {
|
|
24854
|
-
const value = e.target.value;
|
|
24855
|
-
if (value) {
|
|
24856
|
-
editor.chain().focus().setFontSize(value).run();
|
|
24857
|
-
} else {
|
|
24858
|
-
editor.chain().focus().unsetFontSize().run();
|
|
24859
|
-
}
|
|
24860
|
-
},
|
|
24861
|
-
title: "Font Size",
|
|
24862
|
-
children: [
|
|
24863
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", children: "Size" }),
|
|
24864
|
-
sizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: size, children: parseInt(size, 10) }, size))
|
|
24865
|
-
]
|
|
24866
|
-
}
|
|
24867
|
-
);
|
|
25177
|
+
e.preventDefault();
|
|
24868
25178
|
}
|
|
24869
|
-
function
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
25179
|
+
function RichTextToolbar({ editor }) {
|
|
25180
|
+
if (!editor) return null;
|
|
25181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-toolbar ${toolbar_default.richTextToolbar}`, onMouseDown: preventBlur, children: [
|
|
25182
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
|
|
25183
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FontFamilySelect, { editor }),
|
|
25184
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FontSizeSelect, { editor })
|
|
25185
|
+
] }),
|
|
25186
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
|
|
25187
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Bold", shortcut: "Ctrl+B", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25188
|
+
"button",
|
|
25189
|
+
{
|
|
25190
|
+
className: `ee-richtext-btn ee-richtext-bold ${toolbar_default.richTextBtn} ${editor.isActive("bold") ? toolbar_default.richTextBtnActive : ""}`,
|
|
25191
|
+
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
25192
|
+
"aria-label": "Bold",
|
|
25193
|
+
"aria-pressed": editor.isActive("bold"),
|
|
25194
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BoldIcon, {})
|
|
25195
|
+
}
|
|
25196
|
+
) }),
|
|
25197
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Italic", shortcut: "Ctrl+I", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25198
|
+
"button",
|
|
25199
|
+
{
|
|
25200
|
+
className: `ee-richtext-btn ee-richtext-italic ${toolbar_default.richTextBtn} ${editor.isActive("italic") ? toolbar_default.richTextBtnActive : ""}`,
|
|
25201
|
+
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
25202
|
+
"aria-label": "Italic",
|
|
25203
|
+
"aria-pressed": editor.isActive("italic"),
|
|
25204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ItalicIcon, {})
|
|
25205
|
+
}
|
|
25206
|
+
) }),
|
|
25207
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Underline", shortcut: "Ctrl+U", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25208
|
+
"button",
|
|
25209
|
+
{
|
|
25210
|
+
className: `ee-richtext-btn ee-richtext-underline ${toolbar_default.richTextBtn} ${editor.isActive("underline") ? toolbar_default.richTextBtnActive : ""}`,
|
|
25211
|
+
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
25212
|
+
"aria-label": "Underline",
|
|
25213
|
+
"aria-pressed": editor.isActive("underline"),
|
|
25214
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UnderlineIcon, {})
|
|
25215
|
+
}
|
|
25216
|
+
) }),
|
|
25217
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Strikethrough", shortcut: "Ctrl+Shift+X", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25218
|
+
"button",
|
|
25219
|
+
{
|
|
25220
|
+
className: `ee-richtext-btn ee-richtext-strike ${toolbar_default.richTextBtn} ${editor.isActive("strike") ? toolbar_default.richTextBtnActive : ""}`,
|
|
25221
|
+
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
25222
|
+
"aria-label": "Strikethrough",
|
|
25223
|
+
"aria-pressed": editor.isActive("strike"),
|
|
25224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StrikethroughIcon, {})
|
|
25225
|
+
}
|
|
25226
|
+
) })
|
|
25227
|
+
] }),
|
|
25228
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
|
|
25229
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25230
|
+
InlineColorPicker,
|
|
25231
|
+
{
|
|
25232
|
+
editor,
|
|
25233
|
+
type: "color",
|
|
25234
|
+
title: "Text Color",
|
|
25235
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TextColorIcon, {})
|
|
25236
|
+
}
|
|
25237
|
+
),
|
|
25238
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25239
|
+
InlineColorPicker,
|
|
25240
|
+
{
|
|
25241
|
+
editor,
|
|
25242
|
+
type: "highlight",
|
|
25243
|
+
title: "Highlight",
|
|
25244
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HighlightIcon, {})
|
|
25245
|
+
}
|
|
25246
|
+
)
|
|
25247
|
+
] }),
|
|
25248
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
|
|
25249
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Align Left", shortcut: "Ctrl+Shift+L", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25250
|
+
"button",
|
|
25251
|
+
{
|
|
25252
|
+
className: `ee-richtext-btn ee-richtext-align-left ${toolbar_default.richTextBtn} ${editor.isActive({ textAlign: "left" }) ? toolbar_default.richTextBtnActive : ""}`,
|
|
25253
|
+
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
25254
|
+
"aria-label": "Align Left",
|
|
25255
|
+
"aria-pressed": editor.isActive({ textAlign: "left" }),
|
|
25256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlignLeftIcon, {})
|
|
25257
|
+
}
|
|
25258
|
+
) }),
|
|
25259
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Align Center", shortcut: "Ctrl+Shift+E", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25260
|
+
"button",
|
|
25261
|
+
{
|
|
25262
|
+
className: `ee-richtext-btn ee-richtext-align-center ${toolbar_default.richTextBtn} ${editor.isActive({ textAlign: "center" }) ? toolbar_default.richTextBtnActive : ""}`,
|
|
25263
|
+
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
25264
|
+
"aria-label": "Align Center",
|
|
25265
|
+
"aria-pressed": editor.isActive({ textAlign: "center" }),
|
|
25266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlignCenterIcon, {})
|
|
25267
|
+
}
|
|
25268
|
+
) }),
|
|
25269
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Align Right", shortcut: "Ctrl+Shift+R", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25270
|
+
"button",
|
|
25271
|
+
{
|
|
25272
|
+
className: `ee-richtext-btn ee-richtext-align-right ${toolbar_default.richTextBtn} ${editor.isActive({ textAlign: "right" }) ? toolbar_default.richTextBtnActive : ""}`,
|
|
25273
|
+
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
25274
|
+
"aria-label": "Align Right",
|
|
25275
|
+
"aria-pressed": editor.isActive({ textAlign: "right" }),
|
|
25276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlignRightIcon, {})
|
|
25277
|
+
}
|
|
25278
|
+
) }),
|
|
25279
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Justify", shortcut: "Ctrl+Shift+J", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25280
|
+
"button",
|
|
25281
|
+
{
|
|
25282
|
+
className: `ee-richtext-btn ee-richtext-align-justify ${toolbar_default.richTextBtn} ${editor.isActive({ textAlign: "justify" }) ? toolbar_default.richTextBtnActive : ""}`,
|
|
25283
|
+
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
25284
|
+
"aria-label": "Justify",
|
|
25285
|
+
"aria-pressed": editor.isActive({ textAlign: "justify" }),
|
|
25286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlignJustifyIcon, {})
|
|
25287
|
+
}
|
|
25288
|
+
) })
|
|
25289
|
+
] }),
|
|
25290
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
|
|
25291
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Bullet List", shortcut: "Ctrl+Shift+8", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25292
|
+
"button",
|
|
25293
|
+
{
|
|
25294
|
+
className: `ee-richtext-btn ee-richtext-bullet-list ${toolbar_default.richTextBtn} ${editor.isActive("bulletList") ? toolbar_default.richTextBtnActive : ""}`,
|
|
25295
|
+
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
25296
|
+
"aria-label": "Bullet List",
|
|
25297
|
+
"aria-pressed": editor.isActive("bulletList"),
|
|
25298
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BulletListIcon, {})
|
|
25299
|
+
}
|
|
25300
|
+
) }),
|
|
25301
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Ordered List", shortcut: "Ctrl+Shift+7", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25302
|
+
"button",
|
|
25303
|
+
{
|
|
25304
|
+
className: `ee-richtext-btn ee-richtext-ordered-list ${toolbar_default.richTextBtn} ${editor.isActive("orderedList") ? toolbar_default.richTextBtnActive : ""}`,
|
|
25305
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
25306
|
+
"aria-label": "Ordered List",
|
|
25307
|
+
"aria-pressed": editor.isActive("orderedList"),
|
|
25308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OrderedListIcon, {})
|
|
25309
|
+
}
|
|
25310
|
+
) }),
|
|
25311
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Outdent", shortcut: "Shift+Tab", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25312
|
+
"button",
|
|
25313
|
+
{
|
|
25314
|
+
className: `ee-richtext-btn ee-richtext-outdent ${toolbar_default.richTextBtn}`,
|
|
25315
|
+
onClick: () => {
|
|
25316
|
+
if (editor.isActive("listItem")) {
|
|
25317
|
+
editor.chain().focus().liftListItem("listItem").run();
|
|
25318
|
+
} else {
|
|
25319
|
+
editor.commands.focus();
|
|
25320
|
+
applyOutdent(editor);
|
|
25321
|
+
}
|
|
25322
|
+
},
|
|
25323
|
+
"aria-label": "Outdent",
|
|
25324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OutdentIcon, {})
|
|
25325
|
+
}
|
|
25326
|
+
) }),
|
|
25327
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Indent", shortcut: "Tab", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25328
|
+
"button",
|
|
25329
|
+
{
|
|
25330
|
+
className: `ee-richtext-btn ee-richtext-indent ${toolbar_default.richTextBtn}`,
|
|
25331
|
+
onClick: () => {
|
|
25332
|
+
if (editor.isActive("listItem")) {
|
|
25333
|
+
editor.chain().focus().sinkListItem("listItem").run();
|
|
25334
|
+
} else {
|
|
25335
|
+
editor.commands.focus();
|
|
25336
|
+
applyIndent(editor);
|
|
25337
|
+
}
|
|
25338
|
+
},
|
|
25339
|
+
"aria-label": "Indent",
|
|
25340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IndentIcon, {})
|
|
25341
|
+
}
|
|
25342
|
+
) })
|
|
25343
|
+
] }),
|
|
25344
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
|
|
25345
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InlineLinkEditor, { editor }),
|
|
25346
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Horizontal Rule", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25347
|
+
"button",
|
|
25348
|
+
{
|
|
25349
|
+
className: `ee-richtext-btn ee-richtext-hr ${toolbar_default.richTextBtn}`,
|
|
25350
|
+
onClick: () => editor.chain().focus().setHorizontalRule().run(),
|
|
25351
|
+
"aria-label": "Horizontal Rule",
|
|
25352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HorizontalRuleIcon, {})
|
|
25353
|
+
}
|
|
25354
|
+
) }),
|
|
25355
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Clear Formatting", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25356
|
+
"button",
|
|
25357
|
+
{
|
|
25358
|
+
className: `ee-richtext-btn ee-richtext-clear ${toolbar_default.richTextBtn}`,
|
|
25359
|
+
onClick: () => editor.chain().focus().unsetAllMarks().run(),
|
|
25360
|
+
"aria-label": "Clear Formatting",
|
|
25361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClearFormattingIcon, {})
|
|
25362
|
+
}
|
|
25363
|
+
) })
|
|
25364
|
+
] })
|
|
25365
|
+
] });
|
|
25366
|
+
}
|
|
25367
|
+
function FontFamilySelect({ editor }) {
|
|
25368
|
+
const { fontFamilies } = useEditorFonts();
|
|
25369
|
+
const currentFont = editor.getAttributes("textStyle").fontFamily || "";
|
|
25370
|
+
const fonts = fontFamilies.slice();
|
|
25371
|
+
if (currentFont && !fonts.some((f) => f.toLowerCase() === currentFont.toLowerCase())) {
|
|
25372
|
+
fonts.push(currentFont);
|
|
25373
|
+
}
|
|
25374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
25375
|
+
"select",
|
|
25376
|
+
{
|
|
25377
|
+
className: `ee-richtext-font-select ${toolbar_default.richTextSelect}`,
|
|
25378
|
+
value: currentFont,
|
|
25379
|
+
onChange: (e) => {
|
|
25380
|
+
const value = e.target.value;
|
|
25381
|
+
if (value) {
|
|
25382
|
+
editor.chain().focus().setFontFamily(value).run();
|
|
25383
|
+
} else {
|
|
25384
|
+
editor.chain().focus().unsetFontFamily().run();
|
|
25385
|
+
}
|
|
25386
|
+
},
|
|
25387
|
+
title: "Font Family",
|
|
25388
|
+
children: [
|
|
25389
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Default" }),
|
|
25390
|
+
fonts.map((font) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: font, style: { fontFamily: font }, children: font.split(",")[0].trim() }, font))
|
|
25391
|
+
]
|
|
25392
|
+
}
|
|
25393
|
+
);
|
|
25394
|
+
}
|
|
25395
|
+
function FontSizeSelect({ editor }) {
|
|
25396
|
+
const { fontSizes } = useEditorFonts();
|
|
25397
|
+
const currentSize = editor.getAttributes("textStyle").fontSize || "";
|
|
25398
|
+
const sizes = fontSizes.slice();
|
|
25399
|
+
if (currentSize && !sizes.includes(currentSize)) {
|
|
25400
|
+
sizes.push(currentSize);
|
|
25401
|
+
sizes.sort((a, b) => parseInt(a, 10) - parseInt(b, 10));
|
|
25402
|
+
}
|
|
25403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
25404
|
+
"select",
|
|
25405
|
+
{
|
|
25406
|
+
className: `ee-richtext-size-select ${toolbar_default.richTextSelectSmall}`,
|
|
25407
|
+
value: currentSize,
|
|
25408
|
+
onChange: (e) => {
|
|
25409
|
+
const value = e.target.value;
|
|
25410
|
+
if (value) {
|
|
25411
|
+
editor.chain().focus().setFontSize(value).run();
|
|
25412
|
+
} else {
|
|
25413
|
+
editor.chain().focus().unsetFontSize().run();
|
|
25414
|
+
}
|
|
25415
|
+
},
|
|
25416
|
+
title: "Font Size",
|
|
25417
|
+
children: [
|
|
25418
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: "Size" }),
|
|
25419
|
+
sizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: size, children: parseInt(size, 10) }, size))
|
|
25420
|
+
]
|
|
25421
|
+
}
|
|
25422
|
+
);
|
|
25423
|
+
}
|
|
25424
|
+
function InlineLinkEditor({ editor }) {
|
|
25425
|
+
const [isOpen, setIsOpen] = (0, import_react25.useState)(false);
|
|
25426
|
+
const [url, setUrl] = (0, import_react25.useState)("");
|
|
25427
|
+
const wrapperRef = (0, import_react25.useRef)(null);
|
|
25428
|
+
const inputRef = (0, import_react25.useRef)(null);
|
|
24874
25429
|
const isActive2 = editor.isActive("link");
|
|
24875
25430
|
const currentHref = editor.getAttributes("link").href || "";
|
|
24876
|
-
(0,
|
|
25431
|
+
(0, import_react25.useEffect)(() => {
|
|
24877
25432
|
function handleClickOutside(e) {
|
|
24878
25433
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
24879
25434
|
setIsOpen(false);
|
|
@@ -24884,14 +25439,14 @@ function InlineLinkEditor({ editor }) {
|
|
|
24884
25439
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
24885
25440
|
}
|
|
24886
25441
|
}, [isOpen]);
|
|
24887
|
-
const handleOpen = (0,
|
|
25442
|
+
const handleOpen = (0, import_react25.useCallback)(() => {
|
|
24888
25443
|
setUrl(currentHref);
|
|
24889
25444
|
setUrlError("");
|
|
24890
25445
|
setIsOpen(true);
|
|
24891
25446
|
setTimeout(() => inputRef.current?.focus(), 50);
|
|
24892
25447
|
}, [currentHref]);
|
|
24893
|
-
const [urlError, setUrlError] = (0,
|
|
24894
|
-
const handleApply = (0,
|
|
25448
|
+
const [urlError, setUrlError] = (0, import_react25.useState)("");
|
|
25449
|
+
const handleApply = (0, import_react25.useCallback)(() => {
|
|
24895
25450
|
const trimmed = url.trim();
|
|
24896
25451
|
if (trimmed) {
|
|
24897
25452
|
if (!isSafeURL(trimmed)) {
|
|
@@ -24903,12 +25458,12 @@ function InlineLinkEditor({ editor }) {
|
|
|
24903
25458
|
}
|
|
24904
25459
|
setIsOpen(false);
|
|
24905
25460
|
}, [editor, url]);
|
|
24906
|
-
const handleRemove = (0,
|
|
25461
|
+
const handleRemove = (0, import_react25.useCallback)(() => {
|
|
24907
25462
|
editor.chain().focus().unsetLink().run();
|
|
24908
25463
|
setIsOpen(false);
|
|
24909
25464
|
setUrl("");
|
|
24910
25465
|
}, [editor]);
|
|
24911
|
-
const handleKeyDown2 = (0,
|
|
25466
|
+
const handleKeyDown2 = (0, import_react25.useCallback)(
|
|
24912
25467
|
(e) => {
|
|
24913
25468
|
if (e.key === "Enter") {
|
|
24914
25469
|
e.preventDefault();
|
|
@@ -24919,8 +25474,8 @@ function InlineLinkEditor({ editor }) {
|
|
|
24919
25474
|
},
|
|
24920
25475
|
[handleApply]
|
|
24921
25476
|
);
|
|
24922
|
-
return /* @__PURE__ */ (0,
|
|
24923
|
-
/* @__PURE__ */ (0,
|
|
25477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-link ${toolbar_default.richTextColorWrapper}`, ref: wrapperRef, children: [
|
|
25478
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
24924
25479
|
"button",
|
|
24925
25480
|
{
|
|
24926
25481
|
className: `ee-richtext-btn ee-richtext-link-btn ${toolbar_default.richTextBtn} ${isActive2 ? toolbar_default.richTextBtnActive : ""}`,
|
|
@@ -24928,12 +25483,12 @@ function InlineLinkEditor({ editor }) {
|
|
|
24928
25483
|
title: "Link",
|
|
24929
25484
|
"aria-label": "Link",
|
|
24930
25485
|
"aria-pressed": isActive2,
|
|
24931
|
-
children:
|
|
25486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkIcon, {})
|
|
24932
25487
|
}
|
|
24933
25488
|
),
|
|
24934
|
-
isOpen && /* @__PURE__ */ (0,
|
|
24935
|
-
/* @__PURE__ */ (0,
|
|
24936
|
-
/* @__PURE__ */ (0,
|
|
25489
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-link-dropdown ${toolbar_default.richTextLinkDropdown}`, children: [
|
|
25490
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { className: `ee-richtext-link-label ${toolbar_default.richTextLinkLabel}`, children: "URL" }),
|
|
25491
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
24937
25492
|
"input",
|
|
24938
25493
|
{
|
|
24939
25494
|
ref: inputRef,
|
|
@@ -24944,19 +25499,26 @@ function InlineLinkEditor({ editor }) {
|
|
|
24944
25499
|
placeholder: "https://, mailto:, or tel:"
|
|
24945
25500
|
}
|
|
24946
25501
|
),
|
|
24947
|
-
urlError && /* @__PURE__ */ (0,
|
|
24948
|
-
/* @__PURE__ */ (0,
|
|
24949
|
-
/* @__PURE__ */ (0,
|
|
24950
|
-
isActive2 && /* @__PURE__ */ (0,
|
|
25502
|
+
urlError && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `ee-richtext-link-error ${toolbar_default.richTextLinkError}`, children: urlError }),
|
|
25503
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-link-actions ${toolbar_default.richTextLinkActions}`, children: [
|
|
25504
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: `ee-richtext-link-apply ${toolbar_default.richTextLinkApply}`, onClick: handleApply, children: "Apply" }),
|
|
25505
|
+
isActive2 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: `ee-richtext-link-remove ${toolbar_default.richTextLinkRemove}`, onClick: handleRemove, children: "Remove" })
|
|
24951
25506
|
] })
|
|
24952
25507
|
] })
|
|
24953
25508
|
] });
|
|
24954
25509
|
}
|
|
24955
|
-
function InlineColorPicker({ editor, type, title,
|
|
24956
|
-
const [isOpen, setIsOpen] = (0,
|
|
24957
|
-
const
|
|
25510
|
+
function InlineColorPicker({ editor, type, title, icon }) {
|
|
25511
|
+
const [isOpen, setIsOpen] = (0, import_react25.useState)(false);
|
|
25512
|
+
const [hexInput, setHexInput] = (0, import_react25.useState)("");
|
|
25513
|
+
const wrapperRef = (0, import_react25.useRef)(null);
|
|
25514
|
+
const { customColorPresets, addCustomColorPreset, removeCustomColorPreset } = useColorPresets();
|
|
24958
25515
|
const currentColor = type === "color" ? editor.getAttributes("textStyle").color || "#000000" : editor.getAttributes("highlight").color || "";
|
|
24959
|
-
(0,
|
|
25516
|
+
(0, import_react25.useEffect)(() => {
|
|
25517
|
+
if (isOpen) {
|
|
25518
|
+
setHexInput(currentColor || "#000000");
|
|
25519
|
+
}
|
|
25520
|
+
}, [isOpen, currentColor]);
|
|
25521
|
+
(0, import_react25.useEffect)(() => {
|
|
24960
25522
|
function handleClickOutside(e) {
|
|
24961
25523
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
24962
25524
|
setIsOpen(false);
|
|
@@ -24967,18 +25529,19 @@ function InlineColorPicker({ editor, type, title, label }) {
|
|
|
24967
25529
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
24968
25530
|
}
|
|
24969
25531
|
}, [isOpen]);
|
|
24970
|
-
const applyColor = (0,
|
|
24971
|
-
(color) => {
|
|
25532
|
+
const applyColor = (0, import_react25.useCallback)(
|
|
25533
|
+
(color, close2 = false) => {
|
|
24972
25534
|
if (type === "color") {
|
|
24973
25535
|
editor.chain().focus().setColor(color).run();
|
|
24974
25536
|
} else {
|
|
24975
25537
|
editor.chain().focus().toggleHighlight({ color }).run();
|
|
24976
25538
|
}
|
|
24977
|
-
|
|
25539
|
+
setHexInput(color);
|
|
25540
|
+
if (close2) setIsOpen(false);
|
|
24978
25541
|
},
|
|
24979
25542
|
[editor, type]
|
|
24980
25543
|
);
|
|
24981
|
-
const clearColor = (0,
|
|
25544
|
+
const clearColor = (0, import_react25.useCallback)(() => {
|
|
24982
25545
|
if (type === "color") {
|
|
24983
25546
|
editor.chain().focus().unsetColor().run();
|
|
24984
25547
|
} else {
|
|
@@ -24986,19 +25549,41 @@ function InlineColorPicker({ editor, type, title, label }) {
|
|
|
24986
25549
|
}
|
|
24987
25550
|
setIsOpen(false);
|
|
24988
25551
|
}, [editor, type]);
|
|
25552
|
+
const handleHexApply = (0, import_react25.useCallback)(() => {
|
|
25553
|
+
const trimmed = hexInput.trim();
|
|
25554
|
+
if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(trimmed)) {
|
|
25555
|
+
applyColor(trimmed, true);
|
|
25556
|
+
}
|
|
25557
|
+
}, [hexInput, applyColor]);
|
|
25558
|
+
const handleHexKeyDown = (0, import_react25.useCallback)(
|
|
25559
|
+
(e) => {
|
|
25560
|
+
if (e.key === "Enter") {
|
|
25561
|
+
e.preventDefault();
|
|
25562
|
+
handleHexApply();
|
|
25563
|
+
}
|
|
25564
|
+
},
|
|
25565
|
+
[handleHexApply]
|
|
25566
|
+
);
|
|
25567
|
+
const handleSaveCustom = (0, import_react25.useCallback)(() => {
|
|
25568
|
+
const trimmed = hexInput.trim();
|
|
25569
|
+
if (/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(trimmed) && !customColorPresets.includes(trimmed)) {
|
|
25570
|
+
addCustomColorPreset(trimmed);
|
|
25571
|
+
}
|
|
25572
|
+
}, [hexInput, customColorPresets, addCustomColorPreset]);
|
|
25573
|
+
const isValidHex = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(hexInput.trim());
|
|
24989
25574
|
const indicatorColor = type === "color" ? currentColor : currentColor || "transparent";
|
|
24990
|
-
return /* @__PURE__ */ (0,
|
|
24991
|
-
/* @__PURE__ */ (0,
|
|
25575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-color ee-richtext-color--${type} ${toolbar_default.richTextColorWrapper}`, ref: wrapperRef, children: [
|
|
25576
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
24992
25577
|
"button",
|
|
24993
25578
|
{
|
|
24994
|
-
className: `ee-richtext-btn ee-richtext-color-btn ${toolbar_default.
|
|
25579
|
+
className: `ee-richtext-btn ee-richtext-color-btn ${toolbar_default.richTextBtnWithIndicator}`,
|
|
24995
25580
|
onClick: () => setIsOpen(!isOpen),
|
|
24996
25581
|
title,
|
|
24997
25582
|
"aria-label": title,
|
|
24998
25583
|
"aria-expanded": isOpen,
|
|
24999
25584
|
children: [
|
|
25000
|
-
|
|
25001
|
-
/* @__PURE__ */ (0,
|
|
25585
|
+
icon,
|
|
25586
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25002
25587
|
"span",
|
|
25003
25588
|
{
|
|
25004
25589
|
className: `ee-richtext-color-indicator ${toolbar_default.richTextColorIndicator}`,
|
|
@@ -25008,29 +25593,91 @@ function InlineColorPicker({ editor, type, title, label }) {
|
|
|
25008
25593
|
]
|
|
25009
25594
|
}
|
|
25010
25595
|
),
|
|
25011
|
-
isOpen && /* @__PURE__ */ (0,
|
|
25012
|
-
/* @__PURE__ */ (0,
|
|
25596
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-color-dropdown ${toolbar_default.richTextColorDropdown}`, children: [
|
|
25597
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `ee-richtext-color-section-label ${toolbar_default.richTextColorSectionLabel}`, children: "Presets" }),
|
|
25598
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `ee-richtext-color-grid ${toolbar_default.richTextColorGrid}`, children: COLOR_PRESETS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25013
25599
|
"button",
|
|
25014
25600
|
{
|
|
25015
|
-
className: `ee-richtext-color-swatch ${toolbar_default.richTextColorSwatch}`,
|
|
25601
|
+
className: `ee-richtext-color-swatch ${toolbar_default.richTextColorSwatch} ${currentColor.toLowerCase() === color.toLowerCase() ? toolbar_default.richTextColorSwatchActive : ""}`,
|
|
25016
25602
|
style: { backgroundColor: color },
|
|
25017
|
-
onClick: () => applyColor(color),
|
|
25603
|
+
onClick: () => applyColor(color, true),
|
|
25018
25604
|
title: color
|
|
25019
25605
|
},
|
|
25020
25606
|
color
|
|
25021
25607
|
)) }),
|
|
25022
|
-
/* @__PURE__ */ (0,
|
|
25023
|
-
/* @__PURE__ */ (0,
|
|
25608
|
+
customColorPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
25609
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `ee-richtext-color-section-label ${toolbar_default.richTextColorSectionLabel}`, children: "Custom" }),
|
|
25610
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `ee-richtext-color-grid ${toolbar_default.richTextColorGrid}`, children: customColorPresets.map((color) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25611
|
+
"button",
|
|
25612
|
+
{
|
|
25613
|
+
className: `ee-richtext-color-swatch ${toolbar_default.richTextColorSwatch} ${currentColor.toLowerCase() === color.toLowerCase() ? toolbar_default.richTextColorSwatchActive : ""}`,
|
|
25614
|
+
style: { backgroundColor: color },
|
|
25615
|
+
onClick: () => applyColor(color, true),
|
|
25616
|
+
title: color,
|
|
25617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25618
|
+
"span",
|
|
25619
|
+
{
|
|
25620
|
+
className: `ee-richtext-color-swatch-remove ${toolbar_default.richTextColorSwatchRemove}`,
|
|
25621
|
+
onClick: (e) => {
|
|
25622
|
+
e.stopPropagation();
|
|
25623
|
+
removeCustomColorPreset(color);
|
|
25624
|
+
},
|
|
25625
|
+
title: "Remove",
|
|
25626
|
+
children: "\xD7"
|
|
25627
|
+
}
|
|
25628
|
+
)
|
|
25629
|
+
},
|
|
25630
|
+
`custom-${color}`
|
|
25631
|
+
)) })
|
|
25632
|
+
] }),
|
|
25633
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { borderTop: "1px solid var(--ee-border-color)", paddingTop: "var(--ee-space-sm)" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25634
|
+
HslColorArea,
|
|
25635
|
+
{
|
|
25636
|
+
value: isValidHex ? hexInput.trim() : currentColor || "#000000",
|
|
25637
|
+
onChange: (hex) => {
|
|
25638
|
+
setHexInput(hex);
|
|
25639
|
+
},
|
|
25640
|
+
onChangeEnd: (hex) => {
|
|
25641
|
+
applyColor(hex);
|
|
25642
|
+
}
|
|
25643
|
+
}
|
|
25644
|
+
) }),
|
|
25645
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-color-custom-row ${toolbar_default.richTextColorCustomRow}`, children: [
|
|
25646
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25024
25647
|
"input",
|
|
25025
25648
|
{
|
|
25026
|
-
|
|
25027
|
-
value:
|
|
25028
|
-
onChange: (e) =>
|
|
25029
|
-
|
|
25030
|
-
|
|
25649
|
+
className: `ee-richtext-color-hex-input ${toolbar_default.richTextColorHexInput}`,
|
|
25650
|
+
value: hexInput,
|
|
25651
|
+
onChange: (e) => setHexInput(e.target.value),
|
|
25652
|
+
onKeyDown: handleHexKeyDown,
|
|
25653
|
+
placeholder: "#000000",
|
|
25654
|
+
maxLength: 7,
|
|
25655
|
+
spellCheck: false
|
|
25656
|
+
}
|
|
25657
|
+
),
|
|
25658
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25659
|
+
"button",
|
|
25660
|
+
{
|
|
25661
|
+
className: `ee-richtext-color-apply ${toolbar_default.richTextColorApplyBtn}`,
|
|
25662
|
+
onClick: handleHexApply,
|
|
25663
|
+
disabled: !isValidHex,
|
|
25664
|
+
title: "Apply color",
|
|
25665
|
+
children: "Apply"
|
|
25666
|
+
}
|
|
25667
|
+
)
|
|
25668
|
+
] }),
|
|
25669
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-color-bottom ${toolbar_default.richTextColorBottomActions}`, children: [
|
|
25670
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25671
|
+
"button",
|
|
25672
|
+
{
|
|
25673
|
+
className: `ee-richtext-color-save ${toolbar_default.richTextColorClearBtn}`,
|
|
25674
|
+
onClick: handleSaveCustom,
|
|
25675
|
+
title: "Save this color to your custom presets",
|
|
25676
|
+
disabled: !isValidHex || customColorPresets.includes(hexInput.trim()),
|
|
25677
|
+
children: "+ Save preset"
|
|
25031
25678
|
}
|
|
25032
25679
|
),
|
|
25033
|
-
/* @__PURE__ */ (0,
|
|
25680
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
25034
25681
|
"button",
|
|
25035
25682
|
{
|
|
25036
25683
|
className: `ee-richtext-color-clear ${toolbar_default.richTextColorClearBtn}`,
|
|
@@ -25072,6 +25719,8 @@ var blocks_default = {
|
|
|
25072
25719
|
"socialLabel": "socialLabel",
|
|
25073
25720
|
"socialElementsContainer": "socialElementsContainer",
|
|
25074
25721
|
"socialElementItem": "socialElementItem",
|
|
25722
|
+
"socialIconImage": "socialIconImage",
|
|
25723
|
+
"socialIconPreview": "socialIconPreview",
|
|
25075
25724
|
"htmlBlock": "htmlBlock",
|
|
25076
25725
|
"htmlPlaceholder": "htmlPlaceholder",
|
|
25077
25726
|
"videoBlock": "videoBlock",
|
|
@@ -25105,17 +25754,17 @@ var tiptap_default = {
|
|
|
25105
25754
|
};
|
|
25106
25755
|
|
|
25107
25756
|
// src/components/Canvas/blocks/TextBlock.tsx
|
|
25108
|
-
var
|
|
25757
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
25109
25758
|
var TextBlockInner = function TextBlock({ block }) {
|
|
25110
25759
|
const dispatch = useEditorDispatch();
|
|
25111
25760
|
const { setActiveEditor } = useMethodsContext();
|
|
25112
|
-
const editorRef = (0,
|
|
25113
|
-
const wrapperRef = (0,
|
|
25114
|
-
const blurTimerRef = (0,
|
|
25115
|
-
const [isFocused, setIsFocused] = (0,
|
|
25116
|
-
const [editorInstance, setEditorInstance] = (0,
|
|
25117
|
-
const [, forceToolbarUpdate] = (0,
|
|
25118
|
-
(0,
|
|
25761
|
+
const editorRef = (0, import_react26.useRef)(null);
|
|
25762
|
+
const wrapperRef = (0, import_react26.useRef)(null);
|
|
25763
|
+
const blurTimerRef = (0, import_react26.useRef)(null);
|
|
25764
|
+
const [isFocused, setIsFocused] = (0, import_react26.useState)(false);
|
|
25765
|
+
const [editorInstance, setEditorInstance] = (0, import_react26.useState)(null);
|
|
25766
|
+
const [, forceToolbarUpdate] = (0, import_react26.useReducer)((c) => c + 1, 0);
|
|
25767
|
+
(0, import_react26.useEffect)(() => {
|
|
25119
25768
|
if (!editorInstance) return;
|
|
25120
25769
|
const onStateChange = () => forceToolbarUpdate();
|
|
25121
25770
|
editorInstance.on("selectionUpdate", onStateChange);
|
|
@@ -25125,7 +25774,7 @@ var TextBlockInner = function TextBlock({ block }) {
|
|
|
25125
25774
|
editorInstance.off("transaction", onStateChange);
|
|
25126
25775
|
};
|
|
25127
25776
|
}, [editorInstance]);
|
|
25128
|
-
const handleUpdate = (0,
|
|
25777
|
+
const handleUpdate = (0, import_react26.useCallback)(
|
|
25129
25778
|
(html2) => {
|
|
25130
25779
|
dispatch({
|
|
25131
25780
|
type: "UPDATE_BLOCK",
|
|
@@ -25134,16 +25783,16 @@ var TextBlockInner = function TextBlock({ block }) {
|
|
|
25134
25783
|
},
|
|
25135
25784
|
[dispatch, block.id]
|
|
25136
25785
|
);
|
|
25137
|
-
const handleFocus = (0,
|
|
25786
|
+
const handleFocus = (0, import_react26.useCallback)(() => {
|
|
25138
25787
|
setActiveEditor(editorRef.current);
|
|
25139
25788
|
setIsFocused(true);
|
|
25140
25789
|
}, [setActiveEditor]);
|
|
25141
|
-
(0,
|
|
25790
|
+
(0, import_react26.useEffect)(() => {
|
|
25142
25791
|
return () => {
|
|
25143
25792
|
if (blurTimerRef.current !== null) clearTimeout(blurTimerRef.current);
|
|
25144
25793
|
};
|
|
25145
25794
|
}, []);
|
|
25146
|
-
const handleBlur = (0,
|
|
25795
|
+
const handleBlur = (0, import_react26.useCallback)(() => {
|
|
25147
25796
|
if (blurTimerRef.current !== null) clearTimeout(blurTimerRef.current);
|
|
25148
25797
|
blurTimerRef.current = setTimeout(() => {
|
|
25149
25798
|
blurTimerRef.current = null;
|
|
@@ -25157,12 +25806,12 @@ var TextBlockInner = function TextBlock({ block }) {
|
|
|
25157
25806
|
}
|
|
25158
25807
|
}, 200);
|
|
25159
25808
|
}, [setActiveEditor]);
|
|
25160
|
-
const handleEditorRef = (0,
|
|
25809
|
+
const handleEditorRef = (0, import_react26.useCallback)((editor) => {
|
|
25161
25810
|
editorRef.current = editor;
|
|
25162
25811
|
setEditorInstance(editor);
|
|
25163
25812
|
}, []);
|
|
25164
25813
|
const p = block.properties;
|
|
25165
|
-
const wrapperStyle = (0,
|
|
25814
|
+
const wrapperStyle = (0, import_react26.useMemo)(() => ({
|
|
25166
25815
|
fontFamily: p.fontFamily,
|
|
25167
25816
|
fontSize: p.fontSize,
|
|
25168
25817
|
color: p.color,
|
|
@@ -25170,11 +25819,12 @@ var TextBlockInner = function TextBlock({ block }) {
|
|
|
25170
25819
|
padding: p.padding,
|
|
25171
25820
|
fontWeight: p.fontWeight,
|
|
25172
25821
|
textTransform: p.textTransform,
|
|
25173
|
-
letterSpacing: p.letterSpacing
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
/* @__PURE__ */ (0,
|
|
25822
|
+
letterSpacing: p.letterSpacing,
|
|
25823
|
+
backgroundColor: p.backgroundColor && p.backgroundColor !== "transparent" ? p.backgroundColor : void 0
|
|
25824
|
+
}), [p.fontFamily, p.fontSize, p.color, p.lineHeight, p.padding, p.fontWeight, p.textTransform, p.letterSpacing, p.backgroundColor]);
|
|
25825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `ee-block-text ${blocks_default.textBlock}`, ref: wrapperRef, children: [
|
|
25826
|
+
isFocused && editorInstance && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: blocks_default.textBlockToolbar, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RichTextToolbar, { editor: editorInstance }) }),
|
|
25827
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: wrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
25178
25828
|
TipTapEditor,
|
|
25179
25829
|
{
|
|
25180
25830
|
content: block.properties.content,
|
|
@@ -25188,16 +25838,16 @@ var TextBlockInner = function TextBlock({ block }) {
|
|
|
25188
25838
|
) })
|
|
25189
25839
|
] });
|
|
25190
25840
|
};
|
|
25191
|
-
var TextBlock2 =
|
|
25841
|
+
var TextBlock2 = import_react26.default.memo(TextBlockInner);
|
|
25192
25842
|
|
|
25193
25843
|
// src/components/Canvas/blocks/ButtonBlock.tsx
|
|
25194
|
-
var
|
|
25195
|
-
var
|
|
25196
|
-
var ButtonBlock =
|
|
25844
|
+
var import_react27 = __toESM(require("react"));
|
|
25845
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
25846
|
+
var ButtonBlock = import_react27.default.memo(function ButtonBlock2({ block }) {
|
|
25197
25847
|
const p = block.properties;
|
|
25198
25848
|
const alignClass = p.align === "left" ? blocks_default.buttonBlockLeft : p.align === "right" ? blocks_default.buttonBlockRight : blocks_default.buttonBlockCenter;
|
|
25199
|
-
const outerStyle = (0,
|
|
25200
|
-
const buttonStyle = (0,
|
|
25849
|
+
const outerStyle = (0, import_react27.useMemo)(() => ({ padding: p.padding }), [p.padding]);
|
|
25850
|
+
const buttonStyle = (0, import_react27.useMemo)(() => ({
|
|
25201
25851
|
backgroundColor: p.backgroundColor,
|
|
25202
25852
|
color: p.color,
|
|
25203
25853
|
fontFamily: p.fontFamily,
|
|
@@ -25209,7 +25859,7 @@ var ButtonBlock = import_react25.default.memo(function ButtonBlock2({ block }) {
|
|
|
25209
25859
|
textTransform: p.textTransform,
|
|
25210
25860
|
letterSpacing: p.letterSpacing
|
|
25211
25861
|
}), [p.backgroundColor, p.color, p.fontFamily, p.fontSize, p.borderRadius, p.innerPadding, p.width, p.fontWeight, p.textTransform, p.letterSpacing]);
|
|
25212
|
-
return /* @__PURE__ */ (0,
|
|
25862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `ee-block-button ${blocks_default.buttonBlock} ${alignClass}`, style: outerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
25213
25863
|
"span",
|
|
25214
25864
|
{
|
|
25215
25865
|
className: blocks_default.buttonPreview,
|
|
@@ -25220,21 +25870,21 @@ var ButtonBlock = import_react25.default.memo(function ButtonBlock2({ block }) {
|
|
|
25220
25870
|
});
|
|
25221
25871
|
|
|
25222
25872
|
// src/components/Canvas/blocks/ImageBlock.tsx
|
|
25223
|
-
var
|
|
25873
|
+
var import_react29 = __toESM(require("react"));
|
|
25224
25874
|
|
|
25225
25875
|
// src/components/ImageUpload/useImageUpload.ts
|
|
25226
|
-
var
|
|
25876
|
+
var import_react28 = require("react");
|
|
25227
25877
|
function useImageUpload({
|
|
25228
25878
|
adapter,
|
|
25229
25879
|
blockId,
|
|
25230
25880
|
onSuccess,
|
|
25231
25881
|
onError
|
|
25232
25882
|
}) {
|
|
25233
|
-
const [status, setStatus] = (0,
|
|
25234
|
-
const [progress, setProgress] = (0,
|
|
25235
|
-
const [error, setError] = (0,
|
|
25236
|
-
const controllerRef = (0,
|
|
25237
|
-
const upload = (0,
|
|
25883
|
+
const [status, setStatus] = (0, import_react28.useState)("idle");
|
|
25884
|
+
const [progress, setProgress] = (0, import_react28.useState)(0);
|
|
25885
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
25886
|
+
const controllerRef = (0, import_react28.useRef)(null);
|
|
25887
|
+
const upload = (0, import_react28.useCallback)(
|
|
25238
25888
|
async (file) => {
|
|
25239
25889
|
if (!adapter) {
|
|
25240
25890
|
setError("No upload adapter configured");
|
|
@@ -25279,12 +25929,12 @@ function useImageUpload({
|
|
|
25279
25929
|
},
|
|
25280
25930
|
[adapter, blockId, onSuccess, onError]
|
|
25281
25931
|
);
|
|
25282
|
-
const cancel = (0,
|
|
25932
|
+
const cancel = (0, import_react28.useCallback)(() => {
|
|
25283
25933
|
controllerRef.current?.abort();
|
|
25284
25934
|
setStatus("idle");
|
|
25285
25935
|
setProgress(0);
|
|
25286
25936
|
}, []);
|
|
25287
|
-
const browse = (0,
|
|
25937
|
+
const browse = (0, import_react28.useCallback)(async () => {
|
|
25288
25938
|
if (!adapter?.browse) return null;
|
|
25289
25939
|
try {
|
|
25290
25940
|
const result = await adapter.browse();
|
|
@@ -25296,7 +25946,7 @@ function useImageUpload({
|
|
|
25296
25946
|
return null;
|
|
25297
25947
|
}
|
|
25298
25948
|
}, [adapter, onSuccess]);
|
|
25299
|
-
const reset2 = (0,
|
|
25949
|
+
const reset2 = (0, import_react28.useCallback)(() => {
|
|
25300
25950
|
setStatus("idle");
|
|
25301
25951
|
setProgress(0);
|
|
25302
25952
|
setError(null);
|
|
@@ -25305,11 +25955,11 @@ function useImageUpload({
|
|
|
25305
25955
|
}
|
|
25306
25956
|
|
|
25307
25957
|
// src/components/Canvas/blocks/ImageBlock.tsx
|
|
25308
|
-
var
|
|
25958
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
25309
25959
|
var ImageBlockInner = function ImageBlock({ block }) {
|
|
25310
25960
|
const dispatch = useEditorDispatch();
|
|
25311
25961
|
const { imageUploadAdapter } = useConfigContext();
|
|
25312
|
-
const fileInputRef = (0,
|
|
25962
|
+
const fileInputRef = (0, import_react29.useRef)(null);
|
|
25313
25963
|
const p = block.properties;
|
|
25314
25964
|
const { upload, status } = useImageUpload({
|
|
25315
25965
|
adapter: imageUploadAdapter,
|
|
@@ -25329,7 +25979,7 @@ var ImageBlockInner = function ImageBlock({ block }) {
|
|
|
25329
25979
|
}
|
|
25330
25980
|
});
|
|
25331
25981
|
const alignClass = p.align === "left" ? blocks_default.imageBlockLeft : p.align === "right" ? blocks_default.imageBlockRight : blocks_default.imageBlockCenter;
|
|
25332
|
-
const handleFileSelect = (0,
|
|
25982
|
+
const handleFileSelect = (0, import_react29.useCallback)(
|
|
25333
25983
|
async (e) => {
|
|
25334
25984
|
const file = e.target.files?.[0];
|
|
25335
25985
|
if (!file) return;
|
|
@@ -25337,11 +25987,11 @@ var ImageBlockInner = function ImageBlock({ block }) {
|
|
|
25337
25987
|
},
|
|
25338
25988
|
[upload]
|
|
25339
25989
|
);
|
|
25340
|
-
const handlePlaceholderClick = (0,
|
|
25990
|
+
const handlePlaceholderClick = (0, import_react29.useCallback)(() => {
|
|
25341
25991
|
fileInputRef.current?.click();
|
|
25342
25992
|
}, []);
|
|
25343
|
-
return /* @__PURE__ */ (0,
|
|
25344
|
-
p.src ? /* @__PURE__ */ (0,
|
|
25993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `ee-block-image ${blocks_default.imageBlock} ${alignClass}`, style: { padding: p.padding }, children: [
|
|
25994
|
+
p.src ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
25345
25995
|
"img",
|
|
25346
25996
|
{
|
|
25347
25997
|
src: p.src,
|
|
@@ -25352,11 +26002,11 @@ var ImageBlockInner = function ImageBlock({ block }) {
|
|
|
25352
26002
|
height: p.height !== "auto" ? p.height : void 0
|
|
25353
26003
|
}
|
|
25354
26004
|
}
|
|
25355
|
-
) : /* @__PURE__ */ (0,
|
|
25356
|
-
/* @__PURE__ */ (0,
|
|
25357
|
-
/* @__PURE__ */ (0,
|
|
26005
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: blocks_default.imagePlaceholder, onClick: handlePlaceholderClick, children: [
|
|
26006
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: blocks_default.imagePlaceholderIcon, children: "+" }),
|
|
26007
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: status === "uploading" ? "Uploading..." : "Click to upload image" })
|
|
25358
26008
|
] }),
|
|
25359
|
-
/* @__PURE__ */ (0,
|
|
26009
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
25360
26010
|
"input",
|
|
25361
26011
|
{
|
|
25362
26012
|
ref: fileInputRef,
|
|
@@ -25368,19 +26018,19 @@ var ImageBlockInner = function ImageBlock({ block }) {
|
|
|
25368
26018
|
)
|
|
25369
26019
|
] });
|
|
25370
26020
|
};
|
|
25371
|
-
var ImageBlock2 =
|
|
26021
|
+
var ImageBlock2 = import_react29.default.memo(ImageBlockInner);
|
|
25372
26022
|
|
|
25373
26023
|
// src/components/Canvas/blocks/DividerBlock.tsx
|
|
25374
|
-
var
|
|
25375
|
-
var
|
|
25376
|
-
var DividerBlock =
|
|
26024
|
+
var import_react30 = __toESM(require("react"));
|
|
26025
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
26026
|
+
var DividerBlock = import_react30.default.memo(function DividerBlock2({ block }) {
|
|
25377
26027
|
const p = block.properties;
|
|
25378
|
-
const outerStyle = (0,
|
|
25379
|
-
const hrStyle = (0,
|
|
26028
|
+
const outerStyle = (0, import_react30.useMemo)(() => ({ padding: p.padding }), [p.padding]);
|
|
26029
|
+
const hrStyle = (0, import_react30.useMemo)(() => ({
|
|
25380
26030
|
width: p.width,
|
|
25381
26031
|
borderTop: `${p.borderWidth} ${p.borderStyle} ${p.borderColor}`
|
|
25382
26032
|
}), [p.width, p.borderWidth, p.borderStyle, p.borderColor]);
|
|
25383
|
-
return /* @__PURE__ */ (0,
|
|
26033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `ee-block-divider ${blocks_default.dividerBlock}`, style: outerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
25384
26034
|
"hr",
|
|
25385
26035
|
{
|
|
25386
26036
|
className: blocks_default.dividerLine,
|
|
@@ -25390,16 +26040,46 @@ var DividerBlock = import_react28.default.memo(function DividerBlock2({ block })
|
|
|
25390
26040
|
});
|
|
25391
26041
|
|
|
25392
26042
|
// src/components/Canvas/blocks/SpacerBlock.tsx
|
|
25393
|
-
var
|
|
25394
|
-
var
|
|
25395
|
-
var SpacerBlock =
|
|
26043
|
+
var import_react31 = __toESM(require("react"));
|
|
26044
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
26045
|
+
var SpacerBlock = import_react31.default.memo(function SpacerBlock2({ block }) {
|
|
25396
26046
|
const p = block.properties;
|
|
25397
|
-
return /* @__PURE__ */ (0,
|
|
26047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `ee-block-spacer ${blocks_default.spacerBlock}`, style: { height: p.height }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: blocks_default.spacerLabel, children: p.height }) });
|
|
25398
26048
|
});
|
|
25399
26049
|
|
|
25400
26050
|
// src/components/Canvas/blocks/SocialBlock.tsx
|
|
25401
|
-
var
|
|
25402
|
-
|
|
26051
|
+
var import_react32 = __toESM(require("react"));
|
|
26052
|
+
|
|
26053
|
+
// src/components/Canvas/blocks/social-icons.tsx
|
|
26054
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
26055
|
+
var Facebook = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M9.198 21.5h4v-8.01h3.604l.396-3.98h-4V7.5a1 1 0 0 1 1-1h3v-4h-3a5 5 0 0 0-5 5v2.01h-2l-.396 3.98h2.396v8.01Z" }) });
|
|
26056
|
+
var Twitter = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M13.808 10.469 20.88 2h-1.676l-6.142 7.353L8.158 2H2.5l7.418 11.12L2.5 22h1.676l6.486-7.765L15.842 22H21.5l-7.693-11.531Zm-2.296 2.748-.752-1.107L4.78 3.3h2.575l4.826 7.11.751 1.107 6.273 9.242h-2.574l-5.12-7.541Z" }) });
|
|
26057
|
+
var Instagram = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M7.8 2h8.4A5.8 5.8 0 0 1 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8A5.8 5.8 0 0 1 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2Zm-.2 2A3.6 3.6 0 0 0 4 7.6v8.8A3.6 3.6 0 0 0 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6A3.6 3.6 0 0 0 16.4 4H7.6Zm9.65 1.5a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5ZM12 7a5 5 0 1 1 0 10 5 5 0 0 1 0-10Zm0 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z" }) });
|
|
26058
|
+
var LinkedIn = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M6.94 5a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM7 8.48H3V21h4V8.48Zm6.32 0H9.34V21h3.94v-6.57c0-3.66 4.77-4 4.77 0V21H22v-7.93c0-6.17-7.06-5.94-8.72-2.91l.04-1.68Z" }) });
|
|
26059
|
+
var YouTube = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814ZM9.545 15.568V8.432L15.818 12l-6.273 3.568Z" }) });
|
|
26060
|
+
var GitHub = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.464-1.11-1.464-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0 1 12 6.836a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.167 22 16.418 22 12c0-5.523-4.477-10-10-10Z" }) });
|
|
26061
|
+
var Pinterest = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M12 2C6.477 2 2 6.477 2 12c0 4.237 2.636 7.855 6.356 9.312-.088-.791-.167-2.005.035-2.868.181-.78 1.172-4.97 1.172-4.97s-.299-.598-.299-1.482c0-1.388.806-2.425 1.808-2.425.853 0 1.265.64 1.265 1.408 0 .858-.546 2.14-.828 3.33-.236.995.499 1.806 1.48 1.806 1.778 0 3.144-1.874 3.144-4.58 0-2.393-1.72-4.068-4.177-4.068-2.845 0-4.515 2.134-4.515 4.34 0 .859.331 1.781.745 2.282a.3.3 0 0 1 .069.288l-.278 1.133c-.044.183-.145.222-.335.134-1.249-.581-2.03-2.407-2.03-3.874 0-3.154 2.292-6.052 6.608-6.052 3.469 0 6.165 2.472 6.165 5.776 0 3.447-2.173 6.22-5.19 6.22-1.013 0-1.965-.527-2.291-1.148l-.623 2.378c-.226.869-.835 1.958-1.244 2.621.937.29 1.931.446 2.962.446 5.523 0 10-4.477 10-10S17.523 2 12 2Z" }) });
|
|
26062
|
+
var Snapchat = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M12.166 3c1.672 0 3.036.676 3.95 1.956.662.925.826 1.862.826 2.607 0 .478-.045.913-.098 1.3l-.018.122c.106.048.238.076.387.076.27 0 .496-.1.677-.186a.78.78 0 0 1 .335-.08c.132 0 .352.037.521.201.212.207.233.48.233.588 0 .403-.332.694-.988.866-.094.024-.206.048-.328.074-.338.072-.802.17-.927.441-.074.162-.035.369.115.617l.017.027c.039.063 3.786 6.185-1.135 7.318-.047.01-.08.056-.07.1.059.268.322.41.548.534.11.06.213.117.292.179.303.237.35.488.321.655-.04.224-.236.44-.598.514a3.15 3.15 0 0 1-.638.067c-.258 0-.539-.034-.879-.088a5.106 5.106 0 0 0-.85-.073 3.474 3.474 0 0 0-.534.043c-.254.04-.544.143-.877.261-.535.19-1.199.427-2.089.427-.034 0-.069 0-.107-.002h-.037c-.89 0-1.551-.237-2.087-.427a4.36 4.36 0 0 0-.877-.261 3.494 3.494 0 0 0-.534-.043c-.321 0-.6.03-.85.073-.339.054-.62.088-.879.088a3.15 3.15 0 0 1-.638-.067c-.362-.074-.558-.29-.598-.514-.028-.167.018-.418.321-.655.079-.062.182-.118.292-.18.226-.123.49-.265.548-.533a.086.086 0 0 0-.07-.1c-3.07-.706-1.79-4.432-1.235-5.637l.003-.007c.06-.126.14-.293.169-.363.005-.012.012-.028.017-.04.133-.265.172-.46.115-.597-.125-.271-.59-.37-.928-.441a3.72 3.72 0 0 1-.327-.074c-.709-.186-.99-.496-.99-.866 0-.363.302-.638.594-.714a.808.808 0 0 1 .217-.026c.114 0 .23.028.336.08.24.11.481.186.676.186.149 0 .28-.028.386-.076a10.78 10.78 0 0 1-.116-1.422c0-.745.164-1.682.826-2.607C9.13 3.676 10.494 3 12.166 3Z" }) });
|
|
26063
|
+
var TikTok = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M16.6 5.82A4.278 4.278 0 0 1 15.54 3h-3.09v12.4a2.592 2.592 0 0 1-2.59 2.5c-1.42 0-2.6-1.16-2.6-2.6 0-1.72 1.66-3.01 3.37-2.48V9.66c-3.45-.46-6.47 2.22-6.47 5.64 0 3.33 2.76 5.7 5.69 5.7 3.14 0 5.69-2.55 5.69-5.7V9.01a7.35 7.35 0 0 0 4.3 1.38V7.3s-1.88.09-3.86-1.48h-.02Z" }) });
|
|
26064
|
+
var Web = ({ size = 20, color = "#ffffff" }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: color, xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm6.918 6h-3.215a15.876 15.876 0 0 0-1.403-3.846A8.028 8.028 0 0 1 18.918 8ZM12 4.04c.793 1.02 1.44 2.18 1.89 3.46h-3.78c.45-1.28 1.097-2.44 1.89-3.46ZM4.26 14a7.93 7.93 0 0 1 0-4h3.38a16.516 16.516 0 0 0 0 4H4.26Zm.822 2h3.215a15.876 15.876 0 0 0 1.403 3.846A8.028 8.028 0 0 1 5.082 16ZM8.297 8H5.082A8.028 8.028 0 0 1 9.7 4.154 15.876 15.876 0 0 0 8.297 8ZM12 19.96c-.793-1.02-1.44-2.18-1.89-3.46h3.78c-.45 1.28-1.097 2.44-1.89 3.46ZM14.34 14H9.66a14.556 14.556 0 0 1 0-4h4.68a14.556 14.556 0 0 1 0 4Zm.36 5.846A15.876 15.876 0 0 0 16.103 16h3.215a8.029 8.029 0 0 1-4.618 3.846ZM16.36 14a16.516 16.516 0 0 0 0-4h3.38a7.93 7.93 0 0 1 0 4h-3.38Z" }) });
|
|
26065
|
+
var SOCIAL_ICONS = {
|
|
26066
|
+
facebook: Facebook,
|
|
26067
|
+
twitter: Twitter,
|
|
26068
|
+
instagram: Instagram,
|
|
26069
|
+
linkedin: LinkedIn,
|
|
26070
|
+
youtube: YouTube,
|
|
26071
|
+
github: GitHub,
|
|
26072
|
+
pinterest: Pinterest,
|
|
26073
|
+
snapchat: Snapchat,
|
|
26074
|
+
tiktok: TikTok,
|
|
26075
|
+
web: Web
|
|
26076
|
+
};
|
|
26077
|
+
function getSocialIcon(name) {
|
|
26078
|
+
return SOCIAL_ICONS[name.toLowerCase()];
|
|
26079
|
+
}
|
|
26080
|
+
|
|
26081
|
+
// src/components/Canvas/blocks/SocialBlock.tsx
|
|
26082
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
25403
26083
|
var PLATFORM_COLORS = {
|
|
25404
26084
|
facebook: "#3b5998",
|
|
25405
26085
|
twitter: "#1da1f2",
|
|
@@ -25412,39 +26092,75 @@ var PLATFORM_COLORS = {
|
|
|
25412
26092
|
tiktok: "#000000",
|
|
25413
26093
|
web: "#4caf50"
|
|
25414
26094
|
};
|
|
25415
|
-
|
|
26095
|
+
function SocialIconImage({ src, name, iconSizeNum, iconColor, SvgIcon }) {
|
|
26096
|
+
const [errored, setErrored] = import_react32.default.useState(false);
|
|
26097
|
+
if (errored) {
|
|
26098
|
+
if (SvgIcon) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SvgIcon, { size: Math.round(iconSizeNum * 0.6), color: iconColor });
|
|
26099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { color: iconColor, fontSize: Math.max(10, iconSizeNum * 0.5), fontWeight: "bold" }, children: name.charAt(0).toUpperCase() });
|
|
26100
|
+
}
|
|
26101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
26102
|
+
"img",
|
|
26103
|
+
{
|
|
26104
|
+
src,
|
|
26105
|
+
alt: name,
|
|
26106
|
+
className: blocks_default.socialIconImage,
|
|
26107
|
+
width: iconSizeNum,
|
|
26108
|
+
height: iconSizeNum,
|
|
26109
|
+
onError: () => setErrored(true)
|
|
26110
|
+
}
|
|
26111
|
+
);
|
|
26112
|
+
}
|
|
26113
|
+
var SocialBlock = import_react32.default.memo(function SocialBlock2({ block }) {
|
|
25416
26114
|
const p = block.properties;
|
|
25417
26115
|
const isVertical = p.mode === "vertical";
|
|
25418
26116
|
const alignStyle = p.align === "left" ? "flex-start" : p.align === "right" ? "flex-end" : "center";
|
|
25419
26117
|
const iconSizeNum = parseInt(p.iconSize, 10) || 20;
|
|
25420
|
-
const wrapperStyle = (0,
|
|
26118
|
+
const wrapperStyle = (0, import_react32.useMemo)(() => ({
|
|
25421
26119
|
padding: p.padding,
|
|
25422
26120
|
justifyContent: alignStyle,
|
|
25423
26121
|
flexDirection: isVertical ? "column" : "row",
|
|
25424
26122
|
alignItems: isVertical ? alignStyle : "center"
|
|
25425
26123
|
}), [p.padding, alignStyle, isVertical]);
|
|
25426
|
-
const elementPaddingStyle = (0,
|
|
26124
|
+
const elementPaddingStyle = (0, import_react32.useMemo)(() => ({
|
|
25427
26125
|
padding: p.iconPadding
|
|
25428
26126
|
}), [p.iconPadding]);
|
|
25429
|
-
const labelStyle = (0,
|
|
26127
|
+
const labelStyle = (0, import_react32.useMemo)(() => ({
|
|
25430
26128
|
fontSize: p.fontSize,
|
|
25431
26129
|
color: p.color
|
|
25432
26130
|
}), [p.fontSize, p.color]);
|
|
25433
|
-
return /* @__PURE__ */ (0,
|
|
26131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
25434
26132
|
"div",
|
|
25435
26133
|
{
|
|
25436
26134
|
className: `ee-block-social ${blocks_default.socialBlock}`,
|
|
25437
26135
|
style: wrapperStyle,
|
|
25438
26136
|
children: p.elements.map((element) => {
|
|
25439
26137
|
const bgColor = element.backgroundColor || PLATFORM_COLORS[element.name] || "#999999";
|
|
25440
|
-
const
|
|
25441
|
-
|
|
26138
|
+
const iconColor = element.color || "#ffffff";
|
|
26139
|
+
const SvgIcon = getSocialIcon(element.name);
|
|
26140
|
+
let iconContent;
|
|
26141
|
+
if (element.src) {
|
|
26142
|
+
iconContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
26143
|
+
SocialIconImage,
|
|
26144
|
+
{
|
|
26145
|
+
src: element.src,
|
|
26146
|
+
name: element.name,
|
|
26147
|
+
iconSizeNum,
|
|
26148
|
+
iconColor,
|
|
26149
|
+
SvgIcon
|
|
26150
|
+
}
|
|
26151
|
+
);
|
|
26152
|
+
} else if (SvgIcon) {
|
|
26153
|
+
iconContent = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SvgIcon, { size: Math.round(iconSizeNum * 0.6), color: iconColor });
|
|
26154
|
+
} else {
|
|
26155
|
+
iconContent = element.name.charAt(0).toUpperCase();
|
|
26156
|
+
}
|
|
26157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
25442
26158
|
"div",
|
|
25443
26159
|
{
|
|
25444
26160
|
className: blocks_default.socialElement,
|
|
25445
26161
|
style: elementPaddingStyle,
|
|
25446
26162
|
children: [
|
|
25447
|
-
/* @__PURE__ */ (0,
|
|
26163
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
25448
26164
|
"span",
|
|
25449
26165
|
{
|
|
25450
26166
|
className: blocks_default.socialIcon,
|
|
@@ -25453,13 +26169,13 @@ var SocialBlock = import_react30.default.memo(function SocialBlock2({ block }) {
|
|
|
25453
26169
|
height: iconSizeNum,
|
|
25454
26170
|
backgroundColor: bgColor,
|
|
25455
26171
|
borderRadius: p.borderRadius,
|
|
25456
|
-
color:
|
|
26172
|
+
color: iconColor,
|
|
25457
26173
|
fontSize: Math.max(10, iconSizeNum * 0.5)
|
|
25458
26174
|
},
|
|
25459
|
-
children:
|
|
26175
|
+
children: iconContent
|
|
25460
26176
|
}
|
|
25461
26177
|
),
|
|
25462
|
-
element.content && /* @__PURE__ */ (0,
|
|
26178
|
+
element.content && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
25463
26179
|
"span",
|
|
25464
26180
|
{
|
|
25465
26181
|
className: blocks_default.socialLabel,
|
|
@@ -25477,7 +26193,7 @@ var SocialBlock = import_react30.default.memo(function SocialBlock2({ block }) {
|
|
|
25477
26193
|
});
|
|
25478
26194
|
|
|
25479
26195
|
// src/components/Canvas/blocks/HtmlBlock.tsx
|
|
25480
|
-
var
|
|
26196
|
+
var import_react33 = __toESM(require("react"));
|
|
25481
26197
|
|
|
25482
26198
|
// node_modules/dompurify/dist/purify.es.mjs
|
|
25483
26199
|
var {
|
|
@@ -26499,10 +27215,10 @@ function createDOMPurify() {
|
|
|
26499
27215
|
var purify = createDOMPurify();
|
|
26500
27216
|
|
|
26501
27217
|
// src/components/Canvas/blocks/HtmlBlock.tsx
|
|
26502
|
-
var
|
|
26503
|
-
var HtmlBlock =
|
|
27218
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
27219
|
+
var HtmlBlock = import_react33.default.memo(function HtmlBlock2({ block }) {
|
|
26504
27220
|
const p = block.properties;
|
|
26505
|
-
const sanitizedContent = (0,
|
|
27221
|
+
const sanitizedContent = (0, import_react33.useMemo)(() => {
|
|
26506
27222
|
if (!p.content) return "";
|
|
26507
27223
|
return purify.sanitize(p.content, {
|
|
26508
27224
|
ADD_TAGS: ["table", "thead", "tbody", "tr", "td", "th"],
|
|
@@ -26510,12 +27226,12 @@ var HtmlBlock = import_react31.default.memo(function HtmlBlock2({ block }) {
|
|
|
26510
27226
|
});
|
|
26511
27227
|
}, [p.content]);
|
|
26512
27228
|
if (!p.content) {
|
|
26513
|
-
return /* @__PURE__ */ (0,
|
|
26514
|
-
/* @__PURE__ */ (0,
|
|
26515
|
-
/* @__PURE__ */ (0,
|
|
27229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: `ee-block-html ${blocks_default.htmlBlock}`, style: { padding: p.padding }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: blocks_default.htmlPlaceholder, children: [
|
|
27230
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "</>" }),
|
|
27231
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Raw HTML Block" })
|
|
26516
27232
|
] }) });
|
|
26517
27233
|
}
|
|
26518
|
-
return /* @__PURE__ */ (0,
|
|
27234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
26519
27235
|
"div",
|
|
26520
27236
|
{
|
|
26521
27237
|
className: `ee-block-html ${blocks_default.htmlBlock}`,
|
|
@@ -26526,24 +27242,24 @@ var HtmlBlock = import_react31.default.memo(function HtmlBlock2({ block }) {
|
|
|
26526
27242
|
});
|
|
26527
27243
|
|
|
26528
27244
|
// src/components/Canvas/blocks/VideoBlock.tsx
|
|
26529
|
-
var
|
|
26530
|
-
var
|
|
26531
|
-
var VideoBlock =
|
|
27245
|
+
var import_react34 = __toESM(require("react"));
|
|
27246
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
27247
|
+
var VideoBlock = import_react34.default.memo(function VideoBlock2({ block }) {
|
|
26532
27248
|
const p = block.properties;
|
|
26533
27249
|
const alignClass = p.align === "left" ? blocks_default.videoBlockLeft : p.align === "right" ? blocks_default.videoBlockRight : blocks_default.videoBlockCenter;
|
|
26534
27250
|
const thumbnailUrl = p.thumbnailUrl || getAutoThumbnail2(p.src);
|
|
26535
27251
|
if (!thumbnailUrl && !p.src) {
|
|
26536
|
-
return /* @__PURE__ */ (0,
|
|
26537
|
-
/* @__PURE__ */ (0,
|
|
26538
|
-
/* @__PURE__ */ (0,
|
|
27252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `ee-block-video ${blocks_default.videoBlock} ${alignClass}`, style: { padding: p.padding }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: blocks_default.videoPlaceholder, children: [
|
|
27253
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "32px" }, children: "\u25B6" }),
|
|
27254
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Video Block" })
|
|
26539
27255
|
] }) });
|
|
26540
27256
|
}
|
|
26541
|
-
return /* @__PURE__ */ (0,
|
|
26542
|
-
thumbnailUrl ? /* @__PURE__ */ (0,
|
|
26543
|
-
/* @__PURE__ */ (0,
|
|
26544
|
-
/* @__PURE__ */ (0,
|
|
27257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `ee-block-video ${blocks_default.videoBlock} ${alignClass}`, style: { padding: p.padding }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: blocks_default.videoPreview, children: [
|
|
27258
|
+
thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: thumbnailUrl, alt: p.alt, style: { maxWidth: "100%", display: "block" } }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: blocks_default.videoPlaceholder, children: [
|
|
27259
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: { fontSize: "32px" }, children: "\u25B6" }),
|
|
27260
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "No thumbnail" })
|
|
26545
27261
|
] }),
|
|
26546
|
-
/* @__PURE__ */ (0,
|
|
27262
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: blocks_default.playOverlay, children: "\u25B6" })
|
|
26547
27263
|
] }) });
|
|
26548
27264
|
});
|
|
26549
27265
|
function getAutoThumbnail2(url) {
|
|
@@ -26554,8 +27270,8 @@ function getAutoThumbnail2(url) {
|
|
|
26554
27270
|
}
|
|
26555
27271
|
|
|
26556
27272
|
// src/components/Canvas/blocks/HeadingBlock.tsx
|
|
26557
|
-
var
|
|
26558
|
-
var
|
|
27273
|
+
var import_react35 = __toESM(require("react"));
|
|
27274
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
26559
27275
|
var HEADING_FONT_SIZES = {
|
|
26560
27276
|
h1: "36px",
|
|
26561
27277
|
h2: "28px",
|
|
@@ -26565,13 +27281,13 @@ var HEADING_FONT_SIZES = {
|
|
|
26565
27281
|
var HeadingBlockInner = function HeadingBlock({ block }) {
|
|
26566
27282
|
const dispatch = useEditorDispatch();
|
|
26567
27283
|
const { setActiveEditor } = useMethodsContext();
|
|
26568
|
-
const editorRef = (0,
|
|
26569
|
-
const wrapperRef = (0,
|
|
26570
|
-
const blurTimerRef = (0,
|
|
26571
|
-
const [isFocused, setIsFocused] = (0,
|
|
26572
|
-
const [editorInstance, setEditorInstance] = (0,
|
|
26573
|
-
const [, forceToolbarUpdate] = (0,
|
|
26574
|
-
(0,
|
|
27284
|
+
const editorRef = (0, import_react35.useRef)(null);
|
|
27285
|
+
const wrapperRef = (0, import_react35.useRef)(null);
|
|
27286
|
+
const blurTimerRef = (0, import_react35.useRef)(null);
|
|
27287
|
+
const [isFocused, setIsFocused] = (0, import_react35.useState)(false);
|
|
27288
|
+
const [editorInstance, setEditorInstance] = (0, import_react35.useState)(null);
|
|
27289
|
+
const [, forceToolbarUpdate] = (0, import_react35.useReducer)((c) => c + 1, 0);
|
|
27290
|
+
(0, import_react35.useEffect)(() => {
|
|
26575
27291
|
if (!editorInstance) return;
|
|
26576
27292
|
const onStateChange = () => forceToolbarUpdate();
|
|
26577
27293
|
editorInstance.on("selectionUpdate", onStateChange);
|
|
@@ -26581,7 +27297,7 @@ var HeadingBlockInner = function HeadingBlock({ block }) {
|
|
|
26581
27297
|
editorInstance.off("transaction", onStateChange);
|
|
26582
27298
|
};
|
|
26583
27299
|
}, [editorInstance]);
|
|
26584
|
-
const handleUpdate = (0,
|
|
27300
|
+
const handleUpdate = (0, import_react35.useCallback)(
|
|
26585
27301
|
(html2) => {
|
|
26586
27302
|
dispatch({
|
|
26587
27303
|
type: "UPDATE_BLOCK",
|
|
@@ -26590,16 +27306,16 @@ var HeadingBlockInner = function HeadingBlock({ block }) {
|
|
|
26590
27306
|
},
|
|
26591
27307
|
[dispatch, block.id]
|
|
26592
27308
|
);
|
|
26593
|
-
const handleFocus = (0,
|
|
27309
|
+
const handleFocus = (0, import_react35.useCallback)(() => {
|
|
26594
27310
|
setActiveEditor(editorRef.current);
|
|
26595
27311
|
setIsFocused(true);
|
|
26596
27312
|
}, [setActiveEditor]);
|
|
26597
|
-
(0,
|
|
27313
|
+
(0, import_react35.useEffect)(() => {
|
|
26598
27314
|
return () => {
|
|
26599
27315
|
if (blurTimerRef.current !== null) clearTimeout(blurTimerRef.current);
|
|
26600
27316
|
};
|
|
26601
27317
|
}, []);
|
|
26602
|
-
const handleBlur = (0,
|
|
27318
|
+
const handleBlur = (0, import_react35.useCallback)(() => {
|
|
26603
27319
|
if (blurTimerRef.current !== null) clearTimeout(blurTimerRef.current);
|
|
26604
27320
|
blurTimerRef.current = setTimeout(() => {
|
|
26605
27321
|
blurTimerRef.current = null;
|
|
@@ -26613,13 +27329,13 @@ var HeadingBlockInner = function HeadingBlock({ block }) {
|
|
|
26613
27329
|
}
|
|
26614
27330
|
}, 200);
|
|
26615
27331
|
}, [setActiveEditor]);
|
|
26616
|
-
const handleEditorRef = (0,
|
|
27332
|
+
const handleEditorRef = (0, import_react35.useCallback)((editor) => {
|
|
26617
27333
|
editorRef.current = editor;
|
|
26618
27334
|
setEditorInstance(editor);
|
|
26619
27335
|
}, []);
|
|
26620
27336
|
const p = block.properties;
|
|
26621
27337
|
const fontSize = p.fontSize || HEADING_FONT_SIZES[p.level] || "28px";
|
|
26622
|
-
const wrapperStyle = (0,
|
|
27338
|
+
const wrapperStyle = (0, import_react35.useMemo)(() => ({
|
|
26623
27339
|
fontFamily: p.fontFamily,
|
|
26624
27340
|
fontSize,
|
|
26625
27341
|
color: p.color,
|
|
@@ -26627,11 +27343,12 @@ var HeadingBlockInner = function HeadingBlock({ block }) {
|
|
|
26627
27343
|
padding: p.padding,
|
|
26628
27344
|
fontWeight: p.fontWeight,
|
|
26629
27345
|
textTransform: p.textTransform,
|
|
26630
|
-
letterSpacing: p.letterSpacing
|
|
26631
|
-
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
/* @__PURE__ */ (0,
|
|
27346
|
+
letterSpacing: p.letterSpacing,
|
|
27347
|
+
backgroundColor: p.backgroundColor && p.backgroundColor !== "transparent" ? p.backgroundColor : void 0
|
|
27348
|
+
}), [p.fontFamily, fontSize, p.color, p.lineHeight, p.padding, p.fontWeight, p.textTransform, p.letterSpacing, p.backgroundColor]);
|
|
27349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `ee-block-heading ${blocks_default.headingBlock}`, ref: wrapperRef, children: [
|
|
27350
|
+
isFocused && editorInstance && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: blocks_default.textBlockToolbar, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RichTextToolbar, { editor: editorInstance }) }),
|
|
27351
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: wrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
26635
27352
|
TipTapEditor,
|
|
26636
27353
|
{
|
|
26637
27354
|
content: p.content,
|
|
@@ -26645,11 +27362,11 @@ var HeadingBlockInner = function HeadingBlock({ block }) {
|
|
|
26645
27362
|
) })
|
|
26646
27363
|
] });
|
|
26647
27364
|
};
|
|
26648
|
-
var HeadingBlock2 =
|
|
27365
|
+
var HeadingBlock2 = import_react35.default.memo(HeadingBlockInner);
|
|
26649
27366
|
|
|
26650
27367
|
// src/components/Canvas/blocks/CountdownBlock.tsx
|
|
26651
|
-
var
|
|
26652
|
-
var
|
|
27368
|
+
var import_react36 = __toESM(require("react"));
|
|
27369
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
26653
27370
|
function getTimeRemaining(targetDate) {
|
|
26654
27371
|
const total = Math.max(0, new Date(targetDate).getTime() - Date.now());
|
|
26655
27372
|
return {
|
|
@@ -26659,10 +27376,10 @@ function getTimeRemaining(targetDate) {
|
|
|
26659
27376
|
seconds: Math.floor(total / 1e3 % 60)
|
|
26660
27377
|
};
|
|
26661
27378
|
}
|
|
26662
|
-
var CountdownBlock =
|
|
27379
|
+
var CountdownBlock = import_react36.default.memo(function CountdownBlock2({ block }) {
|
|
26663
27380
|
const p = block.properties;
|
|
26664
|
-
const [time, setTime] = (0,
|
|
26665
|
-
(0,
|
|
27381
|
+
const [time, setTime] = (0, import_react36.useState)(() => getTimeRemaining(p.targetDate));
|
|
27382
|
+
(0, import_react36.useEffect)(() => {
|
|
26666
27383
|
setTime(getTimeRemaining(p.targetDate));
|
|
26667
27384
|
const interval = setInterval(() => {
|
|
26668
27385
|
setTime(getTimeRemaining(p.targetDate));
|
|
@@ -26676,29 +27393,29 @@ var CountdownBlock = import_react34.default.memo(function CountdownBlock2({ bloc
|
|
|
26676
27393
|
{ value: time.seconds, label: "Seconds" }
|
|
26677
27394
|
];
|
|
26678
27395
|
const alignStyle = p.align === "left" ? "flex-start" : p.align === "right" ? "flex-end" : "center";
|
|
26679
|
-
const wrapperStyle = (0,
|
|
27396
|
+
const wrapperStyle = (0, import_react36.useMemo)(() => ({
|
|
26680
27397
|
padding: p.padding,
|
|
26681
27398
|
justifyContent: alignStyle
|
|
26682
27399
|
}), [p.padding, alignStyle]);
|
|
26683
|
-
const labelStyle = (0,
|
|
27400
|
+
const labelStyle = (0, import_react36.useMemo)(() => ({
|
|
26684
27401
|
color: p.labelColor,
|
|
26685
27402
|
textAlign: p.align
|
|
26686
27403
|
}), [p.labelColor, p.align]);
|
|
26687
|
-
const digitsContainerStyle = (0,
|
|
27404
|
+
const digitsContainerStyle = (0, import_react36.useMemo)(() => ({
|
|
26688
27405
|
justifyContent: alignStyle
|
|
26689
27406
|
}), [alignStyle]);
|
|
26690
|
-
const digitBoxStyle = (0,
|
|
27407
|
+
const digitBoxStyle = (0, import_react36.useMemo)(() => ({
|
|
26691
27408
|
backgroundColor: p.digitBackgroundColor,
|
|
26692
27409
|
color: p.digitColor,
|
|
26693
27410
|
fontSize: p.fontSize
|
|
26694
27411
|
}), [p.digitBackgroundColor, p.digitColor, p.fontSize]);
|
|
26695
|
-
const unitLabelStyle = (0,
|
|
27412
|
+
const unitLabelStyle = (0, import_react36.useMemo)(() => ({
|
|
26696
27413
|
color: p.labelColor
|
|
26697
27414
|
}), [p.labelColor]);
|
|
26698
|
-
return /* @__PURE__ */ (0,
|
|
26699
|
-
p.label && /* @__PURE__ */ (0,
|
|
26700
|
-
/* @__PURE__ */ (0,
|
|
26701
|
-
/* @__PURE__ */ (0,
|
|
27415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `ee-block-countdown ${blocks_default.countdownBlock}`, style: wrapperStyle, children: [
|
|
27416
|
+
p.label && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: blocks_default.countdownLabel, style: labelStyle, children: p.label }),
|
|
27417
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: blocks_default.countdownDigits, style: digitsContainerStyle, children: units.map((unit) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: blocks_default.countdownUnit, children: [
|
|
27418
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
26702
27419
|
"div",
|
|
26703
27420
|
{
|
|
26704
27421
|
className: blocks_default.countdownDigitBox,
|
|
@@ -26706,30 +27423,30 @@ var CountdownBlock = import_react34.default.memo(function CountdownBlock2({ bloc
|
|
|
26706
27423
|
children: String(unit.value).padStart(2, "0")
|
|
26707
27424
|
}
|
|
26708
27425
|
),
|
|
26709
|
-
/* @__PURE__ */ (0,
|
|
27426
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: blocks_default.countdownUnitLabel, style: unitLabelStyle, children: unit.label })
|
|
26710
27427
|
] }, unit.label)) })
|
|
26711
27428
|
] });
|
|
26712
27429
|
});
|
|
26713
27430
|
|
|
26714
27431
|
// src/components/Canvas/blocks/MenuBlock.tsx
|
|
26715
|
-
var
|
|
26716
|
-
var
|
|
26717
|
-
var MenuBlock =
|
|
27432
|
+
var import_react37 = __toESM(require("react"));
|
|
27433
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
27434
|
+
var MenuBlock = import_react37.default.memo(function MenuBlock2({ block }) {
|
|
26718
27435
|
const p = block.properties;
|
|
26719
27436
|
const alignStyle = p.align === "left" ? "flex-start" : p.align === "right" ? "flex-end" : "center";
|
|
26720
|
-
const wrapperStyle = (0,
|
|
27437
|
+
const wrapperStyle = (0, import_react37.useMemo)(() => ({
|
|
26721
27438
|
padding: p.padding,
|
|
26722
27439
|
justifyContent: alignStyle
|
|
26723
27440
|
}), [p.padding, alignStyle]);
|
|
26724
|
-
const itemsStyle = (0,
|
|
27441
|
+
const itemsStyle = (0, import_react37.useMemo)(() => ({
|
|
26725
27442
|
justifyContent: alignStyle
|
|
26726
27443
|
}), [alignStyle]);
|
|
26727
|
-
const itemStyle = (0,
|
|
27444
|
+
const itemStyle = (0, import_react37.useMemo)(() => ({
|
|
26728
27445
|
fontFamily: p.fontFamily,
|
|
26729
27446
|
fontSize: p.fontSize,
|
|
26730
27447
|
color: p.color
|
|
26731
27448
|
}), [p.fontFamily, p.fontSize, p.color]);
|
|
26732
|
-
return /* @__PURE__ */ (0,
|
|
27449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `ee-block-menu ${blocks_default.menuBlock}`, style: wrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: blocks_default.menuItems, style: itemsStyle, children: p.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
26733
27450
|
"span",
|
|
26734
27451
|
{
|
|
26735
27452
|
className: blocks_default.menuItem,
|
|
@@ -26741,11 +27458,11 @@ var MenuBlock = import_react35.default.memo(function MenuBlock2({ block }) {
|
|
|
26741
27458
|
});
|
|
26742
27459
|
|
|
26743
27460
|
// src/components/Canvas/blocks/HeroBlock.tsx
|
|
26744
|
-
var
|
|
26745
|
-
var
|
|
26746
|
-
var HeroBlock =
|
|
27461
|
+
var import_react38 = __toESM(require("react"));
|
|
27462
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
27463
|
+
var HeroBlock = import_react38.default.memo(function HeroBlock2({ block }) {
|
|
26747
27464
|
const p = block.properties;
|
|
26748
|
-
const containerStyle = (0,
|
|
27465
|
+
const containerStyle = (0, import_react38.useMemo)(() => ({
|
|
26749
27466
|
padding: p.padding,
|
|
26750
27467
|
textAlign: p.align,
|
|
26751
27468
|
backgroundColor: p.backgroundColor || void 0,
|
|
@@ -26754,21 +27471,21 @@ var HeroBlock = import_react36.default.memo(function HeroBlock2({ block }) {
|
|
|
26754
27471
|
backgroundPosition: p.backgroundImage ? "center" : void 0,
|
|
26755
27472
|
backgroundRepeat: p.backgroundImage ? "no-repeat" : void 0
|
|
26756
27473
|
}), [p.padding, p.align, p.backgroundColor, p.backgroundImage]);
|
|
26757
|
-
const headingStyle = (0,
|
|
27474
|
+
const headingStyle = (0, import_react38.useMemo)(() => ({
|
|
26758
27475
|
color: p.headingColor,
|
|
26759
27476
|
fontSize: p.headingFontSize
|
|
26760
27477
|
}), [p.headingColor, p.headingFontSize]);
|
|
26761
|
-
const subtextStyle = (0,
|
|
27478
|
+
const subtextStyle = (0, import_react38.useMemo)(() => ({
|
|
26762
27479
|
color: p.subtextColor,
|
|
26763
27480
|
fontSize: p.subtextFontSize
|
|
26764
27481
|
}), [p.subtextColor, p.subtextFontSize]);
|
|
26765
|
-
const buttonStyle = (0,
|
|
27482
|
+
const buttonStyle = (0, import_react38.useMemo)(() => ({
|
|
26766
27483
|
backgroundColor: p.buttonBackgroundColor,
|
|
26767
27484
|
color: p.buttonColor,
|
|
26768
27485
|
borderRadius: p.buttonBorderRadius
|
|
26769
27486
|
}), [p.buttonBackgroundColor, p.buttonColor, p.buttonBorderRadius]);
|
|
26770
|
-
return /* @__PURE__ */ (0,
|
|
26771
|
-
p.heading && /* @__PURE__ */ (0,
|
|
27487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `ee-block-hero ${blocks_default.heroBlock}`, style: containerStyle, children: [
|
|
27488
|
+
p.heading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26772
27489
|
"h2",
|
|
26773
27490
|
{
|
|
26774
27491
|
className: blocks_default.heroHeading,
|
|
@@ -26776,7 +27493,7 @@ var HeroBlock = import_react36.default.memo(function HeroBlock2({ block }) {
|
|
|
26776
27493
|
children: p.heading
|
|
26777
27494
|
}
|
|
26778
27495
|
),
|
|
26779
|
-
p.subtext && /* @__PURE__ */ (0,
|
|
27496
|
+
p.subtext && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26780
27497
|
"p",
|
|
26781
27498
|
{
|
|
26782
27499
|
className: blocks_default.heroSubtext,
|
|
@@ -26784,7 +27501,7 @@ var HeroBlock = import_react36.default.memo(function HeroBlock2({ block }) {
|
|
|
26784
27501
|
children: p.subtext
|
|
26785
27502
|
}
|
|
26786
27503
|
),
|
|
26787
|
-
p.buttonText && /* @__PURE__ */ (0,
|
|
27504
|
+
p.buttonText && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26788
27505
|
"span",
|
|
26789
27506
|
{
|
|
26790
27507
|
className: blocks_default.heroButton,
|
|
@@ -26796,7 +27513,7 @@ var HeroBlock = import_react36.default.memo(function HeroBlock2({ block }) {
|
|
|
26796
27513
|
});
|
|
26797
27514
|
|
|
26798
27515
|
// src/components/Canvas/BlockRenderer.tsx
|
|
26799
|
-
var
|
|
27516
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
26800
27517
|
registerBlockRenderer("text", TextBlock2);
|
|
26801
27518
|
registerBlockRenderer("button", ButtonBlock);
|
|
26802
27519
|
registerBlockRenderer("image", ImageBlock2);
|
|
@@ -26809,14 +27526,14 @@ registerBlockRenderer("heading", HeadingBlock2);
|
|
|
26809
27526
|
registerBlockRenderer("countdown", CountdownBlock);
|
|
26810
27527
|
registerBlockRenderer("menu", MenuBlock);
|
|
26811
27528
|
registerBlockRenderer("hero", HeroBlock);
|
|
26812
|
-
var BlockRenderer =
|
|
27529
|
+
var BlockRenderer = import_react39.default.memo(function BlockRenderer2({ block }) {
|
|
26813
27530
|
const Component2 = blockRendererRegistry[block.type];
|
|
26814
27531
|
if (!Component2) return null;
|
|
26815
|
-
return /* @__PURE__ */ (0,
|
|
27532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Component2, { block }) });
|
|
26816
27533
|
});
|
|
26817
27534
|
|
|
26818
27535
|
// src/components/Canvas/DropZone.tsx
|
|
26819
|
-
var
|
|
27536
|
+
var import_react40 = __toESM(require("react"));
|
|
26820
27537
|
|
|
26821
27538
|
// src/styles/canvas.module.css
|
|
26822
27539
|
var canvas_default = {
|
|
@@ -26851,12 +27568,12 @@ var canvas_default = {
|
|
|
26851
27568
|
};
|
|
26852
27569
|
|
|
26853
27570
|
// src/components/Canvas/DropZone.tsx
|
|
26854
|
-
var
|
|
26855
|
-
var DropZone =
|
|
27571
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
27572
|
+
var DropZone = import_react40.default.memo(function DropZone2({ sectionId, columnId, index, emptyPlaceholder }) {
|
|
26856
27573
|
const dispatch = useEditorDispatch();
|
|
26857
|
-
const [isOver, setIsOver] = (0,
|
|
26858
|
-
const isOverRef = (0,
|
|
26859
|
-
const handleDragOver = (0,
|
|
27574
|
+
const [isOver, setIsOver] = (0, import_react40.useState)(false);
|
|
27575
|
+
const isOverRef = (0, import_react40.useRef)(false);
|
|
27576
|
+
const handleDragOver = (0, import_react40.useCallback)(
|
|
26860
27577
|
(e) => {
|
|
26861
27578
|
if (!isDropAllowed(e)) return;
|
|
26862
27579
|
e.preventDefault();
|
|
@@ -26869,7 +27586,7 @@ var DropZone = import_react38.default.memo(function DropZone2({ sectionId, colum
|
|
|
26869
27586
|
},
|
|
26870
27587
|
[]
|
|
26871
27588
|
);
|
|
26872
|
-
const handleDragLeave = (0,
|
|
27589
|
+
const handleDragLeave = (0, import_react40.useCallback)((e) => {
|
|
26873
27590
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
26874
27591
|
const { clientX, clientY } = e;
|
|
26875
27592
|
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) {
|
|
@@ -26878,7 +27595,7 @@ var DropZone = import_react38.default.memo(function DropZone2({ sectionId, colum
|
|
|
26878
27595
|
isOverRef.current = false;
|
|
26879
27596
|
setIsOver(false);
|
|
26880
27597
|
}, []);
|
|
26881
|
-
const handleDrop2 = (0,
|
|
27598
|
+
const handleDrop2 = (0, import_react40.useCallback)(
|
|
26882
27599
|
(e) => {
|
|
26883
27600
|
e.preventDefault();
|
|
26884
27601
|
e.stopPropagation();
|
|
@@ -26915,7 +27632,7 @@ var DropZone = import_react38.default.memo(function DropZone2({ sectionId, colum
|
|
|
26915
27632
|
[dispatch, sectionId, columnId, index]
|
|
26916
27633
|
);
|
|
26917
27634
|
if (emptyPlaceholder) {
|
|
26918
|
-
return /* @__PURE__ */ (0,
|
|
27635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
26919
27636
|
"div",
|
|
26920
27637
|
{
|
|
26921
27638
|
className: `ee-drop-zone ee-drop-zone--empty ${canvas_default.emptyColumn} ${isOver ? canvas_default.emptyColumnActive : ""}`,
|
|
@@ -26926,20 +27643,20 @@ var DropZone = import_react38.default.memo(function DropZone2({ sectionId, colum
|
|
|
26926
27643
|
}
|
|
26927
27644
|
);
|
|
26928
27645
|
}
|
|
26929
|
-
return /* @__PURE__ */ (0,
|
|
27646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
26930
27647
|
"div",
|
|
26931
27648
|
{
|
|
26932
27649
|
className: `ee-drop-zone ${canvas_default.dropZone} ${isOver ? canvas_default.dropZoneActive : ""}`,
|
|
26933
27650
|
onDragOver: handleDragOver,
|
|
26934
27651
|
onDragLeave: handleDragLeave,
|
|
26935
27652
|
onDrop: handleDrop2,
|
|
26936
|
-
children: isOver && /* @__PURE__ */ (0,
|
|
27653
|
+
children: isOver && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: canvas_default.dropZoneLabel, children: "Drop here" })
|
|
26937
27654
|
}
|
|
26938
27655
|
);
|
|
26939
27656
|
});
|
|
26940
27657
|
|
|
26941
27658
|
// src/components/Canvas/Column.tsx
|
|
26942
|
-
var
|
|
27659
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
26943
27660
|
function getBlockData(e) {
|
|
26944
27661
|
const el = e.currentTarget;
|
|
26945
27662
|
const blockId = el.dataset.blockId;
|
|
@@ -26947,17 +27664,17 @@ function getBlockData(e) {
|
|
|
26947
27664
|
if (!blockId || index === void 0) return null;
|
|
26948
27665
|
return { blockId, index: Number(index) };
|
|
26949
27666
|
}
|
|
26950
|
-
var Column =
|
|
27667
|
+
var Column = import_react41.default.memo(function Column2({ column, sectionId }) {
|
|
26951
27668
|
const selection = useSelectionContext();
|
|
26952
27669
|
const dispatch = useEditorDispatch();
|
|
26953
|
-
const [blockToRemove, setBlockToRemove] = (0,
|
|
26954
|
-
const confirmRemoveBlock = (0,
|
|
27670
|
+
const [blockToRemove, setBlockToRemove] = (0, import_react41.useState)(null);
|
|
27671
|
+
const confirmRemoveBlock = (0, import_react41.useCallback)(
|
|
26955
27672
|
(blockId) => {
|
|
26956
27673
|
setBlockToRemove(blockId);
|
|
26957
27674
|
},
|
|
26958
27675
|
[]
|
|
26959
27676
|
);
|
|
26960
|
-
const handleConfirmRemove = (0,
|
|
27677
|
+
const handleConfirmRemove = (0, import_react41.useCallback)(() => {
|
|
26961
27678
|
if (blockToRemove) {
|
|
26962
27679
|
dispatch({
|
|
26963
27680
|
type: "REMOVE_BLOCK",
|
|
@@ -26966,7 +27683,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
26966
27683
|
setBlockToRemove(null);
|
|
26967
27684
|
}
|
|
26968
27685
|
}, [dispatch, sectionId, column.id, blockToRemove]);
|
|
26969
|
-
const handleBlockClick = (0,
|
|
27686
|
+
const handleBlockClick = (0, import_react41.useCallback)(
|
|
26970
27687
|
(e) => {
|
|
26971
27688
|
e.stopPropagation();
|
|
26972
27689
|
const data = getBlockData(e);
|
|
@@ -26978,7 +27695,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
26978
27695
|
},
|
|
26979
27696
|
[dispatch, sectionId, column.id]
|
|
26980
27697
|
);
|
|
26981
|
-
const handleRemoveClick = (0,
|
|
27698
|
+
const handleRemoveClick = (0, import_react41.useCallback)(
|
|
26982
27699
|
(e) => {
|
|
26983
27700
|
e.stopPropagation();
|
|
26984
27701
|
const wrapper = e.currentTarget.closest("[data-block-id]");
|
|
@@ -26986,7 +27703,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
26986
27703
|
},
|
|
26987
27704
|
[confirmRemoveBlock]
|
|
26988
27705
|
);
|
|
26989
|
-
const handleDuplicateClick = (0,
|
|
27706
|
+
const handleDuplicateClick = (0, import_react41.useCallback)(
|
|
26990
27707
|
(e) => {
|
|
26991
27708
|
e.stopPropagation();
|
|
26992
27709
|
const wrapper = e.currentTarget.closest("[data-block-id]");
|
|
@@ -26999,7 +27716,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
26999
27716
|
},
|
|
27000
27717
|
[dispatch, sectionId, column.id]
|
|
27001
27718
|
);
|
|
27002
|
-
const handleBlockDragStart = (0,
|
|
27719
|
+
const handleBlockDragStart = (0, import_react41.useCallback)(
|
|
27003
27720
|
(e) => {
|
|
27004
27721
|
const data = getBlockData(e);
|
|
27005
27722
|
if (!data) return;
|
|
@@ -27007,8 +27724,8 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27007
27724
|
},
|
|
27008
27725
|
[sectionId, column.id]
|
|
27009
27726
|
);
|
|
27010
|
-
const [dropTarget, setDropTarget] = (0,
|
|
27011
|
-
const handleBlockDragOver = (0,
|
|
27727
|
+
const [dropTarget, setDropTarget] = (0, import_react41.useState)(null);
|
|
27728
|
+
const handleBlockDragOver = (0, import_react41.useCallback)(
|
|
27012
27729
|
(e) => {
|
|
27013
27730
|
if (!isDropAllowed(e)) return;
|
|
27014
27731
|
e.preventDefault();
|
|
@@ -27026,7 +27743,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27026
27743
|
},
|
|
27027
27744
|
[]
|
|
27028
27745
|
);
|
|
27029
|
-
const handleBlockDragLeave = (0,
|
|
27746
|
+
const handleBlockDragLeave = (0, import_react41.useCallback)((e) => {
|
|
27030
27747
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
27031
27748
|
const { clientX, clientY } = e;
|
|
27032
27749
|
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) {
|
|
@@ -27034,7 +27751,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27034
27751
|
}
|
|
27035
27752
|
setDropTarget(null);
|
|
27036
27753
|
}, []);
|
|
27037
|
-
const handleBlockDrop = (0,
|
|
27754
|
+
const handleBlockDrop = (0, import_react41.useCallback)(
|
|
27038
27755
|
(e) => {
|
|
27039
27756
|
e.preventDefault();
|
|
27040
27757
|
e.stopPropagation();
|
|
@@ -27074,7 +27791,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27074
27791
|
},
|
|
27075
27792
|
[dispatch, sectionId, column.id]
|
|
27076
27793
|
);
|
|
27077
|
-
const handleBlockKeyDown = (0,
|
|
27794
|
+
const handleBlockKeyDown = (0, import_react41.useCallback)(
|
|
27078
27795
|
(e) => {
|
|
27079
27796
|
const target = e.target;
|
|
27080
27797
|
if (target.isContentEditable || target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
|
|
@@ -27098,7 +27815,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27098
27815
|
[dispatch, sectionId, column.id, confirmRemoveBlock]
|
|
27099
27816
|
);
|
|
27100
27817
|
if (column.blocks.length === 0) {
|
|
27101
|
-
return /* @__PURE__ */ (0,
|
|
27818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `ee-column ${canvas_default.column}`, style: { width: column.width }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
27102
27819
|
DropZone,
|
|
27103
27820
|
{
|
|
27104
27821
|
sectionId,
|
|
@@ -27108,10 +27825,10 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27108
27825
|
}
|
|
27109
27826
|
) });
|
|
27110
27827
|
}
|
|
27111
|
-
return /* @__PURE__ */ (0,
|
|
27112
|
-
column.blocks.map((block, index) => /* @__PURE__ */ (0,
|
|
27113
|
-
/* @__PURE__ */ (0,
|
|
27114
|
-
/* @__PURE__ */ (0,
|
|
27828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `ee-column ${canvas_default.column}`, style: { width: column.width }, children: [
|
|
27829
|
+
column.blocks.map((block, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react41.default.Fragment, { children: [
|
|
27830
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { sectionId, columnId: column.id, index }),
|
|
27831
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
27115
27832
|
"div",
|
|
27116
27833
|
{
|
|
27117
27834
|
"data-block-type": block.type,
|
|
@@ -27138,8 +27855,8 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27138
27855
|
"aria-selected": selection.blockId === block.id,
|
|
27139
27856
|
tabIndex: 0,
|
|
27140
27857
|
children: [
|
|
27141
|
-
/* @__PURE__ */ (0,
|
|
27142
|
-
/* @__PURE__ */ (0,
|
|
27858
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `ee-block-actions ${canvas_default.blockOverlay}`, role: "group", "aria-label": "Block actions", children: [
|
|
27859
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
27143
27860
|
"button",
|
|
27144
27861
|
{
|
|
27145
27862
|
className: `ee-block-duplicate ${canvas_default.blockBtn} ${canvas_default.blockBtnDuplicate}`,
|
|
@@ -27149,7 +27866,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27149
27866
|
children: "\u29C9"
|
|
27150
27867
|
}
|
|
27151
27868
|
),
|
|
27152
|
-
/* @__PURE__ */ (0,
|
|
27869
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
27153
27870
|
"button",
|
|
27154
27871
|
{
|
|
27155
27872
|
className: `ee-block-remove ${canvas_default.blockBtn}`,
|
|
@@ -27160,12 +27877,12 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27160
27877
|
}
|
|
27161
27878
|
)
|
|
27162
27879
|
] }),
|
|
27163
|
-
/* @__PURE__ */ (0,
|
|
27880
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BlockRenderer, { block })
|
|
27164
27881
|
]
|
|
27165
27882
|
}
|
|
27166
27883
|
)
|
|
27167
27884
|
] }, block.id)),
|
|
27168
|
-
/* @__PURE__ */ (0,
|
|
27885
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
27169
27886
|
DropZone,
|
|
27170
27887
|
{
|
|
27171
27888
|
sectionId,
|
|
@@ -27173,7 +27890,7 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27173
27890
|
index: column.blocks.length
|
|
27174
27891
|
}
|
|
27175
27892
|
),
|
|
27176
|
-
blockToRemove && /* @__PURE__ */ (0,
|
|
27893
|
+
blockToRemove && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
27177
27894
|
ConfirmDialog,
|
|
27178
27895
|
{
|
|
27179
27896
|
title: "Remove Block",
|
|
@@ -27186,45 +27903,45 @@ var Column = import_react39.default.memo(function Column2({ column, sectionId })
|
|
|
27186
27903
|
});
|
|
27187
27904
|
|
|
27188
27905
|
// src/components/Canvas/Section.tsx
|
|
27189
|
-
var
|
|
27190
|
-
var Section =
|
|
27906
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
27907
|
+
var Section = import_react42.default.memo(function Section2({ section }) {
|
|
27191
27908
|
const selection = useSelectionContext();
|
|
27192
27909
|
const dispatch = useEditorDispatch();
|
|
27193
27910
|
const { template } = useTemplateContext();
|
|
27194
27911
|
const isSelected = selection.sectionId === section.id && !selection.blockId;
|
|
27195
|
-
const [showRemoveConfirm, setShowRemoveConfirm] = (0,
|
|
27196
|
-
const handleClick2 = (0,
|
|
27912
|
+
const [showRemoveConfirm, setShowRemoveConfirm] = (0, import_react42.useState)(false);
|
|
27913
|
+
const handleClick2 = (0, import_react42.useCallback)(
|
|
27197
27914
|
(e) => {
|
|
27198
27915
|
e.stopPropagation();
|
|
27199
27916
|
dispatch({ type: "SELECT_SECTION", payload: { sectionId: section.id } });
|
|
27200
27917
|
},
|
|
27201
27918
|
[dispatch, section.id]
|
|
27202
27919
|
);
|
|
27203
|
-
const handleRemove = (0,
|
|
27920
|
+
const handleRemove = (0, import_react42.useCallback)(
|
|
27204
27921
|
(e) => {
|
|
27205
27922
|
e.stopPropagation();
|
|
27206
27923
|
setShowRemoveConfirm(true);
|
|
27207
27924
|
},
|
|
27208
27925
|
[]
|
|
27209
27926
|
);
|
|
27210
|
-
const handleConfirmRemove = (0,
|
|
27927
|
+
const handleConfirmRemove = (0, import_react42.useCallback)(() => {
|
|
27211
27928
|
dispatch({ type: "REMOVE_SECTION", payload: { sectionId: section.id } });
|
|
27212
27929
|
setShowRemoveConfirm(false);
|
|
27213
27930
|
}, [dispatch, section.id]);
|
|
27214
|
-
const handleDuplicate = (0,
|
|
27931
|
+
const handleDuplicate = (0, import_react42.useCallback)(
|
|
27215
27932
|
(e) => {
|
|
27216
27933
|
e.stopPropagation();
|
|
27217
27934
|
dispatch({ type: "DUPLICATE_SECTION", payload: { sectionId: section.id } });
|
|
27218
27935
|
},
|
|
27219
27936
|
[dispatch, section.id]
|
|
27220
27937
|
);
|
|
27221
|
-
const handleDragStart = (0,
|
|
27938
|
+
const handleDragStart = (0, import_react42.useCallback)(
|
|
27222
27939
|
(e) => {
|
|
27223
27940
|
setSectionMoveDragData(e, section.id);
|
|
27224
27941
|
},
|
|
27225
27942
|
[section.id]
|
|
27226
27943
|
);
|
|
27227
|
-
const handleDragKeyDown = (0,
|
|
27944
|
+
const handleDragKeyDown = (0, import_react42.useCallback)(
|
|
27228
27945
|
(e) => {
|
|
27229
27946
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
27230
27947
|
e.preventDefault();
|
|
@@ -27238,7 +27955,7 @@ var Section = import_react40.default.memo(function Section2({ section }) {
|
|
|
27238
27955
|
},
|
|
27239
27956
|
[dispatch, section.id, template.sections]
|
|
27240
27957
|
);
|
|
27241
|
-
return /* @__PURE__ */ (0,
|
|
27958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
27242
27959
|
"div",
|
|
27243
27960
|
{
|
|
27244
27961
|
className: `ee-section ${isSelected ? "ee-section--selected" : ""} ${section.properties.fullWidth ? "ee-section--full-width" : ""} ${canvas_default.section} ${isSelected ? canvas_default.sectionSelected : ""} ${section.properties.fullWidth ? canvas_default.sectionFullWidth : ""}`,
|
|
@@ -27255,8 +27972,8 @@ var Section = import_react40.default.memo(function Section2({ section }) {
|
|
|
27255
27972
|
"aria-label": `Email section${isSelected ? " (selected)" : ""}`,
|
|
27256
27973
|
"aria-selected": isSelected,
|
|
27257
27974
|
children: [
|
|
27258
|
-
/* @__PURE__ */ (0,
|
|
27259
|
-
/* @__PURE__ */ (0,
|
|
27975
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: `ee-section-actions ${canvas_default.sectionOverlay}`, role: "group", "aria-label": "Section actions", children: [
|
|
27976
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
27260
27977
|
"span",
|
|
27261
27978
|
{
|
|
27262
27979
|
className: `ee-section-drag ${canvas_default.sectionDragHandle}`,
|
|
@@ -27270,7 +27987,7 @@ var Section = import_react40.default.memo(function Section2({ section }) {
|
|
|
27270
27987
|
children: "\u283F"
|
|
27271
27988
|
}
|
|
27272
27989
|
),
|
|
27273
|
-
/* @__PURE__ */ (0,
|
|
27990
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
27274
27991
|
"button",
|
|
27275
27992
|
{
|
|
27276
27993
|
className: `ee-section-duplicate ${canvas_default.sectionBtn} ${canvas_default.sectionBtnDuplicate}`,
|
|
@@ -27280,7 +27997,7 @@ var Section = import_react40.default.memo(function Section2({ section }) {
|
|
|
27280
27997
|
children: "\u29C9"
|
|
27281
27998
|
}
|
|
27282
27999
|
),
|
|
27283
|
-
/* @__PURE__ */ (0,
|
|
28000
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
27284
28001
|
"button",
|
|
27285
28002
|
{
|
|
27286
28003
|
className: `ee-section-remove ${canvas_default.sectionBtn}`,
|
|
@@ -27291,8 +28008,8 @@ var Section = import_react40.default.memo(function Section2({ section }) {
|
|
|
27291
28008
|
}
|
|
27292
28009
|
)
|
|
27293
28010
|
] }),
|
|
27294
|
-
/* @__PURE__ */ (0,
|
|
27295
|
-
showRemoveConfirm && /* @__PURE__ */ (0,
|
|
28011
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: canvas_default.sectionContent, children: section.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Column, { column, sectionId: section.id }, column.id)) }),
|
|
28012
|
+
showRemoveConfirm && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
27296
28013
|
ConfirmDialog,
|
|
27297
28014
|
{
|
|
27298
28015
|
title: "Remove Section",
|
|
@@ -27307,13 +28024,13 @@ var Section = import_react40.default.memo(function Section2({ section }) {
|
|
|
27307
28024
|
});
|
|
27308
28025
|
|
|
27309
28026
|
// src/components/Canvas/SectionDropZone.tsx
|
|
27310
|
-
var
|
|
27311
|
-
var
|
|
27312
|
-
var SectionDropZone =
|
|
28027
|
+
var import_react43 = __toESM(require("react"));
|
|
28028
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
28029
|
+
var SectionDropZone = import_react43.default.memo(function SectionDropZone2({ index }) {
|
|
27313
28030
|
const dispatch = useEditorDispatch();
|
|
27314
|
-
const [isOver, setIsOver] = (0,
|
|
27315
|
-
const isOverRef = (0,
|
|
27316
|
-
const handleDragOver = (0,
|
|
28031
|
+
const [isOver, setIsOver] = (0, import_react43.useState)(false);
|
|
28032
|
+
const isOverRef = (0, import_react43.useRef)(false);
|
|
28033
|
+
const handleDragOver = (0, import_react43.useCallback)((e) => {
|
|
27317
28034
|
if (!isSectionDrop(e)) return;
|
|
27318
28035
|
e.preventDefault();
|
|
27319
28036
|
e.stopPropagation();
|
|
@@ -27323,7 +28040,7 @@ var SectionDropZone = import_react41.default.memo(function SectionDropZone2({ in
|
|
|
27323
28040
|
setIsOver(true);
|
|
27324
28041
|
}
|
|
27325
28042
|
}, []);
|
|
27326
|
-
const handleDragLeave = (0,
|
|
28043
|
+
const handleDragLeave = (0, import_react43.useCallback)((e) => {
|
|
27327
28044
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
27328
28045
|
const { clientX, clientY } = e;
|
|
27329
28046
|
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) {
|
|
@@ -27332,7 +28049,7 @@ var SectionDropZone = import_react41.default.memo(function SectionDropZone2({ in
|
|
|
27332
28049
|
isOverRef.current = false;
|
|
27333
28050
|
setIsOver(false);
|
|
27334
28051
|
}, []);
|
|
27335
|
-
const handleDrop2 = (0,
|
|
28052
|
+
const handleDrop2 = (0, import_react43.useCallback)(
|
|
27336
28053
|
(e) => {
|
|
27337
28054
|
e.preventDefault();
|
|
27338
28055
|
e.stopPropagation();
|
|
@@ -27347,37 +28064,37 @@ var SectionDropZone = import_react41.default.memo(function SectionDropZone2({ in
|
|
|
27347
28064
|
},
|
|
27348
28065
|
[dispatch, index]
|
|
27349
28066
|
);
|
|
27350
|
-
return /* @__PURE__ */ (0,
|
|
28067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
27351
28068
|
"div",
|
|
27352
28069
|
{
|
|
27353
28070
|
className: `ee-section-drop-zone ${canvas_default.sectionDropZone} ${isOver ? canvas_default.sectionDropZoneActive : ""}`,
|
|
27354
28071
|
onDragOver: handleDragOver,
|
|
27355
28072
|
onDragLeave: handleDragLeave,
|
|
27356
28073
|
onDrop: handleDrop2,
|
|
27357
|
-
children: isOver && /* @__PURE__ */ (0,
|
|
28074
|
+
children: isOver && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: canvas_default.sectionDropZoneLabel, children: "Move section here" })
|
|
27358
28075
|
}
|
|
27359
28076
|
);
|
|
27360
28077
|
});
|
|
27361
28078
|
|
|
27362
28079
|
// src/components/Canvas/Canvas.tsx
|
|
27363
|
-
var
|
|
27364
|
-
var Canvas =
|
|
28080
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
28081
|
+
var Canvas = import_react44.default.memo(function Canvas2() {
|
|
27365
28082
|
const { template } = useTemplateContext();
|
|
27366
28083
|
const dispatch = useEditorDispatch();
|
|
27367
|
-
const [isDragOver, setIsDragOver] = (0,
|
|
27368
|
-
const handleAddSection = (0,
|
|
28084
|
+
const [isDragOver, setIsDragOver] = (0, import_react44.useState)(false);
|
|
28085
|
+
const handleAddSection = (0, import_react44.useCallback)(() => {
|
|
27369
28086
|
dispatch({ type: "ADD_SECTION", payload: { section: createSection() } });
|
|
27370
28087
|
}, [dispatch]);
|
|
27371
|
-
const handleCanvasClick = (0,
|
|
28088
|
+
const handleCanvasClick = (0, import_react44.useCallback)(() => {
|
|
27372
28089
|
dispatch({ type: "DESELECT_ALL" });
|
|
27373
28090
|
}, [dispatch]);
|
|
27374
|
-
const handleBodyDragOver = (0,
|
|
28091
|
+
const handleBodyDragOver = (0, import_react44.useCallback)((e) => {
|
|
27375
28092
|
if (!isDropAllowed(e)) return;
|
|
27376
28093
|
e.preventDefault();
|
|
27377
28094
|
e.dataTransfer.dropEffect = "copy";
|
|
27378
28095
|
setIsDragOver(true);
|
|
27379
28096
|
}, []);
|
|
27380
|
-
const handleBodyDragLeave = (0,
|
|
28097
|
+
const handleBodyDragLeave = (0, import_react44.useCallback)((e) => {
|
|
27381
28098
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
27382
28099
|
const { clientX, clientY } = e;
|
|
27383
28100
|
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) {
|
|
@@ -27385,7 +28102,7 @@ var Canvas = import_react42.default.memo(function Canvas2() {
|
|
|
27385
28102
|
}
|
|
27386
28103
|
setIsDragOver(false);
|
|
27387
28104
|
}, []);
|
|
27388
|
-
const handleBodyDrop = (0,
|
|
28105
|
+
const handleBodyDrop = (0, import_react44.useCallback)(
|
|
27389
28106
|
(e) => {
|
|
27390
28107
|
e.preventDefault();
|
|
27391
28108
|
setIsDragOver(false);
|
|
@@ -27402,7 +28119,7 @@ var Canvas = import_react42.default.memo(function Canvas2() {
|
|
|
27402
28119
|
},
|
|
27403
28120
|
[dispatch]
|
|
27404
28121
|
);
|
|
27405
|
-
return /* @__PURE__ */ (0,
|
|
28122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `ee-canvas-wrapper ${canvas_default.canvasWrapper}`, onClick: handleCanvasClick, role: "main", "aria-label": "Email canvas", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
27406
28123
|
"div",
|
|
27407
28124
|
{
|
|
27408
28125
|
className: `ee-canvas-body ${canvas_default.canvasBody} ${isDragOver ? canvas_default.canvasBodyDragOver : ""}`,
|
|
@@ -27417,25 +28134,25 @@ var Canvas = import_react42.default.memo(function Canvas2() {
|
|
|
27417
28134
|
onDrop: handleBodyDrop,
|
|
27418
28135
|
"aria-label": "Email content area",
|
|
27419
28136
|
children: [
|
|
27420
|
-
template.sections.map((section, index) => /* @__PURE__ */ (0,
|
|
27421
|
-
/* @__PURE__ */ (0,
|
|
27422
|
-
/* @__PURE__ */ (0,
|
|
28137
|
+
template.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react44.default.Fragment, { children: [
|
|
28138
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SectionDropZone, { index }),
|
|
28139
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Section, { section })
|
|
27423
28140
|
] }, section.id)),
|
|
27424
|
-
template.sections.length > 0 && /* @__PURE__ */ (0,
|
|
27425
|
-
/* @__PURE__ */ (0,
|
|
28141
|
+
template.sections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SectionDropZone, { index: template.sections.length }),
|
|
28142
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { className: `ee-add-section ${canvas_default.addSectionBtn}`, onClick: handleAddSection, "aria-label": "Add new section", children: "+ Add Section" })
|
|
27426
28143
|
]
|
|
27427
28144
|
}
|
|
27428
28145
|
) });
|
|
27429
28146
|
});
|
|
27430
28147
|
|
|
27431
28148
|
// src/components/Properties/SectionProperties.tsx
|
|
27432
|
-
var
|
|
28149
|
+
var import_react50 = require("react");
|
|
27433
28150
|
|
|
27434
28151
|
// src/components/Properties/PropertyField.tsx
|
|
27435
|
-
var
|
|
28152
|
+
var import_react49 = __toESM(require("react"));
|
|
27436
28153
|
|
|
27437
28154
|
// src/components/Properties/controls/ColorPicker.tsx
|
|
27438
|
-
var
|
|
28155
|
+
var import_react45 = require("react");
|
|
27439
28156
|
|
|
27440
28157
|
// src/styles/properties.module.css
|
|
27441
28158
|
var properties_default = {
|
|
@@ -27483,16 +28200,18 @@ var properties_default = {
|
|
|
27483
28200
|
"fieldInputStacked": "fieldInputStacked fieldInput",
|
|
27484
28201
|
"checkboxLabel": "checkboxLabel fieldLabel",
|
|
27485
28202
|
"colorPresetBtnFull": "colorPresetBtnFull",
|
|
27486
|
-
"
|
|
28203
|
+
"colorPresetSectionLabel": "colorPresetSectionLabel",
|
|
28204
|
+
"colorSavePresetBtn": "colorSavePresetBtn",
|
|
27487
28205
|
"separator": "separator"
|
|
27488
28206
|
};
|
|
27489
28207
|
|
|
27490
28208
|
// src/components/Properties/controls/ColorPicker.tsx
|
|
27491
|
-
var
|
|
28209
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
27492
28210
|
function ColorPicker({ label, value, onChange }) {
|
|
27493
|
-
const [isOpen, setIsOpen] = (0,
|
|
27494
|
-
const wrapperRef = (0,
|
|
27495
|
-
|
|
28211
|
+
const [isOpen, setIsOpen] = (0, import_react45.useState)(false);
|
|
28212
|
+
const wrapperRef = (0, import_react45.useRef)(null);
|
|
28213
|
+
const { customColorPresets, addCustomColorPreset, removeCustomColorPreset } = useColorPresets();
|
|
28214
|
+
(0, import_react45.useEffect)(() => {
|
|
27496
28215
|
function handleClickOutside(e) {
|
|
27497
28216
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
27498
28217
|
setIsOpen(false);
|
|
@@ -27503,36 +28222,48 @@ function ColorPicker({ label, value, onChange }) {
|
|
|
27503
28222
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
27504
28223
|
}
|
|
27505
28224
|
}, [isOpen]);
|
|
27506
|
-
const handlePresetClick = (0,
|
|
28225
|
+
const handlePresetClick = (0, import_react45.useCallback)(
|
|
27507
28226
|
(color) => {
|
|
27508
28227
|
onChange(color);
|
|
27509
28228
|
setIsOpen(false);
|
|
27510
28229
|
},
|
|
27511
28230
|
[onChange]
|
|
27512
28231
|
);
|
|
28232
|
+
const handleSavePreset = (0, import_react45.useCallback)(() => {
|
|
28233
|
+
if (value && value !== "transparent" && !customColorPresets.includes(value)) {
|
|
28234
|
+
addCustomColorPreset(value);
|
|
28235
|
+
}
|
|
28236
|
+
}, [value, customColorPresets, addCustomColorPreset]);
|
|
28237
|
+
const handlePresetContextMenu = (0, import_react45.useCallback)(
|
|
28238
|
+
(e, color) => {
|
|
28239
|
+
e.preventDefault();
|
|
28240
|
+
removeCustomColorPreset(color);
|
|
28241
|
+
},
|
|
28242
|
+
[removeCustomColorPreset]
|
|
28243
|
+
);
|
|
27513
28244
|
const isHex = /^#[0-9a-fA-F]{6}$/.test(value);
|
|
27514
|
-
return /* @__PURE__ */ (0,
|
|
27515
|
-
/* @__PURE__ */ (0,
|
|
27516
|
-
/* @__PURE__ */ (0,
|
|
27517
|
-
/* @__PURE__ */ (0,
|
|
28245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `ee-field-group ee-color-picker ${properties_default.fieldGroup}`, children: [
|
|
28246
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { className: properties_default.fieldLabel, children: label }),
|
|
28247
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: properties_default.colorPickerWrapper, ref: wrapperRef, children: [
|
|
28248
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
27518
28249
|
"div",
|
|
27519
28250
|
{
|
|
27520
28251
|
className: properties_default.colorPickerTrigger,
|
|
27521
28252
|
onClick: () => setIsOpen(!isOpen),
|
|
27522
28253
|
children: [
|
|
27523
|
-
/* @__PURE__ */ (0,
|
|
28254
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
27524
28255
|
"div",
|
|
27525
28256
|
{
|
|
27526
28257
|
className: `${properties_default.colorSwatch} ${value === "transparent" ? properties_default.colorSwatchTransparent : ""}`,
|
|
27527
28258
|
style: value !== "transparent" ? { backgroundColor: value || "transparent" } : void 0
|
|
27528
28259
|
}
|
|
27529
28260
|
),
|
|
27530
|
-
/* @__PURE__ */ (0,
|
|
28261
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: properties_default.colorValue, children: value || "transparent" })
|
|
27531
28262
|
]
|
|
27532
28263
|
}
|
|
27533
28264
|
),
|
|
27534
|
-
isOpen && /* @__PURE__ */ (0,
|
|
27535
|
-
/* @__PURE__ */ (0,
|
|
28265
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: properties_default.colorPresets, children: [
|
|
28266
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
27536
28267
|
"button",
|
|
27537
28268
|
{
|
|
27538
28269
|
className: `ee-color-preset-transparent ${properties_default.colorPresetBtn} ${properties_default.colorPresetBtnTransparent} ${properties_default.colorPresetBtnFull} ${value === "transparent" ? properties_default.colorPresetBtnActive : ""}`,
|
|
@@ -27541,7 +28272,7 @@ function ColorPicker({ label, value, onChange }) {
|
|
|
27541
28272
|
children: "Transparent"
|
|
27542
28273
|
}
|
|
27543
28274
|
),
|
|
27544
|
-
COLOR_PRESETS.map((color) => /* @__PURE__ */ (0,
|
|
28275
|
+
COLOR_PRESETS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
27545
28276
|
"button",
|
|
27546
28277
|
{
|
|
27547
28278
|
className: `${properties_default.colorPresetBtn} ${color === value ? properties_default.colorPresetBtnActive : ""}`,
|
|
@@ -27551,23 +28282,47 @@ function ColorPicker({ label, value, onChange }) {
|
|
|
27551
28282
|
},
|
|
27552
28283
|
color
|
|
27553
28284
|
)),
|
|
27554
|
-
/* @__PURE__ */ (0,
|
|
27555
|
-
"
|
|
27556
|
-
|
|
27557
|
-
|
|
27558
|
-
|
|
27559
|
-
|
|
27560
|
-
|
|
27561
|
-
|
|
27562
|
-
|
|
28285
|
+
customColorPresets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
28286
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: `${properties_default.colorPresetBtnFull} ${properties_default.colorPresetSectionLabel}`, children: "Custom" }),
|
|
28287
|
+
customColorPresets.map((color) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
28288
|
+
"button",
|
|
28289
|
+
{
|
|
28290
|
+
className: `${properties_default.colorPresetBtn} ${color === value ? properties_default.colorPresetBtnActive : ""}`,
|
|
28291
|
+
style: { backgroundColor: color },
|
|
28292
|
+
onClick: () => handlePresetClick(color),
|
|
28293
|
+
onContextMenu: (e) => handlePresetContextMenu(e, color),
|
|
28294
|
+
title: `${color} (right-click to remove)`
|
|
28295
|
+
},
|
|
28296
|
+
`custom-${color}`
|
|
28297
|
+
))
|
|
28298
|
+
] }),
|
|
28299
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `${properties_default.colorPresetBtnFull}`, style: { display: "flex", flexDirection: "column", gap: "8px", alignItems: "stretch" }, children: [
|
|
28300
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
28301
|
+
HslColorArea,
|
|
28302
|
+
{
|
|
28303
|
+
value: isHex ? value : "#ffffff",
|
|
28304
|
+
onChange
|
|
28305
|
+
}
|
|
28306
|
+
),
|
|
28307
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
28308
|
+
"button",
|
|
28309
|
+
{
|
|
28310
|
+
className: `ee-color-save-preset ${properties_default.colorSavePresetBtn}`,
|
|
28311
|
+
onClick: handleSavePreset,
|
|
28312
|
+
title: "Save current color as preset",
|
|
28313
|
+
disabled: !value || value === "transparent" || customColorPresets.includes(value),
|
|
28314
|
+
children: "+ Save"
|
|
28315
|
+
}
|
|
28316
|
+
)
|
|
28317
|
+
] })
|
|
27563
28318
|
] })
|
|
27564
28319
|
] })
|
|
27565
28320
|
] });
|
|
27566
28321
|
}
|
|
27567
28322
|
|
|
27568
28323
|
// src/components/Properties/controls/PaddingInput.tsx
|
|
27569
|
-
var
|
|
27570
|
-
var
|
|
28324
|
+
var import_react46 = require("react");
|
|
28325
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
27571
28326
|
function parsePadding(value) {
|
|
27572
28327
|
const parts = value.split(/\s+/).map((p) => p.trim()).filter(Boolean);
|
|
27573
28328
|
switch (parts.length) {
|
|
@@ -27584,8 +28339,8 @@ function parsePadding(value) {
|
|
|
27584
28339
|
}
|
|
27585
28340
|
}
|
|
27586
28341
|
function PaddingInput({ label, value, onChange }) {
|
|
27587
|
-
const [top, right, bottom, left] = (0,
|
|
27588
|
-
const handleChange = (0,
|
|
28342
|
+
const [top, right, bottom, left] = (0, import_react46.useMemo)(() => parsePadding(value), [value]);
|
|
28343
|
+
const handleChange = (0, import_react46.useCallback)(
|
|
27589
28344
|
(position, newVal) => {
|
|
27590
28345
|
const parts = parsePadding(value);
|
|
27591
28346
|
const idx = { top: 0, right: 1, bottom: 2, left: 3 }[position];
|
|
@@ -27594,12 +28349,12 @@ function PaddingInput({ label, value, onChange }) {
|
|
|
27594
28349
|
},
|
|
27595
28350
|
[value, onChange]
|
|
27596
28351
|
);
|
|
27597
|
-
return /* @__PURE__ */ (0,
|
|
27598
|
-
/* @__PURE__ */ (0,
|
|
27599
|
-
/* @__PURE__ */ (0,
|
|
27600
|
-
/* @__PURE__ */ (0,
|
|
27601
|
-
/* @__PURE__ */ (0,
|
|
27602
|
-
/* @__PURE__ */ (0,
|
|
28352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: `ee-field-group ee-padding ${properties_default.fieldGroup}`, children: [
|
|
28353
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: properties_default.fieldLabel, children: label }),
|
|
28354
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: properties_default.paddingGrid, children: [
|
|
28355
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: properties_default.paddingField, children: [
|
|
28356
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: properties_default.paddingLabel, children: "Top" }),
|
|
28357
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
27603
28358
|
"input",
|
|
27604
28359
|
{
|
|
27605
28360
|
className: properties_default.paddingInput,
|
|
@@ -27608,9 +28363,9 @@ function PaddingInput({ label, value, onChange }) {
|
|
|
27608
28363
|
}
|
|
27609
28364
|
)
|
|
27610
28365
|
] }),
|
|
27611
|
-
/* @__PURE__ */ (0,
|
|
27612
|
-
/* @__PURE__ */ (0,
|
|
27613
|
-
/* @__PURE__ */ (0,
|
|
28366
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: properties_default.paddingField, children: [
|
|
28367
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: properties_default.paddingLabel, children: "Right" }),
|
|
28368
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
27614
28369
|
"input",
|
|
27615
28370
|
{
|
|
27616
28371
|
className: properties_default.paddingInput,
|
|
@@ -27619,9 +28374,9 @@ function PaddingInput({ label, value, onChange }) {
|
|
|
27619
28374
|
}
|
|
27620
28375
|
)
|
|
27621
28376
|
] }),
|
|
27622
|
-
/* @__PURE__ */ (0,
|
|
27623
|
-
/* @__PURE__ */ (0,
|
|
27624
|
-
/* @__PURE__ */ (0,
|
|
28377
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: properties_default.paddingField, children: [
|
|
28378
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: properties_default.paddingLabel, children: "Bottom" }),
|
|
28379
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
27625
28380
|
"input",
|
|
27626
28381
|
{
|
|
27627
28382
|
className: properties_default.paddingInput,
|
|
@@ -27630,9 +28385,9 @@ function PaddingInput({ label, value, onChange }) {
|
|
|
27630
28385
|
}
|
|
27631
28386
|
)
|
|
27632
28387
|
] }),
|
|
27633
|
-
/* @__PURE__ */ (0,
|
|
27634
|
-
/* @__PURE__ */ (0,
|
|
27635
|
-
/* @__PURE__ */ (0,
|
|
28388
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: properties_default.paddingField, children: [
|
|
28389
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: properties_default.paddingLabel, children: "Left" }),
|
|
28390
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
27636
28391
|
"input",
|
|
27637
28392
|
{
|
|
27638
28393
|
className: properties_default.paddingInput,
|
|
@@ -27646,16 +28401,16 @@ function PaddingInput({ label, value, onChange }) {
|
|
|
27646
28401
|
}
|
|
27647
28402
|
|
|
27648
28403
|
// src/components/Properties/controls/AlignmentPicker.tsx
|
|
27649
|
-
var
|
|
28404
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
27650
28405
|
function AlignmentPicker({
|
|
27651
28406
|
label,
|
|
27652
28407
|
value,
|
|
27653
28408
|
onChange,
|
|
27654
28409
|
options = ["left", "center", "right"]
|
|
27655
28410
|
}) {
|
|
27656
|
-
return /* @__PURE__ */ (0,
|
|
27657
|
-
/* @__PURE__ */ (0,
|
|
27658
|
-
/* @__PURE__ */ (0,
|
|
28411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `ee-field-group ee-alignment ${properties_default.fieldGroup}`, children: [
|
|
28412
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: properties_default.fieldLabel, children: label }),
|
|
28413
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: properties_default.alignmentPicker, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
27659
28414
|
"button",
|
|
27660
28415
|
{
|
|
27661
28416
|
className: `${properties_default.alignmentBtn} ${value === option ? properties_default.alignmentBtnActive : ""}`,
|
|
@@ -27669,25 +28424,25 @@ function AlignmentPicker({
|
|
|
27669
28424
|
}
|
|
27670
28425
|
|
|
27671
28426
|
// src/components/Properties/controls/FontPicker.tsx
|
|
27672
|
-
var
|
|
28427
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
27673
28428
|
function FontPicker({ label, value, onChange }) {
|
|
27674
|
-
return /* @__PURE__ */ (0,
|
|
27675
|
-
/* @__PURE__ */ (0,
|
|
27676
|
-
/* @__PURE__ */ (0,
|
|
28429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: `ee-field-group ee-font-picker ${properties_default.fieldGroup}`, children: [
|
|
28430
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: properties_default.fieldLabel, children: label }),
|
|
28431
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
27677
28432
|
"select",
|
|
27678
28433
|
{
|
|
27679
28434
|
className: properties_default.fieldSelect,
|
|
27680
28435
|
value,
|
|
27681
28436
|
onChange: (e) => onChange(e.target.value),
|
|
27682
|
-
children: FONT_OPTIONS.map((font) => /* @__PURE__ */ (0,
|
|
28437
|
+
children: FONT_OPTIONS.map((font) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: font, style: { fontFamily: font }, children: font.split(",")[0].trim() }, font))
|
|
27683
28438
|
}
|
|
27684
28439
|
)
|
|
27685
28440
|
] });
|
|
27686
28441
|
}
|
|
27687
28442
|
|
|
27688
28443
|
// src/components/Properties/controls/SliderInput.tsx
|
|
27689
|
-
var
|
|
27690
|
-
var
|
|
28444
|
+
var import_react47 = require("react");
|
|
28445
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
27691
28446
|
function SliderInput({
|
|
27692
28447
|
label,
|
|
27693
28448
|
value,
|
|
@@ -27697,16 +28452,16 @@ function SliderInput({
|
|
|
27697
28452
|
unit = "px",
|
|
27698
28453
|
onChange
|
|
27699
28454
|
}) {
|
|
27700
|
-
const handleChange = (0,
|
|
28455
|
+
const handleChange = (0, import_react47.useCallback)(
|
|
27701
28456
|
(e) => {
|
|
27702
28457
|
onChange(Number(e.target.value));
|
|
27703
28458
|
},
|
|
27704
28459
|
[onChange]
|
|
27705
28460
|
);
|
|
27706
|
-
return /* @__PURE__ */ (0,
|
|
27707
|
-
/* @__PURE__ */ (0,
|
|
27708
|
-
/* @__PURE__ */ (0,
|
|
27709
|
-
/* @__PURE__ */ (0,
|
|
28461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `ee-field-group ee-slider ${properties_default.fieldGroup}`, children: [
|
|
28462
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { className: properties_default.fieldLabel, children: label }),
|
|
28463
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: properties_default.sliderWrapper, children: [
|
|
28464
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
27710
28465
|
"input",
|
|
27711
28466
|
{
|
|
27712
28467
|
type: "range",
|
|
@@ -27718,7 +28473,7 @@ function SliderInput({
|
|
|
27718
28473
|
onChange: handleChange
|
|
27719
28474
|
}
|
|
27720
28475
|
),
|
|
27721
|
-
/* @__PURE__ */ (0,
|
|
28476
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: properties_default.sliderValue, children: [
|
|
27722
28477
|
value,
|
|
27723
28478
|
unit
|
|
27724
28479
|
] })
|
|
@@ -27727,8 +28482,8 @@ function SliderInput({
|
|
|
27727
28482
|
}
|
|
27728
28483
|
|
|
27729
28484
|
// src/components/Properties/controls/LinkInput.tsx
|
|
27730
|
-
var
|
|
27731
|
-
var
|
|
28485
|
+
var import_react48 = require("react");
|
|
28486
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
27732
28487
|
function validateLink(value, type) {
|
|
27733
28488
|
if (!value) return null;
|
|
27734
28489
|
if (type === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
@@ -27758,22 +28513,22 @@ function addPrefix(value, type) {
|
|
|
27758
28513
|
return value;
|
|
27759
28514
|
}
|
|
27760
28515
|
function LinkInput({ label, value, onChange }) {
|
|
27761
|
-
const [type, setType] = (0,
|
|
27762
|
-
const [rawValue, setRawValue] = (0,
|
|
27763
|
-
const validationError = (0,
|
|
27764
|
-
(0,
|
|
28516
|
+
const [type, setType] = (0, import_react48.useState)(() => detectType(value));
|
|
28517
|
+
const [rawValue, setRawValue] = (0, import_react48.useState)(() => stripPrefix(value, detectType(value)));
|
|
28518
|
+
const validationError = (0, import_react48.useMemo)(() => validateLink(rawValue, type), [rawValue, type]);
|
|
28519
|
+
(0, import_react48.useEffect)(() => {
|
|
27765
28520
|
const detected = detectType(value);
|
|
27766
28521
|
setType(detected);
|
|
27767
28522
|
setRawValue(stripPrefix(value, detected));
|
|
27768
28523
|
}, [value]);
|
|
27769
|
-
const handleTypeChange = (0,
|
|
28524
|
+
const handleTypeChange = (0, import_react48.useCallback)(
|
|
27770
28525
|
(newType) => {
|
|
27771
28526
|
setType(newType);
|
|
27772
28527
|
onChange(addPrefix(rawValue, newType));
|
|
27773
28528
|
},
|
|
27774
28529
|
[rawValue, onChange]
|
|
27775
28530
|
);
|
|
27776
|
-
const handleValueChange = (0,
|
|
28531
|
+
const handleValueChange = (0, import_react48.useCallback)(
|
|
27777
28532
|
(newValue) => {
|
|
27778
28533
|
setRawValue(newValue);
|
|
27779
28534
|
onChange(addPrefix(newValue, type));
|
|
@@ -27781,23 +28536,23 @@ function LinkInput({ label, value, onChange }) {
|
|
|
27781
28536
|
[type, onChange]
|
|
27782
28537
|
);
|
|
27783
28538
|
const placeholder = type === "email" ? "user@example.com" : type === "phone" ? "+1234567890" : "https://";
|
|
27784
|
-
return /* @__PURE__ */ (0,
|
|
27785
|
-
/* @__PURE__ */ (0,
|
|
27786
|
-
/* @__PURE__ */ (0,
|
|
27787
|
-
/* @__PURE__ */ (0,
|
|
28539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `ee-field-group ee-link-input ${properties_default.fieldGroup}`, children: [
|
|
28540
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: properties_default.fieldLabel, children: label }),
|
|
28541
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: properties_default.fieldRowCompact, children: [
|
|
28542
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
27788
28543
|
"select",
|
|
27789
28544
|
{
|
|
27790
28545
|
className: properties_default.fieldSelectNarrow,
|
|
27791
28546
|
value: type,
|
|
27792
28547
|
onChange: (e) => handleTypeChange(e.target.value),
|
|
27793
28548
|
children: [
|
|
27794
|
-
/* @__PURE__ */ (0,
|
|
27795
|
-
/* @__PURE__ */ (0,
|
|
27796
|
-
/* @__PURE__ */ (0,
|
|
28549
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "url", children: "URL" }),
|
|
28550
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "email", children: "Email" }),
|
|
28551
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "phone", children: "Phone" })
|
|
27797
28552
|
]
|
|
27798
28553
|
}
|
|
27799
28554
|
),
|
|
27800
|
-
/* @__PURE__ */ (0,
|
|
28555
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
27801
28556
|
"input",
|
|
27802
28557
|
{
|
|
27803
28558
|
className: properties_default.fieldInputFlex,
|
|
@@ -27809,26 +28564,26 @@ function LinkInput({ label, value, onChange }) {
|
|
|
27809
28564
|
}
|
|
27810
28565
|
)
|
|
27811
28566
|
] }),
|
|
27812
|
-
validationError && /* @__PURE__ */ (0,
|
|
28567
|
+
validationError && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: `ee-validation-error ${properties_default.validationError}`, role: "alert", children: validationError })
|
|
27813
28568
|
] });
|
|
27814
28569
|
}
|
|
27815
28570
|
|
|
27816
28571
|
// src/components/Properties/PropertyField.tsx
|
|
27817
|
-
var
|
|
27818
|
-
var PropertyField =
|
|
28572
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
28573
|
+
var PropertyField = import_react49.default.memo(function PropertyField2(props) {
|
|
27819
28574
|
switch (props.type) {
|
|
27820
28575
|
case "color":
|
|
27821
|
-
return /* @__PURE__ */ (0,
|
|
28576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ColorPicker, { label: props.label, value: props.value, onChange: props.onChange });
|
|
27822
28577
|
case "padding":
|
|
27823
|
-
return /* @__PURE__ */ (0,
|
|
28578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaddingInput, { label: props.label, value: props.value, onChange: props.onChange });
|
|
27824
28579
|
case "alignment":
|
|
27825
|
-
return /* @__PURE__ */ (0,
|
|
28580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AlignmentPicker, { label: props.label, value: props.value, onChange: props.onChange, options: props.options });
|
|
27826
28581
|
case "font":
|
|
27827
|
-
return /* @__PURE__ */ (0,
|
|
28582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FontPicker, { label: props.label, value: props.value, onChange: props.onChange });
|
|
27828
28583
|
case "link":
|
|
27829
|
-
return /* @__PURE__ */ (0,
|
|
28584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LinkInput, { label: props.label, value: props.value, onChange: props.onChange });
|
|
27830
28585
|
case "slider":
|
|
27831
|
-
return /* @__PURE__ */ (0,
|
|
28586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
27832
28587
|
SliderInput,
|
|
27833
28588
|
{
|
|
27834
28589
|
label: props.label,
|
|
@@ -27841,8 +28596,8 @@ var PropertyField = import_react47.default.memo(function PropertyField2(props) {
|
|
|
27841
28596
|
}
|
|
27842
28597
|
);
|
|
27843
28598
|
case "toggle":
|
|
27844
|
-
return /* @__PURE__ */ (0,
|
|
27845
|
-
/* @__PURE__ */ (0,
|
|
28599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: properties_default.fieldGroup, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: `ee-checkbox-label ${properties_default.checkboxLabel}`, children: [
|
|
28600
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
27846
28601
|
"input",
|
|
27847
28602
|
{
|
|
27848
28603
|
type: "checkbox",
|
|
@@ -27853,22 +28608,22 @@ var PropertyField = import_react47.default.memo(function PropertyField2(props) {
|
|
|
27853
28608
|
props.label
|
|
27854
28609
|
] }) });
|
|
27855
28610
|
case "select":
|
|
27856
|
-
return /* @__PURE__ */ (0,
|
|
27857
|
-
/* @__PURE__ */ (0,
|
|
27858
|
-
/* @__PURE__ */ (0,
|
|
28611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
28612
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { className: properties_default.fieldLabel, children: props.label }),
|
|
28613
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
27859
28614
|
"select",
|
|
27860
28615
|
{
|
|
27861
28616
|
className: properties_default.fieldSelect,
|
|
27862
28617
|
value: props.value,
|
|
27863
28618
|
onChange: (e) => props.onChange(e.target.value),
|
|
27864
|
-
children: props.options.map((opt) => /* @__PURE__ */ (0,
|
|
28619
|
+
children: props.options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
27865
28620
|
}
|
|
27866
28621
|
)
|
|
27867
28622
|
] });
|
|
27868
28623
|
case "textarea":
|
|
27869
|
-
return /* @__PURE__ */ (0,
|
|
27870
|
-
/* @__PURE__ */ (0,
|
|
27871
|
-
/* @__PURE__ */ (0,
|
|
28624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
28625
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { className: properties_default.fieldLabel, children: props.label }),
|
|
28626
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
27872
28627
|
"textarea",
|
|
27873
28628
|
{
|
|
27874
28629
|
className: props.code ? `ee-code-textarea ${properties_default.fieldTextareaCode}` : properties_default.fieldTextarea,
|
|
@@ -27881,9 +28636,9 @@ var PropertyField = import_react47.default.memo(function PropertyField2(props) {
|
|
|
27881
28636
|
] });
|
|
27882
28637
|
case "text":
|
|
27883
28638
|
default:
|
|
27884
|
-
return /* @__PURE__ */ (0,
|
|
27885
|
-
/* @__PURE__ */ (0,
|
|
27886
|
-
/* @__PURE__ */ (0,
|
|
28639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
28640
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { className: properties_default.fieldLabel, children: props.label }),
|
|
28641
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
27887
28642
|
"input",
|
|
27888
28643
|
{
|
|
27889
28644
|
className: properties_default.fieldInput,
|
|
@@ -27896,11 +28651,11 @@ var PropertyField = import_react47.default.memo(function PropertyField2(props) {
|
|
|
27896
28651
|
}
|
|
27897
28652
|
});
|
|
27898
28653
|
function FieldSeparator() {
|
|
27899
|
-
return /* @__PURE__ */ (0,
|
|
28654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: properties_default.separator });
|
|
27900
28655
|
}
|
|
27901
28656
|
|
|
27902
28657
|
// src/components/Properties/SectionProperties.tsx
|
|
27903
|
-
var
|
|
28658
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
27904
28659
|
var BG_SIZE_OPTIONS = [
|
|
27905
28660
|
{ value: "cover", label: "Cover" },
|
|
27906
28661
|
{ value: "contain", label: "Contain" },
|
|
@@ -27915,41 +28670,41 @@ var BG_REPEAT_OPTIONS = [
|
|
|
27915
28670
|
function SectionProperties({ section }) {
|
|
27916
28671
|
const dispatch = useEditorDispatch();
|
|
27917
28672
|
const { properties } = section;
|
|
27918
|
-
const update = (0,
|
|
28673
|
+
const update = (0, import_react50.useCallback)(
|
|
27919
28674
|
(props) => {
|
|
27920
28675
|
dispatch({ type: "UPDATE_SECTION", payload: { sectionId: section.id, properties: props } });
|
|
27921
28676
|
},
|
|
27922
28677
|
[dispatch, section.id]
|
|
27923
28678
|
);
|
|
27924
|
-
return /* @__PURE__ */ (0,
|
|
27925
|
-
/* @__PURE__ */ (0,
|
|
27926
|
-
/* @__PURE__ */ (0,
|
|
27927
|
-
/* @__PURE__ */ (0,
|
|
27928
|
-
/* @__PURE__ */ (0,
|
|
27929
|
-
/* @__PURE__ */ (0,
|
|
27930
|
-
/* @__PURE__ */ (0,
|
|
27931
|
-
/* @__PURE__ */ (0,
|
|
27932
|
-
/* @__PURE__ */ (0,
|
|
28679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
28680
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "color", label: "Background Color", value: properties.backgroundColor, onChange: (v) => update({ backgroundColor: v }) }),
|
|
28681
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "padding", label: "Padding", value: properties.padding, onChange: (v) => update({ padding: v }) }),
|
|
28682
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "text", label: "Border Radius", value: properties.borderRadius, onChange: (v) => update({ borderRadius: v }) }),
|
|
28683
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "toggle", label: "Full Width", value: properties.fullWidth || false, onChange: (v) => update({ fullWidth: v }) }),
|
|
28684
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FieldSeparator, {}),
|
|
28685
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "text", label: "Background Image URL", value: properties.backgroundImage || "", onChange: (v) => update({ backgroundImage: v }), placeholder: "https://..." }),
|
|
28686
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "select", label: "Background Size", value: properties.backgroundSize || "cover", onChange: (v) => update({ backgroundSize: v }), options: BG_SIZE_OPTIONS }),
|
|
28687
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PropertyField, { type: "select", label: "Background Repeat", value: properties.backgroundRepeat || "no-repeat", onChange: (v) => update({ backgroundRepeat: v }), options: BG_REPEAT_OPTIONS })
|
|
27933
28688
|
] });
|
|
27934
28689
|
}
|
|
27935
28690
|
|
|
27936
28691
|
// src/components/Properties/HeadMetadataProperties.tsx
|
|
27937
|
-
var
|
|
27938
|
-
var
|
|
28692
|
+
var import_react51 = require("react");
|
|
28693
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
27939
28694
|
function HeadMetadataProperties() {
|
|
27940
28695
|
const { template } = useTemplateContext();
|
|
27941
28696
|
const dispatch = useEditorDispatch();
|
|
27942
28697
|
const metadata = template.headMetadata ?? { title: "", previewText: "", headStyles: [] };
|
|
27943
|
-
const update = (0,
|
|
28698
|
+
const update = (0, import_react51.useCallback)(
|
|
27944
28699
|
(props) => {
|
|
27945
28700
|
dispatch({ type: "UPDATE_HEAD_METADATA", payload: props });
|
|
27946
28701
|
},
|
|
27947
28702
|
[dispatch]
|
|
27948
28703
|
);
|
|
27949
|
-
return /* @__PURE__ */ (0,
|
|
27950
|
-
/* @__PURE__ */ (0,
|
|
27951
|
-
/* @__PURE__ */ (0,
|
|
27952
|
-
/* @__PURE__ */ (0,
|
|
28704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
28705
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PropertyField, { type: "text", label: "Email Title", value: metadata.title, onChange: (v) => update({ title: v }), placeholder: "Email title (mj-title)" }),
|
|
28706
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PropertyField, { type: "text", label: "Preview Text", value: metadata.previewText, onChange: (v) => update({ previewText: v }), placeholder: "Preview text shown in inbox (mj-preview)" }),
|
|
28707
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
27953
28708
|
PropertyField,
|
|
27954
28709
|
{
|
|
27955
28710
|
type: "textarea",
|
|
@@ -27968,10 +28723,10 @@ function HeadMetadataProperties() {
|
|
|
27968
28723
|
}
|
|
27969
28724
|
|
|
27970
28725
|
// src/hooks/useBlockUpdate.ts
|
|
27971
|
-
var
|
|
28726
|
+
var import_react52 = require("react");
|
|
27972
28727
|
function useBlockUpdate(blockId) {
|
|
27973
28728
|
const dispatch = useEditorDispatch();
|
|
27974
|
-
const update = (0,
|
|
28729
|
+
const update = (0, import_react52.useCallback)(
|
|
27975
28730
|
(properties) => {
|
|
27976
28731
|
dispatch({
|
|
27977
28732
|
type: "UPDATE_BLOCK",
|
|
@@ -27984,19 +28739,20 @@ function useBlockUpdate(blockId) {
|
|
|
27984
28739
|
}
|
|
27985
28740
|
|
|
27986
28741
|
// src/components/Properties/TextProperties.tsx
|
|
27987
|
-
var
|
|
28742
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
27988
28743
|
function TextProperties({ block }) {
|
|
27989
28744
|
const update = useBlockUpdate(block.id);
|
|
27990
28745
|
const p = block.properties;
|
|
27991
|
-
return /* @__PURE__ */ (0,
|
|
27992
|
-
/* @__PURE__ */ (0,
|
|
27993
|
-
/* @__PURE__ */ (0,
|
|
27994
|
-
/* @__PURE__ */ (0,
|
|
28746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
28747
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: properties_default.fieldHint, children: "Use the inline toolbar above the text block to format font, size, color, and alignment." }),
|
|
28748
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PropertyField, { type: "color", label: "Background Color", value: p.backgroundColor || "transparent", onChange: (v) => update({ backgroundColor: v }) }),
|
|
28749
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PropertyField, { type: "text", label: "Line Height", value: p.lineHeight, onChange: (v) => update({ lineHeight: v }) }),
|
|
28750
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) })
|
|
27995
28751
|
] });
|
|
27996
28752
|
}
|
|
27997
28753
|
|
|
27998
28754
|
// src/components/Properties/ButtonProperties.tsx
|
|
27999
|
-
var
|
|
28755
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
28000
28756
|
var FONT_WEIGHT_OPTIONS = [
|
|
28001
28757
|
{ value: "normal", label: "Normal" },
|
|
28002
28758
|
{ value: "bold", label: "Bold" },
|
|
@@ -28019,32 +28775,32 @@ var TEXT_TRANSFORM_OPTIONS = [
|
|
|
28019
28775
|
function ButtonProperties({ block }) {
|
|
28020
28776
|
const update = useBlockUpdate(block.id);
|
|
28021
28777
|
const p = block.properties;
|
|
28022
|
-
return /* @__PURE__ */ (0,
|
|
28023
|
-
/* @__PURE__ */ (0,
|
|
28024
|
-
/* @__PURE__ */ (0,
|
|
28025
|
-
/* @__PURE__ */ (0,
|
|
28026
|
-
/* @__PURE__ */ (0,
|
|
28027
|
-
/* @__PURE__ */ (0,
|
|
28028
|
-
/* @__PURE__ */ (0,
|
|
28029
|
-
/* @__PURE__ */ (0,
|
|
28030
|
-
/* @__PURE__ */ (0,
|
|
28031
|
-
/* @__PURE__ */ (0,
|
|
28032
|
-
/* @__PURE__ */ (0,
|
|
28033
|
-
/* @__PURE__ */ (0,
|
|
28034
|
-
/* @__PURE__ */ (0,
|
|
28035
|
-
/* @__PURE__ */ (0,
|
|
28036
|
-
/* @__PURE__ */ (0,
|
|
28037
|
-
/* @__PURE__ */ (0,
|
|
28778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
28779
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "text", label: "Button Text", value: p.text, onChange: (v) => update({ text: v }) }),
|
|
28780
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "link", label: "Link URL", value: p.href, onChange: (v) => update({ href: v }) }),
|
|
28781
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(FieldSeparator, {}),
|
|
28782
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "color", label: "Background Color", value: p.backgroundColor, onChange: (v) => update({ backgroundColor: v }) }),
|
|
28783
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "color", label: "Text Color", value: p.color, onChange: (v) => update({ color: v }) }),
|
|
28784
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "font", label: "Font Family", value: p.fontFamily, onChange: (v) => update({ fontFamily: v }) }),
|
|
28785
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "text", label: "Font Size", value: p.fontSize, onChange: (v) => update({ fontSize: v }) }),
|
|
28786
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "text", label: "Border Radius", value: p.borderRadius, onChange: (v) => update({ borderRadius: v }) }),
|
|
28787
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "text", label: "Width", value: p.width, onChange: (v) => update({ width: v }), placeholder: "auto" }),
|
|
28788
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "select", label: "Font Weight", value: p.fontWeight || "normal", onChange: (v) => update({ fontWeight: v }), options: FONT_WEIGHT_OPTIONS }),
|
|
28789
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "select", label: "Text Transform", value: p.textTransform || "none", onChange: (v) => update({ textTransform: v }), options: TEXT_TRANSFORM_OPTIONS }),
|
|
28790
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "text", label: "Letter Spacing", value: p.letterSpacing || "normal", onChange: (v) => update({ letterSpacing: v }), placeholder: "normal" }),
|
|
28791
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
28792
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "padding", label: "Outer Padding", value: p.padding, onChange: (v) => update({ padding: v }) }),
|
|
28793
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PropertyField, { type: "padding", label: "Inner Padding", value: p.innerPadding, onChange: (v) => update({ innerPadding: v }) })
|
|
28038
28794
|
] });
|
|
28039
28795
|
}
|
|
28040
28796
|
|
|
28041
28797
|
// src/components/Properties/ImageProperties.tsx
|
|
28042
|
-
var
|
|
28043
|
-
var
|
|
28798
|
+
var import_react53 = require("react");
|
|
28799
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
28044
28800
|
function ImageProperties({ block }) {
|
|
28045
28801
|
const update = useBlockUpdate(block.id);
|
|
28046
28802
|
const { imageUploadAdapter } = useImageAdapter();
|
|
28047
|
-
const fileInputRef = (0,
|
|
28803
|
+
const fileInputRef = (0, import_react53.useRef)(null);
|
|
28048
28804
|
const p = block.properties;
|
|
28049
28805
|
const { upload, status, error } = useImageUpload({
|
|
28050
28806
|
adapter: imageUploadAdapter,
|
|
@@ -28057,7 +28813,7 @@ function ImageProperties({ block }) {
|
|
|
28057
28813
|
});
|
|
28058
28814
|
}
|
|
28059
28815
|
});
|
|
28060
|
-
const handleFileSelect = (0,
|
|
28816
|
+
const handleFileSelect = (0, import_react53.useCallback)(
|
|
28061
28817
|
async (e) => {
|
|
28062
28818
|
const file = e.target.files?.[0];
|
|
28063
28819
|
if (!file) return;
|
|
@@ -28065,10 +28821,10 @@ function ImageProperties({ block }) {
|
|
|
28065
28821
|
},
|
|
28066
28822
|
[upload]
|
|
28067
28823
|
);
|
|
28068
|
-
return /* @__PURE__ */ (0,
|
|
28069
|
-
/* @__PURE__ */ (0,
|
|
28070
|
-
imageUploadAdapter && /* @__PURE__ */ (0,
|
|
28071
|
-
/* @__PURE__ */ (0,
|
|
28824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
28825
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "text", label: "Image URL", value: p.src, onChange: (v) => update({ src: v }), placeholder: "https://..." }),
|
|
28826
|
+
imageUploadAdapter && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
28827
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
28072
28828
|
"button",
|
|
28073
28829
|
{
|
|
28074
28830
|
className: `ee-upload-btn ${status === "uploading" ? properties_default.fieldBtnUploadDisabled : properties_default.fieldBtnUpload}`,
|
|
@@ -28077,8 +28833,8 @@ function ImageProperties({ block }) {
|
|
|
28077
28833
|
children: status === "uploading" ? "Uploading..." : "Upload Image"
|
|
28078
28834
|
}
|
|
28079
28835
|
),
|
|
28080
|
-
error && /* @__PURE__ */ (0,
|
|
28081
|
-
/* @__PURE__ */ (0,
|
|
28836
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: `ee-upload-error ${properties_default.validationError}`, children: error }),
|
|
28837
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
28082
28838
|
"input",
|
|
28083
28839
|
{
|
|
28084
28840
|
ref: fileInputRef,
|
|
@@ -28089,21 +28845,21 @@ function ImageProperties({ block }) {
|
|
|
28089
28845
|
}
|
|
28090
28846
|
)
|
|
28091
28847
|
] }),
|
|
28092
|
-
/* @__PURE__ */ (0,
|
|
28093
|
-
/* @__PURE__ */ (0,
|
|
28094
|
-
/* @__PURE__ */ (0,
|
|
28095
|
-
/* @__PURE__ */ (0,
|
|
28096
|
-
/* @__PURE__ */ (0,
|
|
28097
|
-
/* @__PURE__ */ (0,
|
|
28848
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "text", label: "Alt Text", value: p.alt, onChange: (v) => update({ alt: v }), placeholder: "Image description" }),
|
|
28849
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "link", label: "Link URL", value: p.href, onChange: (v) => update({ href: v }) }),
|
|
28850
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FieldSeparator, {}),
|
|
28851
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: properties_default.fieldRow, children: [
|
|
28852
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: properties_default.fieldHalf, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "text", label: "Width", value: p.width, onChange: (v) => update({ width: v }) }) }),
|
|
28853
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: properties_default.fieldHalf, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "text", label: "Height", value: p.height, onChange: (v) => update({ height: v }) }) })
|
|
28098
28854
|
] }),
|
|
28099
|
-
/* @__PURE__ */ (0,
|
|
28100
|
-
/* @__PURE__ */ (0,
|
|
28101
|
-
/* @__PURE__ */ (0,
|
|
28855
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
28856
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) }),
|
|
28857
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PropertyField, { type: "toggle", label: "Fluid on Mobile", value: p.fluidOnMobile, onChange: (v) => update({ fluidOnMobile: v }) })
|
|
28102
28858
|
] });
|
|
28103
28859
|
}
|
|
28104
28860
|
|
|
28105
28861
|
// src/components/Properties/DividerProperties.tsx
|
|
28106
|
-
var
|
|
28862
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
28107
28863
|
var BORDER_STYLE_OPTIONS = [
|
|
28108
28864
|
{ value: "solid", label: "Solid" },
|
|
28109
28865
|
{ value: "dashed", label: "Dashed" },
|
|
@@ -28112,26 +28868,26 @@ var BORDER_STYLE_OPTIONS = [
|
|
|
28112
28868
|
function DividerProperties({ block }) {
|
|
28113
28869
|
const update = useBlockUpdate(block.id);
|
|
28114
28870
|
const p = block.properties;
|
|
28115
|
-
return /* @__PURE__ */ (0,
|
|
28116
|
-
/* @__PURE__ */ (0,
|
|
28117
|
-
/* @__PURE__ */ (0,
|
|
28118
|
-
/* @__PURE__ */ (0,
|
|
28119
|
-
/* @__PURE__ */ (0,
|
|
28120
|
-
/* @__PURE__ */ (0,
|
|
28871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
28872
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PropertyField, { type: "color", label: "Border Color", value: p.borderColor, onChange: (v) => update({ borderColor: v }) }),
|
|
28873
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PropertyField, { type: "text", label: "Border Width", value: p.borderWidth, onChange: (v) => update({ borderWidth: v }) }),
|
|
28874
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PropertyField, { type: "select", label: "Border Style", value: p.borderStyle, onChange: (v) => update({ borderStyle: v }), options: BORDER_STYLE_OPTIONS }),
|
|
28875
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PropertyField, { type: "text", label: "Width", value: p.width, onChange: (v) => update({ width: v }) }),
|
|
28876
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) })
|
|
28121
28877
|
] });
|
|
28122
28878
|
}
|
|
28123
28879
|
|
|
28124
28880
|
// src/components/Properties/SpacerProperties.tsx
|
|
28125
|
-
var
|
|
28881
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
28126
28882
|
function SpacerProperties({ block }) {
|
|
28127
28883
|
const update = useBlockUpdate(block.id);
|
|
28128
28884
|
const p = block.properties;
|
|
28129
28885
|
const heightNum = parseInt(p.height, 10) || 20;
|
|
28130
|
-
return /* @__PURE__ */ (0,
|
|
28886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: properties_default.propertiesBody, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PropertyField, { type: "slider", label: "Height", value: heightNum, min: 5, max: 200, step: 5, unit: "px", onChange: (v) => update({ height: `${v}px` }) }) });
|
|
28131
28887
|
}
|
|
28132
28888
|
|
|
28133
28889
|
// src/components/Properties/SocialProperties.tsx
|
|
28134
|
-
var
|
|
28890
|
+
var import_react54 = require("react");
|
|
28135
28891
|
|
|
28136
28892
|
// src/types.ts
|
|
28137
28893
|
function narrowBlock(block, type) {
|
|
@@ -28139,14 +28895,105 @@ function narrowBlock(block, type) {
|
|
|
28139
28895
|
}
|
|
28140
28896
|
|
|
28141
28897
|
// src/components/Properties/SocialProperties.tsx
|
|
28142
|
-
var
|
|
28898
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
28899
|
+
var ALLOWED_IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/svg+xml", "image/webp"];
|
|
28900
|
+
var MAX_ICON_SIZE_BYTES = 2 * 1024 * 1024;
|
|
28143
28901
|
var MODE_OPTIONS = [
|
|
28144
28902
|
{ value: "horizontal", label: "Horizontal" },
|
|
28145
28903
|
{ value: "vertical", label: "Vertical" }
|
|
28146
28904
|
];
|
|
28905
|
+
var PLATFORM_COLORS2 = {
|
|
28906
|
+
facebook: "#3b5998",
|
|
28907
|
+
twitter: "#1da1f2",
|
|
28908
|
+
instagram: "#e1306c",
|
|
28909
|
+
linkedin: "#0077b5",
|
|
28910
|
+
youtube: "#ff0000",
|
|
28911
|
+
github: "#333333",
|
|
28912
|
+
pinterest: "#bd081c",
|
|
28913
|
+
snapchat: "#fffc00",
|
|
28914
|
+
tiktok: "#000000",
|
|
28915
|
+
web: "#4caf50"
|
|
28916
|
+
};
|
|
28917
|
+
function SocialElementIconUpload({ element, blockId, onUpdate }) {
|
|
28918
|
+
const { imageUploadAdapter } = useImageAdapter();
|
|
28919
|
+
const fileInputRef = (0, import_react54.useRef)(null);
|
|
28920
|
+
const [localError, setLocalError] = (0, import_react54.useState)(null);
|
|
28921
|
+
const { upload, status, error } = useImageUpload({
|
|
28922
|
+
adapter: imageUploadAdapter,
|
|
28923
|
+
blockId,
|
|
28924
|
+
onSuccess: (result) => {
|
|
28925
|
+
onUpdate({ src: result.url });
|
|
28926
|
+
}
|
|
28927
|
+
});
|
|
28928
|
+
const handleFileSelect = (0, import_react54.useCallback)(
|
|
28929
|
+
async (e) => {
|
|
28930
|
+
const file = e.target.files?.[0];
|
|
28931
|
+
if (!file) return;
|
|
28932
|
+
setLocalError(null);
|
|
28933
|
+
if (!ALLOWED_IMAGE_TYPES.includes(file.type)) {
|
|
28934
|
+
setLocalError("Only PNG, JPG, GIF, SVG, and WebP files are allowed");
|
|
28935
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
28936
|
+
return;
|
|
28937
|
+
}
|
|
28938
|
+
if (file.size > MAX_ICON_SIZE_BYTES) {
|
|
28939
|
+
setLocalError("File size must be under 2MB");
|
|
28940
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
28941
|
+
return;
|
|
28942
|
+
}
|
|
28943
|
+
await upload(file);
|
|
28944
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
28945
|
+
},
|
|
28946
|
+
[upload]
|
|
28947
|
+
);
|
|
28948
|
+
const bgColor = PLATFORM_COLORS2[element.name] || "#999999";
|
|
28949
|
+
const SvgIcon = getSocialIcon(element.name);
|
|
28950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "4px" }, children: [
|
|
28951
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28952
|
+
"div",
|
|
28953
|
+
{
|
|
28954
|
+
className: blocks_default.socialIconPreview,
|
|
28955
|
+
style: { backgroundColor: bgColor },
|
|
28956
|
+
children: element.src ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("img", { src: element.src, alt: element.name }) : SvgIcon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SvgIcon, { size: 16, color: element.color || "#ffffff" }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { style: { color: element.color || "#ffffff", fontSize: "12px", fontWeight: "bold" }, children: element.name.charAt(0).toUpperCase() })
|
|
28957
|
+
}
|
|
28958
|
+
),
|
|
28959
|
+
imageUploadAdapter && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
28960
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28961
|
+
"button",
|
|
28962
|
+
{
|
|
28963
|
+
className: `ee-upload-btn ${status === "uploading" ? properties_default.fieldBtnUploadDisabled : properties_default.fieldBtnUpload}`,
|
|
28964
|
+
onClick: () => fileInputRef.current?.click(),
|
|
28965
|
+
disabled: status === "uploading",
|
|
28966
|
+
style: { flex: 1, fontSize: "11px", padding: "3px 6px" },
|
|
28967
|
+
children: status === "uploading" ? "Uploading..." : "Upload Icon"
|
|
28968
|
+
}
|
|
28969
|
+
),
|
|
28970
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28971
|
+
"input",
|
|
28972
|
+
{
|
|
28973
|
+
ref: fileInputRef,
|
|
28974
|
+
type: "file",
|
|
28975
|
+
accept: ".png,.jpg,.jpeg,.gif,.svg,.webp",
|
|
28976
|
+
onChange: handleFileSelect,
|
|
28977
|
+
style: { display: "none" }
|
|
28978
|
+
}
|
|
28979
|
+
)
|
|
28980
|
+
] }),
|
|
28981
|
+
element.src && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28982
|
+
"button",
|
|
28983
|
+
{
|
|
28984
|
+
className: properties_default.itemActionBtnDanger,
|
|
28985
|
+
onClick: () => onUpdate({ src: void 0 }),
|
|
28986
|
+
title: "Reset to default icon",
|
|
28987
|
+
style: { fontSize: "11px", padding: "3px 6px" },
|
|
28988
|
+
children: "Reset"
|
|
28989
|
+
}
|
|
28990
|
+
),
|
|
28991
|
+
(localError || error) && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: properties_default.validationError, style: { fontSize: "10px" }, children: localError || error })
|
|
28992
|
+
] });
|
|
28993
|
+
}
|
|
28147
28994
|
function SocialProperties({ block }) {
|
|
28148
28995
|
const update = useBlockUpdate(block.id);
|
|
28149
|
-
const updateElement = (0,
|
|
28996
|
+
const updateElement = (0, import_react54.useCallback)(
|
|
28150
28997
|
(index, changes) => {
|
|
28151
28998
|
const elements = [...block.properties.elements];
|
|
28152
28999
|
elements[index] = { ...elements[index], ...changes };
|
|
@@ -28154,18 +29001,18 @@ function SocialProperties({ block }) {
|
|
|
28154
29001
|
},
|
|
28155
29002
|
[block.properties.elements, update]
|
|
28156
29003
|
);
|
|
28157
|
-
const addElement = (0,
|
|
29004
|
+
const addElement = (0, import_react54.useCallback)(() => {
|
|
28158
29005
|
const elements = [...block.properties.elements, { id: generateId("se"), name: "web", href: "#" }];
|
|
28159
29006
|
update({ elements });
|
|
28160
29007
|
}, [block.properties.elements, update]);
|
|
28161
|
-
const removeElement = (0,
|
|
29008
|
+
const removeElement = (0, import_react54.useCallback)(
|
|
28162
29009
|
(index) => {
|
|
28163
29010
|
const elements = block.properties.elements.filter((_, i) => i !== index);
|
|
28164
29011
|
update({ elements });
|
|
28165
29012
|
},
|
|
28166
29013
|
[block.properties.elements, update]
|
|
28167
29014
|
);
|
|
28168
|
-
const moveElement = (0,
|
|
29015
|
+
const moveElement = (0, import_react54.useCallback)(
|
|
28169
29016
|
(index, direction) => {
|
|
28170
29017
|
const elements = [...block.properties.elements];
|
|
28171
29018
|
const newIndex = index + direction;
|
|
@@ -28177,45 +29024,45 @@ function SocialProperties({ block }) {
|
|
|
28177
29024
|
);
|
|
28178
29025
|
if (!narrowBlock(block, "social")) return null;
|
|
28179
29026
|
const p = block.properties;
|
|
28180
|
-
return /* @__PURE__ */ (0,
|
|
28181
|
-
/* @__PURE__ */ (0,
|
|
28182
|
-
/* @__PURE__ */ (0,
|
|
28183
|
-
/* @__PURE__ */ (0,
|
|
28184
|
-
/* @__PURE__ */ (0,
|
|
28185
|
-
/* @__PURE__ */ (0,
|
|
28186
|
-
/* @__PURE__ */ (0,
|
|
28187
|
-
/* @__PURE__ */ (0,
|
|
28188
|
-
/* @__PURE__ */ (0,
|
|
28189
|
-
/* @__PURE__ */ (0,
|
|
28190
|
-
/* @__PURE__ */ (0,
|
|
28191
|
-
/* @__PURE__ */ (0,
|
|
28192
|
-
/* @__PURE__ */ (0,
|
|
28193
|
-
/* @__PURE__ */ (0,
|
|
28194
|
-
/* @__PURE__ */ (0,
|
|
29027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29028
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "select", label: "Mode", value: p.mode, onChange: (v) => update({ mode: v }), options: MODE_OPTIONS }),
|
|
29029
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
29030
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "text", label: "Icon Size", value: p.iconSize, onChange: (v) => update({ iconSize: v }) }),
|
|
29031
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "text", label: "Icon Padding", value: p.iconPadding, onChange: (v) => update({ iconPadding: v }) }),
|
|
29032
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "text", label: "Border Radius", value: p.borderRadius, onChange: (v) => update({ borderRadius: v }) }),
|
|
29033
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "color", label: "Text Color", value: p.color, onChange: (v) => update({ color: v }) }),
|
|
29034
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "text", label: "Font Size", value: p.fontSize, onChange: (v) => update({ fontSize: v }) }),
|
|
29035
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) }),
|
|
29036
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldSeparator, {}),
|
|
29037
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
29038
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { className: properties_default.fieldLabel, children: "Social Elements" }),
|
|
29039
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: blocks_default.socialElementsContainer, children: p.elements.map((element, index) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: blocks_default.socialElementItem, children: [
|
|
29040
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: properties_default.fieldRow, children: [
|
|
29041
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
28195
29042
|
"select",
|
|
28196
29043
|
{
|
|
28197
29044
|
className: `${properties_default.fieldSelect} ${properties_default.fieldInputFlex}`,
|
|
28198
29045
|
value: element.name,
|
|
28199
29046
|
onChange: (e) => updateElement(index, { name: e.target.value }),
|
|
28200
29047
|
children: [
|
|
28201
|
-
/* @__PURE__ */ (0,
|
|
28202
|
-
/* @__PURE__ */ (0,
|
|
28203
|
-
/* @__PURE__ */ (0,
|
|
28204
|
-
/* @__PURE__ */ (0,
|
|
28205
|
-
/* @__PURE__ */ (0,
|
|
28206
|
-
/* @__PURE__ */ (0,
|
|
28207
|
-
/* @__PURE__ */ (0,
|
|
28208
|
-
/* @__PURE__ */ (0,
|
|
28209
|
-
/* @__PURE__ */ (0,
|
|
28210
|
-
/* @__PURE__ */ (0,
|
|
29048
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "facebook", children: "Facebook" }),
|
|
29049
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "twitter", children: "Twitter" }),
|
|
29050
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "instagram", children: "Instagram" }),
|
|
29051
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "linkedin", children: "LinkedIn" }),
|
|
29052
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "youtube", children: "YouTube" }),
|
|
29053
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "github", children: "GitHub" }),
|
|
29054
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "pinterest", children: "Pinterest" }),
|
|
29055
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "snapchat", children: "Snapchat" }),
|
|
29056
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "tiktok", children: "TikTok" }),
|
|
29057
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: "web", children: "Web" })
|
|
28211
29058
|
]
|
|
28212
29059
|
}
|
|
28213
29060
|
),
|
|
28214
|
-
/* @__PURE__ */ (0,
|
|
28215
|
-
/* @__PURE__ */ (0,
|
|
28216
|
-
/* @__PURE__ */ (0,
|
|
29061
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { className: `ee-item-move-up ${properties_default.itemActionBtn}`, onClick: () => moveElement(index, -1), disabled: index === 0, title: "Move up", children: "\u2191" }),
|
|
29062
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { className: `ee-item-move-down ${properties_default.itemActionBtn}`, onClick: () => moveElement(index, 1), disabled: index === p.elements.length - 1, title: "Move down", children: "\u2193" }),
|
|
29063
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { className: `ee-item-remove ${properties_default.itemActionBtnDanger}`, onClick: () => removeElement(index), title: "Remove", children: "\xD7" })
|
|
28217
29064
|
] }),
|
|
28218
|
-
/* @__PURE__ */ (0,
|
|
29065
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28219
29066
|
"input",
|
|
28220
29067
|
{
|
|
28221
29068
|
className: properties_default.fieldInputStacked,
|
|
@@ -28224,7 +29071,7 @@ function SocialProperties({ block }) {
|
|
|
28224
29071
|
placeholder: "URL"
|
|
28225
29072
|
}
|
|
28226
29073
|
),
|
|
28227
|
-
/* @__PURE__ */ (0,
|
|
29074
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
28228
29075
|
"input",
|
|
28229
29076
|
{
|
|
28230
29077
|
className: properties_default.fieldInputStacked,
|
|
@@ -28232,27 +29079,35 @@ function SocialProperties({ block }) {
|
|
|
28232
29079
|
onChange: (e) => updateElement(index, { content: e.target.value }),
|
|
28233
29080
|
placeholder: "Label (optional)"
|
|
28234
29081
|
}
|
|
29082
|
+
),
|
|
29083
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
29084
|
+
SocialElementIconUpload,
|
|
29085
|
+
{
|
|
29086
|
+
element,
|
|
29087
|
+
blockId: block.id,
|
|
29088
|
+
onUpdate: (changes) => updateElement(index, changes)
|
|
29089
|
+
}
|
|
28235
29090
|
)
|
|
28236
29091
|
] }, element.id ?? `se-${index}`)) }),
|
|
28237
|
-
/* @__PURE__ */ (0,
|
|
29092
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { className: `ee-add-item ${properties_default.addItemBtn}`, onClick: addElement, children: "+ Add Element" })
|
|
28238
29093
|
] })
|
|
28239
29094
|
] });
|
|
28240
29095
|
}
|
|
28241
29096
|
|
|
28242
29097
|
// src/components/Properties/HtmlProperties.tsx
|
|
28243
|
-
var
|
|
29098
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
28244
29099
|
function HtmlProperties({ block }) {
|
|
28245
29100
|
const update = useBlockUpdate(block.id);
|
|
28246
29101
|
const p = block.properties;
|
|
28247
|
-
return /* @__PURE__ */ (0,
|
|
28248
|
-
/* @__PURE__ */ (0,
|
|
28249
|
-
/* @__PURE__ */ (0,
|
|
29102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29103
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PropertyField, { type: "textarea", label: "HTML Content", value: p.content, onChange: (v) => update({ content: v }), placeholder: "<p>Enter raw HTML here...</p>", rows: 10, code: true }),
|
|
29104
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) })
|
|
28250
29105
|
] });
|
|
28251
29106
|
}
|
|
28252
29107
|
|
|
28253
29108
|
// src/components/Properties/VideoProperties.tsx
|
|
28254
|
-
var
|
|
28255
|
-
var
|
|
29109
|
+
var import_react55 = require("react");
|
|
29110
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
28256
29111
|
function getAutoThumbnail3(url) {
|
|
28257
29112
|
if (!url) return "";
|
|
28258
29113
|
const ytMatch = url.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/);
|
|
@@ -28262,7 +29117,7 @@ function getAutoThumbnail3(url) {
|
|
|
28262
29117
|
function VideoProperties({ block }) {
|
|
28263
29118
|
const update = useBlockUpdate(block.id);
|
|
28264
29119
|
const p = block.properties;
|
|
28265
|
-
const handleVideoUrlChange = (0,
|
|
29120
|
+
const handleVideoUrlChange = (0, import_react55.useCallback)(
|
|
28266
29121
|
(src) => {
|
|
28267
29122
|
const updates = { src };
|
|
28268
29123
|
if (!p.thumbnailUrl) {
|
|
@@ -28273,14 +29128,14 @@ function VideoProperties({ block }) {
|
|
|
28273
29128
|
},
|
|
28274
29129
|
[update, p.thumbnailUrl]
|
|
28275
29130
|
);
|
|
28276
|
-
const handleAutoThumbnail = (0,
|
|
29131
|
+
const handleAutoThumbnail = (0, import_react55.useCallback)(() => {
|
|
28277
29132
|
const auto = getAutoThumbnail3(p.src);
|
|
28278
29133
|
if (auto) update({ thumbnailUrl: auto });
|
|
28279
29134
|
}, [update, p.src]);
|
|
28280
|
-
return /* @__PURE__ */ (0,
|
|
28281
|
-
/* @__PURE__ */ (0,
|
|
28282
|
-
/* @__PURE__ */ (0,
|
|
28283
|
-
/* @__PURE__ */ (0,
|
|
29135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29136
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
29137
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { className: properties_default.fieldLabel, children: "Video URL" }),
|
|
29138
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28284
29139
|
"input",
|
|
28285
29140
|
{
|
|
28286
29141
|
className: properties_default.fieldInput,
|
|
@@ -28290,9 +29145,9 @@ function VideoProperties({ block }) {
|
|
|
28290
29145
|
}
|
|
28291
29146
|
)
|
|
28292
29147
|
] }),
|
|
28293
|
-
/* @__PURE__ */ (0,
|
|
28294
|
-
/* @__PURE__ */ (0,
|
|
28295
|
-
/* @__PURE__ */ (0,
|
|
29148
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
29149
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("label", { className: properties_default.fieldLabel, children: "Thumbnail URL" }),
|
|
29150
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28296
29151
|
"input",
|
|
28297
29152
|
{
|
|
28298
29153
|
className: properties_default.fieldInput,
|
|
@@ -28301,7 +29156,7 @@ function VideoProperties({ block }) {
|
|
|
28301
29156
|
placeholder: "https://..."
|
|
28302
29157
|
}
|
|
28303
29158
|
),
|
|
28304
|
-
p.src && /* @__PURE__ */ (0,
|
|
29159
|
+
p.src && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
28305
29160
|
"button",
|
|
28306
29161
|
{
|
|
28307
29162
|
className: `ee-auto-thumbnail ${properties_default.fieldBtnUpload} ${properties_default.fieldInputStacked}`,
|
|
@@ -28310,15 +29165,15 @@ function VideoProperties({ block }) {
|
|
|
28310
29165
|
}
|
|
28311
29166
|
)
|
|
28312
29167
|
] }),
|
|
28313
|
-
/* @__PURE__ */ (0,
|
|
28314
|
-
/* @__PURE__ */ (0,
|
|
28315
|
-
/* @__PURE__ */ (0,
|
|
29168
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PropertyField, { type: "text", label: "Alt Text", value: p.alt, onChange: (v) => update({ alt: v }), placeholder: "Video description" }),
|
|
29169
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
29170
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) })
|
|
28316
29171
|
] });
|
|
28317
29172
|
}
|
|
28318
29173
|
|
|
28319
29174
|
// src/components/Properties/HeadingProperties.tsx
|
|
28320
|
-
var
|
|
28321
|
-
var
|
|
29175
|
+
var import_react56 = require("react");
|
|
29176
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
28322
29177
|
var LEVEL_OPTIONS = [
|
|
28323
29178
|
{ value: "h1", label: "H1" },
|
|
28324
29179
|
{ value: "h2", label: "H2" },
|
|
@@ -28353,38 +29208,39 @@ var LEVEL_DEFAULTS = {
|
|
|
28353
29208
|
function HeadingProperties({ block }) {
|
|
28354
29209
|
const update = useBlockUpdate(block.id);
|
|
28355
29210
|
const p = block.properties;
|
|
28356
|
-
const handleLevelChange = (0,
|
|
29211
|
+
const handleLevelChange = (0, import_react56.useCallback)(
|
|
28357
29212
|
(level) => {
|
|
28358
29213
|
const defaults2 = LEVEL_DEFAULTS[level] || LEVEL_DEFAULTS.h2;
|
|
28359
29214
|
update({ level, fontSize: defaults2.fontSize, lineHeight: defaults2.lineHeight });
|
|
28360
29215
|
},
|
|
28361
29216
|
[update]
|
|
28362
29217
|
);
|
|
28363
|
-
return /* @__PURE__ */ (0,
|
|
28364
|
-
/* @__PURE__ */ (0,
|
|
28365
|
-
/* @__PURE__ */ (0,
|
|
28366
|
-
/* @__PURE__ */ (0,
|
|
28367
|
-
/* @__PURE__ */ (0,
|
|
28368
|
-
/* @__PURE__ */ (0,
|
|
28369
|
-
/* @__PURE__ */ (0,
|
|
28370
|
-
/* @__PURE__ */ (0,
|
|
28371
|
-
/* @__PURE__ */ (0,
|
|
28372
|
-
/* @__PURE__ */ (0,
|
|
28373
|
-
/* @__PURE__ */ (0,
|
|
28374
|
-
/* @__PURE__ */ (0,
|
|
29218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29219
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "select", label: "Heading Level", value: p.level, onChange: handleLevelChange, options: LEVEL_OPTIONS }),
|
|
29220
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FieldSeparator, {}),
|
|
29221
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "font", label: "Font Family", value: p.fontFamily, onChange: (v) => update({ fontFamily: v }) }),
|
|
29222
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "text", label: "Font Size", value: p.fontSize, onChange: (v) => update({ fontSize: v }) }),
|
|
29223
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "color", label: "Color", value: p.color, onChange: (v) => update({ color: v }) }),
|
|
29224
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "color", label: "Background Color", value: p.backgroundColor || "transparent", onChange: (v) => update({ backgroundColor: v }) }),
|
|
29225
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "text", label: "Line Height", value: p.lineHeight, onChange: (v) => update({ lineHeight: v }) }),
|
|
29226
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "select", label: "Font Weight", value: p.fontWeight || "bold", onChange: (v) => update({ fontWeight: v }), options: FONT_WEIGHT_OPTIONS2 }),
|
|
29227
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "select", label: "Text Transform", value: p.textTransform || "none", onChange: (v) => update({ textTransform: v }), options: TEXT_TRANSFORM_OPTIONS2 }),
|
|
29228
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "text", label: "Letter Spacing", value: p.letterSpacing || "normal", onChange: (v) => update({ letterSpacing: v }), placeholder: "normal" }),
|
|
29229
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
29230
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) })
|
|
28375
29231
|
] });
|
|
28376
29232
|
}
|
|
28377
29233
|
|
|
28378
29234
|
// src/components/Properties/CountdownProperties.tsx
|
|
28379
|
-
var
|
|
29235
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
28380
29236
|
function CountdownProperties({ block }) {
|
|
28381
29237
|
const update = useBlockUpdate(block.id);
|
|
28382
29238
|
if (!narrowBlock(block, "countdown")) return null;
|
|
28383
29239
|
const p = block.properties;
|
|
28384
|
-
return /* @__PURE__ */ (0,
|
|
28385
|
-
/* @__PURE__ */ (0,
|
|
28386
|
-
/* @__PURE__ */ (0,
|
|
28387
|
-
/* @__PURE__ */ (0,
|
|
29240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29241
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
29242
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { className: properties_default.fieldLabel, children: "Target Date" }),
|
|
29243
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
28388
29244
|
"input",
|
|
28389
29245
|
{
|
|
28390
29246
|
className: properties_default.fieldInput,
|
|
@@ -28394,27 +29250,27 @@ function CountdownProperties({ block }) {
|
|
|
28394
29250
|
}
|
|
28395
29251
|
)
|
|
28396
29252
|
] }),
|
|
28397
|
-
/* @__PURE__ */ (0,
|
|
28398
|
-
/* @__PURE__ */ (0,
|
|
28399
|
-
/* @__PURE__ */ (0,
|
|
28400
|
-
/* @__PURE__ */ (0,
|
|
28401
|
-
/* @__PURE__ */ (0,
|
|
28402
|
-
/* @__PURE__ */ (0,
|
|
28403
|
-
/* @__PURE__ */ (0,
|
|
28404
|
-
/* @__PURE__ */ (0,
|
|
29253
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "text", label: "Label", value: p.label, onChange: (v) => update({ label: v }) }),
|
|
29254
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FieldSeparator, {}),
|
|
29255
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "color", label: "Digit Background", value: p.digitBackgroundColor, onChange: (v) => update({ digitBackgroundColor: v }) }),
|
|
29256
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "color", label: "Digit Color", value: p.digitColor, onChange: (v) => update({ digitColor: v }) }),
|
|
29257
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "color", label: "Label Color", value: p.labelColor, onChange: (v) => update({ labelColor: v }) }),
|
|
29258
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "text", label: "Font Size", value: p.fontSize, onChange: (v) => update({ fontSize: v }) }),
|
|
29259
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
29260
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) })
|
|
28405
29261
|
] });
|
|
28406
29262
|
}
|
|
28407
29263
|
|
|
28408
29264
|
// src/components/Properties/MenuProperties.tsx
|
|
28409
|
-
var
|
|
28410
|
-
var
|
|
29265
|
+
var import_react57 = require("react");
|
|
29266
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
28411
29267
|
var HAMBURGER_OPTIONS = [
|
|
28412
29268
|
{ value: "false", label: "Off" },
|
|
28413
29269
|
{ value: "true", label: "On" }
|
|
28414
29270
|
];
|
|
28415
29271
|
function MenuProperties({ block }) {
|
|
28416
29272
|
const update = useBlockUpdate(block.id);
|
|
28417
|
-
const updateItem = (0,
|
|
29273
|
+
const updateItem = (0, import_react57.useCallback)(
|
|
28418
29274
|
(index, changes) => {
|
|
28419
29275
|
const items = [...block.properties.items];
|
|
28420
29276
|
items[index] = { ...items[index], ...changes };
|
|
@@ -28422,18 +29278,18 @@ function MenuProperties({ block }) {
|
|
|
28422
29278
|
},
|
|
28423
29279
|
[block.properties.items, update]
|
|
28424
29280
|
);
|
|
28425
|
-
const addItem = (0,
|
|
29281
|
+
const addItem = (0, import_react57.useCallback)(() => {
|
|
28426
29282
|
const items = [...block.properties.items, { id: generateId("mi"), text: "Link", href: "#" }];
|
|
28427
29283
|
update({ items });
|
|
28428
29284
|
}, [block.properties.items, update]);
|
|
28429
|
-
const removeItem = (0,
|
|
29285
|
+
const removeItem = (0, import_react57.useCallback)(
|
|
28430
29286
|
(index) => {
|
|
28431
29287
|
const items = block.properties.items.filter((_, i) => i !== index);
|
|
28432
29288
|
update({ items });
|
|
28433
29289
|
},
|
|
28434
29290
|
[block.properties.items, update]
|
|
28435
29291
|
);
|
|
28436
|
-
const moveItem = (0,
|
|
29292
|
+
const moveItem = (0, import_react57.useCallback)(
|
|
28437
29293
|
(index, direction) => {
|
|
28438
29294
|
const items = [...block.properties.items];
|
|
28439
29295
|
const newIndex = index + direction;
|
|
@@ -28445,20 +29301,20 @@ function MenuProperties({ block }) {
|
|
|
28445
29301
|
);
|
|
28446
29302
|
if (!narrowBlock(block, "menu")) return null;
|
|
28447
29303
|
const p = block.properties;
|
|
28448
|
-
return /* @__PURE__ */ (0,
|
|
28449
|
-
/* @__PURE__ */ (0,
|
|
28450
|
-
/* @__PURE__ */ (0,
|
|
28451
|
-
/* @__PURE__ */ (0,
|
|
28452
|
-
/* @__PURE__ */ (0,
|
|
28453
|
-
p.hamburger && /* @__PURE__ */ (0,
|
|
28454
|
-
/* @__PURE__ */ (0,
|
|
28455
|
-
/* @__PURE__ */ (0,
|
|
28456
|
-
/* @__PURE__ */ (0,
|
|
28457
|
-
/* @__PURE__ */ (0,
|
|
28458
|
-
/* @__PURE__ */ (0,
|
|
28459
|
-
/* @__PURE__ */ (0,
|
|
28460
|
-
/* @__PURE__ */ (0,
|
|
28461
|
-
/* @__PURE__ */ (0,
|
|
29304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29305
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "font", label: "Font Family", value: p.fontFamily, onChange: (v) => update({ fontFamily: v }) }),
|
|
29306
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "text", label: "Font Size", value: p.fontSize, onChange: (v) => update({ fontSize: v }) }),
|
|
29307
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "color", label: "Text Color", value: p.color, onChange: (v) => update({ color: v }) }),
|
|
29308
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "select", label: "Hamburger Mode", value: p.hamburger ? "true" : "false", onChange: (v) => update({ hamburger: v === "true" }), options: HAMBURGER_OPTIONS }),
|
|
29309
|
+
p.hamburger && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "color", label: "Icon Color", value: p.iconColor, onChange: (v) => update({ iconColor: v }) }),
|
|
29310
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
29311
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) }),
|
|
29312
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FieldSeparator, {}),
|
|
29313
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: properties_default.fieldGroup, children: [
|
|
29314
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("label", { className: properties_default.fieldLabel, children: "Menu Items" }),
|
|
29315
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: blocks_default.menuItemsContainer, children: p.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: blocks_default.menuItemEntry, children: [
|
|
29316
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: properties_default.fieldRow, children: [
|
|
29317
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
28462
29318
|
"input",
|
|
28463
29319
|
{
|
|
28464
29320
|
className: properties_default.fieldInputFlex,
|
|
@@ -28467,11 +29323,11 @@ function MenuProperties({ block }) {
|
|
|
28467
29323
|
placeholder: "Label"
|
|
28468
29324
|
}
|
|
28469
29325
|
),
|
|
28470
|
-
/* @__PURE__ */ (0,
|
|
28471
|
-
/* @__PURE__ */ (0,
|
|
28472
|
-
/* @__PURE__ */ (0,
|
|
29326
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { className: `ee-item-move-up ${properties_default.itemActionBtn}`, onClick: () => moveItem(index, -1), disabled: index === 0, title: "Move up", children: "\u2191" }),
|
|
29327
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { className: `ee-item-move-down ${properties_default.itemActionBtn}`, onClick: () => moveItem(index, 1), disabled: index === p.items.length - 1, title: "Move down", children: "\u2193" }),
|
|
29328
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { className: `ee-item-remove ${properties_default.itemActionBtnDanger}`, onClick: () => removeItem(index), title: "Remove", children: "\xD7" })
|
|
28473
29329
|
] }),
|
|
28474
|
-
/* @__PURE__ */ (0,
|
|
29330
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
28475
29331
|
"input",
|
|
28476
29332
|
{
|
|
28477
29333
|
className: properties_default.fieldInputStacked,
|
|
@@ -28481,17 +29337,17 @@ function MenuProperties({ block }) {
|
|
|
28481
29337
|
}
|
|
28482
29338
|
)
|
|
28483
29339
|
] }, item.id ?? `mi-${index}`)) }),
|
|
28484
|
-
/* @__PURE__ */ (0,
|
|
29340
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { className: `ee-add-item ${properties_default.addItemBtn}`, onClick: addItem, children: "+ Add Item" })
|
|
28485
29341
|
] })
|
|
28486
29342
|
] });
|
|
28487
29343
|
}
|
|
28488
29344
|
|
|
28489
29345
|
// src/components/ImageUpload/ImageUploader.tsx
|
|
28490
|
-
var
|
|
28491
|
-
var
|
|
29346
|
+
var import_react58 = require("react");
|
|
29347
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
28492
29348
|
function ImageUploader({ blockId, onUploadComplete }) {
|
|
28493
29349
|
const { imageUploadAdapter } = useImageAdapter();
|
|
28494
|
-
const fileInputRef = (0,
|
|
29350
|
+
const fileInputRef = (0, import_react58.useRef)(null);
|
|
28495
29351
|
const { status, progress, error, upload, cancel } = useImageUpload({
|
|
28496
29352
|
adapter: imageUploadAdapter,
|
|
28497
29353
|
blockId,
|
|
@@ -28499,7 +29355,7 @@ function ImageUploader({ blockId, onUploadComplete }) {
|
|
|
28499
29355
|
onUploadComplete(result.url, result.alt);
|
|
28500
29356
|
}
|
|
28501
29357
|
});
|
|
28502
|
-
const handleFileChange = (0,
|
|
29358
|
+
const handleFileChange = (0, import_react58.useCallback)(
|
|
28503
29359
|
async (e) => {
|
|
28504
29360
|
const file = e.target.files?.[0];
|
|
28505
29361
|
if (file) {
|
|
@@ -28508,26 +29364,26 @@ function ImageUploader({ blockId, onUploadComplete }) {
|
|
|
28508
29364
|
},
|
|
28509
29365
|
[upload]
|
|
28510
29366
|
);
|
|
28511
|
-
const handleClick2 = (0,
|
|
29367
|
+
const handleClick2 = (0, import_react58.useCallback)(() => {
|
|
28512
29368
|
fileInputRef.current?.click();
|
|
28513
29369
|
}, []);
|
|
28514
|
-
return /* @__PURE__ */ (0,
|
|
28515
|
-
status === "uploading" ? /* @__PURE__ */ (0,
|
|
28516
|
-
/* @__PURE__ */ (0,
|
|
28517
|
-
/* @__PURE__ */ (0,
|
|
29370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
29371
|
+
status === "uploading" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `ee-image-uploading ${blocks_default.imageUploading}`, children: [
|
|
29372
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `ee-image-placeholder ${blocks_default.imagePlaceholder}`, children: [
|
|
29373
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
28518
29374
|
"Uploading... ",
|
|
28519
29375
|
Math.round(progress),
|
|
28520
29376
|
"%"
|
|
28521
29377
|
] }),
|
|
28522
|
-
/* @__PURE__ */ (0,
|
|
29378
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { className: "ee-upload-cancel", onClick: cancel, children: "Cancel" })
|
|
28523
29379
|
] }),
|
|
28524
|
-
/* @__PURE__ */ (0,
|
|
28525
|
-
] }) : /* @__PURE__ */ (0,
|
|
28526
|
-
/* @__PURE__ */ (0,
|
|
28527
|
-
/* @__PURE__ */ (0,
|
|
29380
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: `ee-image-progress ${blocks_default.imageProgress}`, style: { width: `${progress}%` } })
|
|
29381
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `ee-image-placeholder ${blocks_default.imagePlaceholder}`, onClick: handleClick2, children: [
|
|
29382
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: `ee-image-placeholder-icon ${blocks_default.imagePlaceholderIcon}`, children: "+" }),
|
|
29383
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Click to upload image" })
|
|
28528
29384
|
] }),
|
|
28529
|
-
error && /* @__PURE__ */ (0,
|
|
28530
|
-
/* @__PURE__ */ (0,
|
|
29385
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: `ee-image-error ${blocks_default.imageError}`, children: error }),
|
|
29386
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
28531
29387
|
"input",
|
|
28532
29388
|
{
|
|
28533
29389
|
ref: fileInputRef,
|
|
@@ -28541,39 +29397,39 @@ function ImageUploader({ blockId, onUploadComplete }) {
|
|
|
28541
29397
|
}
|
|
28542
29398
|
|
|
28543
29399
|
// src/components/Properties/HeroProperties.tsx
|
|
28544
|
-
var
|
|
29400
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
28545
29401
|
function HeroProperties({ block }) {
|
|
28546
29402
|
const update = useBlockUpdate(block.id);
|
|
28547
29403
|
if (!narrowBlock(block, "hero")) return null;
|
|
28548
29404
|
const p = block.properties;
|
|
28549
|
-
return /* @__PURE__ */ (0,
|
|
28550
|
-
/* @__PURE__ */ (0,
|
|
28551
|
-
/* @__PURE__ */ (0,
|
|
28552
|
-
/* @__PURE__ */ (0,
|
|
28553
|
-
/* @__PURE__ */ (0,
|
|
28554
|
-
/* @__PURE__ */ (0,
|
|
28555
|
-
/* @__PURE__ */ (0,
|
|
28556
|
-
/* @__PURE__ */ (0,
|
|
28557
|
-
/* @__PURE__ */ (0,
|
|
28558
|
-
/* @__PURE__ */ (0,
|
|
28559
|
-
/* @__PURE__ */ (0,
|
|
28560
|
-
/* @__PURE__ */ (0,
|
|
28561
|
-
/* @__PURE__ */ (0,
|
|
28562
|
-
/* @__PURE__ */ (0,
|
|
28563
|
-
/* @__PURE__ */ (0,
|
|
28564
|
-
/* @__PURE__ */ (0,
|
|
28565
|
-
/* @__PURE__ */ (0,
|
|
28566
|
-
/* @__PURE__ */ (0,
|
|
28567
|
-
/* @__PURE__ */ (0,
|
|
28568
|
-
/* @__PURE__ */ (0,
|
|
28569
|
-
!p.backgroundImage && /* @__PURE__ */ (0,
|
|
29405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: properties_default.propertiesBody, children: [
|
|
29406
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "text", label: "Heading", value: p.heading, onChange: (v) => update({ heading: v }) }),
|
|
29407
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "textarea", label: "Subtext", value: p.subtext, onChange: (v) => update({ subtext: v }), rows: 3 }),
|
|
29408
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldSeparator, {}),
|
|
29409
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "text", label: "Button Text", value: p.buttonText, onChange: (v) => update({ buttonText: v }) }),
|
|
29410
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "link", label: "Button Link", value: p.buttonHref, onChange: (v) => update({ buttonHref: v }) }),
|
|
29411
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldSeparator, {}),
|
|
29412
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "color", label: "Heading Color", value: p.headingColor, onChange: (v) => update({ headingColor: v }) }),
|
|
29413
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "text", label: "Heading Font Size", value: p.headingFontSize, onChange: (v) => update({ headingFontSize: v }) }),
|
|
29414
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "color", label: "Subtext Color", value: p.subtextColor, onChange: (v) => update({ subtextColor: v }) }),
|
|
29415
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "text", label: "Subtext Font Size", value: p.subtextFontSize, onChange: (v) => update({ subtextFontSize: v }) }),
|
|
29416
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldSeparator, {}),
|
|
29417
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "color", label: "Button Background", value: p.buttonBackgroundColor, onChange: (v) => update({ buttonBackgroundColor: v }) }),
|
|
29418
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "color", label: "Button Text Color", value: p.buttonColor, onChange: (v) => update({ buttonColor: v }) }),
|
|
29419
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "text", label: "Button Border Radius", value: p.buttonBorderRadius, onChange: (v) => update({ buttonBorderRadius: v }) }),
|
|
29420
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "alignment", label: "Alignment", value: p.align, onChange: (v) => update({ align: v }) }),
|
|
29421
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "padding", label: "Padding", value: p.padding, onChange: (v) => update({ padding: v }) }),
|
|
29422
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldSeparator, {}),
|
|
29423
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "color", label: "Background Color", value: p.backgroundColor, onChange: (v) => update({ backgroundColor: v }) }),
|
|
29424
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PropertyField, { type: "text", label: "Background Image URL", value: p.backgroundImage, onChange: (v) => update({ backgroundImage: v }), placeholder: "https://example.com/image.jpg" }),
|
|
29425
|
+
!p.backgroundImage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
28570
29426
|
ImageUploader,
|
|
28571
29427
|
{
|
|
28572
29428
|
blockId: block.id,
|
|
28573
29429
|
onUploadComplete: (url) => update({ backgroundImage: url })
|
|
28574
29430
|
}
|
|
28575
29431
|
),
|
|
28576
|
-
p.backgroundImage && /* @__PURE__ */ (0,
|
|
29432
|
+
p.backgroundImage && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: properties_default.fieldGroup, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
28577
29433
|
"button",
|
|
28578
29434
|
{
|
|
28579
29435
|
className: `ee-remove-bg ${properties_default.fieldBtnUpload}`,
|
|
@@ -28585,7 +29441,7 @@ function HeroProperties({ block }) {
|
|
|
28585
29441
|
}
|
|
28586
29442
|
|
|
28587
29443
|
// src/components/Properties/PropertiesPanel.tsx
|
|
28588
|
-
var
|
|
29444
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
28589
29445
|
var BUILT_IN_PANELS = {
|
|
28590
29446
|
text: TextProperties,
|
|
28591
29447
|
button: ButtonProperties,
|
|
@@ -28609,28 +29465,28 @@ function PropertiesPanel() {
|
|
|
28609
29465
|
if (selectedBlock) {
|
|
28610
29466
|
const title = selectedBlock.type.charAt(0).toUpperCase() + selectedBlock.type.slice(1);
|
|
28611
29467
|
const Component2 = getBlockPanel(selectedBlock.type);
|
|
28612
|
-
return /* @__PURE__ */ (0,
|
|
28613
|
-
/* @__PURE__ */ (0,
|
|
29468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `ee-properties-panel ${properties_default.propertiesInner}`, children: [
|
|
29469
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `ee-properties-header ${properties_default.propertiesHeader}`, children: [
|
|
28614
29470
|
title,
|
|
28615
29471
|
" Properties"
|
|
28616
29472
|
] }),
|
|
28617
|
-
Component2 ? /* @__PURE__ */ (0,
|
|
29473
|
+
Component2 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Component2, { block: selectedBlock }) : null
|
|
28618
29474
|
] });
|
|
28619
29475
|
}
|
|
28620
29476
|
if (selectedSection) {
|
|
28621
|
-
return /* @__PURE__ */ (0,
|
|
28622
|
-
/* @__PURE__ */ (0,
|
|
28623
|
-
/* @__PURE__ */ (0,
|
|
29477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `ee-properties-panel ${properties_default.propertiesInner}`, children: [
|
|
29478
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: `ee-properties-header ${properties_default.propertiesHeader}`, children: "Section Properties" }),
|
|
29479
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SectionProperties, { section: selectedSection })
|
|
28624
29480
|
] });
|
|
28625
29481
|
}
|
|
28626
|
-
return /* @__PURE__ */ (0,
|
|
28627
|
-
/* @__PURE__ */ (0,
|
|
28628
|
-
/* @__PURE__ */ (0,
|
|
29482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `ee-properties-panel ${properties_default.propertiesInner}`, children: [
|
|
29483
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: `ee-properties-header ${properties_default.propertiesHeader}`, children: "Email Settings" }),
|
|
29484
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(HeadMetadataProperties, {})
|
|
28629
29485
|
] });
|
|
28630
29486
|
}
|
|
28631
29487
|
|
|
28632
29488
|
// src/components/Preview/PreviewPanel.tsx
|
|
28633
|
-
var
|
|
29489
|
+
var import_react59 = require("react");
|
|
28634
29490
|
|
|
28635
29491
|
// src/styles/preview.module.css
|
|
28636
29492
|
var preview_default = {
|
|
@@ -28645,17 +29501,17 @@ var preview_default = {
|
|
|
28645
29501
|
};
|
|
28646
29502
|
|
|
28647
29503
|
// src/components/Preview/PreviewPanel.tsx
|
|
28648
|
-
var
|
|
29504
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
28649
29505
|
var PREVIEW_WIDTHS = {
|
|
28650
29506
|
desktop: 600,
|
|
28651
29507
|
mobile: 375
|
|
28652
29508
|
};
|
|
28653
29509
|
function PreviewPanel() {
|
|
28654
29510
|
const { template } = useTemplateContext();
|
|
28655
|
-
const [html2, setHtml] = (0,
|
|
28656
|
-
const [previewMode, setPreviewMode] = (0,
|
|
28657
|
-
const iframeRef = (0,
|
|
28658
|
-
(0,
|
|
29511
|
+
const [html2, setHtml] = (0, import_react59.useState)("");
|
|
29512
|
+
const [previewMode, setPreviewMode] = (0, import_react59.useState)("desktop");
|
|
29513
|
+
const iframeRef = (0, import_react59.useRef)(null);
|
|
29514
|
+
(0, import_react59.useEffect)(() => {
|
|
28659
29515
|
let cancelled = false;
|
|
28660
29516
|
const timer = setTimeout(() => {
|
|
28661
29517
|
async function compile() {
|
|
@@ -28672,7 +29528,7 @@ function PreviewPanel() {
|
|
|
28672
29528
|
clearTimeout(timer);
|
|
28673
29529
|
};
|
|
28674
29530
|
}, [template]);
|
|
28675
|
-
(0,
|
|
29531
|
+
(0, import_react59.useEffect)(() => {
|
|
28676
29532
|
if (iframeRef.current && html2) {
|
|
28677
29533
|
const doc3 = iframeRef.current.contentDocument;
|
|
28678
29534
|
if (doc3) {
|
|
@@ -28682,9 +29538,9 @@ function PreviewPanel() {
|
|
|
28682
29538
|
}
|
|
28683
29539
|
}
|
|
28684
29540
|
}, [html2]);
|
|
28685
|
-
return /* @__PURE__ */ (0,
|
|
28686
|
-
/* @__PURE__ */ (0,
|
|
28687
|
-
/* @__PURE__ */ (0,
|
|
29541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `ee-preview ${preview_default.preview}`, children: [
|
|
29542
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `ee-preview-toggles ${preview_default.previewToggles}`, role: "group", "aria-label": "Preview size", children: [
|
|
29543
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28688
29544
|
"button",
|
|
28689
29545
|
{
|
|
28690
29546
|
className: `ee-preview-toggle ee-preview-toggle--desktop ${preview_default.previewToggle} ${preview_default.previewToggleDesktop} ${previewMode === "desktop" ? `ee-preview-toggle--active ${preview_default.previewToggleActive}` : ""}`,
|
|
@@ -28694,7 +29550,7 @@ function PreviewPanel() {
|
|
|
28694
29550
|
children: "Desktop"
|
|
28695
29551
|
}
|
|
28696
29552
|
),
|
|
28697
|
-
/* @__PURE__ */ (0,
|
|
29553
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28698
29554
|
"button",
|
|
28699
29555
|
{
|
|
28700
29556
|
className: `ee-preview-toggle ee-preview-toggle--mobile ${preview_default.previewToggle} ${preview_default.previewToggleMobile} ${previewMode === "mobile" ? `ee-preview-toggle--active ${preview_default.previewToggleActive}` : ""}`,
|
|
@@ -28705,7 +29561,7 @@ function PreviewPanel() {
|
|
|
28705
29561
|
}
|
|
28706
29562
|
)
|
|
28707
29563
|
] }),
|
|
28708
|
-
/* @__PURE__ */ (0,
|
|
29564
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: `ee-preview-container ${preview_default.previewContainer}`, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28709
29565
|
"iframe",
|
|
28710
29566
|
{
|
|
28711
29567
|
className: `ee-preview-iframe ${preview_default.previewIframe}`,
|
|
@@ -28719,7 +29575,7 @@ function PreviewPanel() {
|
|
|
28719
29575
|
}
|
|
28720
29576
|
|
|
28721
29577
|
// src/components/SourceEditor/SourceEditor.tsx
|
|
28722
|
-
var
|
|
29578
|
+
var import_react60 = require("react");
|
|
28723
29579
|
|
|
28724
29580
|
// src/styles/source-editor.module.css
|
|
28725
29581
|
var source_editor_default = {
|
|
@@ -28732,16 +29588,16 @@ var source_editor_default = {
|
|
|
28732
29588
|
};
|
|
28733
29589
|
|
|
28734
29590
|
// src/components/SourceEditor/SourceEditor.tsx
|
|
28735
|
-
var
|
|
29591
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
28736
29592
|
function SourceEditor() {
|
|
28737
29593
|
const { template } = useTemplateContext();
|
|
28738
29594
|
const dispatch = useEditorDispatch();
|
|
28739
|
-
const [source, setSource] = (0,
|
|
28740
|
-
const [error, setError] = (0,
|
|
28741
|
-
(0,
|
|
29595
|
+
const [source, setSource] = (0, import_react60.useState)("");
|
|
29596
|
+
const [error, setError] = (0, import_react60.useState)(null);
|
|
29597
|
+
(0, import_react60.useEffect)(() => {
|
|
28742
29598
|
setSource(generateMJML(template));
|
|
28743
29599
|
}, [template]);
|
|
28744
|
-
const handleApply = (0,
|
|
29600
|
+
const handleApply = (0, import_react60.useCallback)(() => {
|
|
28745
29601
|
try {
|
|
28746
29602
|
const template2 = parseMJML(source);
|
|
28747
29603
|
dispatch({ type: "SET_TEMPLATE", payload: template2 });
|
|
@@ -28750,10 +29606,10 @@ function SourceEditor() {
|
|
|
28750
29606
|
setError(err.message);
|
|
28751
29607
|
}
|
|
28752
29608
|
}, [source, dispatch]);
|
|
28753
|
-
return /* @__PURE__ */ (0,
|
|
28754
|
-
/* @__PURE__ */ (0,
|
|
28755
|
-
/* @__PURE__ */ (0,
|
|
28756
|
-
/* @__PURE__ */ (0,
|
|
29609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `ee-source-editor ${source_editor_default.sourceEditor}`, children: [
|
|
29610
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `ee-source-header ${source_editor_default.sourceHeader}`, children: [
|
|
29611
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: `ee-source-label ${source_editor_default.sourceLabel}`, children: "MJML Source" }),
|
|
29612
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
28757
29613
|
"button",
|
|
28758
29614
|
{
|
|
28759
29615
|
className: `ee-source-apply ${source_editor_default.sourceApply}`,
|
|
@@ -28762,8 +29618,8 @@ function SourceEditor() {
|
|
|
28762
29618
|
}
|
|
28763
29619
|
)
|
|
28764
29620
|
] }),
|
|
28765
|
-
error && /* @__PURE__ */ (0,
|
|
28766
|
-
/* @__PURE__ */ (0,
|
|
29621
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: `ee-source-error ${source_editor_default.sourceError}`, children: error }),
|
|
29622
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
28767
29623
|
"textarea",
|
|
28768
29624
|
{
|
|
28769
29625
|
className: `ee-source-textarea ${source_editor_default.sourceTextarea}`,
|
|
@@ -28776,30 +29632,30 @@ function SourceEditor() {
|
|
|
28776
29632
|
}
|
|
28777
29633
|
|
|
28778
29634
|
// src/components/EmailEditor.tsx
|
|
28779
|
-
var
|
|
28780
|
-
var EditorInner = (0,
|
|
29635
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
29636
|
+
var EditorInner = (0, import_react61.forwardRef)(function EditorInner2(props, ref) {
|
|
28781
29637
|
const dispatch = useEditorDispatch();
|
|
28782
29638
|
const { template, activeTab } = useTemplateContext();
|
|
28783
29639
|
const selection = useSelectionContext();
|
|
28784
29640
|
const { clearPersisted } = useConfigContext();
|
|
28785
|
-
const containerRef = (0,
|
|
29641
|
+
const containerRef = (0, import_react61.useRef)(null);
|
|
28786
29642
|
const { onReady, onSave } = props;
|
|
28787
|
-
const [sidebarOpen, setSidebarOpen] = (0,
|
|
28788
|
-
const [propertiesOpen, setPropertiesOpen] = (0,
|
|
28789
|
-
const [pendingRemoval, setPendingRemoval] = (0,
|
|
28790
|
-
const toggleSidebar = (0,
|
|
29643
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react61.useState)(false);
|
|
29644
|
+
const [propertiesOpen, setPropertiesOpen] = (0, import_react61.useState)(false);
|
|
29645
|
+
const [pendingRemoval, setPendingRemoval] = (0, import_react61.useState)(null);
|
|
29646
|
+
const toggleSidebar = (0, import_react61.useCallback)(() => {
|
|
28791
29647
|
setSidebarOpen((prev) => !prev);
|
|
28792
29648
|
setPropertiesOpen(false);
|
|
28793
29649
|
}, []);
|
|
28794
|
-
const toggleProperties = (0,
|
|
29650
|
+
const toggleProperties = (0, import_react61.useCallback)(() => {
|
|
28795
29651
|
setPropertiesOpen((prev) => !prev);
|
|
28796
29652
|
setSidebarOpen(false);
|
|
28797
29653
|
}, []);
|
|
28798
|
-
const closeOverlays = (0,
|
|
29654
|
+
const closeOverlays = (0, import_react61.useCallback)(() => {
|
|
28799
29655
|
setSidebarOpen(false);
|
|
28800
29656
|
setPropertiesOpen(false);
|
|
28801
29657
|
}, []);
|
|
28802
|
-
(0,
|
|
29658
|
+
(0, import_react61.useEffect)(() => {
|
|
28803
29659
|
if (selection.blockId) {
|
|
28804
29660
|
if (typeof window !== "undefined" && window.innerWidth < 1024) {
|
|
28805
29661
|
setPropertiesOpen(true);
|
|
@@ -28807,16 +29663,16 @@ var EditorInner = (0, import_react59.forwardRef)(function EditorInner2(props, re
|
|
|
28807
29663
|
}
|
|
28808
29664
|
}
|
|
28809
29665
|
}, [selection.blockId]);
|
|
28810
|
-
(0,
|
|
29666
|
+
(0, import_react61.useEffect)(() => {
|
|
28811
29667
|
onReady?.();
|
|
28812
29668
|
}, []);
|
|
28813
|
-
const templateRef = (0,
|
|
29669
|
+
const templateRef = (0, import_react61.useRef)(template);
|
|
28814
29670
|
templateRef.current = template;
|
|
28815
|
-
const selectionRef = (0,
|
|
29671
|
+
const selectionRef = (0, import_react61.useRef)(selection);
|
|
28816
29672
|
selectionRef.current = selection;
|
|
28817
|
-
const onSaveRef = (0,
|
|
29673
|
+
const onSaveRef = (0, import_react61.useRef)(onSave);
|
|
28818
29674
|
onSaveRef.current = onSave;
|
|
28819
|
-
(0,
|
|
29675
|
+
(0, import_react61.useEffect)(() => {
|
|
28820
29676
|
const el = containerRef.current;
|
|
28821
29677
|
if (!el) return;
|
|
28822
29678
|
const handler = (e) => {
|
|
@@ -28861,7 +29717,7 @@ var EditorInner = (0, import_react59.forwardRef)(function EditorInner2(props, re
|
|
|
28861
29717
|
el.addEventListener("keydown", handler);
|
|
28862
29718
|
return () => el.removeEventListener("keydown", handler);
|
|
28863
29719
|
}, [dispatch]);
|
|
28864
|
-
const handleConfirmRemoval = (0,
|
|
29720
|
+
const handleConfirmRemoval = (0, import_react61.useCallback)(() => {
|
|
28865
29721
|
if (!pendingRemoval) return;
|
|
28866
29722
|
if (pendingRemoval.type === "block") {
|
|
28867
29723
|
dispatch({ type: "REMOVE_BLOCK", payload: pendingRemoval });
|
|
@@ -28870,7 +29726,7 @@ var EditorInner = (0, import_react59.forwardRef)(function EditorInner2(props, re
|
|
|
28870
29726
|
}
|
|
28871
29727
|
setPendingRemoval(null);
|
|
28872
29728
|
}, [dispatch, pendingRemoval]);
|
|
28873
|
-
(0,
|
|
29729
|
+
(0, import_react61.useImperativeHandle)(ref, () => ({
|
|
28874
29730
|
getMJML: () => generateMJML(templateRef.current),
|
|
28875
29731
|
getHTML: async () => {
|
|
28876
29732
|
const mjml = generateMJML(templateRef.current);
|
|
@@ -28954,8 +29810,8 @@ var EditorInner = (0, import_react59.forwardRef)(function EditorInner2(props, re
|
|
|
28954
29810
|
editor_default.panelOverlay,
|
|
28955
29811
|
sidebarOpen || propertiesOpen ? editor_default.panelOverlayVisible : ""
|
|
28956
29812
|
].filter(Boolean).join(" ");
|
|
28957
|
-
return /* @__PURE__ */ (0,
|
|
28958
|
-
pendingRemoval && /* @__PURE__ */ (0,
|
|
29813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { ref: containerRef, className: `ee-editor ${editor_default.editorContainer}`, tabIndex: -1, children: [
|
|
29814
|
+
pendingRemoval && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
28959
29815
|
ConfirmDialog,
|
|
28960
29816
|
{
|
|
28961
29817
|
title: pendingRemoval.type === "block" ? "Remove Block" : "Remove Section",
|
|
@@ -28964,7 +29820,7 @@ var EditorInner = (0, import_react59.forwardRef)(function EditorInner2(props, re
|
|
|
28964
29820
|
onCancel: () => setPendingRemoval(null)
|
|
28965
29821
|
}
|
|
28966
29822
|
),
|
|
28967
|
-
/* @__PURE__ */ (0,
|
|
29823
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
28968
29824
|
Toolbar,
|
|
28969
29825
|
{
|
|
28970
29826
|
sidebarOpen,
|
|
@@ -28973,22 +29829,22 @@ var EditorInner = (0, import_react59.forwardRef)(function EditorInner2(props, re
|
|
|
28973
29829
|
onToggleProperties: toggleProperties
|
|
28974
29830
|
}
|
|
28975
29831
|
),
|
|
28976
|
-
/* @__PURE__ */ (0,
|
|
28977
|
-
activeTab === "visual" && /* @__PURE__ */ (0,
|
|
28978
|
-
/* @__PURE__ */ (0,
|
|
28979
|
-
/* @__PURE__ */ (0,
|
|
28980
|
-
/* @__PURE__ */ (0,
|
|
28981
|
-
/* @__PURE__ */ (0,
|
|
29832
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: editor_default.editorBody, children: [
|
|
29833
|
+
activeTab === "visual" && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
29834
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-sidebar ${sidebarClasses}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Sidebar, { blockDefinitions: props.blockDefinitions }) }) }),
|
|
29835
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-canvas ${editor_default.editorPanel} ${editor_default.canvasPanel}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Canvas, {}) }) }),
|
|
29836
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-properties ${propertiesClasses}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PropertiesPanel, {}) }) }),
|
|
29837
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: overlayClasses, onClick: closeOverlays })
|
|
28982
29838
|
] }),
|
|
28983
|
-
activeTab === "source" && /* @__PURE__ */ (0,
|
|
28984
|
-
/* @__PURE__ */ (0,
|
|
28985
|
-
/* @__PURE__ */ (0,
|
|
29839
|
+
activeTab === "source" && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `ee-source-layout ${editor_default.sourceLayout}`, children: [
|
|
29840
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-source-pane ${editor_default.sourcePane}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SourceEditor, {}) }) }),
|
|
29841
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-preview-pane ${editor_default.sourcePaneDivider}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PreviewPanel, {}) }) })
|
|
28986
29842
|
] }),
|
|
28987
|
-
activeTab === "preview" && /* @__PURE__ */ (0,
|
|
29843
|
+
activeTab === "preview" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PreviewPanel, {}) })
|
|
28988
29844
|
] })
|
|
28989
29845
|
] });
|
|
28990
29846
|
});
|
|
28991
|
-
var EmailEditor = (0,
|
|
29847
|
+
var EmailEditor = (0, import_react61.forwardRef)(
|
|
28992
29848
|
function EmailEditor2(props, ref) {
|
|
28993
29849
|
const {
|
|
28994
29850
|
initialTemplate,
|
|
@@ -29000,6 +29856,8 @@ var EmailEditor = (0, import_react59.forwardRef)(
|
|
|
29000
29856
|
onVariablesChange,
|
|
29001
29857
|
fontFamilies,
|
|
29002
29858
|
fontSizes,
|
|
29859
|
+
colorPresets,
|
|
29860
|
+
onColorPresetsChange,
|
|
29003
29861
|
persistenceKey,
|
|
29004
29862
|
persistenceAdapter,
|
|
29005
29863
|
className,
|
|
@@ -29021,7 +29879,7 @@ var EmailEditor = (0, import_react59.forwardRef)(
|
|
|
29021
29879
|
template = void 0;
|
|
29022
29880
|
}
|
|
29023
29881
|
}
|
|
29024
|
-
return /* @__PURE__ */ (0,
|
|
29882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
29025
29883
|
EditorProvider,
|
|
29026
29884
|
{
|
|
29027
29885
|
initialTemplate: template,
|
|
@@ -29032,6 +29890,8 @@ var EmailEditor = (0, import_react59.forwardRef)(
|
|
|
29032
29890
|
onVariablesChange,
|
|
29033
29891
|
fontFamilies,
|
|
29034
29892
|
fontSizes,
|
|
29893
|
+
colorPresets,
|
|
29894
|
+
onColorPresetsChange,
|
|
29035
29895
|
persistenceKey,
|
|
29036
29896
|
persistenceAdapter,
|
|
29037
29897
|
onBlockAdd,
|
|
@@ -29042,7 +29902,7 @@ var EmailEditor = (0, import_react59.forwardRef)(
|
|
|
29042
29902
|
onSelectionChange,
|
|
29043
29903
|
onTemplateLoad,
|
|
29044
29904
|
onHistoryChange,
|
|
29045
|
-
children: /* @__PURE__ */ (0,
|
|
29905
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-editor-wrapper ${editor_default.editorWrapper} ${className || ""}`, style: style2, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EditorInner, { ref, ...props }) })
|
|
29046
29906
|
}
|
|
29047
29907
|
);
|
|
29048
29908
|
}
|