PHP Classes

File: public/js/tinymce/src/plugins/autosave/src/main/js/core/BeforeUnload.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/autosave/src/main/js/core/BeforeUnload.js   Download  
File: public/js/tinymce/src/plugins/autosave/src/main/js/core/BeforeUnload.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,190 bytes
 

Contents

Class file image Download
/** * BeforeUnload.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.plugins.autosave.core.BeforeUnload', [ 'global!window', 'tinymce.core.EditorManager', 'tinymce.core.util.Tools', 'tinymce.plugins.autosave.api.Settings' ], function (window, EditorManager, Tools, Settings) { EditorManager._beforeUnloadHandler = function () { var msg; Tools.each(EditorManager.get(), function (editor) { // Store a draft for each editor instance if (editor.plugins.autosave) { editor.plugins.autosave.storeDraft(); } // Setup a return message if the editor is dirty if (!msg && editor.isDirty() && Settings.shouldAskBeforeUnload(editor)) { msg = editor.translate("You have unsaved changes are you sure you want to navigate away?"); } }); return msg; }; var setup = function (editor) { window.onbeforeunload = EditorManager._beforeUnloadHandler; }; return { setup: setup }; } );