commit 251652086e429b152def0de129c0dd1b65b43f0f
parent 85b30ad9a91542eb88b9d929c32ceb3086d9775a
Author: markseu <mark2011@mayberg.se>
Date: Sun, 17 May 2020 14:58:52 +0200
Updated edit extension, improved back/forward cache for Safari
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/system/extensions/edit.js b/system/extensions/edit.js
@@ -9,6 +9,7 @@ var yellow = {
onDrop: function(e) { yellow.edit.drop(e); },
onClick: function(e) { yellow.edit.click(e); },
onClickAction: function(e) { yellow.edit.clickAction(e); },
+ onPageShow: function(e) { yellow.edit.pageShow(e); },
onUpdatePane: function() { yellow.edit.updatePane(yellow.edit.paneId, yellow.edit.paneAction, yellow.edit.paneStatus); },
onResizePane: function() { yellow.edit.resizePane(yellow.edit.paneId, yellow.edit.paneAction, yellow.edit.paneStatus); },
action: function(action, status, args) { yellow.edit.processAction(action, status, args); }
@@ -73,6 +74,13 @@ yellow.edit = {
this.processAction(element.getAttribute("data-action"), element.getAttribute("data-status"), element.getAttribute("data-args"));
},
+ // Handle page cache
+ pageShow: function(e) {
+ if (event.persisted && yellow.system.userEmail && !this.getCookie("csrftoken")) {
+ window.location.reload();
+ }
+ },
+
// Create bar
createBar: function(barId) {
var elementBar = document.createElement("div");
@@ -81,6 +89,7 @@ yellow.edit = {
if (barId=="yellow-bar") {
yellow.toolbox.addEvent(document, "click", yellow.onClick);
yellow.toolbox.addEvent(document, "keydown", yellow.onKeydown);
+ yellow.toolbox.addEvent(window, "pageshow", yellow.onPageShow);
yellow.toolbox.addEvent(window, "resize", yellow.onResizePane);
}
var elementDiv = document.createElement("div");
diff --git a/system/extensions/edit.php b/system/extensions/edit.php
@@ -4,7 +4,7 @@
// This file may be used and distributed under the terms of the public license.
class YellowEdit {
- const VERSION = "0.8.24";
+ const VERSION = "0.8.25";
const TYPE = "feature";
public $yellow; //access to API
public $response; //web response