diff --git a/app/assets/javascripts/strings.ts b/app/assets/javascripts/strings.ts index d80dd225d..5e6cd6056 100644 --- a/app/assets/javascripts/strings.ts +++ b/app/assets/javascripts/strings.ts @@ -13,6 +13,7 @@ export const STRING_NEW_UPDATE_READY = "A new update is ready to install. Please export const STRING_DELETE_TAG = "Are you sure you want to delete this tag? Note: deleting a tag will not delete its notes."; /** @editor */ +export const STRING_SAVING_WHILE_DOCUMENT_HIDDEN = 'Attempting to save an item while the application is hidden. To protect data integrity, please refresh the application window and try again.' export const STRING_DELETED_NOTE = "The note you are attempting to edit has been deleted, and is awaiting sync. Changes you make will be disregarded."; export const STRING_INVALID_NOTE = "The note you are attempting to save can not be found or has been deleted. Changes you make will not be synced. Please copy this note's text and start a new note."; export const STRING_ELLIPSES = "..."; diff --git a/app/assets/javascripts/views/editor/editor_view.ts b/app/assets/javascripts/views/editor/editor_view.ts index 8b2166352..061a7cab5 100644 --- a/app/assets/javascripts/views/editor/editor_view.ts +++ b/app/assets/javascripts/views/editor/editor_view.ts @@ -1,3 +1,4 @@ +import { STRING_SAVING_WHILE_DOCUMENT_HIDDEN } from './../../strings'; import { Editor } from '@/ui_models/editor'; import { WebApplication } from '@/ui_models/application'; import { PanelPuppet, WebDirective } from '@/types'; @@ -437,17 +438,6 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> { extensionsInContextOfItem(this.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(); - } - } - /** * @param bypassDebouncer Calling save will debounce by default. You can pass true to save * immediately. @@ -468,7 +458,12 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> { customMutate?: (mutator: NoteMutator) => void, closeAfterSync = false ) { - this.performFirefoxPinnedTabFix(); + if (document.hidden) { + this.application.alertService!.alert( + STRING_SAVING_WHILE_DOCUMENT_HIDDEN + ); + return; + } const note = this.note; if (note.deleted) { this.application.alertService!.alert(