mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-04 20:36:03 +01:00
Fixed issues that would prevent Incognito / Private browsing to work in Safari (fixes #527)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* Fix for visibility toggle on new page not working [#551](https://github.com/getgrav/grav-plugin-admin/issues/551)
|
||||
* Page tooltips usability issue [#496](https://github.com/getgrav/grav-plugin-admin/issues/496)
|
||||
* Fix removed title attribute from editor toolbar buttons [#539](https://github.com/getgrav/grav-plugin-admin/issues/539)
|
||||
* Allow Incognito / Private browsing to still function in Safari [#527](https://github.com/getgrav/grav-plugin-admin/issues/527)
|
||||
|
||||
# v1.1.0-beta.2
|
||||
## 04/27/2016
|
||||
|
||||
@@ -4,6 +4,7 @@ import request from '../utils/request';
|
||||
import debounce from 'debounce';
|
||||
import { Instance as pagesTree } from './tree';
|
||||
import 'selectize';
|
||||
import '../utils/storage';
|
||||
|
||||
/* @formatter:off */
|
||||
/* eslint-disable */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import '../utils/storage';
|
||||
|
||||
const sessionKey = 'grav:admin:pages';
|
||||
|
||||
@@ -9,7 +10,7 @@ if (!sessionStorage.getItem(sessionKey)) {
|
||||
export default class PagesTree {
|
||||
constructor(elements) {
|
||||
this.elements = $(elements);
|
||||
this.session = JSON.parse(sessionStorage.getItem(sessionKey));
|
||||
this.session = JSON.parse(sessionStorage.getItem(sessionKey) || '{}');
|
||||
|
||||
if (!this.elements.length) { return; }
|
||||
|
||||
|
||||
41
themes/grav/app/utils/storage.js
Normal file
41
themes/grav/app/utils/storage.js
Normal file
@@ -0,0 +1,41 @@
|
||||
// localStorage
|
||||
(function() {
|
||||
function isSupported() {
|
||||
var item = 'localStoragePollyfill';
|
||||
try {
|
||||
localStorage.setItem(item, item);
|
||||
localStorage.removeItem(item);
|
||||
sessionStorage.setItem(item, item);
|
||||
sessionStorage.removeItem(item);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSupported()) {
|
||||
try {
|
||||
Storage.prototype._data = {};
|
||||
|
||||
Storage.prototype.setItem = function(id, val) {
|
||||
this._data[id] = String(val);
|
||||
return this._data[id];
|
||||
};
|
||||
|
||||
Storage.prototype.getItem = function(id) {
|
||||
return this._data.hasOwnProperty(id) ? this._data[id] : undefined;
|
||||
};
|
||||
|
||||
Storage.prototype.removeItem = function(id) {
|
||||
return delete this._data[id];
|
||||
};
|
||||
|
||||
Storage.prototype.clear = function() {
|
||||
this._data = {};
|
||||
return this._data;
|
||||
};
|
||||
} catch (e) {
|
||||
console.error('localStorage pollyfill error: ', e);
|
||||
}
|
||||
}
|
||||
}());
|
||||
22
themes/grav/js/admin.min.js
vendored
22
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
28
themes/grav/js/vendor.min.js
vendored
28
themes/grav/js/vendor.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user