From d714ef37d99544fe77efbd5e5e11e820a1a90646 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 7 Jun 2023 11:01:11 -0500 Subject: [PATCH] Fix:Using arrow keys when editing podcast description #1826 --- client/components/ui/VueTrix.vue | 4 +++- client/layouts/default.vue | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/components/ui/VueTrix.vue b/client/components/ui/VueTrix.vue index e6f65733..ace1edd3 100644 --- a/client/components/ui/VueTrix.vue +++ b/client/components/ui/VueTrix.vue @@ -213,7 +213,9 @@ export default { // Reload HTML content this.$refs.trix.editor.loadHTML(newContent) // Move cursor to end of new content updated - this.$refs.trix.editor.setSelectedRange(this.getContentEndPosition()) + if (this.autofocus) { + this.$refs.trix.editor.setSelectedRange(this.getContentEndPosition()) + } }, getContentEndPosition() { return this.$refs.trix.editor.getDocument().toString().length - 1 diff --git a/client/layouts/default.vue b/client/layouts/default.vue index 7734a7ee..2aaf3ee4 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -491,9 +491,9 @@ export default { } }, checkActiveElementIsInput() { - var activeElement = document.activeElement - var inputs = ['input', 'select', 'button', 'textarea'] - return activeElement && inputs.indexOf(activeElement.tagName.toLowerCase()) !== -1 + const activeElement = document.activeElement + const inputs = ['input', 'select', 'button', 'textarea', 'trix-editor'] + return activeElement && inputs.some((i) => i === activeElement.tagName.toLowerCase()) }, getHotkeyName(e) { var keyCode = e.keyCode || e.which