Browse Source

Add unload alert

pull/36/head
Artur Arseniev 10 years ago
parent
commit
9e89b1267a
  1. 1
      src/demo.js
  2. 3
      src/grapesjs/config/config.js
  3. 5
      src/grapesjs/main.js

1
src/demo.js

@ -6,6 +6,7 @@ require(['config/require-config'], function() {
{
noticeOnUnload: 0,
container : '#gjs',
height: '100%',
fromElement: true,

3
src/grapesjs/config/config.js

@ -22,6 +22,9 @@ define(function () {
// Enable/Disable undo manager
undoManager: true,
// Show an alert before unload the page
noticeOnUnload: true,
// Storage Manager
storage: {},

5
src/grapesjs/main.js

@ -45,6 +45,11 @@ define(function (require) {
if(!els)
throw new Error("'container' is required");
if(c.noticeOnUnload)
window.onbeforeunload = function(e) {
return 1;
};
c.el = document.querySelector(els);
var editor = new Editor(c).init();

Loading…
Cancel
Save