Index: openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js 25 Jan 2008 21:43:56 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js 8 May 2009 18:18:32 -0000 1.2 @@ -2,45 +2,50 @@ * $Id$ * * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2008, 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; -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 - }; - }, + t.editor = ed; - // Private plugin internal methods + window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; + }, - _beforeUnloadHandler : function() { - var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg"); + 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 + }; + }, - if (tinyMCE.getParam("fullscreen_is_enabled")) - return; + // Private plugin internal methods - for (n in tinyMCE.instances) { - inst = tinyMCE.instances[n]; + 'static' : { + _beforeUnloadHandler : function() { + var msg; - if (!tinyMCE.isInstance(inst)) - continue; + tinymce.each(tinyMCE.editors, function(ed) { + if (ed.getParam("fullscreen_is_enabled")) + return; - if (inst.isDirty()) + if (ed.isDirty()) { + msg = ed.getLang("autosave.unload_msg"); + return false; + } + }); + return msg; + } } + }); - return; - } -}; - -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