first commit
This commit is contained in:
@ -0,0 +1,309 @@
|
||||
/*
|
||||
* 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: fck_othercommands.js
|
||||
* Definition of other commands that are not available internaly in the
|
||||
* browser (see FCKNamedCommand).
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
// ### 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( FCKLang.NotImplemented ) ;
|
||||
}
|
||||
|
||||
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 if ( formatName == 'div' && FCKBrowserInfo.IsGecko )
|
||||
FCK.ExecuteNamedCommand( 'FormatBlock', 'div' ) ;
|
||||
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 ;
|
||||
|
||||
if ( typeof( oForm.onsubmit ) == 'function' )
|
||||
{
|
||||
var bRet = oForm.onsubmit() ;
|
||||
if ( bRet != null && bRet === false )
|
||||
return ;
|
||||
}
|
||||
|
||||
// Submit the form.
|
||||
oForm.submit() ;
|
||||
}
|
||||
|
||||
FCKSaveCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK_TRISTATE_OFF ;
|
||||
}
|
||||
|
||||
// ### NewPage
|
||||
var FCKNewPageCommand = function()
|
||||
{
|
||||
this.Name = 'NewPage' ;
|
||||
}
|
||||
|
||||
FCKNewPageCommand.prototype.Execute = function()
|
||||
{
|
||||
FCKUndo.SaveUndoStep() ;
|
||||
FCK.SetHTML( '' ) ;
|
||||
FCKUndo.Typing = true ;
|
||||
// FCK.SetHTML( FCKBrowserInfo.IsGecko ? ' ' : '' ) ;
|
||||
// FCK.SetHTML( FCKBrowserInfo.IsGecko ? GECKO_BOGUS : '' ) ;
|
||||
}
|
||||
|
||||
FCKNewPageCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK_TRISTATE_OFF ;
|
||||
}
|
||||
|
||||
// ### Source button
|
||||
var FCKSourceCommand = function()
|
||||
{
|
||||
this.Name = 'Source' ;
|
||||
}
|
||||
|
||||
FCKSourceCommand.prototype.Execute = function()
|
||||
{
|
||||
if ( FCKConfig.SourcePopup ) // Until v2.2, it was mandatory for FCKBrowserInfo.IsGecko.
|
||||
{
|
||||
var iWidth = FCKConfig.ScreenWidth * 0.65 ;
|
||||
var iHeight = FCKConfig.ScreenHeight * 0.65 ;
|
||||
FCKDialog.OpenDialog( 'FCKDialog_Source', FCKLang.Source, 'dialog/fck_source.html', iWidth, iHeight, null, null, true ) ;
|
||||
}
|
||||
else
|
||||
FCK.SwitchEditMode() ;
|
||||
}
|
||||
|
||||
FCKSourceCommand.prototype.GetState = function()
|
||||
{
|
||||
return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_ON ) ;
|
||||
}
|
||||
|
||||
// ### Undo
|
||||
var FCKUndoCommand = function()
|
||||
{
|
||||
this.Name = 'Undo' ;
|
||||
}
|
||||
|
||||
FCKUndoCommand.prototype.Execute = function()
|
||||
{
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
FCKUndo.Undo() ;
|
||||
else
|
||||
FCK.ExecuteNamedCommand( 'Undo' ) ;
|
||||
}
|
||||
|
||||
FCKUndoCommand.prototype.GetState = function()
|
||||
{
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
return ( FCKUndo.CheckUndoState() ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
|
||||
else
|
||||
return FCK.GetNamedCommandState( 'Undo' ) ;
|
||||
}
|
||||
|
||||
// ### Redo
|
||||
var FCKRedoCommand = function()
|
||||
{
|
||||
this.Name = 'Redo' ;
|
||||
}
|
||||
|
||||
FCKRedoCommand.prototype.Execute = function()
|
||||
{
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
FCKUndo.Redo() ;
|
||||
else
|
||||
FCK.ExecuteNamedCommand( 'Redo' ) ;
|
||||
}
|
||||
|
||||
FCKRedoCommand.prototype.GetState = function()
|
||||
{
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
return ( FCKUndo.CheckRedoState() ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
|
||||
else
|
||||
return FCK.GetNamedCommandState( 'Redo' ) ;
|
||||
}
|
||||
|
||||
// ### Page Break
|
||||
var FCKPageBreakCommand = function()
|
||||
{
|
||||
this.Name = 'PageBreak' ;
|
||||
}
|
||||
|
||||
FCKPageBreakCommand.prototype.Execute = function()
|
||||
{
|
||||
// var e = FCK.EditorDocument.createElement( 'CENTER' ) ;
|
||||
// e.style.pageBreakAfter = 'always' ;
|
||||
|
||||
// Tidy was removing the empty CENTER tags, so the following solution has
|
||||
// been found. It also validates correctly as XHTML 1.0 Strict.
|
||||
var e = FCK.EditorDocument.createElement( 'DIV' ) ;
|
||||
e.style.pageBreakAfter = 'always' ;
|
||||
e.innerHTML = '<span style="DISPLAY:none"> </span>' ;
|
||||
|
||||
var oFakeImage = FCKDocumentProcessor_CreateFakeImage( 'FCK__PageBreak', e ) ;
|
||||
oFakeImage = FCK.InsertElement( oFakeImage ) ;
|
||||
}
|
||||
|
||||
FCKPageBreakCommand.prototype.GetState = function()
|
||||
{
|
||||
return 0 ; // FCK_TRISTATE_OFF
|
||||
}
|
||||
|
||||
// FCKUnlinkCommand - by Johnny Egeland (johnny@coretrek.com)
|
||||
var FCKUnlinkCommand = function()
|
||||
{
|
||||
this.Name = 'Unlink' ;
|
||||
}
|
||||
|
||||
FCKUnlinkCommand.prototype.Execute = function()
|
||||
{
|
||||
if ( FCKBrowserInfo.IsGecko )
|
||||
{
|
||||
var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;
|
||||
if ( oLink )
|
||||
FCK.Selection.SelectNode( oLink ) ;
|
||||
}
|
||||
|
||||
FCK.ExecuteNamedCommand( this.Name ) ;
|
||||
|
||||
if ( FCKBrowserInfo.IsGecko )
|
||||
FCK.Selection.Collapse( true ) ;
|
||||
}
|
||||
|
||||
FCKUnlinkCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK.GetNamedCommandState( this.Name ) ;
|
||||
}
|
164
stud/FCKeditor/editor/_source/commandclasses/fckfitwindow.js
Normal file
164
stud/FCKeditor/editor/_source/commandclasses/fckfitwindow.js
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* 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: fckfitwindow.js
|
||||
* Stretch the editor to full window size and back.
|
||||
*
|
||||
* File Authors:
|
||||
* Paul Moers (mail@saulmade.nl)
|
||||
* Thanks to Christian Fecteau (webmaster@christianfecteau.com)
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKFitWindow = function()
|
||||
{
|
||||
this.Name = 'FitWindow' ;
|
||||
}
|
||||
|
||||
FCKFitWindow.prototype.Execute = function()
|
||||
{
|
||||
var eEditorFrame = window.frameElement ;
|
||||
var eEditorFrameStyle = eEditorFrame.style ;
|
||||
|
||||
var eMainWindow = parent ;
|
||||
var eDocEl = eMainWindow.document.documentElement ;
|
||||
var eBody = eMainWindow.document.body ;
|
||||
var eBodyStyle = eBody.style ;
|
||||
|
||||
// No original style properties known? Go fullscreen.
|
||||
if ( !this.IsMaximized )
|
||||
{
|
||||
// Registering an event handler when the window gets resized.
|
||||
if( FCKBrowserInfo.IsIE )
|
||||
eMainWindow.attachEvent( 'onresize', FCKFitWindow_Resize ) ;
|
||||
else
|
||||
eMainWindow.addEventListener( 'resize', FCKFitWindow_Resize, true ) ;
|
||||
|
||||
// Save the scrollbars position.
|
||||
this._ScrollPos = FCKTools.GetScrollPosition( eMainWindow ) ;
|
||||
|
||||
// Save and reset the styles for the entire node tree. They could interfere in the result.
|
||||
var eParent = eEditorFrame ;
|
||||
while( eParent = eParent.parentNode )
|
||||
{
|
||||
if ( eParent.nodeType == 1 )
|
||||
eParent._fckSavedStyles = FCKTools.SaveStyles( eParent ) ;
|
||||
}
|
||||
|
||||
// Hide IE scrollbars (in strict mode).
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
{
|
||||
this.documentElementOverflow = eDocEl.style.overflow ;
|
||||
eDocEl.style.overflow = 'hidden' ;
|
||||
eBodyStyle.overflow = 'hidden' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hide the scroolbars in Firefox.
|
||||
eBodyStyle.overflow = 'hidden' ;
|
||||
eBodyStyle.width = '0px' ;
|
||||
eBodyStyle.height = '0px' ;
|
||||
}
|
||||
|
||||
// Save the IFRAME styles.
|
||||
this._EditorFrameStyles = FCKTools.SaveStyles( eEditorFrame ) ;
|
||||
|
||||
// Resize.
|
||||
var oViewPaneSize = FCKTools.GetViewPaneSize( eMainWindow ) ;
|
||||
|
||||
eEditorFrameStyle.position = "absolute";
|
||||
eEditorFrameStyle.zIndex = FCKConfig.FloatingPanelsZIndex - 1;
|
||||
eEditorFrameStyle.left = "0px";
|
||||
eEditorFrameStyle.top = "0px";
|
||||
eEditorFrameStyle.width = oViewPaneSize.Width + "px";
|
||||
eEditorFrameStyle.height = oViewPaneSize.Height + "px";
|
||||
|
||||
// Giving the frame some (huge) borders on his right and bottom
|
||||
// side to hide the background that would otherwise show when the
|
||||
// editor is in fullsize mode and the window is increased in size
|
||||
// not for IE, because IE immediately adapts the editor on resize,
|
||||
// without showing any of the background oddly in firefox, the
|
||||
// editor seems not to fill the whole frame, so just setting the
|
||||
// background of it to white to cover the page laying behind it anyway.
|
||||
if ( !FCKBrowserInfo.IsIE )
|
||||
{
|
||||
eEditorFrameStyle.borderRight = eEditorFrameStyle.borderBottom = "9999px solid white" ;
|
||||
eEditorFrameStyle.backgroundColor = "white";
|
||||
}
|
||||
|
||||
// Scroll to top left.
|
||||
eMainWindow.scrollTo(0, 0);
|
||||
|
||||
this.IsMaximized = true ;
|
||||
}
|
||||
else // Resize to original size.
|
||||
{
|
||||
// Remove the event handler of window resizing.
|
||||
if( FCKBrowserInfo.IsIE )
|
||||
eMainWindow.detachEvent( "onresize", FCKFitWindow_Resize ) ;
|
||||
else
|
||||
eMainWindow.removeEventListener( "resize", FCKFitWindow_Resize, true ) ;
|
||||
|
||||
// Restore the CSS position for the entire node tree.
|
||||
var eParent = eEditorFrame ;
|
||||
while( eParent = eParent.parentNode )
|
||||
{
|
||||
if ( eParent._fckSavedStyles )
|
||||
{
|
||||
FCKTools.RestoreStyles( eParent, eParent._fckSavedStyles ) ;
|
||||
eParent._fckSavedStyles = null ;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore IE scrollbars
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
eDocEl.style.overflow = this.documentElementOverflow ;
|
||||
|
||||
// Restore original size
|
||||
FCKTools.RestoreStyles( eEditorFrame, this._EditorFrameStyles ) ;
|
||||
|
||||
// Restore the window scroll position.
|
||||
eMainWindow.scrollTo( this._ScrollPos.X, this._ScrollPos.Y ) ;
|
||||
|
||||
this.IsMaximized = false ;
|
||||
}
|
||||
|
||||
FCKToolbarItems.GetItem('FitWindow').RefreshState() ;
|
||||
|
||||
// It seams that Firefox restarts the editing area when making this changes.
|
||||
// On FF 1.0.x, the area is not anymore editable. On FF 1.5+, the special
|
||||
//configuration, like DisableFFTableHandles and DisableObjectResizing get
|
||||
//lost, so we must reset it. Also, the cursor position and selection are
|
||||
//also lost, even if you comment the following line (MakeEditable).
|
||||
// if ( FCKBrowserInfo.IsGecko10 ) // Initially I thought it was a FF 1.0 only problem.
|
||||
FCK.EditingArea.MakeEditable() ;
|
||||
|
||||
FCK.Focus() ;
|
||||
}
|
||||
|
||||
FCKFitWindow.prototype.GetState = function()
|
||||
{
|
||||
if ( FCKConfig.ToolbarLocation != 'In' )
|
||||
return FCK_TRISTATE_DISABLED ;
|
||||
else
|
||||
return ( this.IsMaximized ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF );
|
||||
}
|
||||
|
||||
function FCKFitWindow_Resize()
|
||||
{
|
||||
var oViewPaneSize = FCKTools.GetViewPaneSize( parent ) ;
|
||||
|
||||
var eEditorFrameStyle = window.frameElement.style ;
|
||||
|
||||
eEditorFrameStyle.width = oViewPaneSize.Width + 'px' ;
|
||||
eEditorFrameStyle.height = oViewPaneSize.Height + 'px' ;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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: fcknamedcommand.js
|
||||
* FCKNamedCommand Class: represents an internal browser command.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKNamedCommand = function( commandName )
|
||||
{
|
||||
this.Name = commandName ;
|
||||
}
|
||||
|
||||
FCKNamedCommand.prototype.Execute = function()
|
||||
{
|
||||
FCK.ExecuteNamedCommand( this.Name ) ;
|
||||
}
|
||||
|
||||
FCKNamedCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK.GetNamedCommandState( this.Name ) ;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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: fckpasteplaintextcommand.js
|
||||
* FCKPastePlainTextCommand Class: represents the
|
||||
* "Paste as Plain Text" command.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKPastePlainTextCommand = function()
|
||||
{
|
||||
this.Name = 'PasteText' ;
|
||||
}
|
||||
|
||||
FCKPastePlainTextCommand.prototype.Execute = function()
|
||||
{
|
||||
FCK.PasteAsPlainText() ;
|
||||
}
|
||||
|
||||
FCKPastePlainTextCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK.GetNamedCommandState( 'Paste' ) ;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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: fckpastewordcommand.js
|
||||
* FCKPasteWordCommand Class: represents the "Paste from Word" command.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKPasteWordCommand = function()
|
||||
{
|
||||
this.Name = 'PasteWord' ;
|
||||
}
|
||||
|
||||
FCKPasteWordCommand.prototype.Execute = function()
|
||||
{
|
||||
FCK.PasteFromWord() ;
|
||||
}
|
||||
|
||||
FCKPasteWordCommand.prototype.GetState = function()
|
||||
{
|
||||
if ( FCKConfig.ForcePasteAsPlainText )
|
||||
return FCK_TRISTATE_DISABLED ;
|
||||
else
|
||||
return FCK.GetNamedCommandState( 'Paste' ) ;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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: fckspellcheckcommand_gecko.js
|
||||
* FCKStyleCommand Class: represents the "Spell Check" command.
|
||||
* (Gecko specific implementation)
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKSpellCheckCommand = function()
|
||||
{
|
||||
this.Name = 'SpellCheck' ;
|
||||
this.IsEnabled = ( FCKConfig.SpellChecker == 'SpellerPages' ) ;
|
||||
}
|
||||
|
||||
FCKSpellCheckCommand.prototype.Execute = function()
|
||||
{
|
||||
FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ;
|
||||
}
|
||||
|
||||
FCKSpellCheckCommand.prototype.GetState = function()
|
||||
{
|
||||
return this.IsEnabled ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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: fckspellcheckcommand_ie.js
|
||||
* FCKStyleCommand Class: represents the "Spell Check" command.
|
||||
* (IE specific implementation)
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKSpellCheckCommand = function()
|
||||
{
|
||||
this.Name = 'SpellCheck' ;
|
||||
this.IsEnabled = ( FCKConfig.SpellChecker == 'ieSpell' || FCKConfig.SpellChecker == 'SpellerPages' ) ;
|
||||
}
|
||||
|
||||
FCKSpellCheckCommand.prototype.Execute = function()
|
||||
{
|
||||
switch ( FCKConfig.SpellChecker )
|
||||
{
|
||||
case 'ieSpell' :
|
||||
this._RunIeSpell() ;
|
||||
break ;
|
||||
|
||||
case 'SpellerPages' :
|
||||
FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKSpellCheckCommand.prototype._RunIeSpell = function()
|
||||
{
|
||||
try
|
||||
{
|
||||
var oIeSpell = new ActiveXObject( "ieSpell.ieSpellExtension" ) ;
|
||||
oIeSpell.CheckAllLinkedDocuments( FCK.EditorDocument ) ;
|
||||
}
|
||||
catch( e )
|
||||
{
|
||||
if( e.number == -2146827859 )
|
||||
{
|
||||
if ( confirm( FCKLang.IeSpellDownload ) )
|
||||
window.open( FCKConfig.IeSpellDownloadUrl , 'IeSpellDownload' ) ;
|
||||
}
|
||||
else
|
||||
alert( 'Error Loading ieSpell: ' + e.message + ' (' + e.number + ')' ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKSpellCheckCommand.prototype.GetState = function()
|
||||
{
|
||||
return this.IsEnabled ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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: fckstylecommand.js
|
||||
* FCKStyleCommand Class: represents the "Style" command.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKStyleCommand = function()
|
||||
{
|
||||
this.Name = 'Style' ;
|
||||
|
||||
// Load the Styles defined in the XML file.
|
||||
this.StylesLoader = new FCKStylesLoader() ;
|
||||
this.StylesLoader.Load( FCKConfig.StylesXmlPath ) ;
|
||||
this.Styles = this.StylesLoader.Styles ;
|
||||
}
|
||||
|
||||
FCKStyleCommand.prototype.Execute = function( styleName, styleComboItem )
|
||||
{
|
||||
FCKUndo.SaveUndoStep() ;
|
||||
|
||||
if ( styleComboItem.Selected )
|
||||
styleComboItem.Style.RemoveFromSelection() ;
|
||||
else
|
||||
styleComboItem.Style.ApplyToSelection() ;
|
||||
|
||||
FCKUndo.SaveUndoStep() ;
|
||||
|
||||
FCK.Focus() ;
|
||||
|
||||
FCK.Events.FireEvent( "OnSelectionChange" ) ;
|
||||
}
|
||||
|
||||
FCKStyleCommand.prototype.GetState = function()
|
||||
{
|
||||
if ( !FCK.EditorDocument )
|
||||
return FCK_TRISTATE_DISABLED ;
|
||||
|
||||
var oSelection = FCK.EditorDocument.selection ;
|
||||
|
||||
if ( FCKSelection.GetType() == 'Control' )
|
||||
{
|
||||
var e = FCKSelection.GetSelectedElement() ;
|
||||
if ( e )
|
||||
return this.StylesLoader.StyleGroups[ e.tagName ] ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
|
||||
}
|
||||
|
||||
return FCK_TRISTATE_OFF ;
|
||||
}
|
||||
|
||||
FCKStyleCommand.prototype.GetActiveStyles = function()
|
||||
{
|
||||
var aActiveStyles = new Array() ;
|
||||
|
||||
if ( FCKSelection.GetType() == 'Control' )
|
||||
this._CheckStyle( FCKSelection.GetSelectedElement(), aActiveStyles, false ) ;
|
||||
else
|
||||
this._CheckStyle( FCKSelection.GetParentElement(), aActiveStyles, true ) ;
|
||||
|
||||
return aActiveStyles ;
|
||||
}
|
||||
|
||||
FCKStyleCommand.prototype._CheckStyle = function( element, targetArray, checkParent )
|
||||
{
|
||||
if ( ! element )
|
||||
return ;
|
||||
|
||||
if ( element.nodeType == 1 )
|
||||
{
|
||||
var aStyleGroup = this.StylesLoader.StyleGroups[ element.tagName ] ;
|
||||
if ( aStyleGroup )
|
||||
{
|
||||
for ( var i = 0 ; i < aStyleGroup.length ; i++ )
|
||||
{
|
||||
if ( aStyleGroup[i].IsEqual( element ) )
|
||||
targetArray[ targetArray.length ] = aStyleGroup[i] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( checkParent )
|
||||
this._CheckStyle( element.parentNode, targetArray, checkParent ) ;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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: fcktablecommand.js
|
||||
* FCKPastePlainTextCommand Class: represents the
|
||||
* "Paste as Plain Text" command.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
var FCKTableCommand = function( command )
|
||||
{
|
||||
this.Name = command ;
|
||||
}
|
||||
|
||||
FCKTableCommand.prototype.Execute = function()
|
||||
{
|
||||
FCKUndo.SaveUndoStep() ;
|
||||
|
||||
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 ;
|
||||
case 'TableDelete' :
|
||||
FCKTableHandler.DeleteTable() ;
|
||||
break ;
|
||||
default :
|
||||
alert( FCKLang.UnknownCommand.replace( /%1/g, this.Name ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKTableCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK_TRISTATE_OFF ;
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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: fcktextcolorcommand.js
|
||||
* FCKTextColorCommand Class: represents the text color comand. It shows the
|
||||
* color selection panel.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
// FCKTextColorCommand Contructor
|
||||
// type: can be 'ForeColor' or 'BackColor'.
|
||||
var FCKTextColorCommand = function( type )
|
||||
{
|
||||
this.Name = type == 'ForeColor' ? 'TextColor' : 'BGColor' ;
|
||||
this.Type = type ;
|
||||
|
||||
var oWindow ;
|
||||
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
oWindow = window ;
|
||||
else if ( FCK.ToolbarSet._IFrame )
|
||||
oWindow = FCKTools.GetElementWindow( FCK.ToolbarSet._IFrame ) ;
|
||||
else
|
||||
oWindow = window.parent ;
|
||||
|
||||
this._Panel = new FCKPanel( oWindow, true ) ;
|
||||
this._Panel.AppendStyleSheet( FCKConfig.SkinPath + 'fck_editor.css' ) ;
|
||||
this._Panel.MainNode.className = 'FCK_Panel' ;
|
||||
this._CreatePanelBody( this._Panel.Document, this._Panel.MainNode ) ;
|
||||
|
||||
FCKTools.DisableSelection( this._Panel.Document.body ) ;
|
||||
}
|
||||
|
||||
FCKTextColorCommand.prototype.Execute = function( panelX, panelY, relElement )
|
||||
{
|
||||
// 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, relElement ) ;
|
||||
}
|
||||
|
||||
FCKTextColorCommand.prototype.SetColor = function( color )
|
||||
{
|
||||
if ( FCK._ActiveColorPanelType == 'ForeColor' )
|
||||
FCK.ExecuteNamedCommand( 'ForeColor', color ) ;
|
||||
else if ( FCKBrowserInfo.IsGeckoLike )
|
||||
{
|
||||
if ( FCKBrowserInfo.IsGecko && !FCKConfig.GeckoUseSPAN )
|
||||
FCK.EditorDocument.execCommand( 'useCSS', false, false ) ;
|
||||
|
||||
FCK.ExecuteNamedCommand( 'hilitecolor', color ) ;
|
||||
|
||||
if ( FCKBrowserInfo.IsGecko && !FCKConfig.GeckoUseSPAN )
|
||||
FCK.EditorDocument.execCommand( 'useCSS', false, true ) ;
|
||||
}
|
||||
else
|
||||
FCK.ExecuteNamedCommand( 'BackColor', color ) ;
|
||||
|
||||
// Delete the "cached" active panel type.
|
||||
delete FCK._ActiveColorPanelType ;
|
||||
}
|
||||
|
||||
FCKTextColorCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK_TRISTATE_OFF ;
|
||||
}
|
||||
|
||||
function FCKTextColorCommand_OnMouseOver() { this.className='ColorSelected' ; }
|
||||
|
||||
function FCKTextColorCommand_OnMouseOut() { this.className='ColorDeselected' ; }
|
||||
|
||||
function FCKTextColorCommand_OnClick()
|
||||
{
|
||||
this.className = 'ColorDeselected' ;
|
||||
this.Command.SetColor( '#' + this.Color ) ;
|
||||
this.Command._Panel.Hide() ;
|
||||
}
|
||||
|
||||
function FCKTextColorCommand_AutoOnClick()
|
||||
{
|
||||
this.className = 'ColorDeselected' ;
|
||||
this.Command.SetColor( '' ) ;
|
||||
this.Command._Panel.Hide() ;
|
||||
}
|
||||
|
||||
function FCKTextColorCommand_MoreOnClick()
|
||||
{
|
||||
this.className = 'ColorDeselected' ;
|
||||
this.Command._Panel.Hide() ;
|
||||
FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, this.Command.SetColor ) ;
|
||||
}
|
||||
|
||||
FCKTextColorCommand.prototype._CreatePanelBody = function( targetDocument, targetDiv )
|
||||
{
|
||||
function CreateSelectionDiv()
|
||||
{
|
||||
var oDiv = targetDocument.createElement( "DIV" ) ;
|
||||
oDiv.className = 'ColorDeselected' ;
|
||||
oDiv.onmouseover = FCKTextColorCommand_OnMouseOver ;
|
||||
oDiv.onmouseout = FCKTextColorCommand_OnMouseOut ;
|
||||
|
||||
return oDiv ;
|
||||
}
|
||||
|
||||
// Create the Table that will hold all colors.
|
||||
var oTable = targetDiv.appendChild( targetDocument.createElement( "TABLE" ) ) ;
|
||||
oTable.className = 'ForceBaseFont' ; // Firefox 1.5 Bug.
|
||||
oTable.style.tableLayout = 'fixed' ;
|
||||
oTable.cellPadding = 0 ;
|
||||
oTable.cellSpacing = 0 ;
|
||||
oTable.border = 0 ;
|
||||
oTable.width = 150 ;
|
||||
|
||||
var oCell = oTable.insertRow(-1).insertCell(-1) ;
|
||||
oCell.colSpan = 8 ;
|
||||
|
||||
// Create the Button for the "Automatic" color selection.
|
||||
var oDiv = oCell.appendChild( CreateSelectionDiv() ) ;
|
||||
oDiv.innerHTML =
|
||||
'<table cellspacing="0" cellpadding="0" width="100%" border="0">\
|
||||
<tr>\
|
||||
<td><div class="ColorBoxBorder"><div class="ColorBox" style="background-color: #000000"></div></div></td>\
|
||||
<td nowrap width="100%" align="center">' + FCKLang.ColorAutomatic + '</td>\
|
||||
</tr>\
|
||||
</table>' ;
|
||||
|
||||
oDiv.Command = this ;
|
||||
oDiv.onclick = FCKTextColorCommand_AutoOnClick ;
|
||||
|
||||
// Create an array of colors based on the configuration file.
|
||||
var aColors = FCKConfig.FontColors.toString().split(',') ;
|
||||
|
||||
// Create the colors table based on the array.
|
||||
var iCounter = 0 ;
|
||||
while ( iCounter < aColors.length )
|
||||
{
|
||||
var oRow = oTable.insertRow(-1) ;
|
||||
|
||||
for ( var i = 0 ; i < 8 && iCounter < aColors.length ; i++, iCounter++ )
|
||||
{
|
||||
oDiv = oRow.insertCell(-1).appendChild( CreateSelectionDiv() ) ;
|
||||
oDiv.Color = aColors[iCounter] ;
|
||||
oDiv.innerHTML = '<div class="ColorBoxBorder"><div class="ColorBox" style="background-color: #' + aColors[iCounter] + '"></div></div>' ;
|
||||
|
||||
oDiv.Command = this ;
|
||||
oDiv.onclick = FCKTextColorCommand_OnClick ;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the Row and the Cell for the "More Colors..." button.
|
||||
oCell = oTable.insertRow(-1).insertCell(-1) ;
|
||||
oCell.colSpan = 8 ;
|
||||
|
||||
oDiv = oCell.appendChild( CreateSelectionDiv() ) ;
|
||||
oDiv.innerHTML = '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td nowrap align="center">' + FCKLang.ColorMoreColors + '</td></tr></table>' ;
|
||||
|
||||
oDiv.Command = this ;
|
||||
oDiv.onclick = FCKTextColorCommand_MoreOnClick ;
|
||||
}
|
Reference in New Issue
Block a user