Update of /cvsroot/phpslash/phpslash-dev/public_html/scripts/fckeditor/editor/_source/commandclasses
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12486/phpslash-dev/public_html/scripts/fckeditor/editor/_source/commandclasses
Added Files:
fck_othercommands.js fcknamedcommand.js
fckpasteplaintextcommand.js fckpastewordcommand.js
fcktablecommand.js fcktextcolorcommand.js
Log Message:
complete fckeditor addition
--- NEW FILE: fck_othercommands.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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/
*
* File Name: fck_othercommands.js
* Definition of other commands that are not available internaly in the
* browser (see FCKNamedCommand).
*
* Version: 2.0 Beta 2
* Modified: 2004-09-01 00:12:43
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// ### General Dialog Box Commands.
var FCKDialogCommand = function( name, title, url, width, height, getStateFunction, getStateParam )
{
this.Name = name ;
this.Title = title ;
this.Url = url ;
this.Width = width ;
this.Height = height ;
this.GetStateFunction = getStateFunction ;
this.GetStateParam = getStateParam ;
}
FCKDialogCommand.prototype.Execute = function()
{
FCKDialog.OpenDialog( 'FCKDialog_' + this.Name , this.Title, this.Url, this.Width, this.Height ) ;
}
FCKDialogCommand.prototype.GetState = function()
{
if ( this.GetStateFunction )
{
return this.GetStateFunction( this.GetStateParam ) ;
}
else
{
return FCK_TRISTATE_OFF ;
}
}
// Generic Undefined command (usually used when a command is under development).
var FCKUndefinedCommand = function()
{
this.Name = 'Undefined' ;
}
FCKUndefinedCommand.prototype.Execute = function()
{
alert( 'Command not implemented.' ) ;
}
FCKUndefinedCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### FontName
var FCKFontNameCommand = function()
{
this.Name = 'FontName' ;
}
FCKFontNameCommand.prototype.Execute = function( fontName )
{
if (fontName == null || fontName == "")
{
// TODO: Remove font name attribute.
}
else
{
FCK.ExecuteNamedCommand( 'FontName', fontName ) ;
}
}
FCKFontNameCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue( 'FontName' ) ;
}
// ### FontSize
var FCKFontSizeCommand = function()
{
this.Name = 'FontSize' ;
}
FCKFontSizeCommand.prototype.Execute = function( fontSize )
{
if ( typeof( fontSize ) == 'string' ) fontSize = parseInt(fontSize) ;
if ( fontSize == null || fontSize == '' )
{
// TODO: Remove font size attribute (Now it works with size 3. Will it work forever?)
FCK.ExecuteNamedCommand( 'FontSize', 3 ) ;
}
else
{
FCK.ExecuteNamedCommand( 'FontSize', fontSize ) ;
}
}
FCKFontSizeCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue( 'FontSize' ) ;
}
// ### FormatBlock
var FCKFormatBlockCommand = function()
{
this.Name = 'FormatBlock' ;
}
FCKFormatBlockCommand.prototype.Execute = function( formatName )
{
if ( formatName == null || formatName == '' )
{
FCK.ExecuteNamedCommand( 'FormatBlock', '<P>' ) ;
}
else
{
FCK.ExecuteNamedCommand( 'FormatBlock', formatName ) ;
}
}
FCKFormatBlockCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue( 'FormatBlock' ) ;
}
// ### Preview
var FCKPreviewCommand = function()
{
this.Name = 'Preview' ;
}
FCKPreviewCommand.prototype.Execute = function()
{
FCK.Preview() ;
}
FCKPreviewCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### Save
var FCKSaveCommand = function()
{
this.Name = 'Save' ;
}
FCKSaveCommand.prototype.Execute = function()
{
// Get the linked field form.
var oForm = FCK.LinkedField.form ;
// Submit the form.
oForm.submit() ;
}
FCKSaveCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### NewPage
var FCKNewPageCommand = function()
{
this.Name = 'NewPage' ;
}
FCKNewPageCommand.prototype.Execute = function()
{
FCK.SetHTML( '' ) ;
}
FCKNewPageCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### Source button
var FCKSourceCommand = function()
{
this.Name = "Source" ;
}
FCKSourceCommand.prototype.Execute = function()
{
FCK.SwitchEditMode() ;
}
FCKSourceCommand.prototype.GetState = function()
{
return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_ON ) ;
}
--- NEW FILE: fcknamedcommand.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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/
*
* File Name: fcknamedcommand.js
* FCKNamedCommand Class: represents an internal browser command.
*
* Version: 2.0 Beta 2
* Modified: 2004-08-17 15:05:35
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKNamedCommand = function( commandName )
{
this.Name = commandName ;
}
FCKNamedCommand.prototype.Execute = function()
{
FCK.ExecuteNamedCommand( this.Name ) ;
}
FCKNamedCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandState( this.Name ) ;
}
--- NEW FILE: fckpasteplaintextcommand.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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/
*
* File Name: fckpasteplaintextcommand.js
* FCKPastePlainTextCommand Class: represents the
* "Paste as Plain Text" command.
*
* Version: 2.0 Beta 2
* Modified: 2004-08-20 23:08:23
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKPastePlainTextCommand = function()
{
this.Name = 'PasteText' ;
}
FCKPastePlainTextCommand.prototype.Execute = function()
{
FCK.PasteAsPlainText() ;
}
FCKPastePlainTextCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandState( 'Paste' ) ;
}
--- NEW FILE: fckpastewordcommand.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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/
*
* File Name: fckpastewordcommand.js
* FCKPasteWordCommand Class: represents the "Paste from Word" command.
*
* Version: 2.0 Beta 2
* Modified: 2004-08-30 23:20:46
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKPasteWordCommand = function()
{
this.Name = 'PasteWord' ;
}
FCKPasteWordCommand.prototype.Execute = function()
{
FCK.PasteFromWord() ;
}
FCKPasteWordCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandState( 'Paste' ) ;
}
--- NEW FILE: fcktablecommand.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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/
*
* File Name: fcktablecommand.js
* FCKPastePlainTextCommand Class: represents the
* "Paste as Plain Text" command.
*
* Version: 2.0 Beta 2
* Modified: 2004-09-02 01:05:29
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKTableCommand = function( command )
{
this.Name = command ;
}
FCKTableCommand.prototype.Execute = function()
{
switch ( this.Name )
{
case 'TableInsertRow' :
FCKTableHandler.InsertRow() ;
break ;
case 'TableDeleteRows' :
FCKTableHandler.DeleteRows() ;
break ;
case 'TableInsertColumn' :
FCKTableHandler.InsertColumn() ;
break ;
case 'TableDeleteColumns' :
FCKTableHandler.DeleteColumns() ;
break ;
case 'TableInsertCell' :
FCKTableHandler.InsertCell() ;
break ;
case 'TableDeleteCells' :
FCKTableHandler.DeleteCells() ;
break ;
case 'TableMergeCells' :
FCKTableHandler.MergeCells() ;
break ;
case 'TableSplitCell' :
FCKTableHandler.SplitCell() ;
break ;
default :
alert( 'Unknown command "' + this.Name + '".' ) ;
}
}
FCKTableCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
--- NEW FILE: fcktextcolorcommand.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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/
*
* File Name: fcktextcolorcommand.js
* FCKTextColorCommand Class: represents the text color comand. It shows the
* color selection panel.
*
* Version: 2.0 Beta 2
* Modified: 2004-08-20 22:49:33
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// FCKTextColorCommand Contructor
// type: can be 'ForeColor' or 'BackColor'.
var FCKTextColorCommand = function( type )
{
this.Name = type == 'ForeColor' ? 'TextColor' : 'BGColor' ;
this.Type = type ;
// ### BEGIN: This code should be moved to the Execute method but it doesn't work
// well if placed there.
this._Panel = new FCKColorPanel( this.SetColor ) ;
this._Panel.Create() ;
// ### END
}
FCKTextColorCommand.prototype.Execute = function( panelX, panelY )
{
/* It was commented because it is not working well if placed here.
It has been moved to the constructor, but it is not the best solution
because the Panel should be created only when called.
// Create the Color Panel if needed.
if ( ! this._Panel )
{
this._Panel = new FCKColorPanel( this.SetColor ) ;
this._Panel.Create() ;
}
*/
// We must "cache" the actual panel type to be used in the SetColor method.
FCK._ActiveColorPanelType = this.Type ;
// Show the Color Panel at the desired position.
this._Panel.Show( panelX, panelY ) ;
}
FCKTextColorCommand.prototype.SetColor = function( color )
{
if ( FCK._ActiveColorPanelType == 'ForeColor' )
FCK.ExecuteNamedCommand( 'ForeColor', color ) ;
else if ( FCKBrowserInfo.IsGecko )
FCK.ExecuteNamedCommand( 'hilitecolor', color ) ;
else
FCK.ExecuteNamedCommand( 'BackColor', color ) ;
// Delete the "cached" active panel type.
delete FCK._ActiveColorPanelType ;
}
FCKTextColorCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
|