make last new line optional, closes #1258

This commit is contained in:
Alexander Drozdov
2024-01-24 14:35:37 +02:00
parent 2e58f4e50f
commit 8c8a71264e

View File

@@ -112,7 +112,9 @@ export function parseClipboard (clipboard: string): Result<ParsedItem, string> {
function itemTextToSections (text: string) {
const lines = text.split(/\r?\n/)
lines.pop()
if (lines[lines.length - 1] === '') {
lines.pop()
}
const sections: string[][] = [[]]
lines.reduce((section, line) => {