fix: insert position for canned responses (#8069)
This commit is contained in:
parent
6a07251007
commit
bb5c6a416a
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="editorRoot" class="editor-root relative">
|
<div ref="editorRoot" class="relative editor-root">
|
||||||
<tag-agents
|
<tag-agents
|
||||||
v-if="showUserMentions && isPrivate"
|
v-if="showUserMentions && isPrivate"
|
||||||
:search-key="mentionSearchKey"
|
:search-key="mentionSearchKey"
|
||||||
@ -542,6 +542,7 @@ export default {
|
|||||||
message: cannedItem,
|
message: cannedItem,
|
||||||
variables: this.variables,
|
variables: this.variables,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.editorView) {
|
if (!this.editorView) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -550,7 +551,12 @@ export default {
|
|||||||
updatedMessage
|
updatedMessage
|
||||||
);
|
);
|
||||||
|
|
||||||
this.insertNodeIntoEditor(node, this.range.from, this.range.to);
|
const from =
|
||||||
|
node.textContent === updatedMessage
|
||||||
|
? this.range.from
|
||||||
|
: this.range.from - 1;
|
||||||
|
|
||||||
|
this.insertNodeIntoEditor(node, from, this.range.to);
|
||||||
|
|
||||||
this.$track(CONVERSATION_EVENTS.INSERTED_A_CANNED_RESPONSE);
|
this.$track(CONVERSATION_EVENTS.INSERTED_A_CANNED_RESPONSE);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user