@maily-to/core 0.3.4 → 0.3.6
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 +128 -64
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +11 -0
- package/dist/extensions/index.d.ts +11 -0
- package/dist/extensions/index.mjs +128 -64
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +287 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +287 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -21
|
@@ -332,47 +332,10 @@ var import_extension_focus = __toESM(require("@tiptap/extension-focus"), 1);
|
|
|
332
332
|
var import_extension_dropcursor = __toESM(require("@tiptap/extension-dropcursor"), 1);
|
|
333
333
|
|
|
334
334
|
// src/editor/nodes/footer.ts
|
|
335
|
-
var
|
|
336
|
-
var Footer = import_core3.Node.create({
|
|
337
|
-
name: "footer",
|
|
338
|
-
group: "block",
|
|
339
|
-
content: "inline*",
|
|
340
|
-
addAttributes() {
|
|
341
|
-
return {
|
|
342
|
-
"maily-component": {
|
|
343
|
-
default: "footer",
|
|
344
|
-
renderHTML: (attributes) => {
|
|
345
|
-
return {
|
|
346
|
-
"data-maily-component": attributes["maily-component"]
|
|
347
|
-
};
|
|
348
|
-
},
|
|
349
|
-
parseHTML: (element) => element == null ? void 0 : element.getAttribute("data-maily-component")
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
},
|
|
353
|
-
addCommands() {
|
|
354
|
-
return {
|
|
355
|
-
setFooter: () => ({ commands }) => {
|
|
356
|
-
return commands.setNode(this.name);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
},
|
|
360
|
-
parseHTML() {
|
|
361
|
-
return [{ tag: 'small[data-maily-component="footer"]' }];
|
|
362
|
-
},
|
|
363
|
-
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
364
|
-
return [
|
|
365
|
-
"small",
|
|
366
|
-
(0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
367
|
-
class: "footer mly:block mly:text-[13px] mly:text-slate-500 mly:relative"
|
|
368
|
-
}),
|
|
369
|
-
0
|
|
370
|
-
];
|
|
371
|
-
}
|
|
372
|
-
});
|
|
335
|
+
var import_core4 = require("@tiptap/core");
|
|
373
336
|
|
|
374
|
-
// src/editor/nodes/
|
|
375
|
-
var
|
|
337
|
+
// src/editor/nodes/paragraph/paragraph.ts
|
|
338
|
+
var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
|
|
376
339
|
|
|
377
340
|
// src/editor/utils/update-attribute.ts
|
|
378
341
|
function updateAttributes(type, attrs) {
|
|
@@ -409,7 +372,7 @@ function updateAttributes(type, attrs) {
|
|
|
409
372
|
}
|
|
410
373
|
|
|
411
374
|
// src/editor/nodes/section/section.ts
|
|
412
|
-
var
|
|
375
|
+
var import_core3 = require("@tiptap/core");
|
|
413
376
|
var DEFAULT_SECTION_BACKGROUND_COLOR = "#f7f7f7";
|
|
414
377
|
var DEFAULT_SECTION_ALIGN = "left";
|
|
415
378
|
var DEFAULT_SECTION_BORDER_WIDTH = 2;
|
|
@@ -424,7 +387,7 @@ var DEFAULT_SECTION_PADDING_RIGHT = 0;
|
|
|
424
387
|
var DEFAULT_SECTION_PADDING_BOTTOM = 0;
|
|
425
388
|
var DEFAULT_SECTION_PADDING_LEFT = 0;
|
|
426
389
|
var DEFAULT_SECTION_SHOW_IF_KEY = null;
|
|
427
|
-
var SectionExtension =
|
|
390
|
+
var SectionExtension = import_core3.Node.create({
|
|
428
391
|
name: "section",
|
|
429
392
|
group: "block",
|
|
430
393
|
content: "(block|columns)+",
|
|
@@ -687,7 +650,7 @@ var SectionExtension = import_core4.Node.create({
|
|
|
687
650
|
},
|
|
688
651
|
[
|
|
689
652
|
"td",
|
|
690
|
-
(0,
|
|
653
|
+
(0, import_core3.mergeAttributes)(HTMLAttributes2, {
|
|
691
654
|
"data-type": "section-cell",
|
|
692
655
|
style: "border-style: solid",
|
|
693
656
|
class: "mly:w-full mly:[text-align:revert-layer]"
|
|
@@ -707,7 +670,116 @@ var SectionExtension = import_core4.Node.create({
|
|
|
707
670
|
}
|
|
708
671
|
});
|
|
709
672
|
|
|
673
|
+
// src/editor/nodes/paragraph/paragraph.ts
|
|
674
|
+
var DEFAULT_TEXT_DIRECTION = "ltr";
|
|
675
|
+
var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
676
|
+
addAttributes() {
|
|
677
|
+
var _a;
|
|
678
|
+
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
679
|
+
textDirection: {
|
|
680
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
681
|
+
parseHTML: (element) => {
|
|
682
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
683
|
+
},
|
|
684
|
+
renderHTML(attributes) {
|
|
685
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
686
|
+
return {};
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
"data-text-direction": attributes.textDirection,
|
|
690
|
+
dir: attributes.textDirection
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
showIfKey: {
|
|
695
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
696
|
+
parseHTML: (element) => {
|
|
697
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
698
|
+
},
|
|
699
|
+
renderHTML(attributes) {
|
|
700
|
+
if (!attributes.showIfKey) {
|
|
701
|
+
return {};
|
|
702
|
+
}
|
|
703
|
+
return {
|
|
704
|
+
"data-show-if-key": attributes.showIfKey
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
addCommands() {
|
|
711
|
+
var _a;
|
|
712
|
+
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
713
|
+
setTextDirection: (direction) => ({ commands }) => {
|
|
714
|
+
return commands.updateAttributes(this.name, {
|
|
715
|
+
textDirection: direction
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// src/editor/nodes/footer.ts
|
|
723
|
+
var Footer = import_core4.Node.create({
|
|
724
|
+
name: "footer",
|
|
725
|
+
group: "block",
|
|
726
|
+
content: "inline*",
|
|
727
|
+
addAttributes() {
|
|
728
|
+
return {
|
|
729
|
+
"maily-component": {
|
|
730
|
+
default: "footer",
|
|
731
|
+
renderHTML: (attributes) => {
|
|
732
|
+
return {
|
|
733
|
+
"data-maily-component": attributes["maily-component"]
|
|
734
|
+
};
|
|
735
|
+
},
|
|
736
|
+
parseHTML: (element) => element == null ? void 0 : element.getAttribute("data-maily-component")
|
|
737
|
+
},
|
|
738
|
+
textDirection: {
|
|
739
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
740
|
+
parseHTML: (element) => {
|
|
741
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
742
|
+
},
|
|
743
|
+
renderHTML(attributes) {
|
|
744
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
745
|
+
return {};
|
|
746
|
+
}
|
|
747
|
+
return {
|
|
748
|
+
"data-text-direction": attributes.textDirection,
|
|
749
|
+
dir: attributes.textDirection
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
},
|
|
755
|
+
addCommands() {
|
|
756
|
+
return {
|
|
757
|
+
setFooter: () => ({ commands }) => {
|
|
758
|
+
return commands.setNode(this.name);
|
|
759
|
+
},
|
|
760
|
+
setFooterTextDirection: (direction) => ({ commands }) => {
|
|
761
|
+
return commands.updateAttributes("footer", {
|
|
762
|
+
textDirection: direction
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
},
|
|
767
|
+
parseHTML() {
|
|
768
|
+
return [{ tag: 'small[data-maily-component="footer"]' }];
|
|
769
|
+
},
|
|
770
|
+
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
771
|
+
return [
|
|
772
|
+
"small",
|
|
773
|
+
(0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
774
|
+
class: "footer mly:block mly:text-[13px] mly:text-slate-500 mly:relative"
|
|
775
|
+
}),
|
|
776
|
+
0
|
|
777
|
+
];
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
|
|
710
781
|
// src/editor/nodes/spacer.ts
|
|
782
|
+
var import_core5 = require("@tiptap/core");
|
|
711
783
|
var DEFAULT_SPACER_HEIGHT = 8;
|
|
712
784
|
var Spacer = import_core5.Node.create({
|
|
713
785
|
name: "spacer",
|
|
@@ -4586,7 +4658,8 @@ function ImageView(props) {
|
|
|
4586
4658
|
newHeight = IMAGE_MAX_HEIGHT;
|
|
4587
4659
|
}
|
|
4588
4660
|
if (node.attrs.lockAspectRatio) {
|
|
4589
|
-
|
|
4661
|
+
const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
|
|
4662
|
+
newHeight = getNewHeight(newWidth, aspectRatio);
|
|
4590
4663
|
}
|
|
4591
4664
|
setResizingStyle({ width: newWidth, height: newHeight });
|
|
4592
4665
|
if (!event2.buttons) {
|
|
@@ -4762,8 +4835,8 @@ function ImageView(props) {
|
|
|
4762
4835
|
"data-drag-handle": editor.isEditable,
|
|
4763
4836
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
4764
4837
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
4765
|
-
width: width ? `${width}px` : void 0,
|
|
4766
|
-
height: height ? `${height}px` : void 0
|
|
4838
|
+
width: width && width !== "auto" ? `${width}px` : void 0,
|
|
4839
|
+
height: height && height !== "auto" ? `${height}px` : void 0
|
|
4767
4840
|
}, resizingStyle) : {}), {
|
|
4768
4841
|
overflow: "hidden",
|
|
4769
4842
|
position: "relative",
|
|
@@ -4815,8 +4888,8 @@ function ImageView(props) {
|
|
|
4815
4888
|
objectFit: "fill",
|
|
4816
4889
|
marginBottom: 0,
|
|
4817
4890
|
borderRadius,
|
|
4818
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
|
|
4819
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
|
|
4891
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
|
|
4892
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
|
|
4820
4893
|
}),
|
|
4821
4894
|
draggable: editor.isEditable,
|
|
4822
4895
|
className: cn(
|
|
@@ -7920,30 +7993,21 @@ var HeadingExtension = import_extension_heading.default.extend({
|
|
|
7920
7993
|
addAttributes() {
|
|
7921
7994
|
var _a;
|
|
7922
7995
|
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
7923
|
-
|
|
7924
|
-
default:
|
|
7996
|
+
textDirection: {
|
|
7997
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
7925
7998
|
parseHTML: (element) => {
|
|
7926
|
-
return element.getAttribute("data-
|
|
7999
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
7927
8000
|
},
|
|
7928
8001
|
renderHTML(attributes) {
|
|
7929
|
-
if (!attributes.
|
|
8002
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
7930
8003
|
return {};
|
|
7931
8004
|
}
|
|
7932
8005
|
return {
|
|
7933
|
-
"data-
|
|
8006
|
+
"data-text-direction": attributes.textDirection,
|
|
8007
|
+
dir: attributes.textDirection
|
|
7934
8008
|
};
|
|
7935
8009
|
}
|
|
7936
|
-
}
|
|
7937
|
-
});
|
|
7938
|
-
}
|
|
7939
|
-
});
|
|
7940
|
-
|
|
7941
|
-
// src/editor/nodes/paragraph/paragraph.ts
|
|
7942
|
-
var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
|
|
7943
|
-
var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
7944
|
-
addAttributes() {
|
|
7945
|
-
var _a;
|
|
7946
|
-
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
8010
|
+
},
|
|
7947
8011
|
showIfKey: {
|
|
7948
8012
|
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
7949
8013
|
parseHTML: (element) => {
|