Fix pasting multiline text inside checklist items [SCI-9881] (#6866)

This commit is contained in:
Soufiane 2024-01-03 16:56:33 +01:00 committed by GitHub
parent 395a214175
commit 4fd6ecf112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -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"
/>
<span v-if="!editingText && (!checklistItem.attributes.urls || deleteUrl)" class="absolute right-0 top-0.5 leading-6 tw-hidden group-hover/checklist-item-header:inline-block !text-sn-blue cursor-pointer" @click="showDeleteModal" tabindex="0">
<i class="sn-icon sn-icon-delete"></i>
@ -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;
},
}
}
</script>

View file

@ -15,6 +15,7 @@
@keydown="handleKeypress"
@blur="handleBlur"
@keyup.escape="cancelEdit && this.atWhoOpened"
@paste="$emit('paste', e)"
@focus="setCaretAtEnd"/>
<textarea v-else
ref="input"
@ -29,6 +30,7 @@
@keydown="handleKeypress"
@blur="handleBlur"
@keyup.escape="cancelEdit && this.atWhoOpened"
@paste="$emit('paste', e)"
@focus="setCaretAtEnd"/>
</template>
<div