@maily-to/core 0.0.24 → 0.0.26
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/blocks/index.d.mts +2 -2
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.js +7 -7
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/index.mjs +6 -6
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.d.mts +8 -8
- package/dist/extensions/index.d.ts +8 -8
- package/dist/extensions/index.js +493 -443
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +414 -364
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +170 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +168 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -22,7 +22,7 @@ type Variable = {
|
|
|
22
22
|
};
|
|
23
23
|
type VariableFunctionOptions = {
|
|
24
24
|
query: string;
|
|
25
|
-
from: 'content-variable' | 'bubble-variable' | '
|
|
25
|
+
from: 'content-variable' | 'bubble-variable' | 'repeat-variable';
|
|
26
26
|
editor: Editor$1;
|
|
27
27
|
};
|
|
28
28
|
type VariablesFunction = (opts: VariableFunctionOptions) => Array<Variable>;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ type Variable = {
|
|
|
22
22
|
};
|
|
23
23
|
type VariableFunctionOptions = {
|
|
24
24
|
query: string;
|
|
25
|
-
from: 'content-variable' | 'bubble-variable' | '
|
|
25
|
+
from: 'content-variable' | 'bubble-variable' | 'repeat-variable';
|
|
26
26
|
editor: Editor$1;
|
|
27
27
|
};
|
|
28
28
|
type VariablesFunction = (opts: VariableFunctionOptions) => Array<Variable>;
|
package/dist/index.js
CHANGED
|
@@ -87,7 +87,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/styles/index.css
|
|
90
|
-
styleInject(':root {\n --placeholder-color: #adb5bd;\n --bg-color: #ffffff;\n --variable-icon-size: 12px;\n --variable-icon-gap: 4px;\n}\n.mly-editor .mly-prose p:where([class~=text-sm]) {\n font-size: 16px;\n}\n.mly-editor .mly-prose h1,\n.mly-editor .mly-prose h2,\n.mly-editor .mly-prose h3 {\n margin-top: 0;\n margin-bottom: 12px;\n}\n.mly-editor .mly-prose h1 {\n font-size: 36px;\n}\n.mly-editor .mly-prose h2 {\n font-size: 30px;\n}\n.mly-editor .mly-prose h3 {\n font-size: 24px;\n}\n.mly-editor .mly-prose p {\n font-size: 15px;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose h1 + p,\n.mly-editor .mly-prose h2 + p,\n.mly-editor .mly-prose h3 + p,\n.mly-editor .mly-prose hr + p,\n.mly-editor .mly-prose table + p {\n margin-top: 0;\n}\n.mly-editor .mly-prose ol,\n.mly-editor .mly-prose ul {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose li:not(:last-child) {\n margin-bottom: 8px;\n}\n.mly-editor .mly-prose li > p {\n margin: 0;\n}\n.mly-editor .mly-prose img,\n.mly-editor .mly-prose .node-logo {\n margin-top: 0;\n margin-bottom: 32px;\n}\n.mly-editor .mly-prose hr {\n margin-block: 32px;\n}\n.mly-editor .mly-prose .footer {\n display: block;\n font-size: 13px;\n margin-bottom: 20px;\n color: rgb(100, 116, 139);\n}\n.mly-editor .mly-prose .spacer + * {\n margin-top: 0;\n}\n.mly-editor .mly-prose p + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose blockquote + .spacer {\n margin-top: -16px;\n}\n.mly-editor .mly-prose h1 + .spacer,\n.mly-editor .mly-prose h2 + .spacer,\n.mly-editor .mly-prose h3 + .spacer {\n margin-top: -12px;\n}\n.mly-editor .mly-prose ol + .spacer,\n.mly-editor .mly-prose ul + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose img + .spacer,\n.mly-editor .mly-prose .node-logo + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose .node-button + .spacer,\n.mly-editor .mly-prose .node-linkCard + .spacer,\n.mly-editor .mly-prose footer + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose .node-button,\n.mly-editor .mly-prose .node-linkCard {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose .node-image {\n line-height: 0;\n margin-top: 0;\n margin-bottom: 32px;\n outline: none;\n}\n.mly-editor .mly-prose .node-image + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose code::before,\n.mly-editor .mly-prose code::after {\n content: none;\n}\n.mly-no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n.mly-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n.mly-editor .react-colorful__alpha {\n border-radius: 0;\n}\n.mly-editor .react-colorful__saturation,\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n border-radius: 8px;\n}\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n height: 16px;\n}\n.mly-editor .react-colorful__pointer {\n width: 16px;\n height: 16px;\n}\n.mly-editable .ProseMirror-selectednode::after {\n content: "";\n position: absolute;\n inset: -2px;\n pointer-events: none;\n border-radius: 6px;\n background: rgba(35, 131, 226, 0.14);\n}\n.mly-prose {\n strong {\n color: currentColor;\n }\n}\n.ProseMirror {\n position: relative;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0;\n &:focus {\n outline: none;\n }\n p {\n margin-top: 0;\n }\n h1 {\n --variable-icon-size: 28px;\n }\n h2 {\n --variable-icon-size: 24px;\n }\n h3 {\n --variable-icon-size: 20px;\n }\n h1,\n h2,\n h3 {\n --variable-icon-gap: 8px;\n }\n .is-editor-empty:first-child:not([data-type=columns], [data-type=section], ul, li, ol)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n .is-empty:not([data-type=columns], [data-type=section], ol, ul, li)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n [data-type=columns] .is-empty::before,\n [data-type=section] .is-empty::before {\n --l-threshold: 0.66;\n --diff: calc(var(--l-threshold) - l);\n color: oklch(from var(--bg-color) clamp(0.05, max(min(var(--diff) * infinity, 1), 0), 0.95) c h) !important;\n opacity: 0.6;\n }\n [data-type=columns] {\n display: flex;\n margin: 0;\n padding: 0;\n &.has-focus [data-type=column],\n &:hover [data-type=column] {\n outline: 1.5px solid #e9ecef;\n outline-style: dashed;\n }\n [data-type=column].has-focus {\n outline-style: solid;\n }\n }\n [data-type=column] {\n display: table-cell;\n flex-basis: 0;\n flex-grow: 1;\n overflow: auto;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n [data-type=section] {\n margin: 0;\n padding: 0;\n [data-type=section-cell] {\n padding: 0;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n [data-type=
|
|
90
|
+
styleInject(':root {\n --placeholder-color: #adb5bd;\n --bg-color: #ffffff;\n --variable-icon-size: 12px;\n --variable-icon-gap: 4px;\n}\n.mly-editor .mly-prose p:where([class~=text-sm]) {\n font-size: 16px;\n}\n.mly-editor .mly-prose h1,\n.mly-editor .mly-prose h2,\n.mly-editor .mly-prose h3 {\n margin-top: 0;\n margin-bottom: 12px;\n}\n.mly-editor .mly-prose h1 {\n font-size: 36px;\n}\n.mly-editor .mly-prose h2 {\n font-size: 30px;\n}\n.mly-editor .mly-prose h3 {\n font-size: 24px;\n}\n.mly-editor .mly-prose p {\n font-size: 15px;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose h1 + p,\n.mly-editor .mly-prose h2 + p,\n.mly-editor .mly-prose h3 + p,\n.mly-editor .mly-prose hr + p,\n.mly-editor .mly-prose table + p {\n margin-top: 0;\n}\n.mly-editor .mly-prose ol,\n.mly-editor .mly-prose ul {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose li:not(:last-child) {\n margin-bottom: 8px;\n}\n.mly-editor .mly-prose li > p {\n margin: 0;\n}\n.mly-editor .mly-prose img,\n.mly-editor .mly-prose .node-logo {\n margin-top: 0;\n margin-bottom: 32px;\n}\n.mly-editor .mly-prose hr {\n margin-block: 32px;\n}\n.mly-editor .mly-prose .footer {\n display: block;\n font-size: 13px;\n margin-bottom: 20px;\n color: rgb(100, 116, 139);\n}\n.mly-editor .mly-prose .spacer + * {\n margin-top: 0;\n}\n.mly-editor .mly-prose p + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose blockquote + .spacer {\n margin-top: -16px;\n}\n.mly-editor .mly-prose h1 + .spacer,\n.mly-editor .mly-prose h2 + .spacer,\n.mly-editor .mly-prose h3 + .spacer {\n margin-top: -12px;\n}\n.mly-editor .mly-prose ol + .spacer,\n.mly-editor .mly-prose ul + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose img + .spacer,\n.mly-editor .mly-prose .node-logo + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose .node-button + .spacer,\n.mly-editor .mly-prose .node-linkCard + .spacer,\n.mly-editor .mly-prose footer + .spacer {\n margin-top: -20px;\n}\n.mly-editor .mly-prose .node-button,\n.mly-editor .mly-prose .node-linkCard {\n margin-top: 0;\n margin-bottom: 20px;\n}\n.mly-editor .mly-prose .node-image {\n line-height: 0;\n margin-top: 0;\n margin-bottom: 32px;\n outline: none;\n}\n.mly-editor .mly-prose .node-image + .spacer {\n margin-top: -32px;\n}\n.mly-editor .mly-prose code::before,\n.mly-editor .mly-prose code::after {\n content: none;\n}\n.mly-no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n.mly-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n.mly-editor .react-colorful__alpha {\n border-radius: 0;\n}\n.mly-editor .react-colorful__saturation,\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n border-radius: 8px;\n}\n.mly-editor .react-colorful__hue,\n.mly-editor .react-colorful__alpha {\n height: 16px;\n}\n.mly-editor .react-colorful__pointer {\n width: 16px;\n height: 16px;\n}\n.mly-editable .ProseMirror-selectednode::after {\n content: "";\n position: absolute;\n inset: -2px;\n pointer-events: none;\n border-radius: 6px;\n background: rgba(35, 131, 226, 0.14);\n}\n.mly-prose {\n strong {\n color: currentColor;\n }\n}\n.ProseMirror {\n position: relative;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0;\n &:focus {\n outline: none;\n }\n p {\n margin-top: 0;\n }\n h1 {\n --variable-icon-size: 28px;\n }\n h2 {\n --variable-icon-size: 24px;\n }\n h3 {\n --variable-icon-size: 20px;\n }\n h1,\n h2,\n h3 {\n --variable-icon-gap: 8px;\n }\n .is-editor-empty:first-child:not([data-type=columns], [data-type=section], ul, li, ol)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n .is-empty:not([data-type=columns], [data-type=section], ol, ul, li)::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--placeholder-color);\n pointer-events: none;\n height: 0;\n }\n [data-type=columns] .is-empty::before,\n [data-type=section] .is-empty::before {\n --l-threshold: 0.66;\n --diff: calc(var(--l-threshold) - l);\n color: oklch(from var(--bg-color) clamp(0.05, max(min(var(--diff) * infinity, 1), 0), 0.95) c h) !important;\n opacity: 0.6;\n }\n [data-type=columns] {\n display: flex;\n margin: 0;\n padding: 0;\n &.has-focus [data-type=column],\n &:hover [data-type=column] {\n outline: 1.5px solid #e9ecef;\n outline-style: dashed;\n }\n [data-type=column].has-focus {\n outline-style: solid;\n }\n }\n [data-type=column] {\n display: table-cell;\n flex-basis: 0;\n flex-grow: 1;\n overflow: auto;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n [data-type=section] {\n margin: 0;\n padding: 0;\n [data-type=section-cell] {\n padding: 0;\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n [data-type=repeat] {\n [data-node-view-content] > div {\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n .node-repeat.has-focus [data-repeat-indicator] {\n opacity: 1;\n }\n [data-type=show] {\n [data-node-view-content] > div {\n & > *:first-child {\n margin-top: 0;\n }\n & > *:last-child {\n margin-bottom: 0;\n }\n }\n }\n *:has(+ .ProseMirror-gapcursor) {\n margin-bottom: 0 !important;\n }\n .ProseMirror-gapcursor {\n &::after {\n border: 1.5px solid gray;\n width: 24px;\n }\n & + * {\n margin-top: 0 !important;\n }\n }\n}\n.hide-number-controls {\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &[type=number] {\n -moz-appearance: textfield;\n }\n}\n.hide-scrollbars {\n scrollbar-width: none;\n -ms-overflow-style: none;\n &::-webkit-scrollbar {\n display: none;\n }\n}\n');
|
|
91
91
|
|
|
92
92
|
// src/styles/preflight.css
|
|
93
93
|
styleInject(':where(.mly-editor),\n:where(.mly-editor) ::before,\n:where(.mly-editor) ::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: #e5e7eb;\n}\n:where(.mly-editor) ::before,\n:where(.mly-editor) ::after {\n --tw-content: "";\n}\n:where(.mly-editor) html {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n font-family:\n ui-sans-serif,\n system-ui,\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-feature-settings: normal;\n font-variation-settings: normal;\n}\n:where(.mly-editor) body {\n margin: 0;\n line-height: inherit;\n}\n:where(.mly-editor) hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n}\n:where(.mly-editor) abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n:where(.mly-editor) h1,\n:where(.mly-editor) h2,\n:where(.mly-editor) h3,\n:where(.mly-editor) h4,\n:where(.mly-editor) h5,\n:where(.mly-editor) h6 {\n font-size: inherit;\n font-weight: inherit;\n}\n:where(.mly-editor) a {\n color: inherit;\n text-decoration: inherit;\n}\n:where(.mly-editor) b,\n:where(.mly-editor) strong {\n font-weight: bolder;\n}\n:where(.mly-editor) code,\n:where(.mly-editor) kbd,\n:where(.mly-editor) samp,\n:where(.mly-editor) pre {\n font-family:\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace;\n font-size: 1em;\n}\n:where(.mly-editor) small {\n font-size: 80%;\n}\n:where(.mly-editor) sub,\n:where(.mly-editor) sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n:where(.mly-editor) sub {\n bottom: -0.25em;\n}\n:where(.mly-editor) sup {\n top: -0.5em;\n}\n:where(.mly-editor) table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) input,\n:where(.mly-editor) optgroup,\n:where(.mly-editor) select,\n:where(.mly-editor) textarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) select {\n text-transform: none;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) [type=button],\n:where(.mly-editor) [type=reset],\n:where(.mly-editor) [type=submit] {\n -webkit-appearance: button;\n background-image: none;\n}\n:where(.mly-editor) :-moz-focusring {\n outline: auto;\n}\n:where(.mly-editor) :-moz-ui-invalid {\n box-shadow: none;\n}\n:where(.mly-editor) progress {\n vertical-align: baseline;\n}\n:where(.mly-editor) ::-webkit-inner-spin-button,\n:where(.mly-editor) ::-webkit-outer-spin-button {\n height: auto;\n}\n:where(.mly-editor) [type=search] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n:where(.mly-editor) ::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n:where(.mly-editor) ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n:where(.mly-editor) summary {\n display: list-item;\n}\n:where(.mly-editor) blockquote,\n:where(.mly-editor) dl,\n:where(.mly-editor) dd,\n:where(.mly-editor) h1,\n:where(.mly-editor) h2,\n:where(.mly-editor) h3,\n:where(.mly-editor) h4,\n:where(.mly-editor) h5,\n:where(.mly-editor) h6,\n:where(.mly-editor) hr,\n:where(.mly-editor) figure,\n:where(.mly-editor) p,\n:where(.mly-editor) pre {\n margin: 0;\n}\n:where(.mly-editor) fieldset {\n margin: 0;\n padding: 0;\n}\n:where(.mly-editor) legend {\n padding: 0;\n}\n:where(.mly-editor) ol,\n:where(.mly-editor) ul,\n:where(.mly-editor) menu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n:where(.mly-editor) dialog {\n padding: 0;\n}\n:where(.mly-editor) textarea {\n resize: vertical;\n}\n:where(.mly-editor) input::-moz-placeholder,\n:where(.mly-editor) textarea::-moz-placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n:where(.mly-editor) input::placeholder,\n:where(.mly-editor) textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n:where(.mly-editor) button,\n:where(.mly-editor) [role=button] {\n cursor: pointer;\n}\n:where(.mly-editor) :disabled {\n cursor: default;\n}\n:where(.mly-editor) img,\n:where(.mly-editor) svg,\n:where(.mly-editor) video,\n:where(.mly-editor) canvas,\n:where(.mly-editor) audio,\n:where(.mly-editor) iframe,\n:where(.mly-editor) embed,\n:where(.mly-editor) object {\n display: block;\n vertical-align: middle;\n}\n:where(.mly-editor) img,\n:where(.mly-editor) video {\n max-width: 100%;\n height: auto;\n}\n:where(.mly-editor) [hidden] {\n display: none;\n}\n');
|
|
@@ -948,16 +948,16 @@ var section = {
|
|
|
948
948
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
949
949
|
}
|
|
950
950
|
};
|
|
951
|
-
var
|
|
952
|
-
title: "
|
|
951
|
+
var repeat = {
|
|
952
|
+
title: "Repeat",
|
|
953
953
|
description: "Loop over an array of items.",
|
|
954
|
-
searchTerms: ["for", "loop"],
|
|
954
|
+
searchTerms: ["repeat", "for", "loop"],
|
|
955
955
|
icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react6.Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
956
956
|
shouldBeHidden: (editor) => {
|
|
957
|
-
return editor.isActive("
|
|
957
|
+
return editor.isActive("repeat");
|
|
958
958
|
},
|
|
959
959
|
command: ({ editor, range }) => {
|
|
960
|
-
editor.chain().focus().deleteRange(range).
|
|
960
|
+
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
961
961
|
}
|
|
962
962
|
};
|
|
963
963
|
var spacer = {
|
|
@@ -1089,7 +1089,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
1089
1089
|
logo,
|
|
1090
1090
|
columns,
|
|
1091
1091
|
section,
|
|
1092
|
-
|
|
1092
|
+
repeat,
|
|
1093
1093
|
divider,
|
|
1094
1094
|
spacer,
|
|
1095
1095
|
button,
|
|
@@ -1668,7 +1668,7 @@ function ColumnsBubbleMenu(props) {
|
|
|
1668
1668
|
}, [editor]);
|
|
1669
1669
|
const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
|
|
1670
1670
|
shouldShow: ({ editor: editor2 }) => {
|
|
1671
|
-
if (isTextSelected(editor2) || editor2.isActive("section") || editor2.isActive("
|
|
1671
|
+
if (isTextSelected(editor2) || editor2.isActive("section") || editor2.isActive("repeat") || !editor2.isEditable) {
|
|
1672
1672
|
return false;
|
|
1673
1673
|
}
|
|
1674
1674
|
return editor2.isActive("columns");
|
|
@@ -2390,23 +2390,23 @@ var EditorMenuBar = (props) => {
|
|
|
2390
2390
|
);
|
|
2391
2391
|
};
|
|
2392
2392
|
|
|
2393
|
-
// src/editor/components/
|
|
2393
|
+
// src/editor/components/repeat-menu/repeat-bubble-menu.tsx
|
|
2394
2394
|
var import_react18 = require("@tiptap/react");
|
|
2395
2395
|
var import_lucide_react16 = require("lucide-react");
|
|
2396
2396
|
var import_react19 = require("react");
|
|
2397
2397
|
var import_tippy3 = require("tippy.js");
|
|
2398
2398
|
|
|
2399
|
-
// src/editor/components/
|
|
2399
|
+
// src/editor/components/repeat-menu/use-repeat-state.ts
|
|
2400
2400
|
var import_react17 = require("@tiptap/react");
|
|
2401
2401
|
var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"));
|
|
2402
|
-
var
|
|
2402
|
+
var useRepeatState = (editor) => {
|
|
2403
2403
|
const states = (0, import_react17.useEditorState)({
|
|
2404
2404
|
editor,
|
|
2405
2405
|
selector: (ctx) => {
|
|
2406
2406
|
var _a, _b;
|
|
2407
2407
|
return {
|
|
2408
|
-
each: (_a = ctx.editor.getAttributes("
|
|
2409
|
-
currentShowIfKey: ((_b = ctx.editor.getAttributes("
|
|
2408
|
+
each: (_a = ctx.editor.getAttributes("repeat")) == null ? void 0 : _a.each,
|
|
2409
|
+
currentShowIfKey: ((_b = ctx.editor.getAttributes("repeat")) == null ? void 0 : _b.showIfKey) || "",
|
|
2410
2410
|
isSectionActive: ctx.editor.isActive("section")
|
|
2411
2411
|
};
|
|
2412
2412
|
},
|
|
@@ -2415,23 +2415,23 @@ var useForState = (editor) => {
|
|
|
2415
2415
|
return states;
|
|
2416
2416
|
};
|
|
2417
2417
|
|
|
2418
|
-
// src/editor/components/
|
|
2418
|
+
// src/editor/components/repeat-menu/repeat-bubble-menu.tsx
|
|
2419
2419
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2420
|
-
function
|
|
2420
|
+
function RepeatBubbleMenu(props) {
|
|
2421
2421
|
const { appendTo, editor } = props;
|
|
2422
2422
|
if (!editor) {
|
|
2423
2423
|
return null;
|
|
2424
2424
|
}
|
|
2425
|
-
const state =
|
|
2425
|
+
const state = useRepeatState(editor);
|
|
2426
2426
|
const getReferenceClientRect = (0, import_react19.useCallback)(() => {
|
|
2427
|
-
const renderContainer = getRenderContainer(editor, "
|
|
2427
|
+
const renderContainer = getRenderContainer(editor, "repeat");
|
|
2428
2428
|
const rect = (renderContainer == null ? void 0 : renderContainer.getBoundingClientRect()) || new DOMRect(-1e3, -1e3, 0, 0);
|
|
2429
2429
|
return rect;
|
|
2430
2430
|
}, [editor]);
|
|
2431
2431
|
const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
|
|
2432
2432
|
shouldShow: ({ editor: editor2 }) => {
|
|
2433
2433
|
var _a;
|
|
2434
|
-
const activeForNode = getClosestNodeByName(editor2, "
|
|
2434
|
+
const activeForNode = getClosestNodeByName(editor2, "repeat");
|
|
2435
2435
|
const sectionNodeChildren = activeForNode ? (_a = (0, import_react18.findChildren)(activeForNode == null ? void 0 : activeForNode.node, (node) => {
|
|
2436
2436
|
return node.type.name === "section";
|
|
2437
2437
|
})) == null ? void 0 : _a[0] : null;
|
|
@@ -2439,7 +2439,7 @@ function ForBubbleMenu(props) {
|
|
|
2439
2439
|
if (isTextSelected(editor2) || hasActiveSectionNodeChildren || !editor2.isEditable) {
|
|
2440
2440
|
return false;
|
|
2441
2441
|
}
|
|
2442
|
-
return editor2.isActive("
|
|
2442
|
+
return editor2.isActive("repeat");
|
|
2443
2443
|
},
|
|
2444
2444
|
tippyOptions: {
|
|
2445
2445
|
offset: [0, 8],
|
|
@@ -2452,7 +2452,7 @@ function ForBubbleMenu(props) {
|
|
|
2452
2452
|
sticky: "popper",
|
|
2453
2453
|
maxWidth: "auto"
|
|
2454
2454
|
},
|
|
2455
|
-
pluginKey: "
|
|
2455
|
+
pluginKey: "repeatBubbleMenu"
|
|
2456
2456
|
});
|
|
2457
2457
|
const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2458
2458
|
const inputRef = (0, import_react19.useRef)(null);
|
|
@@ -2462,7 +2462,7 @@ function ForBubbleMenu(props) {
|
|
|
2462
2462
|
return processVariables(variables, {
|
|
2463
2463
|
query: eachKey || "",
|
|
2464
2464
|
editor,
|
|
2465
|
-
from: "
|
|
2465
|
+
from: "repeat-variable"
|
|
2466
2466
|
}).map((variable) => variable.name);
|
|
2467
2467
|
}, [variables, eachKey, editor]);
|
|
2468
2468
|
const isValidEachKey = eachKey;
|
|
@@ -2472,7 +2472,7 @@ function ForBubbleMenu(props) {
|
|
|
2472
2472
|
className: "mly-flex mly-items-stretch mly-rounded-lg mly-border mly-border-slate-200 mly-bg-white mly-p-0.5 mly-shadow-md",
|
|
2473
2473
|
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TooltipProvider, { children: [
|
|
2474
2474
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1.5 mly-px-1.5 mly-text-sm mly-leading-none", children: [
|
|
2475
|
-
"
|
|
2475
|
+
"Repeat",
|
|
2476
2476
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
|
|
2477
2477
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2478
2478
|
import_lucide_react16.InfoIcon,
|
|
@@ -2530,7 +2530,7 @@ function ForBubbleMenu(props) {
|
|
|
2530
2530
|
placeholder: "ie. payload.items",
|
|
2531
2531
|
value: (state == null ? void 0 : state.each) || "",
|
|
2532
2532
|
onValueChange: (value) => {
|
|
2533
|
-
editor.commands.
|
|
2533
|
+
editor.commands.updateRepeat({
|
|
2534
2534
|
each: value
|
|
2535
2535
|
});
|
|
2536
2536
|
},
|
|
@@ -2538,7 +2538,7 @@ function ForBubbleMenu(props) {
|
|
|
2538
2538
|
setIsUpdatingKey(false);
|
|
2539
2539
|
},
|
|
2540
2540
|
onSelectOption: (value) => {
|
|
2541
|
-
editor.commands.
|
|
2541
|
+
editor.commands.updateRepeat({
|
|
2542
2542
|
each: value
|
|
2543
2543
|
});
|
|
2544
2544
|
setIsUpdatingKey(false);
|
|
@@ -2555,7 +2555,7 @@ function ForBubbleMenu(props) {
|
|
|
2555
2555
|
{
|
|
2556
2556
|
showIfKey: state.currentShowIfKey,
|
|
2557
2557
|
onShowIfKeyValueChange: (value) => {
|
|
2558
|
-
editor.commands.
|
|
2558
|
+
editor.commands.updateRepeat({
|
|
2559
2559
|
showIfKey: value
|
|
2560
2560
|
});
|
|
2561
2561
|
},
|
|
@@ -3931,11 +3931,11 @@ function SectionBubbleMenu(props) {
|
|
|
3931
3931
|
shouldShow: ({ editor: editor2 }) => {
|
|
3932
3932
|
var _a;
|
|
3933
3933
|
const activeSectionNode = getClosestNodeByName(editor2, "section");
|
|
3934
|
-
const
|
|
3935
|
-
return node.type.name === "
|
|
3934
|
+
const repeatNodeChildren = activeSectionNode ? (_a = (0, import_react32.findChildren)(activeSectionNode == null ? void 0 : activeSectionNode.node, (node) => {
|
|
3935
|
+
return node.type.name === "repeat";
|
|
3936
3936
|
})) == null ? void 0 : _a[0] : null;
|
|
3937
|
-
const
|
|
3938
|
-
if (isTextSelected(editor2) ||
|
|
3937
|
+
const hasActiveRepeatNodeChildren = repeatNodeChildren && editor2.isActive("repeat");
|
|
3938
|
+
if (isTextSelected(editor2) || hasActiveRepeatNodeChildren || !editor2.isEditable) {
|
|
3939
3939
|
return false;
|
|
3940
3940
|
}
|
|
3941
3941
|
return editor2.isActive("section");
|
|
@@ -4352,13 +4352,17 @@ var useTextMenuState = (editor) => {
|
|
|
4352
4352
|
const states = (0, import_react36.useEditorState)({
|
|
4353
4353
|
editor,
|
|
4354
4354
|
selector: (ctx) => {
|
|
4355
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4355
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4356
4356
|
return {
|
|
4357
4357
|
currentTextColor: ctx.editor.getAttributes("textStyle").color || DEFAULT_TEXT_COLOR,
|
|
4358
4358
|
linkUrl: (_a = ctx.editor) == null ? void 0 : _a.getAttributes("link").href,
|
|
4359
4359
|
textAlign: ((_b = ctx.editor) == null ? void 0 : _b.isActive({ textAlign: "left" })) ? "left" : ((_c = ctx.editor) == null ? void 0 : _c.isActive({ textAlign: "center" })) ? "center" : ((_d = ctx.editor) == null ? void 0 : _d.isActive({ textAlign: "right" })) ? "right" : ((_e = ctx.editor) == null ? void 0 : _e.isActive({ textAlign: "justify" })) ? "justify" : "left",
|
|
4360
4360
|
isListActive: ctx.editor.isActive("bulletList") || ctx.editor.isActive("orderedList"),
|
|
4361
|
-
isUrlVariable: (_f = ctx.editor.getAttributes("link").isUrlVariable) != null ? _f : false
|
|
4361
|
+
isUrlVariable: (_f = ctx.editor.getAttributes("link").isUrlVariable) != null ? _f : false,
|
|
4362
|
+
isHeadingActive: ctx.editor.isActive("heading"),
|
|
4363
|
+
headingShowIfKey: ((_g = ctx.editor.getAttributes("heading")) == null ? void 0 : _g.showIfKey) || "",
|
|
4364
|
+
isParagraphActive: ctx.editor.isActive("paragraph"),
|
|
4365
|
+
paragraphShowIfKey: ((_h = ctx.editor.getAttributes("paragraph")) == null ? void 0 : _h.showIfKey) || ""
|
|
4362
4366
|
};
|
|
4363
4367
|
},
|
|
4364
4368
|
equalityFn: import_fast_deep_equal6.default
|
|
@@ -5706,22 +5710,22 @@ var ColumnsExtension = import_core12.Node.create({
|
|
|
5706
5710
|
}
|
|
5707
5711
|
});
|
|
5708
5712
|
|
|
5709
|
-
// src/editor/nodes/
|
|
5713
|
+
// src/editor/nodes/repeat/repeat.ts
|
|
5710
5714
|
var import_core13 = require("@tiptap/core");
|
|
5711
5715
|
var import_react48 = require("@tiptap/react");
|
|
5712
5716
|
|
|
5713
|
-
// src/editor/nodes/
|
|
5717
|
+
// src/editor/nodes/repeat/repeat-view.tsx
|
|
5714
5718
|
var import_react47 = require("@tiptap/react");
|
|
5715
5719
|
var import_lucide_react22 = require("lucide-react");
|
|
5716
5720
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5717
|
-
function
|
|
5721
|
+
function RepeatView(props) {
|
|
5718
5722
|
const { editor, getPos } = props;
|
|
5719
5723
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5720
5724
|
import_react47.NodeViewWrapper,
|
|
5721
5725
|
{
|
|
5726
|
+
"data-type": "repeat",
|
|
5722
5727
|
draggable: editor.isEditable,
|
|
5723
5728
|
"data-drag-handle": editor.isEditable,
|
|
5724
|
-
"data-type": "for",
|
|
5725
5729
|
className: "mly-relative",
|
|
5726
5730
|
children: [
|
|
5727
5731
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react47.NodeViewContent, { className: "is-editable" }),
|
|
@@ -5746,9 +5750,9 @@ function ForView(props) {
|
|
|
5746
5750
|
);
|
|
5747
5751
|
}
|
|
5748
5752
|
|
|
5749
|
-
// src/editor/nodes/
|
|
5750
|
-
var
|
|
5751
|
-
name: "
|
|
5753
|
+
// src/editor/nodes/repeat/repeat.ts
|
|
5754
|
+
var RepeatExtension = import_core13.Node.create({
|
|
5755
|
+
name: "repeat",
|
|
5752
5756
|
group: "block",
|
|
5753
5757
|
content: "(block|columns)+",
|
|
5754
5758
|
draggable: true,
|
|
@@ -5806,7 +5810,7 @@ var ForExtension = import_core13.Node.create({
|
|
|
5806
5810
|
},
|
|
5807
5811
|
addCommands() {
|
|
5808
5812
|
return {
|
|
5809
|
-
|
|
5813
|
+
setRepeat: () => ({ commands }) => {
|
|
5810
5814
|
return commands.insertContent({
|
|
5811
5815
|
type: this.name,
|
|
5812
5816
|
attrs: {},
|
|
@@ -5817,11 +5821,11 @@ var ForExtension = import_core13.Node.create({
|
|
|
5817
5821
|
]
|
|
5818
5822
|
});
|
|
5819
5823
|
},
|
|
5820
|
-
|
|
5824
|
+
updateRepeat: (attrs) => updateAttributes(this.name, attrs)
|
|
5821
5825
|
};
|
|
5822
5826
|
},
|
|
5823
5827
|
addNodeView() {
|
|
5824
|
-
return (0, import_react48.ReactNodeViewRenderer)(
|
|
5828
|
+
return (0, import_react48.ReactNodeViewRenderer)(RepeatView, {
|
|
5825
5829
|
contentDOMElementTag: "div",
|
|
5826
5830
|
className: "mly-relative"
|
|
5827
5831
|
});
|
|
@@ -6043,7 +6047,7 @@ function TextBubbleMenu(props) {
|
|
|
6043
6047
|
return false;
|
|
6044
6048
|
}
|
|
6045
6049
|
const nestedNodes = [
|
|
6046
|
-
|
|
6050
|
+
RepeatExtension.name,
|
|
6047
6051
|
SectionExtension.name,
|
|
6048
6052
|
ColumnsExtension.name,
|
|
6049
6053
|
ColumnExtension.name
|
|
@@ -6077,6 +6081,7 @@ function TextBubbleMenu(props) {
|
|
|
6077
6081
|
const turnIntoBlockOptions = useTurnIntoBlockOptions(editor);
|
|
6078
6082
|
const colors = editor == null ? void 0 : editor.storage.color.colors;
|
|
6079
6083
|
const suggestedColors = (_c = (_b = (_a = Array == null ? void 0 : Array.from(colors)) == null ? void 0 : _a.reverse()) == null ? void 0 : _b.slice(0, 6)) != null ? _c : [];
|
|
6084
|
+
const showIfKey = (state == null ? void 0 : state.isHeadingActive) ? state == null ? void 0 : state.headingShowIfKey : state == null ? void 0 : state.paragraphShowIfKey;
|
|
6080
6085
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6081
6086
|
import_react51.BubbleMenu,
|
|
6082
6087
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
@@ -6167,6 +6172,22 @@ function TextBubbleMenu(props) {
|
|
|
6167
6172
|
}
|
|
6168
6173
|
)
|
|
6169
6174
|
}
|
|
6175
|
+
),
|
|
6176
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, { className: "mly-mx-0" }),
|
|
6177
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6178
|
+
ShowPopover,
|
|
6179
|
+
{
|
|
6180
|
+
showIfKey,
|
|
6181
|
+
onShowIfKeyValueChange: (value) => {
|
|
6182
|
+
editor == null ? void 0 : editor.chain().updateAttributes(
|
|
6183
|
+
state.isHeadingActive ? "heading" : "paragraph",
|
|
6184
|
+
{
|
|
6185
|
+
showIfKey: value
|
|
6186
|
+
}
|
|
6187
|
+
).run();
|
|
6188
|
+
},
|
|
6189
|
+
editor
|
|
6190
|
+
}
|
|
6170
6191
|
)
|
|
6171
6192
|
] })
|
|
6172
6193
|
})
|
|
@@ -6287,11 +6308,11 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
6287
6308
|
var import_core15 = require("@tiptap/core");
|
|
6288
6309
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
|
|
6289
6310
|
var import_extension_list_item = __toESM(require("@tiptap/extension-list-item"));
|
|
6290
|
-
var
|
|
6311
|
+
var import_extension_paragraph2 = __toESM(require("@tiptap/extension-paragraph"));
|
|
6291
6312
|
var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"));
|
|
6292
6313
|
var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
|
|
6293
6314
|
var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"));
|
|
6294
|
-
var
|
|
6315
|
+
var import_extension_heading2 = __toESM(require("@tiptap/extension-heading"));
|
|
6295
6316
|
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
6296
6317
|
var import_extension_document = __toESM(require("@tiptap/extension-document"));
|
|
6297
6318
|
var import_extension_focus = __toESM(require("@tiptap/extension-focus"));
|
|
@@ -6368,6 +6389,54 @@ var LinkExtension = import_extension_link.default.extend({
|
|
|
6368
6389
|
}
|
|
6369
6390
|
});
|
|
6370
6391
|
|
|
6392
|
+
// src/editor/nodes/heading/heading.ts
|
|
6393
|
+
var import_extension_heading = __toESM(require("@tiptap/extension-heading"));
|
|
6394
|
+
var HeadingExtension = import_extension_heading.default.extend({
|
|
6395
|
+
addAttributes() {
|
|
6396
|
+
var _a;
|
|
6397
|
+
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
6398
|
+
showIfKey: {
|
|
6399
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
6400
|
+
parseHTML: (element) => {
|
|
6401
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
6402
|
+
},
|
|
6403
|
+
renderHTML(attributes) {
|
|
6404
|
+
if (!attributes.showIfKey) {
|
|
6405
|
+
return {};
|
|
6406
|
+
}
|
|
6407
|
+
return {
|
|
6408
|
+
"data-show-if-key": attributes.showIfKey
|
|
6409
|
+
};
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
});
|
|
6413
|
+
}
|
|
6414
|
+
});
|
|
6415
|
+
|
|
6416
|
+
// src/editor/nodes/paragraph/paragraph.ts
|
|
6417
|
+
var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"));
|
|
6418
|
+
var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
6419
|
+
addAttributes() {
|
|
6420
|
+
var _a;
|
|
6421
|
+
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
6422
|
+
showIfKey: {
|
|
6423
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
6424
|
+
parseHTML: (element) => {
|
|
6425
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
6426
|
+
},
|
|
6427
|
+
renderHTML(attributes) {
|
|
6428
|
+
if (!attributes.showIfKey) {
|
|
6429
|
+
return {};
|
|
6430
|
+
}
|
|
6431
|
+
return {
|
|
6432
|
+
"data-show-if-key": attributes.showIfKey
|
|
6433
|
+
};
|
|
6434
|
+
}
|
|
6435
|
+
}
|
|
6436
|
+
});
|
|
6437
|
+
}
|
|
6438
|
+
});
|
|
6439
|
+
|
|
6371
6440
|
// src/editor/extensions/maily-kit.tsx
|
|
6372
6441
|
var MailyKit = import_core15.Extension.create({
|
|
6373
6442
|
name: "maily-kit",
|
|
@@ -6389,12 +6458,6 @@ var MailyKit = import_core15.Extension.create({
|
|
|
6389
6458
|
content: "(block|columns)+"
|
|
6390
6459
|
}),
|
|
6391
6460
|
import_starter_kit.default.configure({
|
|
6392
|
-
heading: {
|
|
6393
|
-
levels: [1, 2, 3],
|
|
6394
|
-
HTMLAttributes: {
|
|
6395
|
-
class: "mly-relative"
|
|
6396
|
-
}
|
|
6397
|
-
},
|
|
6398
6461
|
code: {
|
|
6399
6462
|
HTMLAttributes: {
|
|
6400
6463
|
class: "mly-px-1 mly-relative mly-py-0.5 mly-bg-[#efefef] mly-text-sm mly-rounded-md mly-tracking-normal mly-font-normal"
|
|
@@ -6405,11 +6468,6 @@ var MailyKit = import_core15.Extension.create({
|
|
|
6405
6468
|
class: "mly-not-prose mly-border-l-4 mly-border-gray-300 mly-pl-4 mly-mt-4 mly-mb-4 mly-relative"
|
|
6406
6469
|
}
|
|
6407
6470
|
},
|
|
6408
|
-
paragraph: {
|
|
6409
|
-
HTMLAttributes: {
|
|
6410
|
-
class: "mly-relative"
|
|
6411
|
-
}
|
|
6412
|
-
},
|
|
6413
6471
|
bulletList: {
|
|
6414
6472
|
HTMLAttributes: {
|
|
6415
6473
|
class: "mly-relative"
|
|
@@ -6420,6 +6478,8 @@ var MailyKit = import_core15.Extension.create({
|
|
|
6420
6478
|
class: "mly-relative"
|
|
6421
6479
|
}
|
|
6422
6480
|
},
|
|
6481
|
+
heading: false,
|
|
6482
|
+
paragraph: false,
|
|
6423
6483
|
horizontalRule: false,
|
|
6424
6484
|
dropcursor: false,
|
|
6425
6485
|
document: false
|
|
@@ -6428,7 +6488,7 @@ var MailyKit = import_core15.Extension.create({
|
|
|
6428
6488
|
Color.configure({ types: [import_extension_text_style.default.name, import_extension_list_item.default.name] }),
|
|
6429
6489
|
import_extension_text_style.default.configure(),
|
|
6430
6490
|
import_extension_text_align.default.configure({
|
|
6431
|
-
types: [
|
|
6491
|
+
types: [import_extension_paragraph2.default.name, import_extension_heading2.default.name, Footer.name]
|
|
6432
6492
|
}),
|
|
6433
6493
|
HorizontalRule,
|
|
6434
6494
|
import_extension_placeholder.default.configure({
|
|
@@ -6439,7 +6499,7 @@ var MailyKit = import_core15.Extension.create({
|
|
|
6439
6499
|
"columns",
|
|
6440
6500
|
"column",
|
|
6441
6501
|
"section",
|
|
6442
|
-
"
|
|
6502
|
+
"repeat",
|
|
6443
6503
|
"show",
|
|
6444
6504
|
"blockquote"
|
|
6445
6505
|
].includes(node.type.name)) {
|
|
@@ -6455,13 +6515,24 @@ var MailyKit = import_core15.Extension.create({
|
|
|
6455
6515
|
color: "#555",
|
|
6456
6516
|
width: 3,
|
|
6457
6517
|
class: "ProseMirror-dropcursor"
|
|
6518
|
+
}),
|
|
6519
|
+
HeadingExtension.configure({
|
|
6520
|
+
levels: [1, 2, 3],
|
|
6521
|
+
HTMLAttributes: {
|
|
6522
|
+
class: "mly-relative"
|
|
6523
|
+
}
|
|
6524
|
+
}),
|
|
6525
|
+
ParagraphExtension.configure({
|
|
6526
|
+
HTMLAttributes: {
|
|
6527
|
+
class: "mly-relative"
|
|
6528
|
+
}
|
|
6458
6529
|
})
|
|
6459
6530
|
];
|
|
6460
6531
|
if (this.options.linkCard !== false) {
|
|
6461
6532
|
extensions2.push(LinkCardExtension.configure(this.options.linkCard));
|
|
6462
6533
|
}
|
|
6463
|
-
if (this.options.
|
|
6464
|
-
extensions2.push(
|
|
6534
|
+
if (this.options.repeat !== false) {
|
|
6535
|
+
extensions2.push(RepeatExtension);
|
|
6465
6536
|
}
|
|
6466
6537
|
if (this.options.section !== false) {
|
|
6467
6538
|
extensions2.push(SectionExtension);
|
|
@@ -6709,6 +6780,24 @@ function extensions(props) {
|
|
|
6709
6780
|
return [...defaultExtensions, ...extensions2];
|
|
6710
6781
|
}
|
|
6711
6782
|
|
|
6783
|
+
// src/editor/utils/replace-deprecated.ts
|
|
6784
|
+
function replaceDeprecatedNode(json) {
|
|
6785
|
+
const stack = [json];
|
|
6786
|
+
while (stack.length) {
|
|
6787
|
+
const node = stack.pop();
|
|
6788
|
+
if (!node) {
|
|
6789
|
+
continue;
|
|
6790
|
+
}
|
|
6791
|
+
if (node.type === "for") {
|
|
6792
|
+
node.type = "repeat";
|
|
6793
|
+
}
|
|
6794
|
+
if (node.content) {
|
|
6795
|
+
stack.push(...node.content);
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6798
|
+
return json;
|
|
6799
|
+
}
|
|
6800
|
+
|
|
6712
6801
|
// src/editor/index.tsx
|
|
6713
6802
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
6714
6803
|
function Editor9(props) {
|
|
@@ -6734,25 +6823,27 @@ function Editor9(props) {
|
|
|
6734
6823
|
editable = true,
|
|
6735
6824
|
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
6736
6825
|
} = props;
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6826
|
+
const formattedContent = (0, import_react58.useMemo)(() => {
|
|
6827
|
+
if (contentJson) {
|
|
6828
|
+
const json = (contentJson == null ? void 0 : contentJson.type) === "doc" ? contentJson : {
|
|
6829
|
+
type: "doc",
|
|
6830
|
+
content: contentJson
|
|
6831
|
+
};
|
|
6832
|
+
return replaceDeprecatedNode(json);
|
|
6833
|
+
} else if (contentHtml) {
|
|
6834
|
+
return contentHtml;
|
|
6835
|
+
} else {
|
|
6836
|
+
return {
|
|
6837
|
+
type: "doc",
|
|
6838
|
+
content: [
|
|
6839
|
+
{
|
|
6840
|
+
type: "paragraph",
|
|
6841
|
+
content: []
|
|
6842
|
+
}
|
|
6843
|
+
]
|
|
6844
|
+
};
|
|
6845
|
+
}
|
|
6846
|
+
}, [contentHtml, contentJson]);
|
|
6756
6847
|
const menuContainerRef = (0, import_react58.useRef)(null);
|
|
6757
6848
|
const editor = (0, import_react57.useEditor)({
|
|
6758
6849
|
editorProps: {
|
|
@@ -6824,7 +6915,7 @@ function Editor9(props) {
|
|
|
6824
6915
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
6825
6916
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
6826
6917
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ContentMenu, { editor }),
|
|
6827
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6918
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RepeatBubbleMenu, { editor, appendTo: menuContainerRef })
|
|
6828
6919
|
]
|
|
6829
6920
|
}
|
|
6830
6921
|
)
|