Merge pull request #445 from Al-aighumaisa/replace-whitespace-in-tag

タグの確定時に空白文字を置換する
This commit is contained in:
shibafu 2020-07-23 18:35:36 +09:00 committed by GitHub
commit 134a11ad51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ export default class TagInput extends Vue {
case 'Enter': case 'Enter':
case ' ': case ' ':
if ((event as any).isComposing !== true) { if ((event as any).isComposing !== true) {
this.tags.push(this.buffer.trim()); this.tags.push(this.buffer.trim().replace(/\s+/g, '_'));
this.buffer = ''; this.buffer = '';
} }
event.preventDefault(); event.preventDefault();
@ -49,7 +49,7 @@ export default class TagInput extends Vue {
case 'Unidentified': case 'Unidentified':
// () // ()
if (event.srcElement && (event.srcElement as HTMLInputElement).value.slice(-1) == ' ') { if (event.srcElement && (event.srcElement as HTMLInputElement).value.slice(-1) == ' ') {
this.tags.push(this.buffer.trim()); this.tags.push(this.buffer.trim().replace(/\s+/g, '_'));
this.buffer = ''; this.buffer = '';
event.preventDefault(); event.preventDefault();
} }