diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml
index 1bbfbee7a7..22618b1bcd 100644
--- a/shell/assets/translations/en-us.yaml
+++ b/shell/assets/translations/en-us.yaml
@@ -7125,7 +7125,7 @@ podAffinity:
keyValue:
keyPlaceholder: e.g. foo
valuePlaceholder: e.g. bar
- protip: 'Paste lines of key=value or key: value into any key field for easy bulk entry'
+ protip: 'Paste lines of key=value or key:value into any key field for easy bulk entry'
registryMirror:
header: Mirrors
diff --git a/shell/assets/translations/zh-hans.yaml b/shell/assets/translations/zh-hans.yaml
index 1bb21d35ee..bfeffcf7f0 100644
--- a/shell/assets/translations/zh-hans.yaml
+++ b/shell/assets/translations/zh-hans.yaml
@@ -6953,7 +6953,7 @@ podAffinity:
keyValue:
keyPlaceholder: 例如:foo
valuePlaceholder: 例如:bar
- protip: '把多行 key=value 或 key: value 键值对复制到各字段中,以便批量输入'
+ protip: '把多行 key=value 或 key:value 键值对复制到各字段中,以便批量输入'
registryMirror:
header: Mirror
diff --git a/shell/components/form/KeyValue.vue b/shell/components/form/KeyValue.vue
index f818bc38eb..954bbf6f2d 100644
--- a/shell/components/form/KeyValue.vue
+++ b/shell/components/form/KeyValue.vue
@@ -220,7 +220,7 @@ export default {
},
parserSeparators: {
type: Array,
- default: () => [': ', '='],
+ default: () => [':', '='],
},
loading: {
default: false,
@@ -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;