@maily-to/core 0.3.5 → 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.
@@ -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 import_core3 = require("@tiptap/core");
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/spacer.ts
375
- var import_core5 = require("@tiptap/core");
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 import_core4 = require("@tiptap/core");
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 = import_core4.Node.create({
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, import_core4.mergeAttributes)(HTMLAttributes2, {
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",
@@ -7921,30 +7993,21 @@ var HeadingExtension = import_extension_heading.default.extend({
7921
7993
  addAttributes() {
7922
7994
  var _a;
7923
7995
  return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
7924
- showIfKey: {
7925
- default: DEFAULT_SECTION_SHOW_IF_KEY,
7996
+ textDirection: {
7997
+ default: DEFAULT_TEXT_DIRECTION,
7926
7998
  parseHTML: (element) => {
7927
- return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
7999
+ return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
7928
8000
  },
7929
8001
  renderHTML(attributes) {
7930
- if (!attributes.showIfKey) {
8002
+ if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
7931
8003
  return {};
7932
8004
  }
7933
8005
  return {
7934
- "data-show-if-key": attributes.showIfKey
8006
+ "data-text-direction": attributes.textDirection,
8007
+ dir: attributes.textDirection
7935
8008
  };
7936
8009
  }
7937
- }
7938
- });
7939
- }
7940
- });
7941
-
7942
- // src/editor/nodes/paragraph/paragraph.ts
7943
- var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
7944
- var ParagraphExtension = import_extension_paragraph.default.extend({
7945
- addAttributes() {
7946
- var _a;
7947
- return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
8010
+ },
7948
8011
  showIfKey: {
7949
8012
  default: DEFAULT_SECTION_SHOW_IF_KEY,
7950
8013
  parseHTML: (element) => {