mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
feat: Add support for canned response command anywhere on rich text editor (#2356)
This commit is contained in:
committed by
GitHub
parent
22965be6dc
commit
2c42e70637
@@ -42,6 +42,7 @@
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
@toggle-user-mention="toggleUserMention"
|
||||
@toggle-canned-menu="toggleCannedMenu"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="hasAttachments" class="attachment-preview-box">
|
||||
@@ -249,7 +250,8 @@ export default {
|
||||
}
|
||||
},
|
||||
message(updatedMessage) {
|
||||
this.hasSlashCommand = updatedMessage[0] === '/';
|
||||
this.hasSlashCommand =
|
||||
updatedMessage[0] === '/' && !this.showRichContentEditor;
|
||||
const hasNextWord = updatedMessage.includes(' ');
|
||||
const isShortCodeActive = this.hasSlashCommand && !hasNextWord;
|
||||
if (isShortCodeActive) {
|
||||
@@ -271,6 +273,9 @@ export default {
|
||||
toggleUserMention(currentMentionState) {
|
||||
this.hasUserMention = currentMentionState;
|
||||
},
|
||||
toggleCannedMenu(value) {
|
||||
this.showCannedMenu = value;
|
||||
},
|
||||
handleKeyEvents(e) {
|
||||
if (isEscape(e)) {
|
||||
this.hideEmojiPicker();
|
||||
@@ -279,7 +284,8 @@ export default {
|
||||
const hasSendOnEnterEnabled =
|
||||
(this.showRichContentEditor &&
|
||||
this.enterToSendEnabled &&
|
||||
!this.hasUserMention) ||
|
||||
!this.hasUserMention &&
|
||||
!this.showCannedMenu) ||
|
||||
!this.showRichContentEditor;
|
||||
const shouldSendMessage =
|
||||
hasSendOnEnterEnabled && !hasPressedShift(e) && this.isFocused;
|
||||
|
||||
Reference in New Issue
Block a user