@maily-to/core 2.0.0-beta.17 → 2.0.0-beta.19
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.cjs +1 -1
- package/dist/extensions/index.d.mts +2 -0
- package/dist/extensions/index.d.mts.map +1 -1
- package/dist/extensions/index.mjs +1 -1
- package/dist/index.cjs +9 -3
- package/dist/index.mjs +9 -3
- package/dist/{use-maily-editor-mwGHSFi6.mjs → use-maily-editor-BUmWtE7-.mjs} +161 -90
- package/dist/{use-maily-editor-B8nvKyXX.cjs → use-maily-editor-CXUuyvCp.cjs} +61 -16
- package/dist/{use-maily-editor-uwcKnkj2.cjs → use-maily-editor-PPpYUhSF.cjs} +161 -90
- package/package.json +3 -3
- package/src/styles/index.css +63 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_use_maily_editor = require("../use-maily-editor-
|
|
2
|
+
const require_use_maily_editor = require("../use-maily-editor-PPpYUhSF.cjs");
|
|
3
3
|
let react_compiler_runtime = require("react/compiler-runtime");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
let lucide_react = require("lucide-react");
|
|
@@ -98,6 +98,7 @@ declare const IMAGE_UPLOAD_STATUSES: {
|
|
|
98
98
|
type ImageUploadStatus = (typeof IMAGE_UPLOAD_STATUSES)[keyof typeof IMAGE_UPLOAD_STATUSES];
|
|
99
99
|
type ImageUploadStorage = {
|
|
100
100
|
uploads: Map<string, ImageUploadStatus>;
|
|
101
|
+
progress: Map<string, number>;
|
|
101
102
|
};
|
|
102
103
|
declare module '@tiptap/core' {
|
|
103
104
|
interface Storage {
|
|
@@ -108,6 +109,7 @@ declare const ALLOWED_IMAGE_MIME_TYPES: readonly ['image/jpeg', 'image/png', 'im
|
|
|
108
109
|
type ImageUploadContext = {
|
|
109
110
|
position: number;
|
|
110
111
|
removeImage: () => void;
|
|
112
|
+
setProgress: (fraction: number) => void;
|
|
111
113
|
};
|
|
112
114
|
type ImageUploadOptions = {
|
|
113
115
|
onImageUpload?: (file: File, context: ImageUploadContext) => Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/extensions/blockquote/blockquote.ts","../../src/extensions/body/body.ts","../../src/extensions/bold/bold.ts","../../src/extensions/button/button.ts","../../src/extensions/collaboration-attributes/collaboration-attributes.ts","../../src/extensions/columns/column.ts","../../src/extensions/columns/columns.ts","../../src/extensions/container/container.ts","../../src/extensions/footer/footer.ts","../../src/extensions/horizontal-rule/horizontal-rule.ts","../../src/extensions/image/image.ts","../../src/extensions/image-upload/image-upload.ts","../../src/extensions/link-card/link-card.ts","../../src/extensions/variable/protect-variable-trigger.ts","../../src/extensions/variable/variable.ts","../../src/extensions/inline-image/inline-image.ts","../../src/extensions/inline-span/inline-span.ts","../../src/extensions/section/section.ts","../../src/extensions/slash-command/slash-command.ts","../../src/extensions/slash-command/default-slash-commands.tsx","../../src/extensions/spacer/spacer.ts","../../src/extensions/span/span.ts","../../src/extensions/style/style.ts","../../src/extensions/html-code-block/html-code-block.ts","../../src/extensions/theme/theme.ts","../../src/extensions/visibility/visibility.ts","../../src/hooks/use-maily-editor.ts","../../src/utils/html.ts"],"mappings":";;;;;;;;;cAIa,4CAAmB,4CAAA;;;cCDnB,eAAa;;;cCCb,sCAAa,sCAAA;;;KCSd;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,YAAY,QAAQ,QAAQ,sBAAsB;MAClD,yBAAyB,OAAO,QAAQ,sBAAsB;;;;cAKvD,iBAAe,KAAA;;;KCrBhB;EACV,UAAU;EACV;;KAGG;EACH;;;YAIU;IACR,yBAAyB;;;cA0DhB,kCAAgC,UAAA,gCAAA;;;;YC1DjC,SAAS;IACjB;MACE,eAAe,OAAO,QAAQ,sBAAsB;;;;cAK7C,iBAAe;;;;YCdhB,SAAS;IACjB;MACE,aAAa,yBAAyB;MACtC,gBAAgB,OAAO,QAAQ,uBAAuB;;;;cAK/C,kBAAgB;;;cCZhB,oBAAkB;;;KCDnB;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,iBAAiB;MACjB,yBAAyB,OAAO,QAAQ,sBAAsB;;;;cAKvD,iBAAe,KAAA;;;cCdf,gDAAuB,iDAAA;;;cCavB,uCAAc,uCAAA;;;cCTd;WACX;WACA;WACA;WACA;;KAGU,4BACF,oCAAoC;KAElC;EACV,SAAS,YAAY;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/extensions/blockquote/blockquote.ts","../../src/extensions/body/body.ts","../../src/extensions/bold/bold.ts","../../src/extensions/button/button.ts","../../src/extensions/collaboration-attributes/collaboration-attributes.ts","../../src/extensions/columns/column.ts","../../src/extensions/columns/columns.ts","../../src/extensions/container/container.ts","../../src/extensions/footer/footer.ts","../../src/extensions/horizontal-rule/horizontal-rule.ts","../../src/extensions/image/image.ts","../../src/extensions/image-upload/image-upload.ts","../../src/extensions/link-card/link-card.ts","../../src/extensions/variable/protect-variable-trigger.ts","../../src/extensions/variable/variable.ts","../../src/extensions/inline-image/inline-image.ts","../../src/extensions/inline-span/inline-span.ts","../../src/extensions/section/section.ts","../../src/extensions/slash-command/slash-command.ts","../../src/extensions/slash-command/default-slash-commands.tsx","../../src/extensions/spacer/spacer.ts","../../src/extensions/span/span.ts","../../src/extensions/style/style.ts","../../src/extensions/html-code-block/html-code-block.ts","../../src/extensions/theme/theme.ts","../../src/extensions/visibility/visibility.ts","../../src/hooks/use-maily-editor.ts","../../src/utils/html.ts"],"mappings":";;;;;;;;;cAIa,4CAAmB,4CAAA;;;cCDnB,eAAa;;;cCCb,sCAAa,sCAAA;;;KCSd;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,YAAY,QAAQ,QAAQ,sBAAsB;MAClD,yBAAyB,OAAO,QAAQ,sBAAsB;;;;cAKvD,iBAAe,KAAA;;;KCrBhB;EACV,UAAU;EACV;;KAGG;EACH;;;YAIU;IACR,yBAAyB;;;cA0DhB,kCAAgC,UAAA,gCAAA;;;;YC1DjC,SAAS;IACjB;MACE,eAAe,OAAO,QAAQ,sBAAsB;;;;cAK7C,iBAAe;;;;YCdhB,SAAS;IACjB;MACE,aAAa,yBAAyB;MACtC,gBAAgB,OAAO,QAAQ,uBAAuB;;;;cAK/C,kBAAgB;;;cCZhB,oBAAkB;;;KCDnB;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,iBAAiB;MACjB,yBAAyB,OAAO,QAAQ,sBAAsB;;;;cAKvD,iBAAe,KAAA;;;cCdf,gDAAuB,iDAAA;;;cCavB,uCAAc,uCAAA;;;cCTd;WACX;WACA;WACA;WACA;;KAGU,4BACF,oCAAoC;KAElC;EACV,SAAS,YAAY;EACrB,UAAU;;;YAIA;IACR,aAAa;;;cAIJ;KAQD;EACV;EACA;EACA,cAAc;;KAGJ;EACV,iBAAiB,MAAM,MAAM,SAAS,uBAAuB;EAC7D,sBACE,gBACA,MAAM,MACN,SAAS;;cAIA,sBAAoB,UAAA,oBAAA;;;KC5CrB;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,cAAc,QAAQ,QAAQ,wBAAwB;MACtD,2BACE,OAAO,QAAQ,wBACZ;;;;cAKE,mBAAiB,KAAA;;;cCbjB,wBAAsB;;;KCC9B,sBAAsB;EACzB;EACA,YAAY;;KAGT;EACH;EACA,YAAY;;;YAIF;IACR,UAAU;;;cAID,0CAAiB,KAAA,qBAAA;;;KCpBlB;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,iBAAiB,OAAO,QAAQ,2BAA2B;MAC3D,8BACE,OAAO,QAAQ,2BACZ;;;;cAOE,sBAAoB,KAAA;;;cCpBpB,qBAAmB;;;;YCIpB,SAAS;IACjB;MACE,kBAAkB;MAClB,gBAAgB,OAAO,QAAQ,uBAAuB;;;;cAK/C,kBAAgB;;;KCNxB;EACH,UAAU;;;YAIA;IACR,cAAc;;;KAIN;EACV,UAAU;EACV,YAAY,KAAK;;cAGN,uBAAqB,UAAA,qBAAA;;;cCYrB,wBAAwB;;;KC3BzB;EACV,gBAAgB;;;YAIN,SAAS;IACjB;MACE,YAAY,QAAQ,QAAQ,sBAAsB;MAClD,mBAAmB;MACnB,yBAAyB,OAAO,QAAQ,sBAAsB;;;;cAKvD,iBAAe,KAAA;;;cClBf,eAAa;;;cCoBb;;YAiCD,SAAS;IACjB;MACE,kBACE,oBACA,cAAc,cAAc,8CACzB;;;;KAKC;EACV,cAAc;EACd;EACA;;cAcW,gBAAc,UAAA;;;;YCnEf,SAAS;IACjB;MACE,mBAAmB;QAAU;YAAuB;MACpD,sBACE,OAAO,QAAQ,6BACZ;;;;cAKE,+CAAsB,qDAAA;;;KClBvB,mBAAmB,KAAK,iBAAiB;;YAGzC,SAAS;IACjB;MACE,eAAe,OAAO,qBAAqB;MAC3C,kBAAkB,OAAO,oBAAoB;MAC7C,mBAAmB,OAAO,qBAAqB;;;;KAKzC;EACV,OAAO;;cAqBI,gBAAc,UAAA;;;cCnCd;KAgBD;EACV;;;YAIU,SAAS;IACjB;MACE,oBACE,oBACA,MAAM,mBACH;MACL,sBAAsB,uBAAuB;;;;cAmBtC,qBAAmB,UAAA;;;cCanB,oBAAoB;;;iBCkQjB,kBAAkB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ProtectVariableTrigger, C as ContainerExtension, D as BodyExtension, E as setStyleDeclarations, J as getMergedNodeTheme, M as VisibilityExtension, N as ColumnsExtension, O as BlockquoteExtension, P as ColumnExtension, Q as getThemeCss, S as FooterExtension, T as BoldExtension, U as VariableExtension, Z as getShellNodes, _ as ALLOWED_IMAGE_MIME_TYPES, a as STYLE_SUPPORTED_TYPES, b as HtmlCodeBlockExtension, c as SpacerExtension, d as SectionExtension, f as InlineSpanExtension, h as ImageState, j as VISIBILITY_SUPPORTED_TYPES, l as SlashCommandExtension, m as ImageExtension, o as StyleExtension, p as InlineImageExtension, r as getNormalizedHtml, s as SpanExtension, t as DEFAULT_EXTENSIONS, u as DEFAULT_SLASH_COMMANDS, v as IMAGE_UPLOAD_STATUSES, w as ButtonExtension, x as HorizontalRuleExtension, y as ImageUploadExtension } from "../use-maily-editor-
|
|
1
|
+
import { A as ProtectVariableTrigger, C as ContainerExtension, D as BodyExtension, E as setStyleDeclarations, J as getMergedNodeTheme, M as VisibilityExtension, N as ColumnsExtension, O as BlockquoteExtension, P as ColumnExtension, Q as getThemeCss, S as FooterExtension, T as BoldExtension, U as VariableExtension, Z as getShellNodes, _ as ALLOWED_IMAGE_MIME_TYPES, a as STYLE_SUPPORTED_TYPES, b as HtmlCodeBlockExtension, c as SpacerExtension, d as SectionExtension, f as InlineSpanExtension, h as ImageState, j as VISIBILITY_SUPPORTED_TYPES, l as SlashCommandExtension, m as ImageExtension, o as StyleExtension, p as InlineImageExtension, r as getNormalizedHtml, s as SpanExtension, t as DEFAULT_EXTENSIONS, u as DEFAULT_SLASH_COMMANDS, v as IMAGE_UPLOAD_STATUSES, w as ButtonExtension, x as HorizontalRuleExtension, y as ImageUploadExtension } from "../use-maily-editor-BUmWtE7-.mjs";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { SquareArrowOutUpRightIcon } from "lucide-react";
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_use_maily_editor = require("./use-maily-editor-
|
|
2
|
+
const require_use_maily_editor = require("./use-maily-editor-PPpYUhSF.cjs");
|
|
3
3
|
let react_compiler_runtime = require("react/compiler-runtime");
|
|
4
4
|
let cromia = require("cromia");
|
|
5
5
|
let react = require("react");
|
|
@@ -4822,8 +4822,14 @@ function DragContextMenu(props) {
|
|
|
4822
4822
|
setIsVisibilityOpen(false);
|
|
4823
4823
|
onOpenChange(nextOpen);
|
|
4824
4824
|
};
|
|
4825
|
+
const isKeyboardOnTriggerRef = (0, react.useRef)(false);
|
|
4825
4826
|
const getInitialFocus = (openType) => {
|
|
4826
|
-
|
|
4827
|
+
const isShortcut = openSourceRef.current === "shortcut";
|
|
4828
|
+
isKeyboardOnTriggerRef.current = !isShortcut && openType === "keyboard";
|
|
4829
|
+
return isShortcut || openType === "keyboard";
|
|
4830
|
+
};
|
|
4831
|
+
const getFinalFocus = () => {
|
|
4832
|
+
return isKeyboardOnTriggerRef.current || editor.view.dom;
|
|
4827
4833
|
};
|
|
4828
4834
|
const handleItemsKeyDown = (event) => {
|
|
4829
4835
|
if (!NAVIGATION_KEYS.includes(event.key)) return;
|
|
@@ -5039,7 +5045,7 @@ function DragContextMenu(props) {
|
|
|
5039
5045
|
side: "bottom",
|
|
5040
5046
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverPopup, {
|
|
5041
5047
|
"data-variant": "drag-context",
|
|
5042
|
-
finalFocus:
|
|
5048
|
+
finalFocus: getFinalFocus,
|
|
5043
5049
|
initialFocus: getInitialFocus,
|
|
5044
5050
|
children: [
|
|
5045
5051
|
isFontStyleOpen && nodeType ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontStyleConfig, {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as Tooltip, A as ProtectVariableTrigger, B as MIN_SPACER_HEIGHT, F as addColumn, H as SPACING_PRESETS, I as getColumnWidths, K as filterVariableSuggestions, L as removeColumn, R as updateColumnWidth, U as VariableExtension, V as SPACER_SPACING, W as getVariableSuggestions, X as getNodeTheme, Y as getNodeStyleState, Z as getShellNodes, at as FLOATING_ELEMENT_HEIGHT, ct as clearInitialNodeSelection, dt as useOnSelectionUpdate, et as TooltipArrow, ft as useFloatingStore, g as VisuallyHidden, ht as useValueAsRef, i as mergeExtensions, it as TooltipTrigger, j as VISIBILITY_SUPPORTED_TYPES, lt as FLOATING_ELEMENT_IDS, mt as ArrowIcon, n as useMailyEditor, nt as TooltipPositioner, ot as FLOATING_ELEMENT_PADDING, pt as useEditorInstance, q as Document, r as getNormalizedHtml, rt as TooltipProvider, st as FloatingElement, t as DEFAULT_EXTENSIONS, tt as TooltipPopup, ut as FLOATING_ELEMENT_ORDER, z as MAX_SPACER_HEIGHT } from "./use-maily-editor-
|
|
1
|
+
import { $ as Tooltip, A as ProtectVariableTrigger, B as MIN_SPACER_HEIGHT, F as addColumn, H as SPACING_PRESETS, I as getColumnWidths, K as filterVariableSuggestions, L as removeColumn, R as updateColumnWidth, U as VariableExtension, V as SPACER_SPACING, W as getVariableSuggestions, X as getNodeTheme, Y as getNodeStyleState, Z as getShellNodes, at as FLOATING_ELEMENT_HEIGHT, ct as clearInitialNodeSelection, dt as useOnSelectionUpdate, et as TooltipArrow, ft as useFloatingStore, g as VisuallyHidden, ht as useValueAsRef, i as mergeExtensions, it as TooltipTrigger, j as VISIBILITY_SUPPORTED_TYPES, lt as FLOATING_ELEMENT_IDS, mt as ArrowIcon, n as useMailyEditor, nt as TooltipPositioner, ot as FLOATING_ELEMENT_PADDING, pt as useEditorInstance, q as Document, r as getNormalizedHtml, rt as TooltipProvider, st as FloatingElement, t as DEFAULT_EXTENSIONS, tt as TooltipPopup, ut as FLOATING_ELEMENT_ORDER, z as MAX_SPACER_HEIGHT } from "./use-maily-editor-BUmWtE7-.mjs";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { ColorPicker as ColorPicker$1 } from "cromia";
|
|
4
4
|
import { Fragment, createContext, forwardRef, use, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
@@ -4833,8 +4833,14 @@ function DragContextMenu(props) {
|
|
|
4833
4833
|
setIsVisibilityOpen(false);
|
|
4834
4834
|
onOpenChange(nextOpen);
|
|
4835
4835
|
};
|
|
4836
|
+
const isKeyboardOnTriggerRef = useRef(false);
|
|
4836
4837
|
const getInitialFocus = (openType) => {
|
|
4837
|
-
|
|
4838
|
+
const isShortcut = openSourceRef.current === "shortcut";
|
|
4839
|
+
isKeyboardOnTriggerRef.current = !isShortcut && openType === "keyboard";
|
|
4840
|
+
return isShortcut || openType === "keyboard";
|
|
4841
|
+
};
|
|
4842
|
+
const getFinalFocus = () => {
|
|
4843
|
+
return isKeyboardOnTriggerRef.current || editor.view.dom;
|
|
4838
4844
|
};
|
|
4839
4845
|
const handleItemsKeyDown = (event) => {
|
|
4840
4846
|
if (!NAVIGATION_KEYS.includes(event.key)) return;
|
|
@@ -5050,7 +5056,7 @@ function DragContextMenu(props) {
|
|
|
5050
5056
|
side: "bottom",
|
|
5051
5057
|
children: /* @__PURE__ */ jsxs(PopoverPopup, {
|
|
5052
5058
|
"data-variant": "drag-context",
|
|
5053
|
-
finalFocus:
|
|
5059
|
+
finalFocus: getFinalFocus,
|
|
5054
5060
|
initialFocus: getInitialFocus,
|
|
5055
5061
|
children: [
|
|
5056
5062
|
isFontStyleOpen && nodeType ? /* @__PURE__ */ jsx(FontStyleConfig, {
|
|
@@ -2174,6 +2174,8 @@ const HorizontalRuleExtension = HorizontalRule.configure({ HTMLAttributes: { [DA
|
|
|
2174
2174
|
//#endregion
|
|
2175
2175
|
//#region src/extensions/html-code-block/html-code-block-view.tsx
|
|
2176
2176
|
const PREVIEW_RESET = `
|
|
2177
|
+
html { overflow: hidden; }
|
|
2178
|
+
body { margin: 0; }
|
|
2177
2179
|
* { font-family: 'Inter', sans-serif; }
|
|
2178
2180
|
blockquote, h1, h2, h3, img, li, ol, p, ul {
|
|
2179
2181
|
margin-top: 0;
|
|
@@ -2199,24 +2201,22 @@ function HtmlCodeBlockView(props) {
|
|
|
2199
2201
|
}
|
|
2200
2202
|
const html = `<style>${t0.join("\n")}</style>${parsed.body.innerHTML}`;
|
|
2201
2203
|
const isEmpty = html === "<style></style>";
|
|
2204
|
+
const [height, setHeight] = useState(0);
|
|
2202
2205
|
let t1;
|
|
2203
|
-
if ($[3]
|
|
2204
|
-
t1 = (
|
|
2205
|
-
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
container.innerHTML = html;
|
|
2212
|
-
shadow.append(container);
|
|
2206
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2207
|
+
t1 = (event) => {
|
|
2208
|
+
const frameWindow = event.currentTarget.contentWindow;
|
|
2209
|
+
const root = frameWindow?.document.documentElement;
|
|
2210
|
+
if (!frameWindow || !root) return;
|
|
2211
|
+
new frameWindow.ResizeObserver(() => {
|
|
2212
|
+
setHeight(root.offsetHeight);
|
|
2213
|
+
}).observe(root);
|
|
2213
2214
|
};
|
|
2214
|
-
$[3] =
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
const setPreviewElement = t1;
|
|
2215
|
+
$[3] = t1;
|
|
2216
|
+
} else t1 = $[3];
|
|
2217
|
+
const onPreviewLoad = t1;
|
|
2218
2218
|
let t2;
|
|
2219
|
-
if ($[
|
|
2219
|
+
if ($[4] !== activeTab || $[5] !== language) {
|
|
2220
2220
|
t2 = activeTab === HTML_CODE_BLOCK_TABS.CODE && /* @__PURE__ */ jsx("pre", {
|
|
2221
2221
|
"data-mly-html-code-block": "",
|
|
2222
2222
|
children: /* @__PURE__ */ jsx(NodeViewContent, {
|
|
@@ -2224,12 +2224,12 @@ function HtmlCodeBlockView(props) {
|
|
|
2224
2224
|
className: language ? `language-${language}` : void 0
|
|
2225
2225
|
})
|
|
2226
2226
|
});
|
|
2227
|
-
$[
|
|
2228
|
-
$[
|
|
2229
|
-
$[
|
|
2230
|
-
} else t2 = $[
|
|
2227
|
+
$[4] = activeTab;
|
|
2228
|
+
$[5] = language;
|
|
2229
|
+
$[6] = t2;
|
|
2230
|
+
} else t2 = $[6];
|
|
2231
2231
|
let t3;
|
|
2232
|
-
if ($[
|
|
2232
|
+
if ($[7] !== activeTab || $[8] !== height || $[9] !== html || $[10] !== isEmpty || $[11] !== updateAttributes) {
|
|
2233
2233
|
t3 = activeTab === HTML_CODE_BLOCK_TABS.PREVIEW && /* @__PURE__ */ jsx("div", {
|
|
2234
2234
|
contentEditable: false,
|
|
2235
2235
|
"data-empty": isEmpty ? "" : void 0,
|
|
@@ -2237,11 +2237,24 @@ function HtmlCodeBlockView(props) {
|
|
|
2237
2237
|
onClick: () => {
|
|
2238
2238
|
if (isEmpty) updateAttributes({ activeTab: HTML_CODE_BLOCK_TABS.CODE });
|
|
2239
2239
|
},
|
|
2240
|
-
|
|
2240
|
+
children: !isEmpty && /* @__PURE__ */ jsx("iframe", {
|
|
2241
|
+
onLoad: onPreviewLoad,
|
|
2242
|
+
sandbox: "allow-same-origin",
|
|
2243
|
+
srcDoc: `<!DOCTYPE html><style>${PREVIEW_RESET}</style>${html}`,
|
|
2244
|
+
style: {
|
|
2245
|
+
border: 0,
|
|
2246
|
+
display: "block",
|
|
2247
|
+
height,
|
|
2248
|
+
pointerEvents: "none",
|
|
2249
|
+
width: "100%"
|
|
2250
|
+
},
|
|
2251
|
+
title: "HTML preview"
|
|
2252
|
+
})
|
|
2241
2253
|
});
|
|
2242
|
-
$[
|
|
2243
|
-
$[
|
|
2244
|
-
$[
|
|
2254
|
+
$[7] = activeTab;
|
|
2255
|
+
$[8] = height;
|
|
2256
|
+
$[9] = html;
|
|
2257
|
+
$[10] = isEmpty;
|
|
2245
2258
|
$[11] = updateAttributes;
|
|
2246
2259
|
$[12] = t3;
|
|
2247
2260
|
} else t3 = $[12];
|
|
@@ -2381,20 +2394,28 @@ function uploadImageFile(editor, file, position) {
|
|
|
2381
2394
|
URL.revokeObjectURL(blobUrl);
|
|
2382
2395
|
return;
|
|
2383
2396
|
}
|
|
2397
|
+
const { uploads, progress } = editor.storage.imageUpload;
|
|
2384
2398
|
const context = {
|
|
2385
2399
|
position,
|
|
2386
|
-
removeImage: () => removeImageByBlobUrl(editor, blobUrl)
|
|
2400
|
+
removeImage: () => removeImageByBlobUrl(editor, blobUrl),
|
|
2401
|
+
setProgress: (fraction) => {
|
|
2402
|
+
const percent = Math.round(Math.min(Math.max(fraction, 0), 1) * 100);
|
|
2403
|
+
if (!uploads.has(blobUrl) || progress.get(blobUrl) === percent) return;
|
|
2404
|
+
progress.set(blobUrl, percent);
|
|
2405
|
+
notifyUploadStatusChanged(editor);
|
|
2406
|
+
}
|
|
2387
2407
|
};
|
|
2388
|
-
const { uploads } = editor.storage.imageUpload;
|
|
2389
2408
|
uploads.set(blobUrl, IMAGE_UPLOAD_STATUSES.LOADING);
|
|
2390
2409
|
notifyUploadStatusChanged(editor);
|
|
2391
2410
|
onImageUpload(file, context).then((url) => {
|
|
2392
2411
|
uploads.delete(blobUrl);
|
|
2412
|
+
progress.delete(blobUrl);
|
|
2393
2413
|
notifyUploadStatusChanged(editor);
|
|
2394
2414
|
updateImageByBlobUrl(editor, blobUrl, { src: url });
|
|
2395
2415
|
URL.revokeObjectURL(blobUrl);
|
|
2396
2416
|
}).catch((error) => {
|
|
2397
2417
|
uploads.set(blobUrl, IMAGE_UPLOAD_STATUSES.ERROR);
|
|
2418
|
+
progress.delete(blobUrl);
|
|
2398
2419
|
notifyUploadStatusChanged(editor);
|
|
2399
2420
|
onImageUploadError?.(error, file, context);
|
|
2400
2421
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -2425,7 +2446,10 @@ const ImageUploadExtension = Extension.create({
|
|
|
2425
2446
|
};
|
|
2426
2447
|
},
|
|
2427
2448
|
addStorage() {
|
|
2428
|
-
return {
|
|
2449
|
+
return {
|
|
2450
|
+
uploads: /* @__PURE__ */ new Map(),
|
|
2451
|
+
progress: /* @__PURE__ */ new Map()
|
|
2452
|
+
};
|
|
2429
2453
|
},
|
|
2430
2454
|
addExtensions() {
|
|
2431
2455
|
return [FileHandler.configure({
|
|
@@ -2698,8 +2722,9 @@ function ImageVariableState() {
|
|
|
2698
2722
|
return t0;
|
|
2699
2723
|
}
|
|
2700
2724
|
function ImageLoadingState(props) {
|
|
2701
|
-
const $ = c(
|
|
2702
|
-
const { alt, src } = props;
|
|
2725
|
+
const $ = c(13);
|
|
2726
|
+
const { alt, src, progress } = props;
|
|
2727
|
+
const isUploading = progress !== void 0 && progress < 100;
|
|
2703
2728
|
const t0 = alt ?? void 0;
|
|
2704
2729
|
let t1;
|
|
2705
2730
|
if ($[0] !== src || $[1] !== t0) {
|
|
@@ -2713,34 +2738,57 @@ function ImageLoadingState(props) {
|
|
|
2713
2738
|
$[2] = t1;
|
|
2714
2739
|
} else t1 = $[2];
|
|
2715
2740
|
let t2;
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2741
|
+
if ($[3] !== isUploading || $[4] !== progress) {
|
|
2742
|
+
t2 = progress !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
2743
|
+
"aria-label": "Uploading image",
|
|
2744
|
+
"aria-valuemax": 100,
|
|
2745
|
+
"aria-valuemin": 0,
|
|
2746
|
+
"aria-valuenow": progress,
|
|
2747
|
+
"data-mly-image-progress": "",
|
|
2748
|
+
"data-state": isUploading ? "uploading" : "done",
|
|
2749
|
+
role: "progressbar",
|
|
2750
|
+
style: { "--mly-image-progress": progress / 100 }
|
|
2751
|
+
});
|
|
2752
|
+
$[3] = isUploading;
|
|
2753
|
+
$[4] = progress;
|
|
2754
|
+
$[5] = t2;
|
|
2755
|
+
} else t2 = $[5];
|
|
2756
|
+
const t3 = progress === void 0 ? "center" : "corner";
|
|
2757
|
+
let t4;
|
|
2758
|
+
if ($[6] !== t3) {
|
|
2759
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
2760
|
+
"data-mly-image-spinner": "",
|
|
2761
|
+
"data-variant": t3
|
|
2762
|
+
});
|
|
2763
|
+
$[6] = t3;
|
|
2764
|
+
$[7] = t4;
|
|
2765
|
+
} else t4 = $[7];
|
|
2766
|
+
let t5;
|
|
2767
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2768
|
+
t5 = /* @__PURE__ */ jsx(VisuallyHidden, {
|
|
2720
2769
|
role: "status",
|
|
2721
2770
|
children: "Uploading image"
|
|
2722
2771
|
});
|
|
2723
|
-
$[
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
}
|
|
2729
|
-
let t4;
|
|
2730
|
-
if ($[5] !== t1) {
|
|
2731
|
-
t4 = /* @__PURE__ */ jsxs("div", {
|
|
2772
|
+
$[8] = t5;
|
|
2773
|
+
} else t5 = $[8];
|
|
2774
|
+
let t6;
|
|
2775
|
+
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t4) {
|
|
2776
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
2732
2777
|
"aria-busy": "true",
|
|
2733
2778
|
"data-mly-image-loading": "",
|
|
2734
2779
|
children: [
|
|
2735
2780
|
t1,
|
|
2736
2781
|
t2,
|
|
2737
|
-
|
|
2782
|
+
t4,
|
|
2783
|
+
t5
|
|
2738
2784
|
]
|
|
2739
2785
|
});
|
|
2740
|
-
$[
|
|
2741
|
-
$[
|
|
2742
|
-
|
|
2743
|
-
|
|
2786
|
+
$[9] = t1;
|
|
2787
|
+
$[10] = t2;
|
|
2788
|
+
$[11] = t4;
|
|
2789
|
+
$[12] = t6;
|
|
2790
|
+
} else t6 = $[12];
|
|
2791
|
+
return t6;
|
|
2744
2792
|
}
|
|
2745
2793
|
function ImagePlaceholder(props) {
|
|
2746
2794
|
const $ = c(3);
|
|
@@ -2793,8 +2841,28 @@ function useUploadStatus(editor, src) {
|
|
|
2793
2841
|
if (!src) return IMAGE_UPLOAD_STATUSES.IDLE;
|
|
2794
2842
|
return status ?? IMAGE_UPLOAD_STATUSES.LOADED;
|
|
2795
2843
|
}
|
|
2844
|
+
function useUploadProgress(editor, src) {
|
|
2845
|
+
const $ = c(5);
|
|
2846
|
+
let t0;
|
|
2847
|
+
if ($[0] !== src) {
|
|
2848
|
+
t0 = (ctx) => src ? ctx.editor.storage.imageUpload?.progress?.get(src) : void 0;
|
|
2849
|
+
$[0] = src;
|
|
2850
|
+
$[1] = t0;
|
|
2851
|
+
} else t0 = $[1];
|
|
2852
|
+
let t1;
|
|
2853
|
+
if ($[2] !== editor || $[3] !== t0) {
|
|
2854
|
+
t1 = {
|
|
2855
|
+
editor,
|
|
2856
|
+
selector: t0
|
|
2857
|
+
};
|
|
2858
|
+
$[2] = editor;
|
|
2859
|
+
$[3] = t0;
|
|
2860
|
+
$[4] = t1;
|
|
2861
|
+
} else t1 = $[4];
|
|
2862
|
+
return useEditorState(t1);
|
|
2863
|
+
}
|
|
2796
2864
|
function ImageView(props) {
|
|
2797
|
-
const $ = c(
|
|
2865
|
+
const $ = c(66);
|
|
2798
2866
|
const { editor, getPos, node, updateAttributes } = props;
|
|
2799
2867
|
const { align, alt, src, width, style } = node.attrs;
|
|
2800
2868
|
const t0 = style ?? "";
|
|
@@ -2819,6 +2887,7 @@ function ImageView(props) {
|
|
|
2819
2887
|
} else t2 = $[5];
|
|
2820
2888
|
const isSrcVariable = t2;
|
|
2821
2889
|
const status = useUploadStatus(editor, isSrcVariable ? void 0 : src);
|
|
2890
|
+
const progress = useUploadProgress(editor, status === IMAGE_UPLOAD_STATUSES.LOADING ? src : void 0);
|
|
2822
2891
|
let t3;
|
|
2823
2892
|
if ($[6] !== updateAttributes) {
|
|
2824
2893
|
t3 = (committed) => updateAttributes({ width: `${committed}%` });
|
|
@@ -2906,25 +2975,27 @@ function ImageView(props) {
|
|
|
2906
2975
|
$[31] = t14;
|
|
2907
2976
|
} else t14 = $[31];
|
|
2908
2977
|
let t15;
|
|
2909
|
-
if ($[32] !== alt || $[33] !== isSrcVariable || $[34] !==
|
|
2978
|
+
if ($[32] !== alt || $[33] !== isSrcVariable || $[34] !== progress || $[35] !== src || $[36] !== status) {
|
|
2910
2979
|
t15 = !isSrcVariable && status === IMAGE_UPLOAD_STATUSES.LOADING ? /* @__PURE__ */ jsx(ImageLoadingState, {
|
|
2911
2980
|
alt,
|
|
2912
|
-
src
|
|
2981
|
+
src,
|
|
2982
|
+
progress
|
|
2913
2983
|
}) : null;
|
|
2914
2984
|
$[32] = alt;
|
|
2915
2985
|
$[33] = isSrcVariable;
|
|
2916
|
-
$[34] =
|
|
2917
|
-
$[35] =
|
|
2918
|
-
$[36] =
|
|
2919
|
-
|
|
2986
|
+
$[34] = progress;
|
|
2987
|
+
$[35] = src;
|
|
2988
|
+
$[36] = status;
|
|
2989
|
+
$[37] = t15;
|
|
2990
|
+
} else t15 = $[37];
|
|
2920
2991
|
let t16;
|
|
2921
|
-
if ($[
|
|
2992
|
+
if ($[38] !== status) {
|
|
2922
2993
|
t16 = status === IMAGE_UPLOAD_STATUSES.ERROR ? /* @__PURE__ */ jsx(ImageErrorState, {}) : null;
|
|
2923
|
-
$[
|
|
2924
|
-
$[
|
|
2925
|
-
} else t16 = $[
|
|
2994
|
+
$[38] = status;
|
|
2995
|
+
$[39] = t16;
|
|
2996
|
+
} else t16 = $[39];
|
|
2926
2997
|
let t17;
|
|
2927
|
-
if ($[
|
|
2998
|
+
if ($[40] !== alt || $[41] !== authoredStyle || $[42] !== editor.isEditable || $[43] !== handlePointerDown || $[44] !== isLoaded || $[45] !== isResizing || $[46] !== isSrcVariable || $[47] !== shouldShowDragHandles || $[48] !== src) {
|
|
2928
2999
|
t17 = !isSrcVariable && isLoaded ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
|
|
2929
3000
|
alt: alt ?? void 0,
|
|
2930
3001
|
contentEditable: false,
|
|
@@ -2939,19 +3010,19 @@ function ImageView(props) {
|
|
|
2939
3010
|
handle: "right",
|
|
2940
3011
|
onPointerDown: (event_1) => handlePointerDown("right", event_1)
|
|
2941
3012
|
})] }) : null] }) : null;
|
|
2942
|
-
$[
|
|
2943
|
-
$[
|
|
2944
|
-
$[
|
|
2945
|
-
$[
|
|
2946
|
-
$[
|
|
2947
|
-
$[
|
|
2948
|
-
$[
|
|
2949
|
-
$[
|
|
2950
|
-
$[
|
|
2951
|
-
$[
|
|
2952
|
-
} else t17 = $[
|
|
3013
|
+
$[40] = alt;
|
|
3014
|
+
$[41] = authoredStyle;
|
|
3015
|
+
$[42] = editor.isEditable;
|
|
3016
|
+
$[43] = handlePointerDown;
|
|
3017
|
+
$[44] = isLoaded;
|
|
3018
|
+
$[45] = isResizing;
|
|
3019
|
+
$[46] = isSrcVariable;
|
|
3020
|
+
$[47] = shouldShowDragHandles;
|
|
3021
|
+
$[48] = src;
|
|
3022
|
+
$[49] = t17;
|
|
3023
|
+
} else t17 = $[49];
|
|
2953
3024
|
let t18;
|
|
2954
|
-
if ($[
|
|
3025
|
+
if ($[50] !== align || $[51] !== imageWrapperRef || $[52] !== t12 || $[53] !== t13 || $[54] !== t14 || $[55] !== t15 || $[56] !== t16 || $[57] !== t17) {
|
|
2955
3026
|
t18 = /* @__PURE__ */ jsxs("div", {
|
|
2956
3027
|
"data-align": align,
|
|
2957
3028
|
"data-mly-image-wrapper": "",
|
|
@@ -2965,18 +3036,18 @@ function ImageView(props) {
|
|
|
2965
3036
|
t17
|
|
2966
3037
|
]
|
|
2967
3038
|
});
|
|
2968
|
-
$[
|
|
2969
|
-
$[
|
|
2970
|
-
$[
|
|
2971
|
-
$[
|
|
2972
|
-
$[
|
|
2973
|
-
$[
|
|
2974
|
-
$[
|
|
2975
|
-
$[
|
|
2976
|
-
$[
|
|
2977
|
-
} else t18 = $[
|
|
3039
|
+
$[50] = align;
|
|
3040
|
+
$[51] = imageWrapperRef;
|
|
3041
|
+
$[52] = t12;
|
|
3042
|
+
$[53] = t13;
|
|
3043
|
+
$[54] = t14;
|
|
3044
|
+
$[55] = t15;
|
|
3045
|
+
$[56] = t16;
|
|
3046
|
+
$[57] = t17;
|
|
3047
|
+
$[58] = t18;
|
|
3048
|
+
} else t18 = $[58];
|
|
2978
3049
|
let t19;
|
|
2979
|
-
if ($[
|
|
3050
|
+
if ($[59] !== containerRef || $[60] !== t10 || $[61] !== t11 || $[62] !== t18 || $[63] !== t8 || $[64] !== t9) {
|
|
2980
3051
|
t19 = /* @__PURE__ */ jsx(NodeViewWrapper, {
|
|
2981
3052
|
"data-drag-handle": t8,
|
|
2982
3053
|
"data-mly-image-view": "",
|
|
@@ -2986,14 +3057,14 @@ function ImageView(props) {
|
|
|
2986
3057
|
ref: containerRef,
|
|
2987
3058
|
children: t18
|
|
2988
3059
|
});
|
|
2989
|
-
$[
|
|
2990
|
-
$[
|
|
2991
|
-
$[
|
|
2992
|
-
$[
|
|
2993
|
-
$[
|
|
2994
|
-
$[
|
|
2995
|
-
$[
|
|
2996
|
-
} else t19 = $[
|
|
3060
|
+
$[59] = containerRef;
|
|
3061
|
+
$[60] = t10;
|
|
3062
|
+
$[61] = t11;
|
|
3063
|
+
$[62] = t18;
|
|
3064
|
+
$[63] = t8;
|
|
3065
|
+
$[64] = t9;
|
|
3066
|
+
$[65] = t19;
|
|
3067
|
+
} else t19 = $[65];
|
|
2997
3068
|
return t19;
|
|
2998
3069
|
}
|
|
2999
3070
|
//#endregion
|
|
@@ -1851,6 +1851,8 @@ const HorizontalRuleExtension = _tiptap_extension_horizontal_rule.HorizontalRule
|
|
|
1851
1851
|
//#endregion
|
|
1852
1852
|
//#region src/extensions/html-code-block/html-code-block-view.tsx
|
|
1853
1853
|
const PREVIEW_RESET = `
|
|
1854
|
+
html { overflow: hidden; }
|
|
1855
|
+
body { margin: 0; }
|
|
1854
1856
|
* { font-family: 'Inter', sans-serif; }
|
|
1855
1857
|
blockquote, h1, h2, h3, img, li, ol, p, ul {
|
|
1856
1858
|
margin-top: 0;
|
|
@@ -1875,15 +1877,14 @@ function HtmlCodeBlockView(props) {
|
|
|
1875
1877
|
}).join("\n")}</style>${parsed.body.innerHTML}`;
|
|
1876
1878
|
}, [node]);
|
|
1877
1879
|
const isEmpty = html === "<style></style>";
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
const
|
|
1881
|
-
const
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
shadow.append(container);
|
|
1880
|
+
const [height, setHeight] = (0, react.useState)(0);
|
|
1881
|
+
const onPreviewLoad = (event) => {
|
|
1882
|
+
const frameWindow = event.currentTarget.contentWindow;
|
|
1883
|
+
const root = frameWindow?.document.documentElement;
|
|
1884
|
+
if (!frameWindow || !root) return;
|
|
1885
|
+
new frameWindow.ResizeObserver(() => {
|
|
1886
|
+
setHeight(root.offsetHeight);
|
|
1887
|
+
}).observe(root);
|
|
1887
1888
|
};
|
|
1888
1889
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_tiptap_react.NodeViewWrapper, {
|
|
1889
1890
|
"data-drag-handle": false,
|
|
@@ -1901,7 +1902,19 @@ function HtmlCodeBlockView(props) {
|
|
|
1901
1902
|
onClick: () => {
|
|
1902
1903
|
if (isEmpty) updateAttributes({ activeTab: _maily_to_shared.HTML_CODE_BLOCK_TABS.CODE });
|
|
1903
1904
|
},
|
|
1904
|
-
|
|
1905
|
+
children: !isEmpty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
1906
|
+
onLoad: onPreviewLoad,
|
|
1907
|
+
sandbox: "allow-same-origin",
|
|
1908
|
+
srcDoc: `<!DOCTYPE html><style>${PREVIEW_RESET}</style>${html}`,
|
|
1909
|
+
style: {
|
|
1910
|
+
border: 0,
|
|
1911
|
+
display: "block",
|
|
1912
|
+
height,
|
|
1913
|
+
pointerEvents: "none",
|
|
1914
|
+
width: "100%"
|
|
1915
|
+
},
|
|
1916
|
+
title: "HTML preview"
|
|
1917
|
+
})
|
|
1905
1918
|
})]
|
|
1906
1919
|
});
|
|
1907
1920
|
}
|
|
@@ -2021,20 +2034,28 @@ function uploadImageFile(editor, file, position) {
|
|
|
2021
2034
|
URL.revokeObjectURL(blobUrl);
|
|
2022
2035
|
return;
|
|
2023
2036
|
}
|
|
2037
|
+
const { uploads, progress } = editor.storage.imageUpload;
|
|
2024
2038
|
const context = {
|
|
2025
2039
|
position,
|
|
2026
|
-
removeImage: () => removeImageByBlobUrl(editor, blobUrl)
|
|
2040
|
+
removeImage: () => removeImageByBlobUrl(editor, blobUrl),
|
|
2041
|
+
setProgress: (fraction) => {
|
|
2042
|
+
const percent = Math.round(Math.min(Math.max(fraction, 0), 1) * 100);
|
|
2043
|
+
if (!uploads.has(blobUrl) || progress.get(blobUrl) === percent) return;
|
|
2044
|
+
progress.set(blobUrl, percent);
|
|
2045
|
+
notifyUploadStatusChanged(editor);
|
|
2046
|
+
}
|
|
2027
2047
|
};
|
|
2028
|
-
const { uploads } = editor.storage.imageUpload;
|
|
2029
2048
|
uploads.set(blobUrl, IMAGE_UPLOAD_STATUSES.LOADING);
|
|
2030
2049
|
notifyUploadStatusChanged(editor);
|
|
2031
2050
|
onImageUpload(file, context).then((url) => {
|
|
2032
2051
|
uploads.delete(blobUrl);
|
|
2052
|
+
progress.delete(blobUrl);
|
|
2033
2053
|
notifyUploadStatusChanged(editor);
|
|
2034
2054
|
updateImageByBlobUrl(editor, blobUrl, { src: url });
|
|
2035
2055
|
URL.revokeObjectURL(blobUrl);
|
|
2036
2056
|
}).catch((error) => {
|
|
2037
2057
|
uploads.set(blobUrl, IMAGE_UPLOAD_STATUSES.ERROR);
|
|
2058
|
+
progress.delete(blobUrl);
|
|
2038
2059
|
notifyUploadStatusChanged(editor);
|
|
2039
2060
|
onImageUploadError?.(error, file, context);
|
|
2040
2061
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -2065,7 +2086,10 @@ const ImageUploadExtension = _tiptap_core.Extension.create({
|
|
|
2065
2086
|
};
|
|
2066
2087
|
},
|
|
2067
2088
|
addStorage() {
|
|
2068
|
-
return {
|
|
2089
|
+
return {
|
|
2090
|
+
uploads: /* @__PURE__ */ new Map(),
|
|
2091
|
+
progress: /* @__PURE__ */ new Map()
|
|
2092
|
+
};
|
|
2069
2093
|
},
|
|
2070
2094
|
addExtensions() {
|
|
2071
2095
|
return [_tiptap_extension_file_handler.FileHandler.configure({
|
|
@@ -2224,7 +2248,7 @@ function ImageVariableState() {
|
|
|
2224
2248
|
});
|
|
2225
2249
|
}
|
|
2226
2250
|
function ImageLoadingState(props) {
|
|
2227
|
-
const { alt, src } = props;
|
|
2251
|
+
const { alt, src, progress } = props;
|
|
2228
2252
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2229
2253
|
"aria-busy": "true",
|
|
2230
2254
|
"data-mly-image-loading": "",
|
|
@@ -2234,7 +2258,20 @@ function ImageLoadingState(props) {
|
|
|
2234
2258
|
"data-mly-image-preview": "",
|
|
2235
2259
|
src
|
|
2236
2260
|
}),
|
|
2237
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2261
|
+
progress !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2262
|
+
"aria-label": "Uploading image",
|
|
2263
|
+
"aria-valuemax": 100,
|
|
2264
|
+
"aria-valuemin": 0,
|
|
2265
|
+
"aria-valuenow": progress,
|
|
2266
|
+
"data-mly-image-progress": "",
|
|
2267
|
+
"data-state": progress !== void 0 && progress < 100 ? "uploading" : "done",
|
|
2268
|
+
role: "progressbar",
|
|
2269
|
+
style: { "--mly-image-progress": progress / 100 }
|
|
2270
|
+
}),
|
|
2271
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2272
|
+
"data-mly-image-spinner": "",
|
|
2273
|
+
"data-variant": progress === void 0 ? "center" : "corner"
|
|
2274
|
+
}),
|
|
2238
2275
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisuallyHidden, {
|
|
2239
2276
|
role: "status",
|
|
2240
2277
|
children: "Uploading image"
|
|
@@ -2267,12 +2304,19 @@ function useUploadStatus(editor, src) {
|
|
|
2267
2304
|
if (!src) return IMAGE_UPLOAD_STATUSES.IDLE;
|
|
2268
2305
|
return status ?? IMAGE_UPLOAD_STATUSES.LOADED;
|
|
2269
2306
|
}
|
|
2307
|
+
function useUploadProgress(editor, src) {
|
|
2308
|
+
return (0, _tiptap_react.useEditorState)({
|
|
2309
|
+
editor,
|
|
2310
|
+
selector: (ctx) => src ? ctx.editor.storage.imageUpload?.progress?.get(src) : void 0
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2270
2313
|
function ImageView(props) {
|
|
2271
2314
|
const { editor, getPos, node, updateAttributes } = props;
|
|
2272
2315
|
const { align, alt, src, width, style } = node.attrs;
|
|
2273
2316
|
const { width: _width, maxWidth: _maxWidth, height: _height, ...authoredStyle } = (0, _maily_to_shared.parseInlineStyles)(style ?? "");
|
|
2274
2317
|
const isSrcVariable = !!src && (0, _maily_to_shared.hasVariableInText)(src);
|
|
2275
2318
|
const status = useUploadStatus(editor, isSrcVariable ? void 0 : src);
|
|
2319
|
+
const progress = useUploadProgress(editor, status === IMAGE_UPLOAD_STATUSES.LOADING ? src : void 0);
|
|
2276
2320
|
const { containerRef, handleResize, imageWrapperRef, isResizing, setShouldShowDragHandles, shouldShowDragHandles } = useImageResizeController({
|
|
2277
2321
|
align,
|
|
2278
2322
|
onWidthCommitted: (0, react.useCallback)((committed) => updateAttributes({ width: `${committed}%` }), [updateAttributes])
|
|
@@ -2315,7 +2359,8 @@ function ImageView(props) {
|
|
|
2315
2359
|
!isSrcVariable && status === IMAGE_UPLOAD_STATUSES.IDLE ? editor.isEditable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImagePlaceholder, { onFileSelect: handleFileSelect }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageIdleState, {}) : null,
|
|
2316
2360
|
!isSrcVariable && status === IMAGE_UPLOAD_STATUSES.LOADING ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageLoadingState, {
|
|
2317
2361
|
alt,
|
|
2318
|
-
src
|
|
2362
|
+
src,
|
|
2363
|
+
progress
|
|
2319
2364
|
}) : null,
|
|
2320
2365
|
status === IMAGE_UPLOAD_STATUSES.ERROR ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageErrorState, {}) : null,
|
|
2321
2366
|
!isSrcVariable && isLoaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
@@ -2206,6 +2206,8 @@ const HorizontalRuleExtension = _tiptap_extension_horizontal_rule.HorizontalRule
|
|
|
2206
2206
|
//#endregion
|
|
2207
2207
|
//#region src/extensions/html-code-block/html-code-block-view.tsx
|
|
2208
2208
|
const PREVIEW_RESET = `
|
|
2209
|
+
html { overflow: hidden; }
|
|
2210
|
+
body { margin: 0; }
|
|
2209
2211
|
* { font-family: 'Inter', sans-serif; }
|
|
2210
2212
|
blockquote, h1, h2, h3, img, li, ol, p, ul {
|
|
2211
2213
|
margin-top: 0;
|
|
@@ -2231,24 +2233,22 @@ function HtmlCodeBlockView(props) {
|
|
|
2231
2233
|
}
|
|
2232
2234
|
const html = `<style>${t0.join("\n")}</style>${parsed.body.innerHTML}`;
|
|
2233
2235
|
const isEmpty = html === "<style></style>";
|
|
2236
|
+
const [height, setHeight] = (0, react.useState)(0);
|
|
2234
2237
|
let t1;
|
|
2235
|
-
if ($[3]
|
|
2236
|
-
t1 = (
|
|
2237
|
-
|
|
2238
|
-
const
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
container.innerHTML = html;
|
|
2244
|
-
shadow.append(container);
|
|
2238
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2239
|
+
t1 = (event) => {
|
|
2240
|
+
const frameWindow = event.currentTarget.contentWindow;
|
|
2241
|
+
const root = frameWindow?.document.documentElement;
|
|
2242
|
+
if (!frameWindow || !root) return;
|
|
2243
|
+
new frameWindow.ResizeObserver(() => {
|
|
2244
|
+
setHeight(root.offsetHeight);
|
|
2245
|
+
}).observe(root);
|
|
2245
2246
|
};
|
|
2246
|
-
$[3] =
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
const setPreviewElement = t1;
|
|
2247
|
+
$[3] = t1;
|
|
2248
|
+
} else t1 = $[3];
|
|
2249
|
+
const onPreviewLoad = t1;
|
|
2250
2250
|
let t2;
|
|
2251
|
-
if ($[
|
|
2251
|
+
if ($[4] !== activeTab || $[5] !== language) {
|
|
2252
2252
|
t2 = activeTab === _maily_to_shared.HTML_CODE_BLOCK_TABS.CODE && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
2253
2253
|
"data-mly-html-code-block": "",
|
|
2254
2254
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewContent, {
|
|
@@ -2256,12 +2256,12 @@ function HtmlCodeBlockView(props) {
|
|
|
2256
2256
|
className: language ? `language-${language}` : void 0
|
|
2257
2257
|
})
|
|
2258
2258
|
});
|
|
2259
|
-
$[
|
|
2260
|
-
$[
|
|
2261
|
-
$[
|
|
2262
|
-
} else t2 = $[
|
|
2259
|
+
$[4] = activeTab;
|
|
2260
|
+
$[5] = language;
|
|
2261
|
+
$[6] = t2;
|
|
2262
|
+
} else t2 = $[6];
|
|
2263
2263
|
let t3;
|
|
2264
|
-
if ($[
|
|
2264
|
+
if ($[7] !== activeTab || $[8] !== height || $[9] !== html || $[10] !== isEmpty || $[11] !== updateAttributes) {
|
|
2265
2265
|
t3 = activeTab === _maily_to_shared.HTML_CODE_BLOCK_TABS.PREVIEW && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2266
2266
|
contentEditable: false,
|
|
2267
2267
|
"data-empty": isEmpty ? "" : void 0,
|
|
@@ -2269,11 +2269,24 @@ function HtmlCodeBlockView(props) {
|
|
|
2269
2269
|
onClick: () => {
|
|
2270
2270
|
if (isEmpty) updateAttributes({ activeTab: _maily_to_shared.HTML_CODE_BLOCK_TABS.CODE });
|
|
2271
2271
|
},
|
|
2272
|
-
|
|
2272
|
+
children: !isEmpty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
2273
|
+
onLoad: onPreviewLoad,
|
|
2274
|
+
sandbox: "allow-same-origin",
|
|
2275
|
+
srcDoc: `<!DOCTYPE html><style>${PREVIEW_RESET}</style>${html}`,
|
|
2276
|
+
style: {
|
|
2277
|
+
border: 0,
|
|
2278
|
+
display: "block",
|
|
2279
|
+
height,
|
|
2280
|
+
pointerEvents: "none",
|
|
2281
|
+
width: "100%"
|
|
2282
|
+
},
|
|
2283
|
+
title: "HTML preview"
|
|
2284
|
+
})
|
|
2273
2285
|
});
|
|
2274
|
-
$[
|
|
2275
|
-
$[
|
|
2276
|
-
$[
|
|
2286
|
+
$[7] = activeTab;
|
|
2287
|
+
$[8] = height;
|
|
2288
|
+
$[9] = html;
|
|
2289
|
+
$[10] = isEmpty;
|
|
2277
2290
|
$[11] = updateAttributes;
|
|
2278
2291
|
$[12] = t3;
|
|
2279
2292
|
} else t3 = $[12];
|
|
@@ -2413,20 +2426,28 @@ function uploadImageFile(editor, file, position) {
|
|
|
2413
2426
|
URL.revokeObjectURL(blobUrl);
|
|
2414
2427
|
return;
|
|
2415
2428
|
}
|
|
2429
|
+
const { uploads, progress } = editor.storage.imageUpload;
|
|
2416
2430
|
const context = {
|
|
2417
2431
|
position,
|
|
2418
|
-
removeImage: () => removeImageByBlobUrl(editor, blobUrl)
|
|
2432
|
+
removeImage: () => removeImageByBlobUrl(editor, blobUrl),
|
|
2433
|
+
setProgress: (fraction) => {
|
|
2434
|
+
const percent = Math.round(Math.min(Math.max(fraction, 0), 1) * 100);
|
|
2435
|
+
if (!uploads.has(blobUrl) || progress.get(blobUrl) === percent) return;
|
|
2436
|
+
progress.set(blobUrl, percent);
|
|
2437
|
+
notifyUploadStatusChanged(editor);
|
|
2438
|
+
}
|
|
2419
2439
|
};
|
|
2420
|
-
const { uploads } = editor.storage.imageUpload;
|
|
2421
2440
|
uploads.set(blobUrl, IMAGE_UPLOAD_STATUSES.LOADING);
|
|
2422
2441
|
notifyUploadStatusChanged(editor);
|
|
2423
2442
|
onImageUpload(file, context).then((url) => {
|
|
2424
2443
|
uploads.delete(blobUrl);
|
|
2444
|
+
progress.delete(blobUrl);
|
|
2425
2445
|
notifyUploadStatusChanged(editor);
|
|
2426
2446
|
updateImageByBlobUrl(editor, blobUrl, { src: url });
|
|
2427
2447
|
URL.revokeObjectURL(blobUrl);
|
|
2428
2448
|
}).catch((error) => {
|
|
2429
2449
|
uploads.set(blobUrl, IMAGE_UPLOAD_STATUSES.ERROR);
|
|
2450
|
+
progress.delete(blobUrl);
|
|
2430
2451
|
notifyUploadStatusChanged(editor);
|
|
2431
2452
|
onImageUploadError?.(error, file, context);
|
|
2432
2453
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -2457,7 +2478,10 @@ const ImageUploadExtension = _tiptap_core.Extension.create({
|
|
|
2457
2478
|
};
|
|
2458
2479
|
},
|
|
2459
2480
|
addStorage() {
|
|
2460
|
-
return {
|
|
2481
|
+
return {
|
|
2482
|
+
uploads: /* @__PURE__ */ new Map(),
|
|
2483
|
+
progress: /* @__PURE__ */ new Map()
|
|
2484
|
+
};
|
|
2461
2485
|
},
|
|
2462
2486
|
addExtensions() {
|
|
2463
2487
|
return [_tiptap_extension_file_handler.FileHandler.configure({
|
|
@@ -2730,8 +2754,9 @@ function ImageVariableState() {
|
|
|
2730
2754
|
return t0;
|
|
2731
2755
|
}
|
|
2732
2756
|
function ImageLoadingState(props) {
|
|
2733
|
-
const $ = (0, react_compiler_runtime.c)(
|
|
2734
|
-
const { alt, src } = props;
|
|
2757
|
+
const $ = (0, react_compiler_runtime.c)(13);
|
|
2758
|
+
const { alt, src, progress } = props;
|
|
2759
|
+
const isUploading = progress !== void 0 && progress < 100;
|
|
2735
2760
|
const t0 = alt ?? void 0;
|
|
2736
2761
|
let t1;
|
|
2737
2762
|
if ($[0] !== src || $[1] !== t0) {
|
|
@@ -2745,34 +2770,57 @@ function ImageLoadingState(props) {
|
|
|
2745
2770
|
$[2] = t1;
|
|
2746
2771
|
} else t1 = $[2];
|
|
2747
2772
|
let t2;
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2773
|
+
if ($[3] !== isUploading || $[4] !== progress) {
|
|
2774
|
+
t2 = progress !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2775
|
+
"aria-label": "Uploading image",
|
|
2776
|
+
"aria-valuemax": 100,
|
|
2777
|
+
"aria-valuemin": 0,
|
|
2778
|
+
"aria-valuenow": progress,
|
|
2779
|
+
"data-mly-image-progress": "",
|
|
2780
|
+
"data-state": isUploading ? "uploading" : "done",
|
|
2781
|
+
role: "progressbar",
|
|
2782
|
+
style: { "--mly-image-progress": progress / 100 }
|
|
2783
|
+
});
|
|
2784
|
+
$[3] = isUploading;
|
|
2785
|
+
$[4] = progress;
|
|
2786
|
+
$[5] = t2;
|
|
2787
|
+
} else t2 = $[5];
|
|
2788
|
+
const t3 = progress === void 0 ? "center" : "corner";
|
|
2789
|
+
let t4;
|
|
2790
|
+
if ($[6] !== t3) {
|
|
2791
|
+
t4 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2792
|
+
"data-mly-image-spinner": "",
|
|
2793
|
+
"data-variant": t3
|
|
2794
|
+
});
|
|
2795
|
+
$[6] = t3;
|
|
2796
|
+
$[7] = t4;
|
|
2797
|
+
} else t4 = $[7];
|
|
2798
|
+
let t5;
|
|
2799
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2800
|
+
t5 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisuallyHidden, {
|
|
2752
2801
|
role: "status",
|
|
2753
2802
|
children: "Uploading image"
|
|
2754
2803
|
});
|
|
2755
|
-
$[
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
}
|
|
2761
|
-
let t4;
|
|
2762
|
-
if ($[5] !== t1) {
|
|
2763
|
-
t4 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2804
|
+
$[8] = t5;
|
|
2805
|
+
} else t5 = $[8];
|
|
2806
|
+
let t6;
|
|
2807
|
+
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t4) {
|
|
2808
|
+
t6 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2764
2809
|
"aria-busy": "true",
|
|
2765
2810
|
"data-mly-image-loading": "",
|
|
2766
2811
|
children: [
|
|
2767
2812
|
t1,
|
|
2768
2813
|
t2,
|
|
2769
|
-
|
|
2814
|
+
t4,
|
|
2815
|
+
t5
|
|
2770
2816
|
]
|
|
2771
2817
|
});
|
|
2772
|
-
$[
|
|
2773
|
-
$[
|
|
2774
|
-
|
|
2775
|
-
|
|
2818
|
+
$[9] = t1;
|
|
2819
|
+
$[10] = t2;
|
|
2820
|
+
$[11] = t4;
|
|
2821
|
+
$[12] = t6;
|
|
2822
|
+
} else t6 = $[12];
|
|
2823
|
+
return t6;
|
|
2776
2824
|
}
|
|
2777
2825
|
function ImagePlaceholder(props) {
|
|
2778
2826
|
const $ = (0, react_compiler_runtime.c)(3);
|
|
@@ -2825,8 +2873,28 @@ function useUploadStatus(editor, src) {
|
|
|
2825
2873
|
if (!src) return IMAGE_UPLOAD_STATUSES.IDLE;
|
|
2826
2874
|
return status ?? IMAGE_UPLOAD_STATUSES.LOADED;
|
|
2827
2875
|
}
|
|
2876
|
+
function useUploadProgress(editor, src) {
|
|
2877
|
+
const $ = (0, react_compiler_runtime.c)(5);
|
|
2878
|
+
let t0;
|
|
2879
|
+
if ($[0] !== src) {
|
|
2880
|
+
t0 = (ctx) => src ? ctx.editor.storage.imageUpload?.progress?.get(src) : void 0;
|
|
2881
|
+
$[0] = src;
|
|
2882
|
+
$[1] = t0;
|
|
2883
|
+
} else t0 = $[1];
|
|
2884
|
+
let t1;
|
|
2885
|
+
if ($[2] !== editor || $[3] !== t0) {
|
|
2886
|
+
t1 = {
|
|
2887
|
+
editor,
|
|
2888
|
+
selector: t0
|
|
2889
|
+
};
|
|
2890
|
+
$[2] = editor;
|
|
2891
|
+
$[3] = t0;
|
|
2892
|
+
$[4] = t1;
|
|
2893
|
+
} else t1 = $[4];
|
|
2894
|
+
return (0, _tiptap_react.useEditorState)(t1);
|
|
2895
|
+
}
|
|
2828
2896
|
function ImageView(props) {
|
|
2829
|
-
const $ = (0, react_compiler_runtime.c)(
|
|
2897
|
+
const $ = (0, react_compiler_runtime.c)(66);
|
|
2830
2898
|
const { editor, getPos, node, updateAttributes } = props;
|
|
2831
2899
|
const { align, alt, src, width, style } = node.attrs;
|
|
2832
2900
|
const t0 = style ?? "";
|
|
@@ -2851,6 +2919,7 @@ function ImageView(props) {
|
|
|
2851
2919
|
} else t2 = $[5];
|
|
2852
2920
|
const isSrcVariable = t2;
|
|
2853
2921
|
const status = useUploadStatus(editor, isSrcVariable ? void 0 : src);
|
|
2922
|
+
const progress = useUploadProgress(editor, status === IMAGE_UPLOAD_STATUSES.LOADING ? src : void 0);
|
|
2854
2923
|
let t3;
|
|
2855
2924
|
if ($[6] !== updateAttributes) {
|
|
2856
2925
|
t3 = (committed) => updateAttributes({ width: `${committed}%` });
|
|
@@ -2938,25 +3007,27 @@ function ImageView(props) {
|
|
|
2938
3007
|
$[31] = t14;
|
|
2939
3008
|
} else t14 = $[31];
|
|
2940
3009
|
let t15;
|
|
2941
|
-
if ($[32] !== alt || $[33] !== isSrcVariable || $[34] !==
|
|
3010
|
+
if ($[32] !== alt || $[33] !== isSrcVariable || $[34] !== progress || $[35] !== src || $[36] !== status) {
|
|
2942
3011
|
t15 = !isSrcVariable && status === IMAGE_UPLOAD_STATUSES.LOADING ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageLoadingState, {
|
|
2943
3012
|
alt,
|
|
2944
|
-
src
|
|
3013
|
+
src,
|
|
3014
|
+
progress
|
|
2945
3015
|
}) : null;
|
|
2946
3016
|
$[32] = alt;
|
|
2947
3017
|
$[33] = isSrcVariable;
|
|
2948
|
-
$[34] =
|
|
2949
|
-
$[35] =
|
|
2950
|
-
$[36] =
|
|
2951
|
-
|
|
3018
|
+
$[34] = progress;
|
|
3019
|
+
$[35] = src;
|
|
3020
|
+
$[36] = status;
|
|
3021
|
+
$[37] = t15;
|
|
3022
|
+
} else t15 = $[37];
|
|
2952
3023
|
let t16;
|
|
2953
|
-
if ($[
|
|
3024
|
+
if ($[38] !== status) {
|
|
2954
3025
|
t16 = status === IMAGE_UPLOAD_STATUSES.ERROR ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageErrorState, {}) : null;
|
|
2955
|
-
$[
|
|
2956
|
-
$[
|
|
2957
|
-
} else t16 = $[
|
|
3026
|
+
$[38] = status;
|
|
3027
|
+
$[39] = t16;
|
|
3028
|
+
} else t16 = $[39];
|
|
2958
3029
|
let t17;
|
|
2959
|
-
if ($[
|
|
3030
|
+
if ($[40] !== alt || $[41] !== authoredStyle || $[42] !== editor.isEditable || $[43] !== handlePointerDown || $[44] !== isLoaded || $[45] !== isResizing || $[46] !== isSrcVariable || $[47] !== shouldShowDragHandles || $[48] !== src) {
|
|
2960
3031
|
t17 = !isSrcVariable && isLoaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
2961
3032
|
alt: alt ?? void 0,
|
|
2962
3033
|
contentEditable: false,
|
|
@@ -2971,19 +3042,19 @@ function ImageView(props) {
|
|
|
2971
3042
|
handle: "right",
|
|
2972
3043
|
onPointerDown: (event_1) => handlePointerDown("right", event_1)
|
|
2973
3044
|
})] }) : null] }) : null;
|
|
2974
|
-
$[
|
|
2975
|
-
$[
|
|
2976
|
-
$[
|
|
2977
|
-
$[
|
|
2978
|
-
$[
|
|
2979
|
-
$[
|
|
2980
|
-
$[
|
|
2981
|
-
$[
|
|
2982
|
-
$[
|
|
2983
|
-
$[
|
|
2984
|
-
} else t17 = $[
|
|
3045
|
+
$[40] = alt;
|
|
3046
|
+
$[41] = authoredStyle;
|
|
3047
|
+
$[42] = editor.isEditable;
|
|
3048
|
+
$[43] = handlePointerDown;
|
|
3049
|
+
$[44] = isLoaded;
|
|
3050
|
+
$[45] = isResizing;
|
|
3051
|
+
$[46] = isSrcVariable;
|
|
3052
|
+
$[47] = shouldShowDragHandles;
|
|
3053
|
+
$[48] = src;
|
|
3054
|
+
$[49] = t17;
|
|
3055
|
+
} else t17 = $[49];
|
|
2985
3056
|
let t18;
|
|
2986
|
-
if ($[
|
|
3057
|
+
if ($[50] !== align || $[51] !== imageWrapperRef || $[52] !== t12 || $[53] !== t13 || $[54] !== t14 || $[55] !== t15 || $[56] !== t16 || $[57] !== t17) {
|
|
2987
3058
|
t18 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2988
3059
|
"data-align": align,
|
|
2989
3060
|
"data-mly-image-wrapper": "",
|
|
@@ -2997,18 +3068,18 @@ function ImageView(props) {
|
|
|
2997
3068
|
t17
|
|
2998
3069
|
]
|
|
2999
3070
|
});
|
|
3000
|
-
$[
|
|
3001
|
-
$[
|
|
3002
|
-
$[
|
|
3003
|
-
$[
|
|
3004
|
-
$[
|
|
3005
|
-
$[
|
|
3006
|
-
$[
|
|
3007
|
-
$[
|
|
3008
|
-
$[
|
|
3009
|
-
} else t18 = $[
|
|
3071
|
+
$[50] = align;
|
|
3072
|
+
$[51] = imageWrapperRef;
|
|
3073
|
+
$[52] = t12;
|
|
3074
|
+
$[53] = t13;
|
|
3075
|
+
$[54] = t14;
|
|
3076
|
+
$[55] = t15;
|
|
3077
|
+
$[56] = t16;
|
|
3078
|
+
$[57] = t17;
|
|
3079
|
+
$[58] = t18;
|
|
3080
|
+
} else t18 = $[58];
|
|
3010
3081
|
let t19;
|
|
3011
|
-
if ($[
|
|
3082
|
+
if ($[59] !== containerRef || $[60] !== t10 || $[61] !== t11 || $[62] !== t18 || $[63] !== t8 || $[64] !== t9) {
|
|
3012
3083
|
t19 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react.NodeViewWrapper, {
|
|
3013
3084
|
"data-drag-handle": t8,
|
|
3014
3085
|
"data-mly-image-view": "",
|
|
@@ -3018,14 +3089,14 @@ function ImageView(props) {
|
|
|
3018
3089
|
ref: containerRef,
|
|
3019
3090
|
children: t18
|
|
3020
3091
|
});
|
|
3021
|
-
$[
|
|
3022
|
-
$[
|
|
3023
|
-
$[
|
|
3024
|
-
$[
|
|
3025
|
-
$[
|
|
3026
|
-
$[
|
|
3027
|
-
$[
|
|
3028
|
-
} else t19 = $[
|
|
3092
|
+
$[59] = containerRef;
|
|
3093
|
+
$[60] = t10;
|
|
3094
|
+
$[61] = t11;
|
|
3095
|
+
$[62] = t18;
|
|
3096
|
+
$[63] = t8;
|
|
3097
|
+
$[64] = t9;
|
|
3098
|
+
$[65] = t19;
|
|
3099
|
+
} else t19 = $[65];
|
|
3029
3100
|
return t19;
|
|
3030
3101
|
}
|
|
3031
3102
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maily-to/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
|
|
6
6
|
"keywords": [
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"lucide-react": "^1.28.0",
|
|
88
88
|
"unit-field": "^0.0.3",
|
|
89
89
|
"zustand": "^5.0.14",
|
|
90
|
-
"@maily-to/shared": "2.0.0-beta.
|
|
90
|
+
"@maily-to/shared": "2.0.0-beta.19"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@react-email/components": "^1.0.12",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"@maily-to/extension-ai-actions": "0.0.1",
|
|
111
111
|
"@maily-to/extension-inline-suggestion": "0.0.1",
|
|
112
112
|
"@maily-to/extension-variable": "0.0.1",
|
|
113
|
-
"@maily-to/render": "2.0.0-beta.
|
|
113
|
+
"@maily-to/render": "2.0.0-beta.19",
|
|
114
114
|
"@maily-to/tsconfig": "0.0.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
package/src/styles/index.css
CHANGED
|
@@ -410,11 +410,69 @@
|
|
|
410
410
|
position: relative;
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
[data-mly-image-loading]::before {
|
|
414
|
+
position: absolute;
|
|
415
|
+
inset: 0;
|
|
416
|
+
background: rgb(0 0 0 / 40%);
|
|
417
|
+
content: '';
|
|
418
|
+
}
|
|
419
|
+
|
|
413
420
|
[data-mly-image-preview] {
|
|
421
|
+
display: block;
|
|
414
422
|
width: 100%;
|
|
415
423
|
max-width: 100%;
|
|
416
424
|
height: auto;
|
|
417
|
-
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
@property --mly-image-progress {
|
|
428
|
+
syntax: '<number>';
|
|
429
|
+
inherits: false;
|
|
430
|
+
initial-value: 0;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
[data-mly-image-progress] {
|
|
434
|
+
position: absolute;
|
|
435
|
+
top: 50%;
|
|
436
|
+
left: 50%;
|
|
437
|
+
width: 64px;
|
|
438
|
+
height: 64px;
|
|
439
|
+
margin: -32px 0 0 -32px;
|
|
440
|
+
border-radius: 50%;
|
|
441
|
+
background:
|
|
442
|
+
conic-gradient(
|
|
443
|
+
#fff calc(var(--mly-image-progress) * 360deg),
|
|
444
|
+
transparent 0
|
|
445
|
+
),
|
|
446
|
+
rgb(255 255 255 / 20%);
|
|
447
|
+
transition:
|
|
448
|
+
--mly-image-progress 0.5s ease-in-out,
|
|
449
|
+
opacity 0.2s ease-out,
|
|
450
|
+
scale 0.2s ease-out;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@starting-style {
|
|
454
|
+
[data-mly-image-progress] {
|
|
455
|
+
opacity: 0;
|
|
456
|
+
scale: 0.75;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
[data-mly-image-progress][data-state='done'] {
|
|
461
|
+
opacity: 0;
|
|
462
|
+
scale: 0.75;
|
|
463
|
+
transition-delay: 0s, 0.3s, 0.3s;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
[data-mly-image-spinner][data-variant='corner'] {
|
|
467
|
+
top: 10px;
|
|
468
|
+
right: 10px;
|
|
469
|
+
left: auto;
|
|
470
|
+
width: 14px;
|
|
471
|
+
height: 14px;
|
|
472
|
+
margin: 0;
|
|
473
|
+
border-width: 2px;
|
|
474
|
+
border-color: rgb(255 255 255 / 35%);
|
|
475
|
+
border-top-color: #fff;
|
|
418
476
|
}
|
|
419
477
|
|
|
420
478
|
[data-mly-image-spinner] {
|
|
@@ -2538,6 +2596,10 @@ body:has([data-mly-unit-field][data-dragging='true']) * {
|
|
|
2538
2596
|
animation: none;
|
|
2539
2597
|
}
|
|
2540
2598
|
|
|
2599
|
+
[data-mly-image-progress] {
|
|
2600
|
+
transition: none;
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2541
2603
|
[data-mly-suggestion] {
|
|
2542
2604
|
transition: none;
|
|
2543
2605
|
}
|