@dialpad/dialtone 9.96.0 → 9.97.0

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 (106) hide show
  1. package/dist/css/dialtone-default-theme.css +45 -1
  2. package/dist/css/dialtone-default-theme.min.css +1 -1
  3. package/dist/css/dialtone.css +45 -1
  4. package/dist/css/dialtone.min.css +1 -1
  5. package/dist/tokens/doc.json +19430 -19430
  6. package/dist/vue2/component-documentation.json +1 -1
  7. package/dist/vue2/components/keyboard_shortcut/keyboard_shortcut.vue.cjs +2 -2
  8. package/dist/vue2/components/keyboard_shortcut/keyboard_shortcut.vue.js +2 -2
  9. package/dist/vue2/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.cjs.map +1 -1
  10. package/dist/vue2/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.js.map +1 -1
  11. package/dist/vue2/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.cjs.map +1 -1
  12. package/dist/vue2/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.js.map +1 -1
  13. package/dist/vue2/components/rich_text_editor/rich_text_editor.vue.cjs +160 -17
  14. package/dist/vue2/components/rich_text_editor/rich_text_editor.vue.cjs.map +1 -1
  15. package/dist/vue2/components/rich_text_editor/rich_text_editor.vue.js +161 -18
  16. package/dist/vue2/components/rich_text_editor/rich_text_editor.vue.js.map +1 -1
  17. package/dist/vue2/recipes/conversation_view/editor/editor.vue.cjs +1 -1
  18. package/dist/vue2/recipes/conversation_view/editor/editor.vue.cjs.map +1 -1
  19. package/dist/vue2/recipes/conversation_view/editor/editor.vue.js +1 -1
  20. package/dist/vue2/recipes/conversation_view/editor/editor.vue.js.map +1 -1
  21. package/dist/vue2/recipes/conversation_view/message_input/last_active_nodes.cjs +87 -0
  22. package/dist/vue2/recipes/conversation_view/message_input/last_active_nodes.cjs.map +1 -0
  23. package/dist/vue2/recipes/conversation_view/message_input/last_active_nodes.js +87 -0
  24. package/dist/vue2/recipes/conversation_view/message_input/last_active_nodes.js.map +1 -0
  25. package/dist/vue2/recipes/conversation_view/message_input/message_input.vue.cjs +229 -46
  26. package/dist/vue2/recipes/conversation_view/message_input/message_input.vue.cjs.map +1 -1
  27. package/dist/vue2/recipes/conversation_view/message_input/message_input.vue.js +229 -46
  28. package/dist/vue2/recipes/conversation_view/message_input/message_input.vue.js.map +1 -1
  29. package/dist/vue2/recipes/conversation_view/message_input/message_input_button.vue.cjs +58 -0
  30. package/dist/vue2/recipes/conversation_view/message_input/message_input_button.vue.cjs.map +1 -0
  31. package/dist/vue2/recipes/conversation_view/message_input/message_input_button.vue.js +58 -0
  32. package/dist/vue2/recipes/conversation_view/message_input/message_input_button.vue.js.map +1 -0
  33. package/dist/vue2/recipes/conversation_view/message_input/message_input_link.vue.cjs +108 -0
  34. package/dist/vue2/recipes/conversation_view/message_input/message_input_link.vue.cjs.map +1 -0
  35. package/dist/vue2/recipes/conversation_view/message_input/message_input_link.vue.js +108 -0
  36. package/dist/vue2/recipes/conversation_view/message_input/message_input_link.vue.js.map +1 -0
  37. package/dist/vue2/recipes/conversation_view/message_input/message_input_topbar.vue.cjs +106 -0
  38. package/dist/vue2/recipes/conversation_view/message_input/message_input_topbar.vue.cjs.map +1 -0
  39. package/dist/vue2/recipes/conversation_view/message_input/message_input_topbar.vue.js +106 -0
  40. package/dist/vue2/recipes/conversation_view/message_input/message_input_topbar.vue.js.map +1 -0
  41. package/dist/vue2/types/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.d.ts.map +1 -1
  42. package/dist/vue2/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts.map +1 -1
  43. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +37 -1
  44. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  45. package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
  46. package/dist/vue2/types/recipes/conversation_view/message_input/last_active_nodes.d.ts +3 -0
  47. package/dist/vue2/types/recipes/conversation_view/message_input/last_active_nodes.d.ts.map +1 -0
  48. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +183 -60
  49. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  50. package/dist/vue2/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts +48 -0
  51. package/dist/vue2/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts.map +1 -0
  52. package/dist/vue2/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +38 -0
  53. package/dist/vue2/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -0
  54. package/dist/vue2/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +87 -0
  55. package/dist/vue2/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -0
  56. package/dist/vue3/component-documentation.json +1 -1
  57. package/dist/vue3/components/keyboard_shortcut/keyboard_shortcut.vue.cjs +2 -2
  58. package/dist/vue3/components/keyboard_shortcut/keyboard_shortcut.vue.js +2 -2
  59. package/dist/vue3/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.cjs.map +1 -1
  60. package/dist/vue3/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.js.map +1 -1
  61. package/dist/vue3/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.cjs.map +1 -1
  62. package/dist/vue3/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.js.map +1 -1
  63. package/dist/vue3/components/rich_text_editor/rich_text_editor.vue.cjs +223 -21
  64. package/dist/vue3/components/rich_text_editor/rich_text_editor.vue.cjs.map +1 -1
  65. package/dist/vue3/components/rich_text_editor/rich_text_editor.vue.js +225 -23
  66. package/dist/vue3/components/rich_text_editor/rich_text_editor.vue.js.map +1 -1
  67. package/dist/vue3/recipes/conversation_view/editor/editor.vue.cjs +1 -0
  68. package/dist/vue3/recipes/conversation_view/editor/editor.vue.cjs.map +1 -1
  69. package/dist/vue3/recipes/conversation_view/editor/editor.vue.js +1 -0
  70. package/dist/vue3/recipes/conversation_view/editor/editor.vue.js.map +1 -1
  71. package/dist/vue3/recipes/conversation_view/message_input/last_active_nodes.cjs +87 -0
  72. package/dist/vue3/recipes/conversation_view/message_input/last_active_nodes.cjs.map +1 -0
  73. package/dist/vue3/recipes/conversation_view/message_input/last_active_nodes.js +87 -0
  74. package/dist/vue3/recipes/conversation_view/message_input/last_active_nodes.js.map +1 -0
  75. package/dist/vue3/recipes/conversation_view/message_input/message_input.vue.cjs +279 -65
  76. package/dist/vue3/recipes/conversation_view/message_input/message_input.vue.cjs.map +1 -1
  77. package/dist/vue3/recipes/conversation_view/message_input/message_input.vue.js +280 -66
  78. package/dist/vue3/recipes/conversation_view/message_input/message_input.vue.js.map +1 -1
  79. package/dist/vue3/recipes/conversation_view/message_input/message_input_button.vue.cjs +81 -0
  80. package/dist/vue3/recipes/conversation_view/message_input/message_input_button.vue.cjs.map +1 -0
  81. package/dist/vue3/recipes/conversation_view/message_input/message_input_button.vue.js +81 -0
  82. package/dist/vue3/recipes/conversation_view/message_input/message_input_button.vue.js.map +1 -0
  83. package/dist/vue3/recipes/conversation_view/message_input/message_input_link.vue.cjs +193 -0
  84. package/dist/vue3/recipes/conversation_view/message_input/message_input_link.vue.cjs.map +1 -0
  85. package/dist/vue3/recipes/conversation_view/message_input/message_input_link.vue.js +193 -0
  86. package/dist/vue3/recipes/conversation_view/message_input/message_input_link.vue.js.map +1 -0
  87. package/dist/vue3/recipes/conversation_view/message_input/message_input_topbar.vue.cjs +223 -0
  88. package/dist/vue3/recipes/conversation_view/message_input/message_input_topbar.vue.cjs.map +1 -0
  89. package/dist/vue3/recipes/conversation_view/message_input/message_input_topbar.vue.js +223 -0
  90. package/dist/vue3/recipes/conversation_view/message_input/message_input_topbar.vue.js.map +1 -0
  91. package/dist/vue3/types/components/rich_text_editor/extensions/mentions/MentionSuggestion.vue.d.ts.map +1 -1
  92. package/dist/vue3/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts.map +1 -1
  93. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +42 -1
  94. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  95. package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
  96. package/dist/vue3/types/recipes/conversation_view/message_input/last_active_nodes.d.ts +3 -0
  97. package/dist/vue3/types/recipes/conversation_view/message_input/last_active_nodes.d.ts.map +1 -0
  98. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +185 -61
  99. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  100. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts +50 -0
  101. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts.map +1 -0
  102. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +42 -0
  103. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -0
  104. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +89 -0
  105. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -0
  106. package/package.json +7 -4
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const last_active_nodes = require("./last_active_nodes.cjs");
3
4
  const meeting_pill = require("./extensions/meeting_pill/meeting_pill.cjs");
4
5
  const vue3 = require("@dialpad/dialtone-icons/vue3");
6
+ const message_input_topbar = require("./message_input_topbar.vue.cjs");
7
+ const message_input_link = require("./message_input_link.vue.cjs");
8
+ const editor_constants = require("../editor/editor_constants.cjs");
5
9
  const vue = require("vue");
6
10
  const _pluginVue_exportHelper = require("../../../_virtual/_plugin-vue_export-helper.cjs");
7
11
  const button = require("../../../components/button/button.vue.cjs");
@@ -19,6 +23,8 @@ const _sfc_main = {
19
23
  DtEmojiPicker: emoji_picker.default,
20
24
  DtInput: input.default,
21
25
  DtPopover: popover.default,
26
+ DtRecipeMessageInputTopbar: message_input_topbar.default,
27
+ DtRecipeMessageInputLink: message_input_link.default,
22
28
  DtRichTextEditor: rich_text_editor.default,
23
29
  DtTooltip: tooltip.default,
24
30
  DtStack: stack.default,
@@ -30,6 +36,18 @@ const _sfc_main = {
30
36
  mixins: [],
31
37
  inheritAttrs: false,
32
38
  props: {
39
+ /**
40
+ * Displays all the buttons for rich text formatting above the message input, and enables it within the editor.
41
+ * Rich text formatting for the purposes of this component is defined as:
42
+ *
43
+ * bold, italic, strikethrough, lists, blockquotes, inline code tags, and code blocks.
44
+ *
45
+ * If you are sending a message to a phone rather than a Dialpad to Dialpad message, you should have this as false.
46
+ */
47
+ richText: {
48
+ type: Boolean,
49
+ default: true
50
+ },
33
51
  /**
34
52
  * Value of the input. The object format should match TipTap's JSON
35
53
  * document structure: https://tiptap.dev/guide/output#option-1-json
@@ -98,18 +116,11 @@ const _sfc_main = {
98
116
  */
99
117
  outputFormat: {
100
118
  type: String,
101
- default: "text",
119
+ default: "json",
102
120
  validator(outputFormat) {
103
121
  return rich_text_editor_constants.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(outputFormat);
104
122
  }
105
123
  },
106
- /**
107
- * Enables the Link extension and optionally passes configurations to it
108
- */
109
- link: {
110
- type: [Boolean, Object],
111
- default: true
112
- },
113
124
  /**
114
125
  * Placeholder text
115
126
  */
@@ -244,53 +255,139 @@ const _sfc_main = {
244
255
  default: null
245
256
  },
246
257
  /**
247
- * Whether the input allows for block quote.
258
+ * descriptive text fields for the bold button
259
+ *
260
+ * object format:
261
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
248
262
  */
249
- allowBlockquote: {
250
- type: Boolean,
251
- default: true
263
+ boldButtonOptions: {
264
+ type: Object,
265
+ default: () => ({
266
+ ariaLabel: "Toggle bold on selected text",
267
+ tooltipText: "Bold",
268
+ keyboardShortcutText: "Mod + B"
269
+ })
252
270
  },
253
271
  /**
254
- * Whether the input allows for bold to be introduced in the text.
272
+ * descriptive text fields for the italic button
273
+ *
274
+ * object format:
275
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
255
276
  */
256
- allowBold: {
257
- type: Boolean,
258
- default: true
277
+ italicButtonOptions: {
278
+ type: Object,
279
+ default: () => ({
280
+ ariaLabel: "Toggle italic on selected text",
281
+ tooltipText: "Italic",
282
+ keyboardShortcutText: "Mod + I"
283
+ })
259
284
  },
260
285
  /**
261
- * Whether the input allows for bullet list to be introduced in the text.
286
+ * descriptive text fields for the strikethrough button
287
+ *
288
+ * object format:
289
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
262
290
  */
263
- allowBulletList: {
264
- type: Boolean,
265
- default: true
291
+ strikeButtonOptions: {
292
+ type: Object,
293
+ default: () => ({
294
+ ariaLabel: "Toggle strikethrough on selected text",
295
+ tooltipText: "Strikethrough",
296
+ keyboardShortcutText: "Mod + Shift + S"
297
+ })
266
298
  },
267
299
  /**
268
- * Whether the input allows for italic to be introduced in the text.
300
+ * descriptive text fields for the link button
301
+ *
302
+ * object format:
303
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
269
304
  */
270
- allowItalic: {
271
- type: Boolean,
272
- default: true
305
+ linkButtonOptions: {
306
+ type: Object,
307
+ default: () => ({
308
+ ariaLabel: "Create or edit link on selected text",
309
+ tooltipText: "Link",
310
+ // TODO: implement mod k
311
+ keyboardShortcutText: "Mod + K",
312
+ dialogTitle: "Add a link",
313
+ textLabel: "Text to display (optional)",
314
+ linkLabel: "Link",
315
+ linkPlaceholder: "e.g. https://www.dialpad.com",
316
+ removeLabel: "Remove",
317
+ cancelLabel: "Cancel",
318
+ confirmLabel: "Done",
319
+ visuallyHiddenCloseText: "Close link dialog"
320
+ })
273
321
  },
274
322
  /**
275
- * Whether the input allows for strike to be introduced in the text.
323
+ * descriptive text fields for the bullet list button
324
+ *
325
+ * object format:
326
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
276
327
  */
277
- allowStrike: {
278
- type: Boolean,
279
- default: true
328
+ bulletListButtonOptions: {
329
+ type: Object,
330
+ default: () => ({
331
+ ariaLabel: "Toggle bullet list on selected text",
332
+ tooltipText: "Bullet list",
333
+ keyboardShortcutText: "Mod + Shift + 8"
334
+ })
280
335
  },
281
336
  /**
282
- * Whether the input allows for underline to be introduced in the text.
337
+ * descriptive text fields for the ordered list button
338
+ *
339
+ * object format:
340
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
283
341
  */
284
- allowUnderline: {
285
- type: Boolean,
286
- default: true
342
+ orderedListButtonOptions: {
343
+ type: Object,
344
+ default: () => ({
345
+ ariaLabel: "Toggle ordered list on selected text",
346
+ tooltipText: "Ordered list",
347
+ keyboardShortcutText: "Mod + Shift + 7"
348
+ })
287
349
  },
288
350
  /**
289
- * Whether the input allows codeblock to be introduced in the text.
351
+ * descriptive text fields for the italic button
352
+ *
353
+ * object format:
354
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
290
355
  */
291
- allowCodeblock: {
292
- type: Boolean,
293
- default: true
356
+ blockQuoteButtonOptions: {
357
+ type: Object,
358
+ default: () => ({
359
+ ariaLabel: "Toggle Blockquote on selected text",
360
+ tooltipText: "Blockquote",
361
+ keyboardShortcutText: "Mod + Shift + B"
362
+ })
363
+ },
364
+ /**
365
+ * descriptive text fields for the code button
366
+ *
367
+ * object format:
368
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
369
+ */
370
+ codeButtonOptions: {
371
+ type: Object,
372
+ default: () => ({
373
+ ariaLabel: "Toggle code tag on selected text",
374
+ tooltipText: "Code",
375
+ keyboardShortcutText: "Mod + E"
376
+ })
377
+ },
378
+ /**
379
+ * descriptive text fields for the code block button
380
+ *
381
+ * object format:
382
+ * { ariaLabel: string, tooltipText: string, keyboardShortcutText: string }
383
+ */
384
+ codeBlockButtonOptions: {
385
+ type: Object,
386
+ default: () => ({
387
+ ariaLabel: "Toggle code block on selected text",
388
+ tooltipText: "Code block",
389
+ keyboardShortcutText: "Mod + Alt + C"
390
+ })
294
391
  }
295
392
  },
296
393
  emits: [
@@ -362,16 +459,33 @@ const _sfc_main = {
362
459
  * @event update:modelValue
363
460
  * @type {String|JSON}
364
461
  */
365
- "update:modelValue"
462
+ "update:modelValue",
463
+ /**
464
+ * Emitted when input changes, returns text content only
465
+ * @event text-input
466
+ * @type {String}
467
+ */
468
+ "text-input"
366
469
  ],
367
470
  data() {
368
471
  return {
472
+ // If an ordered list is nested within an unordered list, we only want to show the currently selected list as
473
+ // active. This function performs the logic to determine the farthest active node from the root.
474
+ lastActiveNodes: last_active_nodes.default,
369
475
  additionalExtensions: [meeting_pill.default],
370
476
  internalInputValue: this.modelValue,
371
477
  // internal input content
372
478
  imagePickerFocus: false,
373
479
  emojiPickerFocus: false,
374
- emojiPickerOpened: false
480
+ emojiPickerOpened: false,
481
+ isFocused: false,
482
+ linkOptions: {
483
+ class: "d-link d-c-text d-d-inline-block"
484
+ },
485
+ linkDialogOpen: false,
486
+ selectedText: "",
487
+ text: "",
488
+ hideLinkBubbleMenu: false
375
489
  };
376
490
  },
377
491
  computed: {
@@ -379,7 +493,7 @@ const _sfc_main = {
379
493
  return !this.showSend.text;
380
494
  },
381
495
  inputLength() {
382
- return this.internalInputValue.length;
496
+ return this.text.length;
383
497
  },
384
498
  displayCharacterLimitWarning() {
385
499
  return Boolean(this.showCharacterLimit) && this.showCharacterLimit.count - this.inputLength <= this.showCharacterLimit.warning;
@@ -416,9 +530,68 @@ const _sfc_main = {
416
530
  created() {
417
531
  if (this.modelValue && this.outputFormat === "text") {
418
532
  this.internalInputValue = this.modelValue.replace(/\n/g, "<br>");
533
+ } else {
534
+ this.internalInputValue = this.modelValue;
419
535
  }
420
536
  },
421
537
  methods: {
538
+ linkDialogOpened(value) {
539
+ var _a;
540
+ this.linkDialogOpen = value;
541
+ if (value === true) {
542
+ this.initLinkDialog();
543
+ } else {
544
+ this.hideLinkBubbleMenu = false;
545
+ (_a = this.$refs.richTextEditor) == null ? void 0 : _a.focusEditor();
546
+ }
547
+ },
548
+ // eslint-disable-next-line complexity
549
+ handleTopbarClick(type) {
550
+ var _a;
551
+ const editor = (_a = this.$refs.richTextEditor) == null ? void 0 : _a.editor;
552
+ const typeToCommandMap = {
553
+ bold: () => editor == null ? void 0 : editor.chain().focus().toggleBold().run(),
554
+ italic: () => editor == null ? void 0 : editor.chain().focus().toggleItalic().run(),
555
+ strike: () => editor == null ? void 0 : editor.chain().focus().toggleStrike().run(),
556
+ bulletList: () => editor == null ? void 0 : editor.chain().focus().toggleBulletList().run(),
557
+ orderedList: () => editor == null ? void 0 : editor.chain().focus().toggleOrderedList().run(),
558
+ blockquote: () => editor == null ? void 0 : editor.chain().focus().toggleBlockquote().run(),
559
+ code: () => editor == null ? void 0 : editor.chain().focus().toggleCode().run(),
560
+ codeBlock: () => editor == null ? void 0 : editor.chain().focus().toggleCodeBlock().run()
561
+ };
562
+ if (editor && typeToCommandMap[type]) {
563
+ typeToCommandMap[type]();
564
+ }
565
+ },
566
+ // Checks if the node currently selected is active ex/ the bold button is active if the selected text is bold
567
+ isSelectionActive(type) {
568
+ var _a, _b, _c, _d;
569
+ if (["bulletList", "orderedList"].includes(type)) {
570
+ return this.lastActiveNodes((_b = (_a = this.$refs.richTextEditor) == null ? void 0 : _a.editor) == null ? void 0 : _b.state, [{ type: "bulletList" }, { type: "orderedList" }]).includes(type) && this.isFocused;
571
+ }
572
+ return ((_d = (_c = this.$refs.richTextEditor) == null ? void 0 : _c.editor) == null ? void 0 : _d.isActive(type)) && this.isFocused;
573
+ },
574
+ initLinkDialog() {
575
+ var _a, _b, _c;
576
+ this.$refs.link.setInitialValues(this.selectedText, (_c = (_b = (_a = this.$refs.richTextEditor) == null ? void 0 : _a.editor) == null ? void 0 : _b.getAttributes("link")) == null ? void 0 : _c.href);
577
+ this.hideLinkBubbleMenu = true;
578
+ this.linkDialogOpen = true;
579
+ },
580
+ removeLink() {
581
+ var _a;
582
+ (_a = this.$refs.richTextEditor) == null ? void 0 : _a.removeLink();
583
+ this.linkDialogOpen = false;
584
+ },
585
+ setLink(linkText, linkInput) {
586
+ this.$refs.richTextEditor.setLink(
587
+ linkInput,
588
+ linkText,
589
+ this.linkOptions,
590
+ editor_constants.EDITOR_SUPPORTED_LINK_PROTOCOLS,
591
+ editor_constants.EDITOR_DEFAULT_LINK_PREFIX
592
+ );
593
+ this.linkDialogOpen = false;
594
+ },
422
595
  // Mousedown instead of click because it fires before the blur event.
423
596
  onMousedown(e) {
424
597
  const isWithinInput = this.$refs.richTextEditor.$el.querySelector(".tiptap").contains(e.target);
@@ -481,6 +654,10 @@ const _sfc_main = {
481
654
  },
482
655
  onInput(event) {
483
656
  this.$emit("update:modelValue", event);
657
+ },
658
+ onTextInput(event) {
659
+ this.text = event;
660
+ this.$emit("text-input", event);
484
661
  }
485
662
  }
486
663
  };
@@ -490,6 +667,8 @@ const _hoisted_3 = { class: "d-recipe-message-input__bottom-section-right" };
490
667
  const _hoisted_4 = { class: "d-recipe-message-input__sms-count" };
491
668
  const _hoisted_5 = { key: 0 };
492
669
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
670
+ const _component_dt_recipe_message_input_link = vue.resolveComponent("dt-recipe-message-input-link");
671
+ const _component_dt_recipe_message_input_topbar = vue.resolveComponent("dt-recipe-message-input-topbar");
493
672
  const _component_dt_rich_text_editor = vue.resolveComponent("dt-rich-text-editor");
494
673
  const _component_dt_icon_image = vue.resolveComponent("dt-icon-image");
495
674
  const _component_dt_button = vue.resolveComponent("dt-button");
@@ -506,14 +685,40 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
506
685
  return vue.openBlock(), vue.createElementBlock("div", {
507
686
  "data-qa": "dt-recipe-message-input",
508
687
  role: "presentation",
509
- class: vue.normalizeClass(["d-recipe-message-input"]),
510
- onDragover: _cache[10] || (_cache[10] = vue.withModifiers(() => {
688
+ class: "d-recipe-message-input",
689
+ onDragover: _cache[12] || (_cache[12] = vue.withModifiers(() => {
511
690
  }, ["prevent"])),
512
- onDrop: _cache[11] || (_cache[11] = vue.withModifiers((...args) => $options.onDrop && $options.onDrop(...args), ["prevent"])),
513
- onPaste: _cache[12] || (_cache[12] = (...args) => $options.onPaste && $options.onPaste(...args)),
514
- onMousedown: _cache[13] || (_cache[13] = (...args) => $options.onMousedown && $options.onMousedown(...args))
691
+ onDrop: _cache[13] || (_cache[13] = vue.withModifiers((...args) => $options.onDrop && $options.onDrop(...args), ["prevent"])),
692
+ onPaste: _cache[14] || (_cache[14] = (...args) => $options.onPaste && $options.onPaste(...args)),
693
+ onMousedown: _cache[15] || (_cache[15] = (...args) => $options.onMousedown && $options.onMousedown(...args))
515
694
  }, [
516
695
  vue.renderSlot(_ctx.$slots, "top"),
696
+ $props.richText ? (vue.openBlock(), vue.createBlock(_component_dt_recipe_message_input_topbar, {
697
+ key: $data.selectedText,
698
+ "bold-button-options": $props.boldButtonOptions,
699
+ "italic-button-options": $props.italicButtonOptions,
700
+ "strike-button-options": $props.strikeButtonOptions,
701
+ "bullet-list-button-options": $props.bulletListButtonOptions,
702
+ "ordered-list-button-options": $props.orderedListButtonOptions,
703
+ "block-quote-button-options": $props.blockQuoteButtonOptions,
704
+ "code-button-options": $props.codeButtonOptions,
705
+ "code-block-button-options": $props.codeBlockButtonOptions,
706
+ "is-selection-active": $options.isSelectionActive,
707
+ onClick: $options.handleTopbarClick
708
+ }, {
709
+ link: vue.withCtx(() => [
710
+ vue.createVNode(_component_dt_recipe_message_input_link, {
711
+ ref: "link",
712
+ open: $data.linkDialogOpen,
713
+ "link-button-options": $props.linkButtonOptions,
714
+ "is-selection-active": $options.isSelectionActive,
715
+ onOpened: $options.linkDialogOpened,
716
+ onSetLink: $options.setLink,
717
+ onRemoveLink: $options.removeLink
718
+ }, null, 8, ["open", "link-button-options", "is-selection-active", "onOpened", "onSetLink", "onRemoveLink"])
719
+ ]),
720
+ _: 1
721
+ }, 8, ["bold-button-options", "italic-button-options", "strike-button-options", "bullet-list-button-options", "ordered-list-button-options", "block-quote-button-options", "code-button-options", "code-block-button-options", "is-selection-active", "onClick"])) : vue.createCommentVNode("", true),
517
722
  vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
518
723
  class: "d-recipe-message-input__editor-wrapper",
519
724
  style: vue.normalizeStyle({ "max-height": $props.maxHeight })
@@ -522,26 +727,36 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
522
727
  ref: "richTextEditor",
523
728
  modelValue: $data.internalInputValue,
524
729
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.internalInputValue = $event),
525
- "allow-blockquote": $props.allowBlockquote,
526
- "allow-bold": $props.allowBold,
527
- "allow-bullet-list": $props.allowBulletList,
528
- "allow-codeblock": $props.allowCodeblock,
529
- "allow-italic": $props.allowItalic,
530
- "allow-strike": $props.allowStrike,
531
- "allow-underline": $props.allowUnderline,
730
+ "allow-blockquote": $props.richText,
731
+ "allow-bold": $props.richText,
732
+ "allow-bullet-list": $props.richText,
733
+ "allow-code": $props.richText,
734
+ "allow-codeblock": $props.richText,
735
+ "allow-italic": $props.richText,
736
+ "allow-strike": $props.richText,
737
+ "allow-underline": $props.richText,
532
738
  editable: $props.editable,
533
739
  "input-aria-label": $props.inputAriaLabel,
534
740
  "input-class": $props.inputClass,
535
741
  "output-format": $props.outputFormat,
536
742
  "auto-focus": $props.autoFocus,
537
- link: $props.link,
743
+ link: $props.richText,
538
744
  placeholder: $props.placeholder,
539
745
  "prevent-typing": $props.preventTyping,
540
746
  "mention-suggestion": $props.mentionSuggestion,
541
747
  "channel-suggestion": $props.channelSuggestion,
542
748
  "slash-command-suggestion": $props.slashCommandSuggestion,
543
- "additional-extensions": $data.additionalExtensions
544
- }, _ctx.$attrs, { onInput: $options.onInput }), null, 16, ["modelValue", "allow-blockquote", "allow-bold", "allow-bullet-list", "allow-codeblock", "allow-italic", "allow-strike", "allow-underline", "editable", "input-aria-label", "input-class", "output-format", "auto-focus", "link", "placeholder", "prevent-typing", "mention-suggestion", "channel-suggestion", "slash-command-suggestion", "additional-extensions", "onInput"])
749
+ "additional-extensions": $data.additionalExtensions,
750
+ "hide-link-bubble-menu": $data.hideLinkBubbleMenu
751
+ }, _ctx.$attrs, {
752
+ onInput: $options.onInput,
753
+ onTextInput: $options.onTextInput,
754
+ onEnter: $options.onSend,
755
+ onSelected: _cache[1] || (_cache[1] = ($event) => $data.selectedText = $event),
756
+ onEditLink: $options.initLinkDialog,
757
+ onFocus: _cache[2] || (_cache[2] = ($event) => $data.isFocused = true),
758
+ onBlur: _cache[3] || (_cache[3] = ($event) => $data.isFocused = false)
759
+ }), null, 16, ["modelValue", "allow-blockquote", "allow-bold", "allow-bullet-list", "allow-code", "allow-codeblock", "allow-italic", "allow-strike", "allow-underline", "editable", "input-aria-label", "input-class", "output-format", "auto-focus", "link", "placeholder", "prevent-typing", "mention-suggestion", "channel-suggestion", "slash-command-suggestion", "additional-extensions", "hide-link-bubble-menu", "onInput", "onTextInput", "onEnter", "onEditLink"])
545
760
  ], 4)), [
546
761
  [_directive_dt_scrollbar]
547
762
  ]),
@@ -564,10 +779,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
564
779
  importance: "clear",
565
780
  "aria-label": $props.showImagePicker.ariaLabel,
566
781
  onClick: $options.onSelectImage,
567
- onMouseenter: _cache[1] || (_cache[1] = ($event) => $data.imagePickerFocus = true),
568
- onMouseleave: _cache[2] || (_cache[2] = ($event) => $data.imagePickerFocus = false),
569
- onFocus: _cache[3] || (_cache[3] = ($event) => $data.imagePickerFocus = true),
570
- onBlur: _cache[4] || (_cache[4] = ($event) => $data.imagePickerFocus = false)
782
+ onMouseenter: _cache[4] || (_cache[4] = ($event) => $data.imagePickerFocus = true),
783
+ onMouseleave: _cache[5] || (_cache[5] = ($event) => $data.imagePickerFocus = false),
784
+ onFocus: _cache[6] || (_cache[6] = ($event) => $data.imagePickerFocus = true),
785
+ onBlur: _cache[7] || (_cache[7] = ($event) => $data.imagePickerFocus = false)
571
786
  }, {
572
787
  icon: vue.withCtx(() => [
573
788
  vue.createVNode(_component_dt_icon_image, { size: "300" })
@@ -588,8 +803,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
588
803
  }, null, 8, ["onInput"]),
589
804
  $props.showEmojiPicker ? (vue.openBlock(), vue.createBlock(_component_dt_popover, {
590
805
  key: 1,
591
- open: $data.emojiPickerOpened,
592
- "onUpdate:open": _cache[9] || (_cache[9] = ($event) => $data.emojiPickerOpened = $event),
806
+ "open.sync": "emojiPickerOpened",
593
807
  "data-qa": "dt-recipe-message-input-emoji-picker-popover",
594
808
  "initial-focus-element": "#searchInput",
595
809
  padding: "none"
@@ -603,10 +817,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
603
817
  importance: "clear",
604
818
  "aria-label": $props.emojiButtonAriaLabel,
605
819
  onClick: $options.toggleEmojiPicker,
606
- onMouseenter: _cache[5] || (_cache[5] = ($event) => $data.emojiPickerFocus = true),
607
- onMouseleave: _cache[6] || (_cache[6] = ($event) => $data.emojiPickerFocus = false),
608
- onFocus: _cache[7] || (_cache[7] = ($event) => $data.emojiPickerFocus = true),
609
- onBlur: _cache[8] || (_cache[8] = ($event) => $data.emojiPickerFocus = false)
820
+ onMouseenter: _cache[8] || (_cache[8] = ($event) => $data.emojiPickerFocus = true),
821
+ onMouseleave: _cache[9] || (_cache[9] = ($event) => $data.emojiPickerFocus = false),
822
+ onFocus: _cache[10] || (_cache[10] = ($event) => $data.emojiPickerFocus = true),
823
+ onBlur: _cache[11] || (_cache[11] = ($event) => $data.emojiPickerFocus = false)
610
824
  }), {
611
825
  icon: vue.withCtx(() => [
612
826
  $options.emojiPickerHovered ? (vue.openBlock(), vue.createBlock(_component_dt_icon_very_satisfied, {
@@ -629,7 +843,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
629
843
  }), null, 16, ["onSkinTone", "onSelectedEmoji"])
630
844
  ]),
631
845
  _: 1
632
- }, 8, ["open"])) : vue.createCommentVNode("", true),
846
+ })) : vue.createCommentVNode("", true),
633
847
  vue.renderSlot(_ctx.$slots, "emojiGiphyPicker")
634
848
  ];
635
849
  }),