@dialpad/dialtone-vue 3.219.0 → 3.219.2

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.
Files changed (38) hide show
  1. package/dist/component-documentation.json +1 -1
  2. package/dist/components/collapsible/collapsible.vue.d.ts.map +1 -1
  3. package/dist/components/popover/popover.vue.d.ts.map +1 -1
  4. package/dist/components/rich_text_editor/rich_text_editor.vue.d.ts +9 -0
  5. package/dist/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  6. package/dist/dialtone-vue.cjs +1 -1
  7. package/dist/dialtone-vue.js +2 -2
  8. package/dist/lib/collapsible/collapsible.cjs +1 -1
  9. package/dist/lib/collapsible/collapsible.cjs.map +1 -1
  10. package/dist/lib/collapsible/collapsible.js +5 -2
  11. package/dist/lib/collapsible/collapsible.js.map +1 -1
  12. package/dist/lib/editor/editor.cjs +1 -1
  13. package/dist/lib/editor/editor.js +1 -1
  14. package/dist/lib/message-input/index.cjs +1 -1
  15. package/dist/lib/message-input/index.js +1 -1
  16. package/dist/lib/message-input/message-input.cjs +1 -1
  17. package/dist/lib/message-input/message-input.js +1 -1
  18. package/dist/lib/popover/popover.cjs +1 -1
  19. package/dist/lib/popover/popover.cjs.map +1 -1
  20. package/dist/lib/popover/popover.js +9 -3
  21. package/dist/lib/popover/popover.js.map +1 -1
  22. package/dist/lib/rich-text-editor/index.cjs +1 -1
  23. package/dist/lib/rich-text-editor/index.js +1 -1
  24. package/dist/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  25. package/dist/lib/rich-text-editor/rich-text-editor.js +1 -1
  26. package/dist/{message_input-CHlTsBGK.js → message_input-BssxPs1B.js} +2 -2
  27. package/dist/{message_input-CHlTsBGK.js.map → message_input-BssxPs1B.js.map} +1 -1
  28. package/dist/{message_input-AWgvtwMV.cjs → message_input-Bw5RZHOI.cjs} +2 -2
  29. package/dist/{message_input-AWgvtwMV.cjs.map → message_input-Bw5RZHOI.cjs.map} +1 -1
  30. package/dist/recipes/conversation_view/editor/editor.vue.d.ts +9 -0
  31. package/dist/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
  32. package/dist/recipes/conversation_view/message_input/message_input.vue.d.ts +9 -0
  33. package/dist/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  34. package/dist/{rich_text_editor-DMP5eTlf.cjs → rich_text_editor-BE49FAdX.cjs} +4 -2
  35. package/dist/{rich_text_editor-DMP5eTlf.cjs.map → rich_text_editor-BE49FAdX.cjs.map} +1 -1
  36. package/dist/{rich_text_editor-Ba67C4Uk.js → rich_text_editor-BtvmJUw1.js} +44 -8
  37. package/dist/{rich_text_editor-Ba67C4Uk.js.map → rich_text_editor-BtvmJUw1.js.map} +1 -1
  38. package/package.json +12 -7
@@ -2558,6 +2558,10 @@ var Vi = {
2558
2558
  type: Boolean,
2559
2559
  default: !1
2560
2560
  },
2561
+ allowTextAlign: {
2562
+ type: Boolean,
2563
+ default: !0
2564
+ },
2561
2565
  allowImageResize: {
2562
2566
  type: Boolean,
2563
2567
  default: !1
@@ -2656,9 +2660,41 @@ var Vi = {
2656
2660
  }
2657
2661
  }));
2658
2662
  }
2659
- return this.allowVariable && e.push(Ei.configure({ variableItems: this.variableItems })), e.push(Jr), e.push(nt.configure({ types: ["paragraph"] })), this.allowCode && e.push(Be), this.allowCodeblock && e.push(ze.extend({ renderText({ node: e }) {
2660
- return `\`\`\`\n${e.textContent}\n\`\`\``;
2661
- } }).configure({ HTMLAttributes: { class: "d-rich-text-editor__code-block" } })), this.allowInlineImages && e.push(oi.configure({ resize: {
2663
+ return this.allowVariable && e.push(Ei.configure({ variableItems: this.variableItems })), e.push(Jr), this.allowTextAlign && e.push(nt.configure({ types: ["paragraph"] })), this.allowCode && e.push(Be), this.allowCodeblock && e.push(ze.extend({
2664
+ renderText({ node: e, pos: t, range: n }) {
2665
+ let r = n?.from ?? 0, i = n?.to ?? t + e.nodeSize;
2666
+ if (r <= t && i >= t + e.nodeSize) return `\`\`\`\n${e.textContent}\n\`\`\``;
2667
+ let a = Math.max(0, r - t - 1), o = Math.min(e.textContent.length, i - t - 1);
2668
+ return e.textContent.slice(a, o);
2669
+ },
2670
+ addCommands() {
2671
+ return {
2672
+ ...this.parent?.(),
2673
+ toggleCodeBlock: (e = {}) => ({ state: t, chain: n, commands: r }) => {
2674
+ let i = t.schema.nodes[this.name], { $from: a } = t.selection;
2675
+ if (a.parent.type === i) {
2676
+ let e = t.schema.nodes.paragraph, r = a.parent.textContent.split("\n"), i = a.before(), o = a.parent;
2677
+ return n().command(({ tr: n }) => {
2678
+ let a = r.map((n) => e.create({}, n ? [t.schema.text(n)] : []));
2679
+ return n.replaceWith(i, i + o.nodeSize, a), !0;
2680
+ }).run();
2681
+ }
2682
+ let { from: o, to: s } = t.selection, c = [];
2683
+ if (t.doc.nodesBetween(o, s, (e, t) => {
2684
+ if (e.isTextblock) return c.push({
2685
+ node: e,
2686
+ pos: t
2687
+ }), !1;
2688
+ }), c.length <= 1) return r.setNode(this.name, e);
2689
+ let l = c.map(({ node: e }) => e.textContent).join("\n"), u = c[0].pos, d = c[c.length - 1], f = d.pos + d.node.nodeSize;
2690
+ return n().command(({ tr: n }) => {
2691
+ let r = l.length ? [t.schema.text(l)] : [];
2692
+ return n.replaceWith(u, f, i.create(e, r)), !0;
2693
+ }).run();
2694
+ }
2695
+ };
2696
+ }
2697
+ }).configure({ HTMLAttributes: { class: "d-rich-text-editor__code-block" } })), this.allowInlineImages && e.push(oi.configure({ resize: {
2662
2698
  enabled: this.allowImageResize,
2663
2699
  alwaysPreserveAspectRatio: !0
2664
2700
  } })), (this.allowFontFamily || this.allowFontColor || this.allowFontSize || this.allowBackgroundColor || this.allowLineHeight) && (e.push(ct.configure({
@@ -2728,7 +2764,7 @@ var Vi = {
2728
2764
  return this.processPasteData(e, r, i);
2729
2765
  },
2730
2766
  transformPastedHTML(e) {
2731
- return e.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
2767
+ return e.replace(/<hr[^>]*\/?>/gi, "<p><br></p>").replace(/(<\/\w+>)((<br \/>)+)/g, "$2$1");
2732
2768
  }
2733
2769
  }
2734
2770
  }), this.addEditorListeners();
@@ -2761,10 +2797,10 @@ var Vi = {
2761
2797
  return;
2762
2798
  }
2763
2799
  r.find((t) => t.test(e)) || (e = `${i}${e}`), this.editor.chain().focus().extendMarkRange("link").run();
2764
- let a = this.editor?.view?.state?.selection;
2765
- this.editor.chain().focus().insertContent(t).setTextSelection({
2800
+ let a = this.editor?.view?.state?.selection, o = t || e;
2801
+ this.editor.chain().focus().insertContent(o).setTextSelection({
2766
2802
  from: a.from,
2767
- to: a.from + t.length
2803
+ to: a.from + o.length
2768
2804
  }).setLink({
2769
2805
  href: e,
2770
2806
  class: n.class
@@ -2953,4 +2989,4 @@ var Gi = /* @__PURE__ */ i(Hi, [["render", Wi]]);
2953
2989
  //#endregion
2954
2990
  export { Gi as t };
2955
2991
 
2956
- //# sourceMappingURL=rich_text_editor-Ba67C4Uk.js.map
2992
+ //# sourceMappingURL=rich_text_editor-BtvmJUw1.js.map