Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1688 → Rev 1921

/branches/livraison_aha/api/fckeditor/editor/plugins/placeholder/fckplugin.js
1,24 → 1,28
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckplugin.js
* Plugin to insert "Placeholders" in the editor.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Plugin to insert "Placeholders" in the editor.
*/
 
// Register the related command.
FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 170 ) ) ;
FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 160 ) ) ;
 
// Create the "Plaholder" toolbar button.
var oPlaceholderItem = new FCKToolbarButton( 'Placeholder', FCKLang.PlaceholderBtn ) ;
33,7 → 37,7
// Add a new placeholder at the actual selection.
FCKPlaceholders.Add = function( name )
{
var oSpan = FCK.CreateElement( 'SPAN' ) ;
var oSpan = FCK.InsertElement( 'span' ) ;
this.SetupSpan( oSpan, name ) ;
}
 
82,7 → 86,7
// Check if a Placholder name is already in use.
FCKPlaceholders.Exist = function( name )
{
var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' )
var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' ) ;
 
for ( var i = 0 ; i < aSpans.length ; i++ )
{
89,6 → 93,8
if ( aSpans[i]._fckplaceholder == name )
return true ;
}
 
return false ;
}
 
if ( FCKBrowserInfo.IsIE )
95,6 → 101,9
{
FCKPlaceholders.Redraw = function()
{
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
return ;
 
var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ;
if ( !aPlaholders )
return ;
115,11 → 124,14
{
FCKPlaceholders.Redraw = function()
{
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
return ;
 
var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKPlaceholders._AcceptNode, true ) ;
 
var aNodes = new Array() ;
 
while ( oNode = oInteractor.nextNode() )
while ( ( oNode = oInteractor.nextNode() ) )
{
aNodes[ aNodes.length ] = oNode ;
}
148,7 → 160,7
 
aNodes[n].parentNode.removeChild( aNodes[n] ) ;
}
 
FCKPlaceholders._SetupClickListener() ;
}
 
172,4 → 184,4
FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
 
return node ;
}
}