From f62a3a6b0012aa083921ccb1fe1fc17a614edc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20H=C3=A4ssler?= Date: Sat, 9 Jun 2018 23:24:20 +0200 Subject: [PATCH] Handle key-value pairs pasted as tags --- modules/ui/raw_tag_editor.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/ui/raw_tag_editor.js b/modules/ui/raw_tag_editor.js index d8c7e1344..85a7f786e 100644 --- a/modules/ui/raw_tag_editor.js +++ b/modules/ui/raw_tag_editor.js @@ -1,4 +1,5 @@ import _map from 'lodash-es/map'; +import _includes from 'lodash-es/includes'; import { ascending as d3_ascending } from 'd3-array'; import { dispatch as d3_dispatch } from 'd3-dispatch'; @@ -281,6 +282,15 @@ export function uiRawTagEditor(context) { while (_tags[kNew]) { // rename key if already in use kNew = base + '_' + suffix++; } + + if (_includes(kNew, '=')) { + var splitStr = kNew.split('=').map(function(str) { return str.trim(); }), + key = splitStr[0], + value = splitStr[1]; + + kNew = key; + d.value = value; + } } tag[kOld] = undefined; tag[kNew] = d.value;