@maily-to/core 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/index.cjs +122 -59
- 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 +122 -59
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +269 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +4 -4
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +269 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -216,6 +216,16 @@ declare module '@tiptap/core' {
|
|
|
216
216
|
}
|
|
217
217
|
declare const ColumnsExtension: Node<any, any>;
|
|
218
218
|
|
|
219
|
+
declare const allowedTextDirection: readonly ["ltr", "rtl"];
|
|
220
|
+
type AllowedTextDirection = (typeof allowedTextDirection)[number];
|
|
221
|
+
declare module '@tiptap/core' {
|
|
222
|
+
interface Commands<ReturnType> {
|
|
223
|
+
textDirection: {
|
|
224
|
+
setTextDirection: (direction: AllowedTextDirection) => ReturnType;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
219
229
|
interface FooterOptions {
|
|
220
230
|
HTMLAttributes: Record<string, any>;
|
|
221
231
|
}
|
|
@@ -223,6 +233,7 @@ declare module '@tiptap/core' {
|
|
|
223
233
|
interface Commands<ReturnType> {
|
|
224
234
|
footer: {
|
|
225
235
|
setFooter: () => ReturnType;
|
|
236
|
+
setFooterTextDirection: (direction: AllowedTextDirection) => ReturnType;
|
|
226
237
|
};
|
|
227
238
|
}
|
|
228
239
|
}
|
|
@@ -216,6 +216,16 @@ declare module '@tiptap/core' {
|
|
|
216
216
|
}
|
|
217
217
|
declare const ColumnsExtension: Node<any, any>;
|
|
218
218
|
|
|
219
|
+
declare const allowedTextDirection: readonly ["ltr", "rtl"];
|
|
220
|
+
type AllowedTextDirection = (typeof allowedTextDirection)[number];
|
|
221
|
+
declare module '@tiptap/core' {
|
|
222
|
+
interface Commands<ReturnType> {
|
|
223
|
+
textDirection: {
|
|
224
|
+
setTextDirection: (direction: AllowedTextDirection) => ReturnType;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
219
229
|
interface FooterOptions {
|
|
220
230
|
HTMLAttributes: Record<string, any>;
|
|
221
231
|
}
|
|
@@ -223,6 +233,7 @@ declare module '@tiptap/core' {
|
|
|
223
233
|
interface Commands<ReturnType> {
|
|
224
234
|
footer: {
|
|
225
235
|
setFooter: () => ReturnType;
|
|
236
|
+
setFooterTextDirection: (direction: AllowedTextDirection) => ReturnType;
|
|
226
237
|
};
|
|
227
238
|
}
|
|
228
239
|
}
|
|
@@ -239,47 +239,10 @@ import Focus from "@tiptap/extension-focus";
|
|
|
239
239
|
import Dropcursor from "@tiptap/extension-dropcursor";
|
|
240
240
|
|
|
241
241
|
// src/editor/nodes/footer.ts
|
|
242
|
-
import { mergeAttributes, Node } from "@tiptap/core";
|
|
243
|
-
var Footer = Node.create({
|
|
244
|
-
name: "footer",
|
|
245
|
-
group: "block",
|
|
246
|
-
content: "inline*",
|
|
247
|
-
addAttributes() {
|
|
248
|
-
return {
|
|
249
|
-
"maily-component": {
|
|
250
|
-
default: "footer",
|
|
251
|
-
renderHTML: (attributes) => {
|
|
252
|
-
return {
|
|
253
|
-
"data-maily-component": attributes["maily-component"]
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
parseHTML: (element) => element == null ? void 0 : element.getAttribute("data-maily-component")
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
},
|
|
260
|
-
addCommands() {
|
|
261
|
-
return {
|
|
262
|
-
setFooter: () => ({ commands }) => {
|
|
263
|
-
return commands.setNode(this.name);
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
},
|
|
267
|
-
parseHTML() {
|
|
268
|
-
return [{ tag: 'small[data-maily-component="footer"]' }];
|
|
269
|
-
},
|
|
270
|
-
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
271
|
-
return [
|
|
272
|
-
"small",
|
|
273
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
274
|
-
class: "footer mly:block mly:text-[13px] mly:text-slate-500 mly:relative"
|
|
275
|
-
}),
|
|
276
|
-
0
|
|
277
|
-
];
|
|
278
|
-
}
|
|
279
|
-
});
|
|
242
|
+
import { mergeAttributes as mergeAttributes2, Node as Node2 } from "@tiptap/core";
|
|
280
243
|
|
|
281
|
-
// src/editor/nodes/
|
|
282
|
-
import
|
|
244
|
+
// src/editor/nodes/paragraph/paragraph.ts
|
|
245
|
+
import TiptapParagraph from "@tiptap/extension-paragraph";
|
|
283
246
|
|
|
284
247
|
// src/editor/utils/update-attribute.ts
|
|
285
248
|
function updateAttributes(type, attrs) {
|
|
@@ -316,7 +279,7 @@ function updateAttributes(type, attrs) {
|
|
|
316
279
|
}
|
|
317
280
|
|
|
318
281
|
// src/editor/nodes/section/section.ts
|
|
319
|
-
import { mergeAttributes
|
|
282
|
+
import { mergeAttributes, Node } from "@tiptap/core";
|
|
320
283
|
var DEFAULT_SECTION_BACKGROUND_COLOR = "#f7f7f7";
|
|
321
284
|
var DEFAULT_SECTION_ALIGN = "left";
|
|
322
285
|
var DEFAULT_SECTION_BORDER_WIDTH = 2;
|
|
@@ -331,7 +294,7 @@ var DEFAULT_SECTION_PADDING_RIGHT = 0;
|
|
|
331
294
|
var DEFAULT_SECTION_PADDING_BOTTOM = 0;
|
|
332
295
|
var DEFAULT_SECTION_PADDING_LEFT = 0;
|
|
333
296
|
var DEFAULT_SECTION_SHOW_IF_KEY = null;
|
|
334
|
-
var SectionExtension =
|
|
297
|
+
var SectionExtension = Node.create({
|
|
335
298
|
name: "section",
|
|
336
299
|
group: "block",
|
|
337
300
|
content: "(block|columns)+",
|
|
@@ -594,7 +557,7 @@ var SectionExtension = Node2.create({
|
|
|
594
557
|
},
|
|
595
558
|
[
|
|
596
559
|
"td",
|
|
597
|
-
|
|
560
|
+
mergeAttributes(HTMLAttributes2, {
|
|
598
561
|
"data-type": "section-cell",
|
|
599
562
|
style: "border-style: solid",
|
|
600
563
|
class: "mly:w-full mly:[text-align:revert-layer]"
|
|
@@ -614,7 +577,116 @@ var SectionExtension = Node2.create({
|
|
|
614
577
|
}
|
|
615
578
|
});
|
|
616
579
|
|
|
580
|
+
// src/editor/nodes/paragraph/paragraph.ts
|
|
581
|
+
var DEFAULT_TEXT_DIRECTION = "ltr";
|
|
582
|
+
var ParagraphExtension = TiptapParagraph.extend({
|
|
583
|
+
addAttributes() {
|
|
584
|
+
var _a;
|
|
585
|
+
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
586
|
+
textDirection: {
|
|
587
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
588
|
+
parseHTML: (element) => {
|
|
589
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
590
|
+
},
|
|
591
|
+
renderHTML(attributes) {
|
|
592
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
593
|
+
return {};
|
|
594
|
+
}
|
|
595
|
+
return {
|
|
596
|
+
"data-text-direction": attributes.textDirection,
|
|
597
|
+
dir: attributes.textDirection
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
showIfKey: {
|
|
602
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
603
|
+
parseHTML: (element) => {
|
|
604
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
605
|
+
},
|
|
606
|
+
renderHTML(attributes) {
|
|
607
|
+
if (!attributes.showIfKey) {
|
|
608
|
+
return {};
|
|
609
|
+
}
|
|
610
|
+
return {
|
|
611
|
+
"data-show-if-key": attributes.showIfKey
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
},
|
|
617
|
+
addCommands() {
|
|
618
|
+
var _a;
|
|
619
|
+
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
620
|
+
setTextDirection: (direction) => ({ commands }) => {
|
|
621
|
+
return commands.updateAttributes(this.name, {
|
|
622
|
+
textDirection: direction
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// src/editor/nodes/footer.ts
|
|
630
|
+
var Footer = Node2.create({
|
|
631
|
+
name: "footer",
|
|
632
|
+
group: "block",
|
|
633
|
+
content: "inline*",
|
|
634
|
+
addAttributes() {
|
|
635
|
+
return {
|
|
636
|
+
"maily-component": {
|
|
637
|
+
default: "footer",
|
|
638
|
+
renderHTML: (attributes) => {
|
|
639
|
+
return {
|
|
640
|
+
"data-maily-component": attributes["maily-component"]
|
|
641
|
+
};
|
|
642
|
+
},
|
|
643
|
+
parseHTML: (element) => element == null ? void 0 : element.getAttribute("data-maily-component")
|
|
644
|
+
},
|
|
645
|
+
textDirection: {
|
|
646
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
647
|
+
parseHTML: (element) => {
|
|
648
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
649
|
+
},
|
|
650
|
+
renderHTML(attributes) {
|
|
651
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
652
|
+
return {};
|
|
653
|
+
}
|
|
654
|
+
return {
|
|
655
|
+
"data-text-direction": attributes.textDirection,
|
|
656
|
+
dir: attributes.textDirection
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
},
|
|
662
|
+
addCommands() {
|
|
663
|
+
return {
|
|
664
|
+
setFooter: () => ({ commands }) => {
|
|
665
|
+
return commands.setNode(this.name);
|
|
666
|
+
},
|
|
667
|
+
setFooterTextDirection: (direction) => ({ commands }) => {
|
|
668
|
+
return commands.updateAttributes("footer", {
|
|
669
|
+
textDirection: direction
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
},
|
|
674
|
+
parseHTML() {
|
|
675
|
+
return [{ tag: 'small[data-maily-component="footer"]' }];
|
|
676
|
+
},
|
|
677
|
+
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
678
|
+
return [
|
|
679
|
+
"small",
|
|
680
|
+
mergeAttributes2(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
681
|
+
class: "footer mly:block mly:text-[13px] mly:text-slate-500 mly:relative"
|
|
682
|
+
}),
|
|
683
|
+
0
|
|
684
|
+
];
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
|
|
617
688
|
// src/editor/nodes/spacer.ts
|
|
689
|
+
import { mergeAttributes as mergeAttributes3, Node as Node3 } from "@tiptap/core";
|
|
618
690
|
var DEFAULT_SPACER_HEIGHT = 8;
|
|
619
691
|
var Spacer = Node3.create({
|
|
620
692
|
name: "spacer",
|
|
@@ -7863,30 +7935,21 @@ var HeadingExtension = TiptapHeading.extend({
|
|
|
7863
7935
|
addAttributes() {
|
|
7864
7936
|
var _a;
|
|
7865
7937
|
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
7866
|
-
|
|
7867
|
-
default:
|
|
7938
|
+
textDirection: {
|
|
7939
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
7868
7940
|
parseHTML: (element) => {
|
|
7869
|
-
return element.getAttribute("data-
|
|
7941
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
7870
7942
|
},
|
|
7871
7943
|
renderHTML(attributes) {
|
|
7872
|
-
if (!attributes.
|
|
7944
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
7873
7945
|
return {};
|
|
7874
7946
|
}
|
|
7875
7947
|
return {
|
|
7876
|
-
"data-
|
|
7948
|
+
"data-text-direction": attributes.textDirection,
|
|
7949
|
+
dir: attributes.textDirection
|
|
7877
7950
|
};
|
|
7878
7951
|
}
|
|
7879
|
-
}
|
|
7880
|
-
});
|
|
7881
|
-
}
|
|
7882
|
-
});
|
|
7883
|
-
|
|
7884
|
-
// src/editor/nodes/paragraph/paragraph.ts
|
|
7885
|
-
import TiptapParagraph from "@tiptap/extension-paragraph";
|
|
7886
|
-
var ParagraphExtension = TiptapParagraph.extend({
|
|
7887
|
-
addAttributes() {
|
|
7888
|
-
var _a;
|
|
7889
|
-
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
7952
|
+
},
|
|
7890
7953
|
showIfKey: {
|
|
7891
7954
|
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
7892
7955
|
parseHTML: (element) => {
|