Skip to content

Commit

Permalink
face-edit: prevent trailing space (fix #1074)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Mar 16, 2024
1 parent 70c895c commit add7c1e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/modal/FaceEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<NcTextField
class="field"
:autofocus="true"
:value.sync="input"
:value.sync="rawInput"
:label="t('memories', 'Name')"
:label-visible="false"
:placeholder="t('memories', 'Name')"
Expand Down Expand Up @@ -51,7 +51,7 @@ export default defineComponent({
emits: [],
data: () => ({
input: String(),
rawInput: String(),
}),
computed: {
Expand All @@ -66,6 +66,12 @@ export default defineComponent({
canSave() {
return this.input && this.name !== this.input && isNaN(Number(this.input));
},
input() {
// Prevent leading and trailing spaces in name
// https://github.com/pulsejet/memories/issues/1074
return this.rawInput.trim();
},
},
methods: {
Expand All @@ -75,7 +81,7 @@ export default defineComponent({
return;
}
this.input = isNaN(Number(this.name)) ? this.name : String();
this.rawInput = isNaN(Number(this.name)) ? this.name : String();
this.show = true;
},
Expand Down

0 comments on commit add7c1e

Please sign in to comment.