[ Index ]
 

Code source de Seagull 0.6.1

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

title

Body

[fermer]

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

   1  /**

   2   * $RCSfile: editor_plugin_src.js,v $

   3   * $Revision: 1.23 $

   4   * $Date: 2006/03/20 12:03:44 $

   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('preview', 'en,tr,cs,de,el,fr_ca,it,ko,pt,sv,zh_cn,fa,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,zh_tw,zh_tw_utf8,sk');
  12  
  13  var TinyMCE_PreviewPlugin = {
  14      getInfo : function() {
  15          return {
  16              longname : 'Preview',
  17              author : 'Moxiecode Systems',
  18              authorurl : 'http://tinymce.moxiecode.com',
  19              infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_preview.html',
  20              version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  21          };
  22      },
  23  
  24      /**

  25       * Returns the HTML contents of the preview control.

  26       */
  27      getControlHTML : function(cn) {
  28          switch (cn) {
  29              case "preview":
  30                  return tinyMCE.getButtonHTML(cn, 'lang_preview_desc', '{$pluginurl}/images/preview.gif', 'mcePreview');
  31          }
  32  
  33          return "";
  34      },
  35  
  36      /**

  37       * Executes the mcePreview command.

  38       */
  39      execCommand : function(editor_id, element, command, user_interface, value) {
  40          // Handle commands

  41          switch (command) {
  42              case "mcePreview":
  43                  var previewPage = tinyMCE.getParam("plugin_preview_pageurl", null);
  44                  var previewWidth = tinyMCE.getParam("plugin_preview_width", "550");
  45                  var previewHeight = tinyMCE.getParam("plugin_preview_height", "600");
  46  
  47                  // Use a custom preview page

  48                  if (previewPage) {
  49                      var template = new Array();
  50  
  51                      template['file'] = previewPage;
  52                      template['width'] = previewWidth;
  53                      template['height'] = previewHeight;
  54  
  55                      tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "yes", inline : "yes", content : tinyMCE.getContent(), content_css : tinyMCE.getParam("content_css")});
  56                  } else {
  57                      var win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + previewWidth + ",height="  + previewHeight);
  58                      var html = "";
  59                      var c = tinyMCE.getContent();
  60                      var pos = c.indexOf('<body'), pos2;
  61  
  62                      if (pos != -1) {
  63                          pos = c.indexOf('>', pos);
  64                          pos2 = c.lastIndexOf('</body>');
  65                          c = c.substring(pos + 1, pos2);
  66                      }
  67  
  68                      html += tinyMCE.getParam('doctype');
  69                      html += '<html xmlns="http://www.w3.org/1999/xhtml">';
  70                      html += '<head>';
  71                      html += '<title>' + tinyMCE.getLang('lang_preview_desc') + '</title>';
  72                      html += '<base href="' + tinyMCE.settings['base_href'] + '" />';
  73                      html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
  74                      html += '<link href="' + tinyMCE.getParam("content_css") + '" rel="stylesheet" type="text/css" />';
  75                      html += '</head>';
  76                      html += '<body dir="' + tinyMCE.getParam("directionality") + '">';
  77                      html += c;
  78                      html += '</body>';
  79                      html += '</html>';
  80  
  81                      win.document.write(html);
  82                      win.document.close();
  83                  }
  84  
  85                  return true;
  86          }
  87  
  88          return false;
  89      }
  90  };
  91  
  92  tinyMCE.addPlugin("preview", TinyMCE_PreviewPlugin);


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