create several cards if the new title contains a linebreak
Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
@@ -53,13 +53,14 @@
|
|||||||
|
|
||||||
<form v-if="showAddCard" class="stack--card-add" @submit.prevent="clickAddCard()">
|
<form v-if="showAddCard" class="stack--card-add" @submit.prevent="clickAddCard()">
|
||||||
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
||||||
<input id="new-stack-input-main"
|
<textarea id="new-stack-input-main"
|
||||||
v-model="newCardTitle"
|
v-model="newCardTitle"
|
||||||
v-focus
|
v-focus
|
||||||
type="text"
|
type="text"
|
||||||
class="no-close"
|
class="no-close"
|
||||||
placeholder="Add a new card"
|
placeholder="Add a new card"
|
||||||
required>
|
required>
|
||||||
|
</textarea>
|
||||||
|
|
||||||
<input class="icon-confirm"
|
<input class="icon-confirm"
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -161,14 +162,36 @@ export default {
|
|||||||
this.editing = false
|
this.editing = false
|
||||||
},
|
},
|
||||||
clickAddCard() {
|
clickAddCard() {
|
||||||
const newCard = {
|
|
||||||
title: this.newCardTitle,
|
let match = /\r|\n/.exec(this.newCardTitle);
|
||||||
stackId: this.stack.id,
|
if (match) {
|
||||||
boardId: this.stack.boardId,
|
|
||||||
|
match.forEach(() => (line) => {
|
||||||
|
|
||||||
|
let newCard = {
|
||||||
|
title: line,
|
||||||
|
stackId: this.stack.id,
|
||||||
|
boardId: this.stack.boardId,
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$store.dispatch('addCard', newCard)
|
||||||
|
this.newCardTitle = ''
|
||||||
|
this.showAddCard = false
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
const newCard = {
|
||||||
|
title: this.newCardTitle,
|
||||||
|
stackId: this.stack.id,
|
||||||
|
boardId: this.stack.boardId,
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$store.dispatch('addCard', newCard)
|
||||||
|
this.newCardTitle = ''
|
||||||
|
this.showAddCard = false
|
||||||
|
|
||||||
}
|
}
|
||||||
this.$store.dispatch('addCard', newCard)
|
|
||||||
this.newCardTitle = ''
|
|
||||||
this.showAddCard = false
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user