From 8ca40ac0563f94db8e0bc5316848bdbf21d990b4 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Sat, 18 Jan 2020 13:38:21 -0500 Subject: [PATCH] Support the raw tag text editor during multiselection --- modules/ui/raw_tag_editor.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/ui/raw_tag_editor.js b/modules/ui/raw_tag_editor.js index d7ae0a668..631240662 100644 --- a/modules/ui/raw_tag_editor.js +++ b/modules/ui/raw_tag_editor.js @@ -91,13 +91,13 @@ export function uiRawTagEditor(context) { // View Options var options = wrap.selectAll('.raw-tag-options') - .data((!_entityIDs || _entityIDs.length === 1) ? [0] : []); + .data([0]); options.exit() .remove(); var optionsEnter = options.enter() - .append('div') + .insert('div', ':first-child') .attr('class', 'raw-tag-options'); var optionEnter = optionsEnter.selectAll('.raw-tag-option') @@ -342,7 +342,9 @@ export function uiRawTagEditor(context) { var str = rows .filter(function(row) { return row.key && row.key.trim() !== ''; }) .map(function(row) { - var val = row.value ? stringify(row.value) : ''; + var rawVal = row.value; + if (rawVal === true) rawVal = '*'; + var val = rawVal ? stringify(rawVal) : ''; return stringify(row.key) + '=' + val; }) .join('\n'); @@ -371,6 +373,9 @@ export function uiRawTagEditor(context) { tagDiff.forEach(function(change) { if (isReadOnly({ key: change.key })) return; + // skip unchanged multiselection placeholders + if (change.newVal === '*' && change.oldVal === true) return; + if (change.type === '-') { _pendingChange[change.key] = undefined; } else if (change.type === '+') { @@ -378,6 +383,11 @@ export function uiRawTagEditor(context) { } }); + if (Object.keys(_pendingChange).length === 0) { + _pendingChange = null; + return; + } + scheduleChange(); } @@ -616,13 +626,6 @@ export function uiRawTagEditor(context) { _orderedKeys = []; } - if (_entityIDs.length > 1) { - // require the list editor when editing multiple entities - _tagView = 'list'; - } else { - _tagView = (context.storage('raw-tag-editor-view') || 'list'); - } - var combinedTags = {}; var sharedKeys = null; _keyValues = {};