File tree Expand file tree Collapse file tree 3 files changed +47
-7
lines changed
packages/dialtone-vue/recipes/conversation_view/editor Expand file tree Collapse file tree 3 files changed +47
-7
lines changed Original file line number Diff line number Diff line change 44 padding =" small"
55 navigation-type =" arrow-keys"
66 placement =" bottom-start"
7+ @opened =" onDropdownOpened"
78 >
89 <template #anchor =" { attrs } " >
910 <dt-button
2829 </template >
2930 </dt-button >
3031 </template >
31- <template #list =" { close } " >
32+ <template #list =" { close: dropdownClose } " >
3233 <slot
3334 name =" list"
34- :close =" close "
35+ :close =" (cb) => { pendingCallback = cb; dropdownClose(); } "
3536 />
3637 </template >
3738 </dt-dropdown >
@@ -110,5 +111,22 @@ export default {
110111 */
111112 ' shift-focus-left' ,
112113 ],
114+
115+ data () {
116+ return {
117+ pendingCallback: null ,
118+ };
119+ },
120+
121+ methods: {
122+ // Wait until the dropdown is fully closed so the modal's anchor focus
123+ // completes first, then the callback can override it (e.g. to focus the editor).
124+ onDropdownOpened (isOpen ) {
125+ if (! isOpen && typeof this .pendingCallback === ' function' ) {
126+ this .pendingCallback ();
127+ this .pendingCallback = null ;
128+ }
129+ },
130+ },
113131};
114132 </script >
Original file line number Diff line number Diff line change 55 navigation-type =" arrow-keys"
66 placement =" bottom-start"
77 :open-with-arrow-keys =" true"
8+ @opened =" onPopoverOpened"
89 >
910 <template #anchor =" { attrs } " >
1011 <dt-button
2930 </template >
3031 </dt-button >
3132 </template >
32- <template #content =" { close } " >
33+ <template #content =" { close: popoverClose } " >
3334 <slot
3435 name =" content"
35- :close =" close "
36+ :close =" (cb) => { pendingCallback = cb; popoverClose(); } "
3637 />
3738 </template >
3839 </dt-popover >
@@ -111,5 +112,22 @@ export default {
111112 */
112113 ' shift-focus-left' ,
113114 ],
115+
116+ data () {
117+ return {
118+ pendingCallback: null ,
119+ };
120+ },
121+
122+ methods: {
123+ // Wait until the dropdown is fully closed so the modal's anchor focus
124+ // completes first, then the callback can override it (e.g. to focus the editor).
125+ onPopoverOpened (isOpen ) {
126+ if (! isOpen && typeof this .pendingCallback === ' function' ) {
127+ this .pendingCallback ();
128+ this .pendingCallback = null ;
129+ }
130+ },
131+ },
114132};
115133 </script >
Original file line number Diff line number Diff line change 6969 role =" option"
7070 navigation-type =" arrow-keys"
7171 @click ="
72- close();
72+ close(focusEditor );
7373 onFontStyleSelect(fontStyle.value)
7474 "
7575 >
103103 role =" menuitem"
104104 navigation-type =" arrow-keys"
105105 @click ="
106- close();
106+ close(focusEditor );
107107 onFontSizeSelect(fontSize.value, $event)
108108 "
109109 >
204204 navigation-type =" arrow-keys"
205205 @click ="
206206 insertVariable(category.name, item);
207- close();
207+ close(focusEditor );
208208 "
209209 >
210210 {{ item.name }}
@@ -1176,6 +1176,10 @@ export default {
11761176 removeClassStyleAttrs,
11771177 addClassStyleAttrs,
11781178
1179+ focusEditor () {
1180+ this .$refs .richTextEditor ? .editor ? .commands .focus ();
1181+ },
1182+
11791183 onInputFocus (event ) {
11801184 event ? .stopPropagation ();
11811185 },
You can’t perform that action at this time.
0 commit comments