Merge pull request #10959 from rancher/fix_10958

fix: support colon as separator when onPaste context in label key field
This commit is contained in:
Andy Lee 2024-05-09 15:34:09 +08:00 committed by GitHub
commit 4dffddb0f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -515,14 +515,14 @@ export default {
this.$emit('input', out);
},
onPaste(index, event, pastedValue) {
onPaste(index, event) {
const text = event.clipboardData.getData('text/plain');
const lines = text.split('\n');
const splits = lines.map((line) => {
const splitter = !line.includes(':') || ((line.indexOf('=') < line.indexOf(':')) && line.includes(':')) ? '=' : ':';
const splitter = this.parserSeparators.find((sep) => line.includes(sep));
return line.split(splitter);
});
return splitter ? line.split(splitter) : '';
}).filter((split) => split && split.length > 0);
if (splits.length === 0 || (splits.length === 1 && splits[0].length < 2)) {
return;