diff --git a/CHANGELOG.md b/CHANGELOG.md index b1f946af6..78a3c1efb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ [#883](https://github.com/nextcloud/cookbook/pull/883) @christianlupus - Make the controls sticky on top [#888](https://github.com/nextcloud/cookbook/pull/888) @MarcelRobitaille +- Cleanup code related to pasting + [#886](https://github.com/nextcloud/cookbook/pull/886) @MarcelRobitaille ### Documentation - Added clarification between categories and keywords for users diff --git a/src/components/EditInputGroup.vue b/src/components/EditInputGroup.vue index c998cd888..8db53b18b 100644 --- a/src/components/EditInputGroup.vue +++ b/src/components/EditInputGroup.vue @@ -170,7 +170,10 @@ export default { // from the data pasted in the input field (e.target.value) const clipboardData = e.clipboardData || window.clipboardData const pastedData = clipboardData.getData("Text") - const inputLinesArray = pastedData.split(/\r\n|\r|\n/g) + const inputLinesArray = pastedData + .split(/\r\n|\r|\n/g) + // Remove empty lines + .filter((line) => line.trim() !== "") if (inputLinesArray.length === 1) { this.singleLinePasted = true @@ -187,12 +190,6 @@ export default { $li ) - // Remove empty lines - for (let i = inputLinesArray.length - 1; i >= 0; --i) { - if (inputLinesArray[i].trim() === "") { - inputLinesArray.splice(i, 1) - } - } for (let i = 0; i < inputLinesArray.length; ++i) { this.addNewEntry( $insertedIndex + i + 1,