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; 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({ saveNote({
bypassDebouncer, bypassDebouncer,
updateClientModified, updateClientModified,
dontUpdatePreviews dontUpdatePreviews
}) { }) {
this.performFirefoxPinnedTabFix();
const note = this.state.note; const note = this.state.note;
note.dummy = false; note.dummy = false;
if (note.deleted) { if (note.deleted) {
@@ -545,7 +557,7 @@ class EditorCtrl extends PureCtrl {
const text = StringDeleteNote({ const text = StringDeleteNote({
title: title, title: title,
permanently: permanently permanently: permanently
}) });
this.alertManager.confirm({ this.alertManager.confirm({
text: text, text: text,
destructive: true, destructive: true,
@@ -899,7 +911,7 @@ class EditorCtrl extends PureCtrl {
} }
} }
} }
else if(this.state.note) { else if (this.state.note) {
const enableable = ( const enableable = (
component.isExplicitlyEnabledForItem(this.state.note) component.isExplicitlyEnabledForItem(this.state.note)
|| component.isDefaultEditor() || component.isDefaultEditor()
@@ -1138,12 +1150,12 @@ class EditorCtrl extends PureCtrl {
note.text = editor.value; note.text = editor.value;
this.setState({ this.setState({
note: note note: note
}) });
this.saveNote({ this.saveNote({
bypassDebouncer: true bypassDebouncer: true
}); });
}, },
}) });
/** /**
* Handles when the editor is destroyed, * Handles when the editor is destroyed,

View File

@@ -741,6 +741,18 @@ function (_PureCtrl) {
value: function hasAvailableExtensions() { value: function hasAvailableExtensions() {
return this.actionsManager.extensionsInContextOfItem(this.state.note).length > 0; 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", key: "saveNote",
value: function saveNote(_ref2) { value: function saveNote(_ref2) {
@@ -749,6 +761,7 @@ function (_PureCtrl) {
var bypassDebouncer = _ref2.bypassDebouncer, var bypassDebouncer = _ref2.bypassDebouncer,
updateClientModified = _ref2.updateClientModified, updateClientModified = _ref2.updateClientModified,
dontUpdatePreviews = _ref2.dontUpdatePreviews; dontUpdatePreviews = _ref2.dontUpdatePreviews;
this.performFirefoxPinnedTabFix();
var note = this.state.note; var note = this.state.note;
note.dummy = false; note.dummy = false;

File diff suppressed because one or more lines are too long