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