[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/include/fckeditor/editor/_source/internals/ -> fck_2_ie.js (source)

   1  /*
   2   * FCKeditor - The text editor for internet
   3   * Copyright (C) 2003-2005 Frederico Caldeira Knabben
   4   * 
   5   * Licensed under the terms of the GNU Lesser General Public License:
   6   *         http://www.opensource.org/licenses/lgpl-license.php
   7   * 
   8   * For further information visit:
   9   *         http://www.fckeditor.net/
  10   * 
  11   * "Support Open Source software. What about a donation today?"
  12   * 
  13   * File Name: fck_2_ie.js
  14   *     This is the second part of the "FCK" object creation. This is the main
  15   *     object that represents an editor instance.
  16   *     (IE specific implementations)
  17   * 
  18   * File Authors:
  19   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  20   */
  21  
  22  /*
  23  if ( FCKConfig.UseBROnCarriageReturn ) 
  24  {
  25      // Named commands to be handled by this browsers specific implementation.
  26      FCK.RedirectNamedCommands = 
  27      {
  28          InsertOrderedList    : true,
  29          InsertUnorderedList    : true
  30      }
  31  
  32      FCK.ExecuteRedirectedNamedCommand = function( commandName, commandParameter )
  33      {
  34          if ( commandName == 'InsertOrderedList' || commandName == 'InsertUnorderedList' )
  35          {
  36              if ( !(FCK.EditorDocument.queryCommandState( 'InsertOrderedList' ) || FCK.EditorDocument.queryCommandState( 'InsertUnorderedList' )) )
  37              {
  38              }                
  39          }
  40  
  41          FCK.ExecuteNamedCommand( commandName, commandParameter ) ;
  42      }
  43  }
  44  */
  45  
  46  FCK.Paste = function()
  47  {
  48      if ( FCKConfig.ForcePasteAsPlainText )
  49      {
  50          FCK.PasteAsPlainText() ;    
  51          return false ;
  52      }
  53      else if ( FCKConfig.AutoDetectPasteFromWord )
  54      {
  55          var sHTML = FCK.GetClipboardHTML() ;
  56          var re = /<\w[^>]*(( class="?MsoNormal"?)|(="mso-))/gi ;
  57          if ( re.test( sHTML ) )
  58          {
  59              if ( confirm( FCKLang["PasteWordConfirm"] ) )
  60              {
  61                  FCK.PasteFromWord() ;
  62                  return false ;
  63              }
  64          }
  65      }
  66      else
  67          return true ;
  68  }
  69  
  70  FCK.PasteAsPlainText = function()
  71  {
  72      // Get the data available in the clipboard and encodes it in HTML.
  73      var sText = FCKTools.HTMLEncode( clipboardData.getData("Text") ) ;
  74  
  75      // Replace the carriage returns with <BR>
  76      sText = sText.replace( /\n/g, '<BR>' ) ;
  77      
  78      // Insert the resulting data in the editor.
  79      this.InsertHtml( sText ) ;    
  80  }
  81  /*
  82  FCK.PasteFromWord = function()
  83  {
  84      FCK.CleanAndPaste( FCK.GetClipboardHTML() ) ;
  85  }
  86  */
  87  FCK.InsertElement = function( element )
  88  {
  89      FCK.InsertHtml( element.outerHTML ) ;
  90  }
  91  
  92  FCK.GetClipboardHTML = function()
  93  {
  94      var oDiv = document.getElementById( '___FCKHiddenDiv' ) ;
  95      
  96      if ( !oDiv )
  97      {
  98          var oDiv = document.createElement( 'DIV' ) ;
  99          oDiv.id = '___FCKHiddenDiv' ;
 100          oDiv.style.visibility    = 'hidden' ;
 101          oDiv.style.overflow        = 'hidden' ;
 102          oDiv.style.position        = 'absolute' ;
 103          oDiv.style.width        = 1 ;
 104          oDiv.style.height        = 1 ;
 105      
 106          document.body.appendChild( oDiv ) ;
 107      }
 108      
 109      oDiv.innerHTML = '' ;
 110      
 111      var oTextRange = document.body.createTextRange() ;
 112      oTextRange.moveToElementText( oDiv ) ;
 113      oTextRange.execCommand( 'Paste' ) ;
 114      
 115      var sData = oDiv.innerHTML ;
 116      oDiv.innerHTML = '' ;
 117      
 118      return sData ;
 119  }
 120  
 121  FCK.AttachToOnSelectionChange = function( functionPointer )
 122  {
 123      this.Events.AttachEvent( 'OnSelectionChange', functionPointer ) ;
 124  }
 125  
 126  /*
 127  FCK.AttachToOnSelectionChange = function( functionPointer )
 128  {
 129      FCK.EditorDocument.attachEvent( 'onselectionchange', functionPointer ) ;
 130  }
 131  */
 132  
 133  FCK.CreateLink = function( url )
 134  {    
 135      FCK.ExecuteNamedCommand( 'Unlink' ) ;
 136  
 137      if ( url.length > 0 )
 138      {
 139          // Generate a temporary name for the link.
 140          var sTempUrl = 'javascript:void(0);/*' + ( new Date().getTime() ) + '*/' ;
 141          
 142          // Use the internal "CreateLink" command to create the link.
 143          FCK.ExecuteNamedCommand( 'CreateLink', sTempUrl ) ;
 144  
 145          // Loof for the just create link.
 146          var oLinks = this.EditorDocument.links ;
 147  
 148          for ( i = 0 ; i < oLinks.length ; i++ )
 149          {
 150              if ( oLinks[i].href == sTempUrl )
 151              {
 152                  oLinks[i].href = url ;
 153                  return oLinks[i] ;
 154              }
 155          }
 156      }
 157  }


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7