/static/scripts/tiny_mce/plugins/autosave/editor_plugin_src.js

http://n23.googlecode.com/ · JavaScript · 51 lines · 33 code · 10 blank · 8 comment · 2 complexity · 665de5702fa6064750a76c30c36d7e57 MD5 · raw file

  1. /**
  2. * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
  3. *
  4. * @author Moxiecode
  5. * @copyright Copyright Š 2004-2008, Moxiecode Systems AB, All rights reserved.
  6. */
  7. (function() {
  8. tinymce.create('tinymce.plugins.AutoSavePlugin', {
  9. init : function(ed, url) {
  10. var t = this;
  11. t.editor = ed;
  12. window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;
  13. },
  14. getInfo : function() {
  15. return {
  16. longname : 'Auto save',
  17. author : 'Moxiecode Systems AB',
  18. authorurl : 'http://tinymce.moxiecode.com',
  19. infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
  20. version : tinymce.majorVersion + "." + tinymce.minorVersion
  21. };
  22. },
  23. // Private plugin internal methods
  24. 'static' : {
  25. _beforeUnloadHandler : function() {
  26. var msg;
  27. tinymce.each(tinyMCE.editors, function(ed) {
  28. if (ed.getParam("fullscreen_is_enabled"))
  29. return;
  30. if (ed.isDirty()) {
  31. msg = ed.getLang("autosave.unload_msg");
  32. return false;
  33. }
  34. });
  35. return msg;
  36. }
  37. }
  38. });
  39. // Register plugin
  40. tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin);
  41. })();