[ Index ]
 

Code source de Seagull 0.6.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tinyfck/plugins/save/ -> editor_plugin_src.js (source)

   1  /**

   2   * $RCSfile: editor_plugin_src.js,v $

   3   * $Revision: 1.26 $

   4   * $Date: 2006/02/13 15:09:28 $

   5   *

   6   * @author Moxiecode

   7   * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.

   8   */
   9  
  10  /* Import plugin specific language pack */

  11  tinyMCE.importPluginLanguagePack('save', 'en,tr,sv,zh_cn,cs,fa,fr_ca,fr,de,pl,pt_br,nl,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,da,es,cy,is,zh_tw,zh_tw_utf8,sk');
  12  
  13  var TinyMCE_SavePlugin = {
  14      getInfo : function() {
  15          return {
  16              longname : 'Save',
  17              author : 'Moxiecode Systems',
  18              authorurl : 'http://tinymce.moxiecode.com',
  19              infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_save.html',
  20              version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  21          };
  22      },
  23  
  24      initInstance : function(inst) {
  25          inst.addShortcut('ctrl', 's', 'lang_save_desc', 'mceSave');
  26      },
  27  
  28      /**

  29       * Returns the HTML contents of the save control.

  30       */
  31      getControlHTML : function(cn) {
  32          switch (cn) {
  33              case "save":
  34                  return tinyMCE.getButtonHTML(cn, 'lang_save_desc', '{$pluginurl}/images/save.gif', 'mceSave');
  35          }
  36  
  37          return "";
  38      },
  39  
  40      /**

  41       * Executes the save command.

  42       */
  43      execCommand : function(editor_id, element, command, user_interface, value) {
  44          // Handle commands

  45          switch (command) {
  46              case "mceSave":
  47                  if (tinyMCE.getParam("fullscreen_is_enabled"))
  48                      return true;
  49  
  50                  var inst = tinyMCE.selectedInstance;
  51                  var formObj = inst.formElement.form;
  52  
  53                  if (tinyMCE.getParam("save_enablewhendirty") && !inst.isDirty())
  54                      return true;
  55  
  56                  if (formObj) {
  57                      tinyMCE.triggerSave();
  58  
  59                      // Use callback instead

  60                      var os;
  61                      if ((os = tinyMCE.getParam("save_onsavecallback"))) {
  62                          if (eval(os + '(inst);')) {
  63                              inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
  64                              /*inst.undoLevels = new Array();

  65                              inst.undoIndex = 0;

  66                              inst.typingUndoIndex = -1;

  67                              inst.undoRedo = true;

  68                              inst.undoLevels[inst.undoLevels.length] = inst.startContent;*/
  69                              tinyMCE.triggerNodeChange(false, true);
  70                          }
  71  
  72                          return true;
  73                      }
  74  
  75                      // Disable all UI form elements that TinyMCE created

  76                      for (var i=0; i<formObj.elements.length; i++) {
  77                          var elementId = formObj.elements[i].name ? formObj.elements[i].name : formObj.elements[i].id;
  78  
  79                          if (elementId.indexOf('mce_editor_') == 0)
  80                              formObj.elements[i].disabled = true;
  81                      }
  82  
  83                      tinyMCE.isNotDirty = true;
  84  
  85                      if (formObj.onsubmit == null || formObj.onsubmit() != false)
  86                          inst.formElement.form.submit();
  87                  } else
  88                      alert("Error: No form element found.");
  89  
  90                  return true;
  91          }
  92          // Pass to next handler in chain

  93          return false;
  94      },
  95  
  96      handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
  97          if (tinyMCE.getParam("fullscreen_is_enabled")) {
  98              tinyMCE.switchClass(editor_id + '_save', 'mceButtonDisabled');
  99              return true;
 100          }
 101  
 102          if (tinyMCE.getParam("save_enablewhendirty")) {
 103              var inst = tinyMCE.getInstanceById(editor_id);
 104  
 105              if (inst.isDirty()) {
 106                  tinyMCE.switchClass(editor_id + '_save', 'mceButtonNormal');
 107                  return true;
 108              }
 109  
 110              tinyMCE.switchClass(editor_id + '_save', 'mceButtonDisabled');
 111          }
 112  
 113          return true;
 114      }
 115  };
 116  
 117  tinyMCE.addPlugin("save", TinyMCE_SavePlugin);


Généré le : Fri Mar 30 01:27:52 2007 par Balluche grâce à PHPXref 0.7