Make remote edit work when /edit is loaded

Change detection of the edit request to use the URL as the class
will not be set on the body now, and force the router to think we
actually loaded the normal view.
This commit is contained in:
Tom Hughes 2013-12-05 10:40:21 +00:00
parent a51b4c869e
commit 6670de16a1
2 changed files with 10 additions and 4 deletions

View file

@ -201,10 +201,6 @@ $(document).ready(function () {
e.preventDefault();
});
if (OSM.preferred_editor == "remote" && $('body').hasClass("site-edit")) {
remoteEditHandler(map.getBounds());
}
if (OSM.params().edit_help) {
$('#editanchor')
.removeAttr('title')
@ -284,6 +280,11 @@ $(document).ready(function () {
"/changeset/:id": OSM.Browse(map, 'changeset')
});
if (OSM.preferred_editor == "remote" && document.location.pathname == "/edit") {
remoteEditHandler(map.getBounds());
OSM.router.setCurrentPath("/");
}
OSM.router.load();
$(document).on("click", "a", function(e) {

View file

@ -167,6 +167,11 @@ OSM.Router = function(map, rts) {
router.stateChange(loadState || {});
};
router.setCurrentPath = function (path) {
currentPath = path;
currentRoute = routes.recognize(currentPath);
};
map.on('moveend baselayerchange overlaylayerchange', router.updateHash);
$(window).on('hashchange', router.hashUpdated);