[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  /*
   2   * FCKeditor - The text editor for internet
   3   * Copyright (C) 2003-2006 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 ;
  52      }
  53  
  54      var sHTML = FCK.GetClipboardHTML() ;
  55  
  56      if ( FCKConfig.AutoDetectPasteFromWord )
  57      {
  58          var re = /<\w[^>]*(( class="?MsoNormal"?)|(="mso-))/gi ;
  59          if ( re.test( sHTML ) )
  60          {
  61              if ( confirm( FCKLang["PasteWordConfirm"] ) )
  62              {
  63                  FCK.PasteFromWord() ;
  64                  return ;
  65              }
  66          }
  67      }
  68  
  69      FCK.InsertHtml( sHTML ) ;    
  70  }
  71  
  72  FCK.PasteAsPlainText = function()
  73  {
  74      // Get the data available in the clipboard and encodes it in HTML.
  75      var sText = FCKTools.HTMLEncode( clipboardData.getData("Text") ) ;
  76  
  77      // Replace the carriage returns with <BR>
  78      sText = sText.replace( /\n/g, '<BR>' ) ;
  79      
  80      // Insert the resulting data in the editor.
  81      this.InsertHtml( sText ) ;    
  82  }
  83  /*
  84  FCK.PasteFromWord = function()
  85  {
  86      FCK.CleanAndPaste( FCK.GetClipboardHTML() ) ;
  87  }
  88  */
  89  FCK.InsertElement = function( element )
  90  {
  91      FCK.InsertHtml( element.outerHTML ) ;
  92  }
  93  
  94  FCK.GetClipboardHTML = function()
  95  {
  96      var oDiv = document.getElementById( '___FCKHiddenDiv' ) ;
  97      
  98      if ( !oDiv )
  99      {
 100          var oDiv = document.createElement( 'DIV' ) ;
 101          oDiv.id = '___FCKHiddenDiv' ;
 102          oDiv.style.visibility    = 'hidden' ;
 103          oDiv.style.overflow        = 'hidden' ;
 104          oDiv.style.position        = 'absolute' ;
 105          oDiv.style.width        = 1 ;
 106          oDiv.style.height        = 1 ;
 107      
 108          document.body.appendChild( oDiv ) ;
 109      }
 110      
 111      oDiv.innerHTML = '' ;
 112      
 113      var oTextRange = document.body.createTextRange() ;
 114      oTextRange.moveToElementText( oDiv ) ;
 115      oTextRange.execCommand( 'Paste' ) ;
 116      
 117      var sData = oDiv.innerHTML ;
 118      oDiv.innerHTML = '' ;
 119      
 120      return sData ;
 121  }
 122  
 123  FCK.AttachToOnSelectionChange = function( functionPointer )
 124  {
 125      this.Events.AttachEvent( 'OnSelectionChange', functionPointer ) ;
 126  }
 127  
 128  /*
 129  FCK.AttachToOnSelectionChange = function( functionPointer )
 130  {
 131      FCK.EditorDocument.attachEvent( 'onselectionchange', functionPointer ) ;
 132  }
 133  */
 134  
 135  FCK.CreateLink = function( url )
 136  {    
 137      FCK.ExecuteNamedCommand( 'Unlink' ) ;
 138  
 139      if ( url.length > 0 )
 140      {
 141          // Generate a temporary name for the link.
 142          var sTempUrl = 'javascript:void(0);/*' + ( new Date().getTime() ) + '*/' ;
 143          
 144          // Use the internal "CreateLink" command to create the link.
 145          FCK.ExecuteNamedCommand( 'CreateLink', sTempUrl ) ;
 146  
 147          // Loof for the just create link.
 148          var oLinks = this.EditorDocument.links ;
 149  
 150          for ( i = 0 ; i < oLinks.length ; i++ )
 151          {
 152              if ( oLinks[i].href == sTempUrl )
 153              {
 154                  oLinks[i].href = url ;
 155                  return oLinks[i] ;
 156              }
 157          }
 158      }
 159  }


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics