mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-23 14:14:11 +00:00
Make expandable sidebar sections work with incognito mode
In other words, don't rely on context.storage() working (re: #4159)
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
|
||||
export function uiPreset(context) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
expandedPreference = (context.storage('preset_fields.expanded') !== 'false'),
|
||||
state,
|
||||
fieldsArr,
|
||||
preset,
|
||||
@@ -84,12 +85,13 @@ export function uiPreset(context) {
|
||||
function presets(selection) {
|
||||
selection.call(uiDisclosure()
|
||||
.title(t('inspector.all_fields'))
|
||||
.expanded(context.storage('preset_fields.expanded') !== 'false')
|
||||
.expanded(expandedPreference)
|
||||
.on('toggled', toggled)
|
||||
.content(content)
|
||||
);
|
||||
|
||||
function toggled(expanded) {
|
||||
expandedPreference = expanded;
|
||||
context.storage('preset_fields.expanded', expanded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@ import {
|
||||
export function uiRawTagEditor(context) {
|
||||
var taginfo = services.taginfo,
|
||||
dispatch = d3.dispatch('change'),
|
||||
expanded = context.storage('raw_tag_editor.expanded') === 'true',
|
||||
readOnlyTags = [],
|
||||
expandedPreference = (context.storage('raw_tag_editor.expanded') === 'true'),
|
||||
expandedCurrent = expandedPreference,
|
||||
updatePreference = true,
|
||||
readOnlyTags = [],
|
||||
showBlank = false,
|
||||
newRow,
|
||||
state,
|
||||
@@ -31,13 +32,15 @@ export function uiRawTagEditor(context) {
|
||||
|
||||
selection.call(uiDisclosure()
|
||||
.title(t('inspector.all_tags') + ' (' + count + ')')
|
||||
.expanded(expanded)
|
||||
.expanded(expandedCurrent)
|
||||
.on('toggled', toggled)
|
||||
.content(content)
|
||||
);
|
||||
|
||||
function toggled(expanded) {
|
||||
expandedCurrent = expanded;
|
||||
if (updatePreference) {
|
||||
expandedPreference = expanded;
|
||||
context.storage('raw_tag_editor.expanded', expanded);
|
||||
}
|
||||
if (expanded) {
|
||||
@@ -319,10 +322,10 @@ export function uiRawTagEditor(context) {
|
||||
if (!arguments.length) return preset;
|
||||
preset = _;
|
||||
if (preset.isFallback()) {
|
||||
expanded = true;
|
||||
expandedCurrent = true;
|
||||
updatePreference = false;
|
||||
} else {
|
||||
expanded = context.storage('raw_tag_editor.expanded') === 'true';
|
||||
expandedCurrent = expandedPreference;
|
||||
updatePreference = true;
|
||||
}
|
||||
return rawTagEditor;
|
||||
@@ -344,8 +347,8 @@ export function uiRawTagEditor(context) {
|
||||
|
||||
|
||||
rawTagEditor.expanded = function(_) {
|
||||
if (!arguments.length) return expanded;
|
||||
expanded = _;
|
||||
if (!arguments.length) return expandedCurrent;
|
||||
expandedCurrent = _;
|
||||
updatePreference = false;
|
||||
return rawTagEditor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user