diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/autosave/editor_plugin_src.js --- a/includes/clientside/tinymce/plugins/autosave/editor_plugin_src.js Wed Dec 26 00:37:26 2007 -0500 +++ b/includes/clientside/tinymce/plugins/autosave/editor_plugin_src.js Thu Dec 27 22:09:33 2007 -0500 @@ -1,46 +1,51 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * $Id: editor_plugin_src.js 372 2007-11-11 18:38:50Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('autosave'); +(function() { + tinymce.create('tinymce.plugins.AutoSavePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; + }, -var TinyMCE_AutoSavePlugin = { - getInfo : function() { - return { - longname : 'Auto save', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, + getInfo : function() { + return { + longname : 'Auto save', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, - // Private plugin internal methods - - _beforeUnloadHandler : function() { - var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg"); + // Private plugin internal methods - if (tinyMCE.getParam("fullscreen_is_enabled")) - return; + 'static' : { + _beforeUnloadHandler : function() { + var msg; - for (n in tinyMCE.instances) { - inst = tinyMCE.instances[n]; - - if (!tinyMCE.isInstance(inst)) - continue; + tinymce.each(tinyMCE.editors, function(ed) { + if (ed.getParam("fullscreen_is_enabled")) + return; - if (inst.isDirty()) - return msg; - } + if (ed.isDirty()) { + msg = ed.getLang("autosave.unload_msg"); + return false; + } + }); - return; - } -}; + return msg; + } + } + }); -window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler; - -tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin); + // Register plugin + tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); +})(); \ No newline at end of file