Support the raw tag text editor during multiselection

This commit is contained in:
Quincy Morgan
2020-01-18 13:38:21 -05:00
parent e62e3107cc
commit 8ca40ac056
+13 -10
View File
@@ -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 = {};