From 4fd6ecf112c450a05154b267ab994c63e5a4f7fd Mon Sep 17 00:00:00 2001 From: Soufiane Date: Wed, 3 Jan 2024 16:56:33 +0100 Subject: [PATCH] Fix pasting multiline text inside checklist items [SCI-9881] (#6866) --- app/javascript/vue/shared/content/checklistItem.vue | 10 +++++++++- app/javascript/vue/shared/inline_edit.vue | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/javascript/vue/shared/content/checklistItem.vue b/app/javascript/vue/shared/content/checklistItem.vue index 9c4420e65..30e90cc20 100644 --- a/app/javascript/vue/shared/content/checklistItem.vue +++ b/app/javascript/vue/shared/content/checklistItem.vue @@ -35,12 +35,14 @@ :attributeName="`${i18n.t('ChecklistItem')} ${i18n.t('name')}`" :editOnload="checklistItem.attributes.isNew" :smartAnnotation="true" + :allowNewLine="true" @editingEnabled="enableTextEdit" @editingDisabled="disableTextEdit" @update="updateText" @delete="removeItem()" @keypress="keyPressHandler" @blur="onBlurHandler" + @paste="pasteHandler" /> @@ -164,10 +166,16 @@ this.$emit('update', this.checklistItem, withKey); }, keyPressHandler(e) { - if (e.key === 'Enter' && e.shiftKey) { + if ( + ((e.shiftKey || e.metaKey) && e.key === 'Enter') + || ((e.ctrlKey || e.metaKey) && e.key === 'v') + ) { this.checklistItem.attributes.with_paragraphs = true; } }, + pasteHandler() { + this.checklistItem.attributes.with_paragraphs = true; + }, } } diff --git a/app/javascript/vue/shared/inline_edit.vue b/app/javascript/vue/shared/inline_edit.vue index b89de6436..d8b88294e 100644 --- a/app/javascript/vue/shared/inline_edit.vue +++ b/app/javascript/vue/shared/inline_edit.vue @@ -15,6 +15,7 @@ @keydown="handleKeypress" @blur="handleBlur" @keyup.escape="cancelEdit && this.atWhoOpened" + @paste="$emit('paste', e)" @focus="setCaretAtEnd"/>