Firefox pinned tab workaround, closes #356

This commit is contained in:
Mo Bitar
2020-01-31 11:47:27 -06:00
parent a9d2d519f4
commit 2418f35477
3 changed files with 30 additions and 5 deletions

View File

@@ -360,11 +360,23 @@ class EditorCtrl extends PureCtrl {
return this.actionsManager.extensionsInContextOfItem(this.state.note).length > 0;
}
performFirefoxPinnedTabFix() {
/**
* For Firefox pinned tab issue:
* When a new browser session is started, and SN is in a pinned tab,
* SN is unusable until the tab is reloaded.
*/
if (document.hidden) {
window.location.reload();
}
}
saveNote({
bypassDebouncer,
updateClientModified,
dontUpdatePreviews
}) {
this.performFirefoxPinnedTabFix();
const note = this.state.note;
note.dummy = false;
if (note.deleted) {
@@ -545,7 +557,7 @@ class EditorCtrl extends PureCtrl {
const text = StringDeleteNote({
title: title,
permanently: permanently
})
});
this.alertManager.confirm({
text: text,
destructive: true,
@@ -899,7 +911,7 @@ class EditorCtrl extends PureCtrl {
}
}
}
else if(this.state.note) {
else if (this.state.note) {
const enableable = (
component.isExplicitlyEnabledForItem(this.state.note)
|| component.isDefaultEditor()
@@ -1138,12 +1150,12 @@ class EditorCtrl extends PureCtrl {
note.text = editor.value;
this.setState({
note: note
})
});
this.saveNote({
bypassDebouncer: true
});
},
})
});
/**
* Handles when the editor is destroyed,

View File

@@ -741,6 +741,18 @@ function (_PureCtrl) {
value: function hasAvailableExtensions() {
return this.actionsManager.extensionsInContextOfItem(this.state.note).length > 0;
}
}, {
key: "performFirefoxPinnedTabFix",
value: function performFirefoxPinnedTabFix() {
/**
* For Firefox pinned tab issue:
* When a new browser session is started, and SN is in a pinned tab,
* SN is unusable until the tab is reloaded.
*/
if (document.hidden) {
window.location.reload();
}
}
}, {
key: "saveNote",
value: function saveNote(_ref2) {
@@ -749,6 +761,7 @@ function (_PureCtrl) {
var bypassDebouncer = _ref2.bypassDebouncer,
updateClientModified = _ref2.updateClientModified,
dontUpdatePreviews = _ref2.dontUpdatePreviews;
this.performFirefoxPinnedTabFix();
var note = this.state.note;
note.dummy = false;

File diff suppressed because one or more lines are too long