mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
This commit is contained in:
@@ -97,19 +97,11 @@ export function behaviorHash(context) {
|
||||
context.zoomToEntity(q.id.split(',')[0], !q.map);
|
||||
}
|
||||
|
||||
if (q.comment) {
|
||||
context.storage('comment', q.comment);
|
||||
context.storage('commentDate', Date.now());
|
||||
}
|
||||
|
||||
if (q.source) {
|
||||
context.storage('source', q.source);
|
||||
context.storage('commentDate', Date.now());
|
||||
}
|
||||
|
||||
if (q.hashtags) {
|
||||
context.storage('hashtags', q.hashtags);
|
||||
}
|
||||
// Store these here instead of updating local storage since local
|
||||
// storage could be flushed if the user discards pending changes
|
||||
if (q.comment) behavior.comment = q.comment;
|
||||
if (q.source) behavior.source = q.source;
|
||||
if (q.hashtags) behavior.hashtags = q.hashtags;
|
||||
|
||||
if (q.walkthrough === 'true') {
|
||||
behavior.startWalkthrough = true;
|
||||
|
||||
@@ -643,7 +643,14 @@ export function coreHistory(context) {
|
||||
|
||||
clearSaved: function() {
|
||||
context.debouncedSave.cancel();
|
||||
if (lock.locked()) context.storage(getKey('saved_history'), null);
|
||||
if (lock.locked()) {
|
||||
context.storage(getKey('saved_history'), null);
|
||||
|
||||
// clear the changeset metadata associated with the saved history
|
||||
context.storage('comment', null);
|
||||
context.storage('hashtags', null);
|
||||
context.storage('source', null);
|
||||
}
|
||||
return history;
|
||||
},
|
||||
|
||||
|
||||
+16
-1
@@ -65,6 +65,21 @@ export function uiCommit(context) {
|
||||
// Initialize changeset if one does not exist yet.
|
||||
// Also pull values from local storage.
|
||||
if (!_changeset) {
|
||||
|
||||
// load in the URL hash values, if any
|
||||
var hash = context.ui().hash;
|
||||
if (hash.comment) {
|
||||
context.storage('comment', hash.comment);
|
||||
context.storage('commentDate', Date.now());
|
||||
}
|
||||
if (hash.source) {
|
||||
context.storage('source', hash.source);
|
||||
context.storage('commentDate', Date.now());
|
||||
}
|
||||
if (hash.hashtags) {
|
||||
context.storage('hashtags', hash.hashtags);
|
||||
}
|
||||
|
||||
var detected = utilDetect();
|
||||
tags = {
|
||||
comment: context.storage('comment') || '',
|
||||
@@ -94,7 +109,7 @@ export function uiCommit(context) {
|
||||
if (sources.indexOf('streetlevel imagery') === -1) {
|
||||
sources.push('streetlevel imagery');
|
||||
}
|
||||
|
||||
|
||||
// add the photo overlays used during editing as sources
|
||||
photoOverlaysUsed.forEach(function(photoOverlay) {
|
||||
if (sources.indexOf(photoOverlay) === -1) {
|
||||
|
||||
+6
-6
@@ -221,9 +221,9 @@ export function uiInit(context) {
|
||||
ui.onResize();
|
||||
map.redrawEnable(true);
|
||||
|
||||
var hash = behaviorHash(context);
|
||||
hash();
|
||||
if (!hash.hadHash) {
|
||||
ui.hash = behaviorHash(context);
|
||||
ui.hash();
|
||||
if (!ui.hash.hadHash) {
|
||||
map.centerZoom([0, 0], 2);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ export function uiInit(context) {
|
||||
context.enter(modeBrowse(context));
|
||||
|
||||
if (!_initCounter++) {
|
||||
if (!hash.startWalkthrough) {
|
||||
if (!ui.hash.startWalkthrough) {
|
||||
context.container()
|
||||
.call(uiSplash(context))
|
||||
.call(uiRestore(context));
|
||||
@@ -317,8 +317,8 @@ export function uiInit(context) {
|
||||
|
||||
_initCounter++;
|
||||
|
||||
if (hash.startWalkthrough) {
|
||||
hash.startWalkthrough = false;
|
||||
if (ui.hash.startWalkthrough) {
|
||||
ui.hash.startWalkthrough = false;
|
||||
context.container().call(uiIntro(context));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user