@maily-to/core 0.0.23 → 0.0.24
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/extensions/index.d.mts +11 -1
- package/dist/extensions/index.d.ts +11 -1
- package/dist/extensions/index.js +214 -72
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +169 -31
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +230 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -227,19 +227,29 @@ declare const DEFAULT_BUTTON_VARIANT: AllowedButtonVariant;
|
|
|
227
227
|
declare const DEFAULT_BUTTON_BORDER_RADIUS: AllowedButtonBorderRadius;
|
|
228
228
|
declare const DEFAULT_BUTTON_BACKGROUND_COLOR = "#000000";
|
|
229
229
|
declare const DEFAULT_BUTTON_TEXT_COLOR = "#ffffff";
|
|
230
|
+
declare const DEFAULT_BUTTON_PADDING_TOP = 10;
|
|
231
|
+
declare const DEFAULT_BUTTON_PADDING_RIGHT = 32;
|
|
232
|
+
declare const DEFAULT_BUTTON_PADDING_BOTTOM = 10;
|
|
233
|
+
declare const DEFAULT_BUTTON_PADDING_LEFT = 32;
|
|
230
234
|
declare const allowedButtonVariant: readonly ["filled", "outline"];
|
|
231
235
|
type AllowedButtonVariant = (typeof allowedButtonVariant)[number];
|
|
232
236
|
declare const allowedButtonBorderRadius: readonly ["sharp", "smooth", "round"];
|
|
233
237
|
type AllowedButtonBorderRadius = (typeof allowedButtonBorderRadius)[number];
|
|
234
238
|
type ButtonAttributes = {
|
|
235
239
|
text: string;
|
|
240
|
+
isTextVariable: boolean;
|
|
236
241
|
url: string;
|
|
242
|
+
isUrlVariable: boolean;
|
|
237
243
|
alignment: AllowedLogoAlignment;
|
|
238
244
|
variant: AllowedButtonVariant;
|
|
239
245
|
borderRadius: AllowedButtonBorderRadius;
|
|
240
246
|
buttonColor: string;
|
|
241
247
|
textColor: string;
|
|
242
248
|
showIfKey: string;
|
|
249
|
+
paddingTop: number;
|
|
250
|
+
paddingRight: number;
|
|
251
|
+
paddingBottom: number;
|
|
252
|
+
paddingLeft: number;
|
|
243
253
|
};
|
|
244
254
|
declare module '@tiptap/core' {
|
|
245
255
|
interface Commands<ReturnType> {
|
|
@@ -297,4 +307,4 @@ type VariableListProps = {
|
|
|
297
307
|
declare const VariableList: react.ForwardRefExoticComponent<VariableListProps & react.RefAttributes<unknown>>;
|
|
298
308
|
declare function getVariableSuggestions(variables?: Variables, char?: string): Omit<SuggestionOptions, 'editor'>;
|
|
299
309
|
|
|
300
|
-
export { type AllowedButtonBorderRadius, type AllowedButtonVariant, type AllowedColumnVerticalAlign, type AllowedLogoAlignment, type AllowedLogoSize, type AllowedSpacerSize, ButtonExtension, Color, ColumnExtension, ColumnsExtension, DEFAULT_BUTTON_ALIGNMENT, DEFAULT_BUTTON_BACKGROUND_COLOR, DEFAULT_BUTTON_BORDER_RADIUS, DEFAULT_BUTTON_TEXT_COLOR, DEFAULT_BUTTON_VARIANT, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMN_VERTICAL_ALIGN, DEFAULT_COLUMN_WIDTH, DEFAULT_LOGO_SIZE, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_RADIUS, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, DEFAULT_SECTION_SHOW_IF_KEY, Footer, type FooterOptions, ForExtension, HorizontalRule, ImageExtension, LinkExtension, type LogoAttributes, LogoExtension, MailyKit, type MailyKitOptions, SectionExtension, SlashCommandExtension, type SlashCommandOptions, Spacer, type SpacerOptions, VariableExtension, VariableList, type VariableOptions, VariablePluginKey, allowedButtonBorderRadius, allowedButtonVariant, allowedLogoAlignment, allowedLogoSize, allowedSpacerSize, getSlashCommandSuggestions, getVariableSuggestions, logoSizes };
|
|
310
|
+
export { type AllowedButtonBorderRadius, type AllowedButtonVariant, type AllowedColumnVerticalAlign, type AllowedLogoAlignment, type AllowedLogoSize, type AllowedSpacerSize, type ButtonAttributes, ButtonExtension, Color, ColumnExtension, ColumnsExtension, DEFAULT_BUTTON_ALIGNMENT, DEFAULT_BUTTON_BACKGROUND_COLOR, DEFAULT_BUTTON_BORDER_RADIUS, DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_BUTTON_TEXT_COLOR, DEFAULT_BUTTON_VARIANT, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMN_VERTICAL_ALIGN, DEFAULT_COLUMN_WIDTH, DEFAULT_LOGO_SIZE, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_RADIUS, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, DEFAULT_SECTION_SHOW_IF_KEY, Footer, type FooterOptions, ForExtension, HorizontalRule, ImageExtension, LinkExtension, type LogoAttributes, LogoExtension, MailyKit, type MailyKitOptions, SectionExtension, SlashCommandExtension, type SlashCommandOptions, Spacer, type SpacerOptions, VariableExtension, VariableList, type VariableOptions, VariablePluginKey, allowedButtonBorderRadius, allowedButtonVariant, allowedLogoAlignment, allowedLogoSize, allowedSpacerSize, getSlashCommandSuggestions, getVariableSuggestions, logoSizes };
|
|
@@ -227,19 +227,29 @@ declare const DEFAULT_BUTTON_VARIANT: AllowedButtonVariant;
|
|
|
227
227
|
declare const DEFAULT_BUTTON_BORDER_RADIUS: AllowedButtonBorderRadius;
|
|
228
228
|
declare const DEFAULT_BUTTON_BACKGROUND_COLOR = "#000000";
|
|
229
229
|
declare const DEFAULT_BUTTON_TEXT_COLOR = "#ffffff";
|
|
230
|
+
declare const DEFAULT_BUTTON_PADDING_TOP = 10;
|
|
231
|
+
declare const DEFAULT_BUTTON_PADDING_RIGHT = 32;
|
|
232
|
+
declare const DEFAULT_BUTTON_PADDING_BOTTOM = 10;
|
|
233
|
+
declare const DEFAULT_BUTTON_PADDING_LEFT = 32;
|
|
230
234
|
declare const allowedButtonVariant: readonly ["filled", "outline"];
|
|
231
235
|
type AllowedButtonVariant = (typeof allowedButtonVariant)[number];
|
|
232
236
|
declare const allowedButtonBorderRadius: readonly ["sharp", "smooth", "round"];
|
|
233
237
|
type AllowedButtonBorderRadius = (typeof allowedButtonBorderRadius)[number];
|
|
234
238
|
type ButtonAttributes = {
|
|
235
239
|
text: string;
|
|
240
|
+
isTextVariable: boolean;
|
|
236
241
|
url: string;
|
|
242
|
+
isUrlVariable: boolean;
|
|
237
243
|
alignment: AllowedLogoAlignment;
|
|
238
244
|
variant: AllowedButtonVariant;
|
|
239
245
|
borderRadius: AllowedButtonBorderRadius;
|
|
240
246
|
buttonColor: string;
|
|
241
247
|
textColor: string;
|
|
242
248
|
showIfKey: string;
|
|
249
|
+
paddingTop: number;
|
|
250
|
+
paddingRight: number;
|
|
251
|
+
paddingBottom: number;
|
|
252
|
+
paddingLeft: number;
|
|
243
253
|
};
|
|
244
254
|
declare module '@tiptap/core' {
|
|
245
255
|
interface Commands<ReturnType> {
|
|
@@ -297,4 +307,4 @@ type VariableListProps = {
|
|
|
297
307
|
declare const VariableList: react.ForwardRefExoticComponent<VariableListProps & react.RefAttributes<unknown>>;
|
|
298
308
|
declare function getVariableSuggestions(variables?: Variables, char?: string): Omit<SuggestionOptions, 'editor'>;
|
|
299
309
|
|
|
300
|
-
export { type AllowedButtonBorderRadius, type AllowedButtonVariant, type AllowedColumnVerticalAlign, type AllowedLogoAlignment, type AllowedLogoSize, type AllowedSpacerSize, ButtonExtension, Color, ColumnExtension, ColumnsExtension, DEFAULT_BUTTON_ALIGNMENT, DEFAULT_BUTTON_BACKGROUND_COLOR, DEFAULT_BUTTON_BORDER_RADIUS, DEFAULT_BUTTON_TEXT_COLOR, DEFAULT_BUTTON_VARIANT, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMN_VERTICAL_ALIGN, DEFAULT_COLUMN_WIDTH, DEFAULT_LOGO_SIZE, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_RADIUS, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, DEFAULT_SECTION_SHOW_IF_KEY, Footer, type FooterOptions, ForExtension, HorizontalRule, ImageExtension, LinkExtension, type LogoAttributes, LogoExtension, MailyKit, type MailyKitOptions, SectionExtension, SlashCommandExtension, type SlashCommandOptions, Spacer, type SpacerOptions, VariableExtension, VariableList, type VariableOptions, VariablePluginKey, allowedButtonBorderRadius, allowedButtonVariant, allowedLogoAlignment, allowedLogoSize, allowedSpacerSize, getSlashCommandSuggestions, getVariableSuggestions, logoSizes };
|
|
310
|
+
export { type AllowedButtonBorderRadius, type AllowedButtonVariant, type AllowedColumnVerticalAlign, type AllowedLogoAlignment, type AllowedLogoSize, type AllowedSpacerSize, type ButtonAttributes, ButtonExtension, Color, ColumnExtension, ColumnsExtension, DEFAULT_BUTTON_ALIGNMENT, DEFAULT_BUTTON_BACKGROUND_COLOR, DEFAULT_BUTTON_BORDER_RADIUS, DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_BUTTON_TEXT_COLOR, DEFAULT_BUTTON_VARIANT, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMN_VERTICAL_ALIGN, DEFAULT_COLUMN_WIDTH, DEFAULT_LOGO_SIZE, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_RADIUS, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, DEFAULT_SECTION_SHOW_IF_KEY, Footer, type FooterOptions, ForExtension, HorizontalRule, ImageExtension, LinkExtension, type LogoAttributes, LogoExtension, MailyKit, type MailyKitOptions, SectionExtension, SlashCommandExtension, type SlashCommandOptions, Spacer, type SpacerOptions, VariableExtension, VariableList, type VariableOptions, VariablePluginKey, allowedButtonBorderRadius, allowedButtonVariant, allowedLogoAlignment, allowedLogoSize, allowedSpacerSize, getSlashCommandSuggestions, getVariableSuggestions, logoSizes };
|
package/dist/extensions/index.js
CHANGED
|
@@ -66,6 +66,10 @@ __export(extensions_exports, {
|
|
|
66
66
|
DEFAULT_BUTTON_ALIGNMENT: () => DEFAULT_BUTTON_ALIGNMENT,
|
|
67
67
|
DEFAULT_BUTTON_BACKGROUND_COLOR: () => DEFAULT_BUTTON_BACKGROUND_COLOR,
|
|
68
68
|
DEFAULT_BUTTON_BORDER_RADIUS: () => DEFAULT_BUTTON_BORDER_RADIUS,
|
|
69
|
+
DEFAULT_BUTTON_PADDING_BOTTOM: () => DEFAULT_BUTTON_PADDING_BOTTOM,
|
|
70
|
+
DEFAULT_BUTTON_PADDING_LEFT: () => DEFAULT_BUTTON_PADDING_LEFT,
|
|
71
|
+
DEFAULT_BUTTON_PADDING_RIGHT: () => DEFAULT_BUTTON_PADDING_RIGHT,
|
|
72
|
+
DEFAULT_BUTTON_PADDING_TOP: () => DEFAULT_BUTTON_PADDING_TOP,
|
|
69
73
|
DEFAULT_BUTTON_TEXT_COLOR: () => DEFAULT_BUTTON_TEXT_COLOR,
|
|
70
74
|
DEFAULT_BUTTON_VARIANT: () => DEFAULT_BUTTON_VARIANT,
|
|
71
75
|
DEFAULT_COLUMNS_GAP: () => DEFAULT_COLUMNS_GAP,
|
|
@@ -728,8 +732,8 @@ function LinkCardComponent(props) {
|
|
|
728
732
|
import_react.NodeViewWrapper,
|
|
729
733
|
{
|
|
730
734
|
className: `react-component ${props.selected && "ProseMirror-selectednode"}`,
|
|
731
|
-
draggable:
|
|
732
|
-
"data-drag-handle":
|
|
735
|
+
draggable: editor.isEditable,
|
|
736
|
+
"data-drag-handle": editor.isEditable,
|
|
733
737
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Popover, { open: props.selected, children: [
|
|
734
738
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
735
739
|
"div",
|
|
@@ -746,7 +750,8 @@ function LinkCardComponent(props) {
|
|
|
746
750
|
{
|
|
747
751
|
src: image2,
|
|
748
752
|
alt: "link-card",
|
|
749
|
-
className: "mly-no-prose !mly-mb-0 mly-h-full mly-w-full mly-rounded-t-lg"
|
|
753
|
+
className: "mly-no-prose !mly-mb-0 mly-h-full mly-w-full mly-rounded-t-lg",
|
|
754
|
+
draggable: editor.isEditable
|
|
750
755
|
}
|
|
751
756
|
) }),
|
|
752
757
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mly-flex mly-items-stretch mly-p-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn("mly-flex mly-flex-col"), children: [
|
|
@@ -1211,8 +1216,8 @@ function ForView(props) {
|
|
|
1211
1216
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1212
1217
|
import_react3.NodeViewWrapper,
|
|
1213
1218
|
{
|
|
1214
|
-
draggable:
|
|
1215
|
-
"data-drag-handle":
|
|
1219
|
+
draggable: editor.isEditable,
|
|
1220
|
+
"data-drag-handle": editor.isEditable,
|
|
1216
1221
|
"data-type": "for",
|
|
1217
1222
|
className: "mly-relative",
|
|
1218
1223
|
children: [
|
|
@@ -1322,7 +1327,7 @@ var ForExtension = import_core10.Node.create({
|
|
|
1322
1327
|
|
|
1323
1328
|
// src/editor/nodes/button/button.tsx
|
|
1324
1329
|
var import_core11 = require("@tiptap/core");
|
|
1325
|
-
var
|
|
1330
|
+
var import_react22 = require("@tiptap/react");
|
|
1326
1331
|
|
|
1327
1332
|
// src/editor/components/alignment-switch.tsx
|
|
1328
1333
|
var import_lucide_react2 = require("lucide-react");
|
|
@@ -1851,12 +1856,23 @@ function VariableView(props) {
|
|
|
1851
1856
|
className: "react-component mly-inline-block mly-leading-none",
|
|
1852
1857
|
draggable: "false",
|
|
1853
1858
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Popover, { children: [
|
|
1854
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1860
|
+
PopoverTrigger,
|
|
1861
|
+
{
|
|
1862
|
+
onClick: (e) => {
|
|
1863
|
+
if (!editor.isEditable) {
|
|
1864
|
+
e.preventDefault();
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1868
|
+
children: renderVariable({
|
|
1869
|
+
variable: { name: id, required, valid: true },
|
|
1870
|
+
fallback,
|
|
1871
|
+
editor,
|
|
1872
|
+
from: "content-variable"
|
|
1873
|
+
})
|
|
1874
|
+
}
|
|
1875
|
+
),
|
|
1860
1876
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1861
1877
|
PopoverContent,
|
|
1862
1878
|
{
|
|
@@ -1948,10 +1964,12 @@ var DefaultRenderVariable = (props) => {
|
|
|
1948
1964
|
|
|
1949
1965
|
// src/editor/provider.tsx
|
|
1950
1966
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1967
|
+
var DEFAULT_PLACEHOLDER_URL = "maily.to/";
|
|
1951
1968
|
var DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
|
|
1952
1969
|
var DEFAULT_VARIABLES = [];
|
|
1953
1970
|
var DEFAULT_RENDER_VARIABLE_FUNCTION = DefaultRenderVariable;
|
|
1954
1971
|
var MailyContext = (0, import_react6.createContext)({
|
|
1972
|
+
placeholderUrl: DEFAULT_PLACEHOLDER_URL,
|
|
1955
1973
|
variableTriggerCharacter: DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
1956
1974
|
variables: DEFAULT_VARIABLES,
|
|
1957
1975
|
blocks: DEFAULT_SLASH_COMMANDS,
|
|
@@ -2220,7 +2238,8 @@ function LinkInputPopover(props) {
|
|
|
2220
2238
|
const {
|
|
2221
2239
|
variables = [],
|
|
2222
2240
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
2223
|
-
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION
|
|
2241
|
+
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
2242
|
+
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
2224
2243
|
} = useMailyContext();
|
|
2225
2244
|
const autoCompleteOptions = (0, import_react12.useMemo)(() => {
|
|
2226
2245
|
const withoutTrigger = defaultUrlWithoutProtocol.replace(
|
|
@@ -2340,7 +2359,7 @@ function LinkInputPopover(props) {
|
|
|
2340
2359
|
},
|
|
2341
2360
|
autoCompleteOptions,
|
|
2342
2361
|
ref: linkInputRef,
|
|
2343
|
-
placeholder:
|
|
2362
|
+
placeholder: placeholderUrl,
|
|
2344
2363
|
className: "-mly-ms-px mly-block mly-h-8 mly-w-52 mly-rounded-lg mly-rounded-s-none mly-border mly-border-gray-300 mly-px-2 mly-py-1.5 mly-pr-6 mly-text-sm mly-shadow-sm mly-outline-none placeholder:mly-text-gray-400",
|
|
2345
2364
|
triggerChar: variableTriggerCharacter,
|
|
2346
2365
|
onSelectOption: (value) => {
|
|
@@ -2551,7 +2570,8 @@ function ButtonLabelInput(props) {
|
|
|
2551
2570
|
const {
|
|
2552
2571
|
variables = [],
|
|
2553
2572
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
2554
|
-
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION
|
|
2573
|
+
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
2574
|
+
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
2555
2575
|
} = useMailyContext();
|
|
2556
2576
|
const autoCompleteOptions = (0, import_react17.useMemo)(() => {
|
|
2557
2577
|
const withoutTrigger = value.replace(
|
|
@@ -2595,7 +2615,7 @@ function ButtonLabelInput(props) {
|
|
|
2595
2615
|
},
|
|
2596
2616
|
autoCompleteOptions,
|
|
2597
2617
|
ref: linkInputRef,
|
|
2598
|
-
placeholder:
|
|
2618
|
+
placeholder: placeholderUrl,
|
|
2599
2619
|
className: "mly-h-7 mly-w-40 mly-rounded-md mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray hover:mly-bg-soft-gray focus:mly-bg-soft-gray focus:mly-outline-none",
|
|
2600
2620
|
triggerChar: variableTriggerCharacter,
|
|
2601
2621
|
onSelectOption: (value2) => {
|
|
@@ -2612,6 +2632,7 @@ function ButtonLabelInput(props) {
|
|
|
2612
2632
|
}
|
|
2613
2633
|
|
|
2614
2634
|
// src/editor/nodes/button/button-view.tsx
|
|
2635
|
+
var import_react21 = require("react");
|
|
2615
2636
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2616
2637
|
function ButtonView(props) {
|
|
2617
2638
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
@@ -2625,26 +2646,52 @@ function ButtonView(props) {
|
|
|
2625
2646
|
textColor,
|
|
2626
2647
|
url: externalLink,
|
|
2627
2648
|
showIfKey = "",
|
|
2628
|
-
isUrlVariable
|
|
2649
|
+
isUrlVariable,
|
|
2650
|
+
paddingTop,
|
|
2651
|
+
paddingRight,
|
|
2652
|
+
paddingBottom,
|
|
2653
|
+
paddingLeft
|
|
2629
2654
|
} = node.attrs;
|
|
2630
2655
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2656
|
+
const sizes = (0, import_react21.useMemo)(
|
|
2657
|
+
() => ({
|
|
2658
|
+
small: {
|
|
2659
|
+
paddingX: 24,
|
|
2660
|
+
paddingY: 6
|
|
2661
|
+
},
|
|
2662
|
+
medium: {
|
|
2663
|
+
paddingX: 32,
|
|
2664
|
+
paddingY: 10
|
|
2665
|
+
},
|
|
2666
|
+
large: {
|
|
2667
|
+
paddingX: 40,
|
|
2668
|
+
paddingY: 14
|
|
2669
|
+
}
|
|
2670
|
+
}),
|
|
2671
|
+
[]
|
|
2672
|
+
);
|
|
2673
|
+
const size = (0, import_react21.useMemo)(() => {
|
|
2674
|
+
var _a;
|
|
2675
|
+
return (_a = Object.entries(sizes).find(
|
|
2676
|
+
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
2677
|
+
)) == null ? void 0 : _a[0];
|
|
2678
|
+
}, [paddingRight, paddingTop, sizes]);
|
|
2631
2679
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2632
2680
|
import_react20.NodeViewWrapper,
|
|
2633
2681
|
{
|
|
2634
|
-
draggable:
|
|
2635
|
-
"data-drag-handle":
|
|
2682
|
+
draggable: editor.isEditable,
|
|
2683
|
+
"data-drag-handle": editor.isEditable,
|
|
2636
2684
|
"data-type": "button",
|
|
2637
2685
|
style: {
|
|
2638
2686
|
textAlign: alignment
|
|
2639
2687
|
},
|
|
2640
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Popover, { open: props.selected, children: [
|
|
2688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
2641
2689
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2642
2690
|
"button",
|
|
2643
2691
|
{
|
|
2644
2692
|
className: cn(
|
|
2645
2693
|
"mly-inline-flex mly-items-center mly-justify-center mly-rounded-md mly-text-sm mly-font-medium mly-ring-offset-white mly-transition-colors disabled:mly-pointer-events-none disabled:mly-opacity-50",
|
|
2646
|
-
"mly-
|
|
2647
|
-
"mly-px-[32px] mly-py-[20px] mly-font-semibold mly-no-underline",
|
|
2694
|
+
"mly-font-semibold mly-no-underline",
|
|
2648
2695
|
{
|
|
2649
2696
|
"!mly-rounded-full": _radius === "round",
|
|
2650
2697
|
"!mly-rounded-md": _radius === "smooth",
|
|
@@ -2660,10 +2707,17 @@ function ButtonView(props) {
|
|
|
2660
2707
|
borderColor: buttonColor,
|
|
2661
2708
|
// decrease the border color opacity to 80%
|
|
2662
2709
|
// so that it's not too prominent
|
|
2663
|
-
"--button-var-border-color": `${textColor}80
|
|
2710
|
+
"--button-var-border-color": `${textColor}80`,
|
|
2711
|
+
paddingTop,
|
|
2712
|
+
paddingRight,
|
|
2713
|
+
paddingBottom,
|
|
2714
|
+
paddingLeft
|
|
2664
2715
|
},
|
|
2665
2716
|
onClick: (e) => {
|
|
2666
2717
|
e.preventDefault();
|
|
2718
|
+
if (!editor.isEditable) {
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2667
2721
|
const pos = getPos();
|
|
2668
2722
|
editor.commands.setNodeSelection(pos);
|
|
2669
2723
|
},
|
|
@@ -2736,6 +2790,28 @@ function ButtonView(props) {
|
|
|
2736
2790
|
tooltip: "Style",
|
|
2737
2791
|
className: "mly-capitalize"
|
|
2738
2792
|
}
|
|
2793
|
+
),
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2795
|
+
Select,
|
|
2796
|
+
{
|
|
2797
|
+
label: "Size",
|
|
2798
|
+
value: size,
|
|
2799
|
+
options: [
|
|
2800
|
+
{ value: "small", label: "Small" },
|
|
2801
|
+
{ value: "medium", label: "Medium" },
|
|
2802
|
+
{ value: "large", label: "Large" }
|
|
2803
|
+
],
|
|
2804
|
+
onValueChange: (value) => {
|
|
2805
|
+
const { paddingX, paddingY } = sizes[value];
|
|
2806
|
+
updateAttributes2({
|
|
2807
|
+
paddingTop: paddingY,
|
|
2808
|
+
paddingRight: paddingX,
|
|
2809
|
+
paddingBottom: paddingY,
|
|
2810
|
+
paddingLeft: paddingX
|
|
2811
|
+
});
|
|
2812
|
+
},
|
|
2813
|
+
tooltip: "Size"
|
|
2814
|
+
}
|
|
2739
2815
|
)
|
|
2740
2816
|
] }),
|
|
2741
2817
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Divider, {}),
|
|
@@ -2874,6 +2950,10 @@ var DEFAULT_BUTTON_VARIANT = "filled";
|
|
|
2874
2950
|
var DEFAULT_BUTTON_BORDER_RADIUS = "smooth";
|
|
2875
2951
|
var DEFAULT_BUTTON_BACKGROUND_COLOR = "#000000";
|
|
2876
2952
|
var DEFAULT_BUTTON_TEXT_COLOR = "#ffffff";
|
|
2953
|
+
var DEFAULT_BUTTON_PADDING_TOP = 10;
|
|
2954
|
+
var DEFAULT_BUTTON_PADDING_RIGHT = 32;
|
|
2955
|
+
var DEFAULT_BUTTON_PADDING_BOTTOM = 10;
|
|
2956
|
+
var DEFAULT_BUTTON_PADDING_LEFT = 32;
|
|
2877
2957
|
var allowedButtonVariant = ["filled", "outline"];
|
|
2878
2958
|
var allowedButtonBorderRadius = ["sharp", "smooth", "round"];
|
|
2879
2959
|
var ButtonExtension = import_core11.Node.create({
|
|
@@ -3004,6 +3084,62 @@ var ButtonExtension = import_core11.Node.create({
|
|
|
3004
3084
|
"data-show-if-key": attributes.showIfKey
|
|
3005
3085
|
};
|
|
3006
3086
|
}
|
|
3087
|
+
},
|
|
3088
|
+
paddingTop: {
|
|
3089
|
+
default: DEFAULT_BUTTON_PADDING_TOP,
|
|
3090
|
+
parseHTML: (element) => {
|
|
3091
|
+
return parseInt(
|
|
3092
|
+
element.getAttribute("data-padding-top") || DEFAULT_BUTTON_PADDING_TOP.toString(),
|
|
3093
|
+
10
|
|
3094
|
+
);
|
|
3095
|
+
},
|
|
3096
|
+
renderHTML: (attributes) => {
|
|
3097
|
+
return {
|
|
3098
|
+
"data-padding-top": attributes.paddingTop
|
|
3099
|
+
};
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3102
|
+
paddingRight: {
|
|
3103
|
+
default: DEFAULT_BUTTON_PADDING_RIGHT,
|
|
3104
|
+
parseHTML: (element) => {
|
|
3105
|
+
return parseInt(
|
|
3106
|
+
element.getAttribute("data-padding-right") || DEFAULT_BUTTON_PADDING_RIGHT.toString(),
|
|
3107
|
+
10
|
|
3108
|
+
);
|
|
3109
|
+
},
|
|
3110
|
+
renderHTML: (attributes) => {
|
|
3111
|
+
return {
|
|
3112
|
+
"data-padding-right": attributes.paddingRight
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
},
|
|
3116
|
+
paddingBottom: {
|
|
3117
|
+
default: DEFAULT_BUTTON_PADDING_BOTTOM,
|
|
3118
|
+
parseHTML: (element) => {
|
|
3119
|
+
return parseInt(
|
|
3120
|
+
element.getAttribute("data-padding-bottom") || DEFAULT_BUTTON_PADDING_BOTTOM.toString(),
|
|
3121
|
+
10
|
|
3122
|
+
);
|
|
3123
|
+
},
|
|
3124
|
+
renderHTML: (attributes) => {
|
|
3125
|
+
return {
|
|
3126
|
+
"data-padding-bottom": attributes.paddingBottom
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
},
|
|
3130
|
+
paddingLeft: {
|
|
3131
|
+
default: DEFAULT_BUTTON_PADDING_LEFT,
|
|
3132
|
+
parseHTML: (element) => {
|
|
3133
|
+
return parseInt(
|
|
3134
|
+
element.getAttribute("data-padding-left") || DEFAULT_BUTTON_PADDING_LEFT.toString(),
|
|
3135
|
+
10
|
|
3136
|
+
);
|
|
3137
|
+
},
|
|
3138
|
+
renderHTML: (attributes) => {
|
|
3139
|
+
return {
|
|
3140
|
+
"data-padding-left": attributes.paddingLeft
|
|
3141
|
+
};
|
|
3142
|
+
}
|
|
3007
3143
|
}
|
|
3008
3144
|
};
|
|
3009
3145
|
},
|
|
@@ -3035,7 +3171,7 @@ var ButtonExtension = import_core11.Node.create({
|
|
|
3035
3171
|
};
|
|
3036
3172
|
},
|
|
3037
3173
|
addNodeView() {
|
|
3038
|
-
return (0,
|
|
3174
|
+
return (0, import_react22.ReactNodeViewRenderer)(ButtonView, {
|
|
3039
3175
|
contentDOMElementTag: "div",
|
|
3040
3176
|
className: "mly-relative"
|
|
3041
3177
|
});
|
|
@@ -3044,21 +3180,21 @@ var ButtonExtension = import_core11.Node.create({
|
|
|
3044
3180
|
|
|
3045
3181
|
// src/editor/nodes/logo/logo.ts
|
|
3046
3182
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
3047
|
-
var
|
|
3183
|
+
var import_react29 = require("@tiptap/react");
|
|
3048
3184
|
|
|
3049
3185
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3050
|
-
var
|
|
3051
|
-
var import_react26 = require("react");
|
|
3186
|
+
var import_react26 = require("@tiptap/react");
|
|
3052
3187
|
var import_react27 = require("react");
|
|
3188
|
+
var import_react28 = require("react");
|
|
3053
3189
|
|
|
3054
3190
|
// src/editor/utils/use-event.ts
|
|
3055
|
-
var
|
|
3191
|
+
var import_react23 = require("react");
|
|
3056
3192
|
var useEvent = (handler) => {
|
|
3057
|
-
const handlerRef = (0,
|
|
3058
|
-
(0,
|
|
3193
|
+
const handlerRef = (0, import_react23.useRef)(null);
|
|
3194
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
3059
3195
|
handlerRef.current = handler;
|
|
3060
3196
|
}, [handler]);
|
|
3061
|
-
return (0,
|
|
3197
|
+
return (0, import_react23.useCallback)((...args) => {
|
|
3062
3198
|
if (handlerRef.current === null) {
|
|
3063
3199
|
throw new Error("Handler is not assigned");
|
|
3064
3200
|
}
|
|
@@ -3067,18 +3203,18 @@ var useEvent = (handler) => {
|
|
|
3067
3203
|
};
|
|
3068
3204
|
|
|
3069
3205
|
// src/editor/nodes/image/image-view.tsx
|
|
3070
|
-
var
|
|
3206
|
+
var import_react24 = require("@tiptap/react");
|
|
3071
3207
|
var import_lucide_react14 = require("lucide-react");
|
|
3072
|
-
var
|
|
3208
|
+
var import_react25 = require("react");
|
|
3073
3209
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3074
3210
|
var MIN_WIDTH = 20;
|
|
3075
3211
|
var MAX_WIDTH = 600;
|
|
3076
3212
|
function ImageView(props) {
|
|
3077
|
-
const { node, updateAttributes: updateAttributes2, selected } = props;
|
|
3078
|
-
const [status, setStatus] = (0,
|
|
3079
|
-
const wrapperRef = (0,
|
|
3080
|
-
const imgRef = (0,
|
|
3081
|
-
const [resizingStyle, setResizingStyle] = (0,
|
|
3213
|
+
const { node, updateAttributes: updateAttributes2, selected, editor } = props;
|
|
3214
|
+
const [status, setStatus] = (0, import_react25.useState)("idle");
|
|
3215
|
+
const wrapperRef = (0, import_react25.useRef)(null);
|
|
3216
|
+
const imgRef = (0, import_react25.useRef)(null);
|
|
3217
|
+
const [resizingStyle, setResizingStyle] = (0, import_react25.useState)();
|
|
3082
3218
|
const handleMouseDown = useEvent(
|
|
3083
3219
|
(event) => {
|
|
3084
3220
|
const imageParent = document.querySelector(
|
|
@@ -3152,7 +3288,7 @@ function ImageView(props) {
|
|
|
3152
3288
|
"showIfKey"
|
|
3153
3289
|
]);
|
|
3154
3290
|
const hasImageSrc = !!attrs.src;
|
|
3155
|
-
(0,
|
|
3291
|
+
(0, import_react25.useEffect)(() => {
|
|
3156
3292
|
if (!src) {
|
|
3157
3293
|
return;
|
|
3158
3294
|
}
|
|
@@ -3187,11 +3323,11 @@ function ImageView(props) {
|
|
|
3187
3323
|
};
|
|
3188
3324
|
}, [src]);
|
|
3189
3325
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3190
|
-
|
|
3326
|
+
import_react24.NodeViewWrapper,
|
|
3191
3327
|
{
|
|
3192
3328
|
as: "div",
|
|
3193
|
-
draggable:
|
|
3194
|
-
"data-drag-handle":
|
|
3329
|
+
draggable: editor.isEditable,
|
|
3330
|
+
"data-drag-handle": editor.isEditable,
|
|
3195
3331
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
3196
3332
|
width: `${width}px`,
|
|
3197
3333
|
height: `${height}px`
|
|
@@ -3220,10 +3356,11 @@ function ImageView(props) {
|
|
|
3220
3356
|
style: __spreadProps(__spreadValues({}, resizingStyle), {
|
|
3221
3357
|
cursor: "default",
|
|
3222
3358
|
marginBottom: 0
|
|
3223
|
-
})
|
|
3359
|
+
}),
|
|
3360
|
+
draggable: editor.isEditable
|
|
3224
3361
|
})
|
|
3225
3362
|
),
|
|
3226
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
3363
|
+
selected && editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
3227
3364
|
[
|
|
3228
3365
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
3229
3366
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
@@ -3286,8 +3423,8 @@ function ImageStatusLabel(props) {
|
|
|
3286
3423
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3287
3424
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3288
3425
|
function LogoView(props) {
|
|
3289
|
-
const { node } = props;
|
|
3290
|
-
const [status, setStatus] = (0,
|
|
3426
|
+
const { node, editor } = props;
|
|
3427
|
+
const [status, setStatus] = (0, import_react28.useState)("idle");
|
|
3291
3428
|
let {
|
|
3292
3429
|
alignment = "center",
|
|
3293
3430
|
src: logoSrc,
|
|
@@ -3295,7 +3432,7 @@ function LogoView(props) {
|
|
|
3295
3432
|
size = "sm"
|
|
3296
3433
|
} = node.attrs || {};
|
|
3297
3434
|
const hasImageSrc = !!logoSrc;
|
|
3298
|
-
(0,
|
|
3435
|
+
(0, import_react27.useEffect)(() => {
|
|
3299
3436
|
if (!logoSrc) {
|
|
3300
3437
|
return;
|
|
3301
3438
|
}
|
|
@@ -3316,11 +3453,11 @@ function LogoView(props) {
|
|
|
3316
3453
|
}, [logoSrc]);
|
|
3317
3454
|
const logoSize = logoSizes[size];
|
|
3318
3455
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3319
|
-
|
|
3456
|
+
import_react26.NodeViewWrapper,
|
|
3320
3457
|
{
|
|
3321
3458
|
as: "div",
|
|
3322
|
-
draggable:
|
|
3323
|
-
"data-drag-handle":
|
|
3459
|
+
draggable: editor.isEditable,
|
|
3460
|
+
"data-drag-handle": editor.isEditable,
|
|
3324
3461
|
style: {
|
|
3325
3462
|
overflow: "hidden",
|
|
3326
3463
|
position: "relative",
|
|
@@ -3347,7 +3484,8 @@ function LogoView(props) {
|
|
|
3347
3484
|
center: { marginLeft: "auto", marginRight: "auto" },
|
|
3348
3485
|
left: { marginRight: "auto" },
|
|
3349
3486
|
right: { marginLeft: "auto" }
|
|
3350
|
-
}[alignment] || {})
|
|
3487
|
+
}[alignment] || {}),
|
|
3488
|
+
draggable: editor.isEditable
|
|
3351
3489
|
}
|
|
3352
3490
|
)
|
|
3353
3491
|
]
|
|
@@ -3452,7 +3590,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3452
3590
|
];
|
|
3453
3591
|
},
|
|
3454
3592
|
addNodeView() {
|
|
3455
|
-
return (0,
|
|
3593
|
+
return (0, import_react29.ReactNodeViewRenderer)(LogoView, {
|
|
3456
3594
|
className: "mly-relative"
|
|
3457
3595
|
});
|
|
3458
3596
|
}
|
|
@@ -3460,7 +3598,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3460
3598
|
|
|
3461
3599
|
// src/editor/nodes/image/image.ts
|
|
3462
3600
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
3463
|
-
var
|
|
3601
|
+
var import_react30 = require("@tiptap/react");
|
|
3464
3602
|
var ImageExtension = import_extension_image2.default.extend({
|
|
3465
3603
|
addAttributes() {
|
|
3466
3604
|
var _a;
|
|
@@ -3552,7 +3690,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
3552
3690
|
});
|
|
3553
3691
|
},
|
|
3554
3692
|
addNodeView() {
|
|
3555
|
-
return (0,
|
|
3693
|
+
return (0, import_react30.ReactNodeViewRenderer)(ImageView, {
|
|
3556
3694
|
className: "mly-relative"
|
|
3557
3695
|
});
|
|
3558
3696
|
}
|
|
@@ -3740,14 +3878,14 @@ var updateScrollView = (container, item) => {
|
|
|
3740
3878
|
};
|
|
3741
3879
|
|
|
3742
3880
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
3743
|
-
var
|
|
3744
|
-
var
|
|
3881
|
+
var import_react31 = require("@tiptap/react");
|
|
3882
|
+
var import_react32 = require("react");
|
|
3745
3883
|
var import_tippy = __toESM(require("tippy.js"));
|
|
3746
3884
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3747
3885
|
function CommandList(props) {
|
|
3748
3886
|
const { items, command, editor } = props;
|
|
3749
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3750
|
-
const selectItem = (0,
|
|
3887
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react32.useState)(0);
|
|
3888
|
+
const selectItem = (0, import_react32.useCallback)(
|
|
3751
3889
|
(index) => {
|
|
3752
3890
|
const item = items[index];
|
|
3753
3891
|
if (item) {
|
|
@@ -3757,7 +3895,7 @@ function CommandList(props) {
|
|
|
3757
3895
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3758
3896
|
[command, editor, items]
|
|
3759
3897
|
);
|
|
3760
|
-
(0,
|
|
3898
|
+
(0, import_react32.useEffect)(() => {
|
|
3761
3899
|
const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
|
|
3762
3900
|
const onKeyDown = (e) => {
|
|
3763
3901
|
if (navigationKeys.includes(e.key)) {
|
|
@@ -3782,11 +3920,11 @@ function CommandList(props) {
|
|
|
3782
3920
|
document.removeEventListener("keydown", onKeyDown);
|
|
3783
3921
|
};
|
|
3784
3922
|
}, [items, selectedIndex, setSelectedIndex, selectItem]);
|
|
3785
|
-
(0,
|
|
3923
|
+
(0, import_react32.useEffect)(() => {
|
|
3786
3924
|
setSelectedIndex(0);
|
|
3787
3925
|
}, [items]);
|
|
3788
|
-
const commandListContainer = (0,
|
|
3789
|
-
(0,
|
|
3926
|
+
const commandListContainer = (0, import_react32.useRef)(null);
|
|
3927
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
3790
3928
|
const container = commandListContainer == null ? void 0 : commandListContainer.current;
|
|
3791
3929
|
const item = container == null ? void 0 : container.children[selectedIndex];
|
|
3792
3930
|
if (item && container) {
|
|
@@ -3859,7 +3997,7 @@ function getSlashCommandSuggestions(commands = DEFAULT_SLASH_COMMANDS) {
|
|
|
3859
3997
|
let popup = null;
|
|
3860
3998
|
return {
|
|
3861
3999
|
onStart: (props) => {
|
|
3862
|
-
component = new
|
|
4000
|
+
component = new import_react31.ReactRenderer(CommandList, {
|
|
3863
4001
|
props,
|
|
3864
4002
|
editor: props.editor
|
|
3865
4003
|
});
|
|
@@ -3901,7 +4039,7 @@ function getSlashCommandSuggestions(commands = DEFAULT_SLASH_COMMANDS) {
|
|
|
3901
4039
|
// src/editor/nodes/variable/variable.ts
|
|
3902
4040
|
var import_core14 = require("@tiptap/core");
|
|
3903
4041
|
var import_state2 = require("@tiptap/pm/state");
|
|
3904
|
-
var
|
|
4042
|
+
var import_react33 = require("@tiptap/react");
|
|
3905
4043
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"));
|
|
3906
4044
|
var VariablePluginKey = new import_state2.PluginKey("variable");
|
|
3907
4045
|
var VariableExtension = import_core14.Node.create({
|
|
@@ -4054,7 +4192,7 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4054
4192
|
];
|
|
4055
4193
|
},
|
|
4056
4194
|
addNodeView() {
|
|
4057
|
-
return (0,
|
|
4195
|
+
return (0, import_react33.ReactNodeViewRenderer)(VariableView, {
|
|
4058
4196
|
className: "mly-relative mly-inline-block",
|
|
4059
4197
|
as: "div"
|
|
4060
4198
|
});
|
|
@@ -4062,15 +4200,15 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4062
4200
|
});
|
|
4063
4201
|
|
|
4064
4202
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
4065
|
-
var
|
|
4066
|
-
var import_react34 = require("react");
|
|
4067
|
-
var import_tippy2 = __toESM(require("tippy.js"));
|
|
4203
|
+
var import_react34 = require("@tiptap/react");
|
|
4068
4204
|
var import_react35 = require("react");
|
|
4205
|
+
var import_tippy2 = __toESM(require("tippy.js"));
|
|
4206
|
+
var import_react36 = require("react");
|
|
4069
4207
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4070
|
-
var VariableList = (0,
|
|
4208
|
+
var VariableList = (0, import_react35.forwardRef)((props, ref) => {
|
|
4071
4209
|
const { items = [] } = props;
|
|
4072
|
-
const popoverRef = (0,
|
|
4073
|
-
(0,
|
|
4210
|
+
const popoverRef = (0, import_react36.useRef)(null);
|
|
4211
|
+
(0, import_react35.useImperativeHandle)(ref, () => ({
|
|
4074
4212
|
onKeyDown: ({ event }) => {
|
|
4075
4213
|
if (!popoverRef.current) {
|
|
4076
4214
|
return false;
|
|
@@ -4124,7 +4262,7 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4124
4262
|
let popup = null;
|
|
4125
4263
|
return {
|
|
4126
4264
|
onStart: (props) => {
|
|
4127
|
-
component = new
|
|
4265
|
+
component = new import_react34.ReactRenderer(VariableList, {
|
|
4128
4266
|
props,
|
|
4129
4267
|
editor: props.editor
|
|
4130
4268
|
});
|
|
@@ -4179,6 +4317,10 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4179
4317
|
DEFAULT_BUTTON_ALIGNMENT,
|
|
4180
4318
|
DEFAULT_BUTTON_BACKGROUND_COLOR,
|
|
4181
4319
|
DEFAULT_BUTTON_BORDER_RADIUS,
|
|
4320
|
+
DEFAULT_BUTTON_PADDING_BOTTOM,
|
|
4321
|
+
DEFAULT_BUTTON_PADDING_LEFT,
|
|
4322
|
+
DEFAULT_BUTTON_PADDING_RIGHT,
|
|
4323
|
+
DEFAULT_BUTTON_PADDING_TOP,
|
|
4182
4324
|
DEFAULT_BUTTON_TEXT_COLOR,
|
|
4183
4325
|
DEFAULT_BUTTON_VARIANT,
|
|
4184
4326
|
DEFAULT_COLUMNS_GAP,
|