添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@364 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckcontextmenugroup.js
|
||||
* FCKContextMenuGroup Class: represents a group of items in the context
|
||||
* menu. Generaly a group of items is directly dependent of the same rules.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKContextMenuGroup = function( addSeparator, contextMenu, firstItemCommand, firstItemLabel, hasIcon )
|
||||
{
|
||||
this.IsVisible = true ;
|
||||
|
||||
// Array with all available context menu items of this group.
|
||||
this.Items = new Array() ;
|
||||
|
||||
if ( addSeparator )
|
||||
this.Add( new FCKContextMenuSeparator() ) ;
|
||||
|
||||
if ( contextMenu && firstItemCommand && firstItemLabel )
|
||||
this.Add( new FCKContextMenuItem( contextMenu, firstItemCommand, firstItemLabel, hasIcon ) ) ;
|
||||
|
||||
// This OPTIONAL function checks if the group must be shown.
|
||||
this.ValidationFunction = null ;
|
||||
}
|
||||
|
||||
// Adds an item to the group's items collecion.
|
||||
FCKContextMenuGroup.prototype.Add = function( contextMenuItem )
|
||||
{
|
||||
this.Items[ this.Items.length ] = contextMenuItem ;
|
||||
}
|
||||
|
||||
// Creates the <TR> elements that represent the item in a table (usually the rendered context menu).
|
||||
FCKContextMenuGroup.prototype.CreateTableRows = function( table )
|
||||
{
|
||||
for ( var i = 0 ; i < this.Items.length ; i++ )
|
||||
{
|
||||
this.Items[i].CreateTableRow( table ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKContextMenuGroup.prototype.SetVisible = function( isVisible )
|
||||
{
|
||||
for ( var i = 0 ; i < this.Items.length ; i++ )
|
||||
{
|
||||
this.Items[i].SetVisible( isVisible ) ;
|
||||
}
|
||||
|
||||
this.IsVisible = isVisible ;
|
||||
}
|
||||
|
||||
FCKContextMenuGroup.prototype.RefreshState = function()
|
||||
{
|
||||
if ( ! this.IsVisible ) return ;
|
||||
|
||||
for ( var i = 0 ; i < this.Items.length ; i++ )
|
||||
{
|
||||
this.Items[i].RefreshState() ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckcontextmenuitem.js
|
||||
* FCKContextMenuItem Class: represents a item in the context menu.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKContextMenuItem = function( contextMenu, commandName, label, hasIcon )
|
||||
{
|
||||
this.ContextMenu = contextMenu ;
|
||||
this.Command = FCKCommands.GetCommand( commandName ) ;
|
||||
this.Label = label ? label : commandName ;
|
||||
this.HasIcon = hasIcon ? true : false ;
|
||||
}
|
||||
|
||||
function FCKContextMenuItem_OnMouseOver()
|
||||
{
|
||||
if ( this.className != 'CM_Disabled' )
|
||||
this.className = 'CM_Over' ;
|
||||
}
|
||||
|
||||
function FCKContextMenuItem_OnMouseOut()
|
||||
{
|
||||
if ( this.className != 'CM_Disabled' )
|
||||
this.className = 'CM_Option' ;
|
||||
}
|
||||
|
||||
function FCKContextMenuItem_OnClick()
|
||||
{
|
||||
if ( this.className != 'CM_Disabled' )
|
||||
{
|
||||
this.FCKContextMenuItem.ContextMenu.Hide() ;
|
||||
this.FCKContextMenuItem.Command.Execute() ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
FCKContextMenuItem.prototype.CreateTableRow = function( targetTable )
|
||||
{
|
||||
// Creates the <TR> element.
|
||||
this._Row = targetTable.insertRow(-1) ;
|
||||
this._Row.className = 'CM_Disabled' ;
|
||||
this._Row.FCKContextMenuItem = this ;
|
||||
|
||||
this._Row.onmouseover = FCKContextMenuItem_OnMouseOver ;
|
||||
this._Row.onmouseout = FCKContextMenuItem_OnMouseOut ;
|
||||
this._Row.onclick = FCKContextMenuItem_OnClick ;
|
||||
|
||||
var oCell = this._Row.insertCell(-1) ;
|
||||
oCell.className = 'CM_Icon' ;
|
||||
|
||||
if ( this.HasIcon ) oCell.innerHTML = '<img alt="" src="' + FCKConfig.SkinPath + 'toolbar/' + this.Command.Name.toLowerCase() + '.gif" width="21" height="20">' ;
|
||||
|
||||
oCell = this._Row.insertCell(-1) ;
|
||||
oCell.className = 'CM_Label' ;
|
||||
oCell.noWrap = true ;
|
||||
oCell.innerHTML = this.Label ;
|
||||
}
|
||||
|
||||
FCKContextMenuItem.prototype.SetVisible = function( isVisible )
|
||||
{
|
||||
this._Row.style.display = isVisible ? '' : 'none' ;
|
||||
}
|
||||
|
||||
FCKContextMenuItem.prototype.RefreshState = function()
|
||||
{
|
||||
switch ( this.Command.GetState() )
|
||||
{
|
||||
case FCK_TRISTATE_ON :
|
||||
case FCK_TRISTATE_OFF :
|
||||
this._Row.className = 'CM_Option' ;
|
||||
break ;
|
||||
default :
|
||||
this._Row.className = 'CM_Disabled' ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Sample output.
|
||||
-----------------------------------------
|
||||
<tr class="CM_Disabled">
|
||||
<td class="CM_Icon"><img alt="" src="icons/cut.gif" width="21" height="20"></td>
|
||||
<td class="CM_Label">Cut</td>
|
||||
</tr>
|
||||
-----------------------------------------
|
||||
<tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
|
||||
<td class="CM_Icon"></td>
|
||||
<td class="CM_Label">Do Something</td>
|
||||
</tr>
|
||||
*/
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckcontextmenuseparator.js
|
||||
* FCKContextMenuSeparator Class: represents a separator in the toolbar.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKContextMenuSeparator = function()
|
||||
{
|
||||
}
|
||||
|
||||
FCKContextMenuSeparator.prototype.CreateTableRow = function( targetTable )
|
||||
{
|
||||
// Creates the <TR> element.
|
||||
this._Row = targetTable.insertRow(-1) ;
|
||||
this._Row.className = 'CM_Separator' ;
|
||||
|
||||
var oCell = this._Row.insertCell(-1) ;
|
||||
oCell.className = 'CM_Icon' ;
|
||||
|
||||
var oDoc = targetTable.ownerDocument || targetTable.document ;
|
||||
|
||||
oCell = this._Row.insertCell(-1) ;
|
||||
oCell.className = 'CM_Label' ;
|
||||
oCell.appendChild( oDoc.createElement( 'DIV' ) ).className = 'CM_Separator_Line' ;
|
||||
}
|
||||
|
||||
FCKContextMenuSeparator.prototype.SetVisible = function( isVisible )
|
||||
{
|
||||
this._Row.style.display = isVisible ? '' : 'none' ;
|
||||
}
|
||||
|
||||
FCKContextMenuSeparator.prototype.RefreshState = function()
|
||||
{
|
||||
// Do nothing... its state doesn't change.
|
||||
}
|
||||
|
||||
/*
|
||||
Sample output.
|
||||
-----------------------------------------
|
||||
<tr class="CM_Separator">
|
||||
<td class="CM_Icon"></td>
|
||||
<td class="CM_Label"><div></div></td>
|
||||
</tr>
|
||||
*/
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckevents.js
|
||||
* FCKEvents Class: used to handle events is a advanced way.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKEvents ;
|
||||
|
||||
if ( !( FCKEvents = NS.FCKEvents ) )
|
||||
{
|
||||
FCKEvents = NS.FCKEvents = function( eventsOwner )
|
||||
{
|
||||
this.Owner = eventsOwner ;
|
||||
this.RegisteredEvents = new Object() ;
|
||||
}
|
||||
|
||||
FCKEvents.prototype.AttachEvent = function( eventName, functionPointer )
|
||||
{
|
||||
if ( ! this.RegisteredEvents[ eventName ] ) this.RegisteredEvents[ eventName ] = new Array() ;
|
||||
|
||||
this.RegisteredEvents[ eventName ][ this.RegisteredEvents[ eventName ].length ] = functionPointer ;
|
||||
}
|
||||
|
||||
FCKEvents.prototype.FireEvent = function( eventName, params )
|
||||
{
|
||||
var bReturnValue = true ;
|
||||
|
||||
var oCalls = this.RegisteredEvents[ eventName ] ;
|
||||
if ( oCalls )
|
||||
{
|
||||
for ( var i = 0 ; i < oCalls.length ; i++ )
|
||||
bReturnValue = ( oCalls[ i ]( this.Owner, params ) && bReturnValue ) ;
|
||||
}
|
||||
|
||||
return bReturnValue ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckpanel_gecko.js
|
||||
* FCKPanel Class: Creates and manages floating panels in Gecko Browsers.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKPanel = function( parentWindow )
|
||||
{
|
||||
this.IsRTL = false ;
|
||||
this.IsContextMenu = false ;
|
||||
this._IsOpened = false ;
|
||||
|
||||
if ( parentWindow )
|
||||
this._Window = parentWindow ;
|
||||
else
|
||||
{
|
||||
this._Window = window ;
|
||||
|
||||
while ( this._Window != window.top )
|
||||
{
|
||||
// Try/Catch must be used to avoit an error when using a frameset
|
||||
// on a different domain:
|
||||
// "Permission denied to get property HTMLDocument.Body".
|
||||
try
|
||||
{
|
||||
if ( this._Window.parent.document.body.tagName == 'FRAMESET' )
|
||||
break ;
|
||||
} catch (e) { break ; }
|
||||
|
||||
this._Window = this._Window.parent ;
|
||||
}
|
||||
}
|
||||
|
||||
var oIFrame = this._IFrame = this._Window.document.createElement('iframe') ;
|
||||
oIFrame.frameBorder = '0';
|
||||
oIFrame.scrolling = 'no' ;
|
||||
oIFrame.style.position = 'absolute';
|
||||
oIFrame.width = oIFrame.height = 0 ;
|
||||
oIFrame.style.zIndex = FCKConfig.FloatingPanelsZIndex ;
|
||||
|
||||
this._Window.document.body.appendChild( oIFrame ) ;
|
||||
|
||||
this.Document = oIFrame.contentWindow.document ;
|
||||
|
||||
// Initialize the IFRAME document body.
|
||||
this.Document.open() ;
|
||||
this.Document.write( '<html><head></head><body><\/body><\/html>' ) ;
|
||||
this.Document.close() ;
|
||||
|
||||
// Remove the default margins.
|
||||
this.Document.body.style.margin = this.Document.body.style.padding = '0px' ;
|
||||
|
||||
this._IFrame.contentWindow.onblur = this.Hide ;
|
||||
|
||||
oIFrame.contentWindow.Panel = this ;
|
||||
|
||||
|
||||
// Create the main DIV that is used as the panel base.
|
||||
this.PanelDiv = this.Document.body.appendChild( this.Document.createElement('DIV') ) ;
|
||||
this.PanelDiv.className = 'FCK_Panel' ;
|
||||
|
||||
this.EnableContextMenu( false ) ;
|
||||
this.SetDirection( FCKLang.Dir ) ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.EnableContextMenu = function( enabled )
|
||||
{
|
||||
this.Document.oncontextmenu = enabled ? null : FCKTools.CancelEvent ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.AppendStyleSheet = function( styleSheet )
|
||||
{
|
||||
FCKTools.AppendStyleSheet( this.Document, styleSheet ) ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.SetDirection = function( dir )
|
||||
{
|
||||
this.IsRTL = ( dir == 'rtl' ) ;
|
||||
this.Document.dir = dir ;
|
||||
|
||||
// The "float" property must be set so Firefox calculates the size correcly.
|
||||
this.PanelDiv.style.cssFloat = ( dir == 'rtl' ? 'right' : 'left' ) ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.Load = function()
|
||||
{
|
||||
// This is a IE only need.
|
||||
}
|
||||
|
||||
FCKPanel.prototype.Show = function( x, y, relElement, width, height )
|
||||
{
|
||||
this.PanelDiv.style.width = width ? width + 'px' : '' ;
|
||||
this.PanelDiv.style.height = height ? height + 'px' : '' ;
|
||||
|
||||
if ( !width ) this._IFrame.width = 1 ;
|
||||
if ( !height ) this._IFrame.height = 1 ;
|
||||
|
||||
var oPos = FCKTools.GetElementPosition( relElement, this._Window ) ;
|
||||
|
||||
x += oPos.X ;
|
||||
y += oPos.Y ;
|
||||
|
||||
if ( this.IsRTL )
|
||||
{
|
||||
if ( this.IsContextMenu )
|
||||
x = x - this.PanelDiv.offsetWidth + 1 ;
|
||||
else if ( relElement )
|
||||
x = x + ( relElement.offsetWidth - this.PanelDiv.offsetWidth ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ( x + this.PanelDiv.offsetWidth ) > this._Window.document.body.clientWidth )
|
||||
x -= x + this.PanelDiv.offsetWidth - this._Window.document.body.clientWidth ;
|
||||
}
|
||||
|
||||
if ( x < 0 )
|
||||
x = 0 ;
|
||||
|
||||
// Set the context menu DIV in the specified location.
|
||||
this._IFrame.style.left = x + 'px' ;
|
||||
this._IFrame.style.top = y + 'px' ;
|
||||
|
||||
var iWidth = this.PanelDiv.offsetWidth ;
|
||||
var iHeight = this.PanelDiv.offsetHeight ;
|
||||
|
||||
this._IFrame.width = iWidth ;
|
||||
this._IFrame.height = iHeight ;
|
||||
|
||||
// Move the focus to the IFRAME so we catch the "onblur".
|
||||
this._IFrame.contentWindow.focus() ;
|
||||
|
||||
this._IsOpened = true ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.Hide = function()
|
||||
{
|
||||
var oPanel = this.Panel ? this.Panel : this ;
|
||||
|
||||
if ( !oPanel._IsOpened )
|
||||
return ;
|
||||
|
||||
// It is better to set the sizes to 0, otherwise Firefox would have
|
||||
// rendering problems.
|
||||
oPanel._IFrame.width = oPanel._IFrame.height = 0 ;
|
||||
|
||||
if ( oPanel._OnHide )
|
||||
oPanel._OnHide( oPanel ) ;
|
||||
|
||||
oPanel._IsOpened = false ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.CheckIsOpened = function()
|
||||
{
|
||||
return this._IsOpened ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.AttachToOnHideEvent = function( targetFunction )
|
||||
{
|
||||
this._OnHide = targetFunction ;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckpanel_ie.js
|
||||
* FCKPanel Class: Creates and manages floating panels in IE Browsers.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKPanel = function( parentWindow )
|
||||
{
|
||||
this.IsRTL = false ;
|
||||
this.IsContextMenu = false ;
|
||||
this._IsOpened = false ;
|
||||
|
||||
this._Window = parentWindow ? parentWindow : window ;
|
||||
|
||||
// Create the Popup that will hold the panel.
|
||||
this._Popup = this._Window.createPopup() ;
|
||||
this.Document = this._Popup.document ;
|
||||
|
||||
|
||||
// Create the main DIV that is used as the panel base.
|
||||
this.PanelDiv = this.Document.body.appendChild( this.Document.createElement('DIV') ) ;
|
||||
this.PanelDiv.className = 'FCK_Panel' ;
|
||||
|
||||
this.EnableContextMenu( false ) ;
|
||||
this.SetDirection( FCKLang.Dir ) ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.EnableContextMenu = function( enabled )
|
||||
{
|
||||
this.Document.oncontextmenu = enabled ? null : FCKTools.CancelEvent ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.AppendStyleSheet = function( styleSheet )
|
||||
{
|
||||
FCKTools.AppendStyleSheet( this.Document, styleSheet ) ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.SetDirection = function( dir )
|
||||
{
|
||||
this.IsRTL = ( dir == 'rtl' ) ;
|
||||
this.Document.dir = dir ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.Load = function( x, y, relElement )
|
||||
{
|
||||
// The offsetWidth and offsetHeight properties are not available if the
|
||||
// element is not visible. So we must "show" the popup with no size to
|
||||
// be able to use that values in the second call.
|
||||
this._Popup.show( x, y, 0, 0, relElement ) ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.Show = function( x, y, relElement, width, height )
|
||||
{
|
||||
this.Load( x, y, relElement ) ;
|
||||
|
||||
// The following lines must be place after the above "show", otherwise it
|
||||
// doesn't has the desired effect.
|
||||
this.PanelDiv.style.width = width ? width + 'px' : '' ;
|
||||
this.PanelDiv.style.height = height ? height + 'px' : '' ;
|
||||
|
||||
if ( this.IsRTL )
|
||||
{
|
||||
if ( this.IsContextMenu )
|
||||
x = x - this.PanelDiv.offsetWidth + 1 ;
|
||||
else if ( relElement )
|
||||
x = x + ( relElement.offsetWidth - this.PanelDiv.offsetWidth ) ;
|
||||
}
|
||||
|
||||
// Second call: Show the Popup at the specified location, with the correct size.
|
||||
this._Popup.show( x, y, this.PanelDiv.offsetWidth, this.PanelDiv.offsetHeight, relElement ) ;
|
||||
|
||||
if ( this._OnHide )
|
||||
{
|
||||
if ( FCKPanel_ActivePopupInfo.Timer )
|
||||
CheckPopupOnHide() ;
|
||||
FCKPanel_ActivePopupInfo.Timer = window.setInterval( CheckPopupOnHide, 200 ) ;
|
||||
FCKPanel_ActivePopupInfo.Panel = this ;
|
||||
}
|
||||
|
||||
this._IsOpened = true ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.Hide = function()
|
||||
{
|
||||
this._Popup.hide() ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.CheckIsOpened = function()
|
||||
{
|
||||
return this._Popup.isOpen ;
|
||||
}
|
||||
|
||||
FCKPanel.prototype.AttachToOnHideEvent = function( targetFunction )
|
||||
{
|
||||
this._OnHide = targetFunction ;
|
||||
}
|
||||
|
||||
var FCKPanel_ActivePopupInfo = new Object() ;
|
||||
|
||||
function CheckPopupOnHide()
|
||||
{
|
||||
var oPanel = FCKPanel_ActivePopupInfo.Panel ;
|
||||
|
||||
if ( oPanel && !oPanel._Popup.isOpen )
|
||||
{
|
||||
window.clearInterval( FCKPanel_ActivePopupInfo.Timer ) ;
|
||||
|
||||
if ( oPanel._OnHide )
|
||||
oPanel._OnHide( oPanel ) ;
|
||||
|
||||
FCKPanel_ActivePopupInfo.Timer = null ;
|
||||
FCKPanel_ActivePopupInfo.Panel = null ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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
|
||||
* FCKPlugin Class: Represents a single plugin.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
// Certifies that the "PluginsPath" configuration ends with a slash.
|
||||
if ( !FCKConfig.PluginsPath.endsWith('/') )
|
||||
FCKConfig.PluginsPath += '/' ;
|
||||
|
||||
var FCKPlugin = function( name, availableLangs, basePath )
|
||||
{
|
||||
this.Name = name ;
|
||||
this.BasePath = basePath ? basePath : FCKConfig.PluginsPath ;
|
||||
this.Path = this.BasePath + name + '/' ;
|
||||
|
||||
if ( !availableLangs || availableLangs.length == 0 )
|
||||
this.AvailableLangs = new Array() ;
|
||||
else
|
||||
this.AvailableLangs = availableLangs.split(',') ;
|
||||
}
|
||||
|
||||
FCKPlugin.prototype.Load = function()
|
||||
{
|
||||
// Load the language file, if defined.
|
||||
if ( this.AvailableLangs.length > 0 )
|
||||
{
|
||||
var sLang ;
|
||||
|
||||
// Check if the plugin has the language file for the active language.
|
||||
if ( this.AvailableLangs.indexOf( FCKLanguageManager.ActiveLanguage.Code ) >= 0 )
|
||||
sLang = FCKLanguageManager.ActiveLanguage.Code ;
|
||||
else
|
||||
// Load the default language file (first one) if the current one is not available.
|
||||
sLang = this.AvailableLangs[0] ;
|
||||
|
||||
// Add the main plugin script.
|
||||
FCKScriptLoader.AddScript( this.Path + 'lang/' + sLang + '.js' ) ;
|
||||
}
|
||||
|
||||
// Add the main plugin script.
|
||||
FCKScriptLoader.AddScript( this.Path + 'fckplugin.js' ) ;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckstyledef.js
|
||||
* FCKStyleDef Class: represents a single stylke definition.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKStyleDef = function( name, element )
|
||||
{
|
||||
this.Name = name ;
|
||||
this.Element = element.toUpperCase() ;
|
||||
this.IsObjectElement = FCKRegexLib.ObjectElements.test( this.Element ) ;
|
||||
this.Attributes = new Object() ;
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype.AddAttribute = function( name, value )
|
||||
{
|
||||
this.Attributes[ name ] = value ;
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype.GetOpenerTag = function()
|
||||
{
|
||||
var s = '<' + this.Element ;
|
||||
|
||||
for ( var a in this.Attributes )
|
||||
s += ' ' + a + '="' + this.Attributes[a] + '"' ;
|
||||
|
||||
return s + '>' ;
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype.GetCloserTag = function()
|
||||
{
|
||||
return '</' + this.Element + '>' ;
|
||||
}
|
||||
|
||||
|
||||
FCKStyleDef.prototype.RemoveFromSelection = function()
|
||||
{
|
||||
if ( FCKSelection.GetType() == 'Control' )
|
||||
this._RemoveMe( FCKSelection.GetSelectedElement() ) ;
|
||||
else
|
||||
this._RemoveMe( FCKSelection.GetParentElement() ) ;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckstyledef_gecko.js
|
||||
* FCKStyleDef Class: represents a single stylke definition. (Gecko specific)
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
FCKStyleDef.prototype.ApplyToSelection = function()
|
||||
{
|
||||
if ( FCKSelection.GetType() == 'Text' && !this.IsObjectElement )
|
||||
{
|
||||
var oSelection = FCK.EditorWindow.getSelection() ;
|
||||
|
||||
// Create the main element.
|
||||
var e = FCK.EditorDocument.createElement( this.Element ) ;
|
||||
|
||||
for ( var i = 0 ; i < oSelection.rangeCount ; i++ )
|
||||
{
|
||||
e.appendChild( oSelection.getRangeAt(i).extractContents() ) ;
|
||||
}
|
||||
|
||||
// Set the attributes.
|
||||
this._AddAttributes( e ) ;
|
||||
|
||||
// Remove the duplicated elements.
|
||||
this._RemoveDuplicates( e ) ;
|
||||
|
||||
var oRange = oSelection.getRangeAt(0) ;
|
||||
oRange.insertNode( e ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
var oControl = FCKSelection.GetSelectedElement() ;
|
||||
if ( oControl.tagName == this.Element )
|
||||
this._AddAttributes( oControl ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype._AddAttributes = function( targetElement )
|
||||
{
|
||||
for ( var a in this.Attributes )
|
||||
targetElement.setAttribute( a, this.Attributes[a], 0 ) ;
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype._RemoveDuplicates = function( parent )
|
||||
{
|
||||
for ( var i = 0 ; i < parent.childNodes.length ; i++ )
|
||||
{
|
||||
var oChild = parent.childNodes[i] ;
|
||||
|
||||
if ( oChild.nodeType != 1 )
|
||||
continue ;
|
||||
|
||||
this._RemoveDuplicates( oChild ) ;
|
||||
|
||||
if ( this.IsEqual( oChild ) )
|
||||
FCKTools.RemoveOuterTags( oChild ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype.IsEqual = function( e )
|
||||
{
|
||||
if ( e.tagName != this.Element )
|
||||
return false ;
|
||||
|
||||
for ( var a in this.Attributes )
|
||||
{
|
||||
if ( e.getAttribute( a ) != this.Attributes[a] )
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype._RemoveMe = function( elementToCheck )
|
||||
{
|
||||
if ( ! elementToCheck )
|
||||
return ;
|
||||
|
||||
var oParent = elementToCheck.parentNode ;
|
||||
|
||||
if ( elementToCheck.nodeType == 1 && this.IsEqual( elementToCheck ) )
|
||||
{
|
||||
if ( this.IsObjectElement )
|
||||
{
|
||||
for ( var a in this.Attributes )
|
||||
elementToCheck.removeAttribute( a, 0 ) ;
|
||||
return ;
|
||||
}
|
||||
else
|
||||
FCKTools.RemoveOuterTags( elementToCheck ) ;
|
||||
}
|
||||
|
||||
this._RemoveMe( oParent ) ;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckstyledef_ie.js
|
||||
* FCKStyleDef Class: represents a single stylke definition. (IE specific)
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
FCKStyleDef.prototype.ApplyToSelection = function()
|
||||
{
|
||||
var oSelection = FCK.EditorDocument.selection ;
|
||||
|
||||
if ( oSelection.type == 'Text' )
|
||||
{
|
||||
var oRange = oSelection.createRange() ;
|
||||
|
||||
// Create the main element.
|
||||
var e = document.createElement( this.Element ) ;
|
||||
e.innerHTML = oRange.htmlText ;
|
||||
|
||||
// Set the attributes.
|
||||
this._AddAttributes( e ) ;
|
||||
|
||||
// Remove the duplicated elements.
|
||||
this._RemoveDuplicates( e ) ;
|
||||
|
||||
// Replace the selection with the resulting HTML.
|
||||
oRange.pasteHTML( e.outerHTML ) ;
|
||||
}
|
||||
else if ( oSelection.type == 'Control' )
|
||||
{
|
||||
var oControl = FCKSelection.GetSelectedElement() ;
|
||||
if ( oControl.tagName == this.Element )
|
||||
this._AddAttributes( oControl ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype._AddAttributes = function( targetElement )
|
||||
{
|
||||
for ( var a in this.Attributes )
|
||||
{
|
||||
switch ( a.toLowerCase() )
|
||||
{
|
||||
case 'style' :
|
||||
targetElement.style.cssText = this.Attributes[a] ;
|
||||
break ;
|
||||
|
||||
case 'class' :
|
||||
targetElement.setAttribute( 'className', this.Attributes[a], 0 ) ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
targetElement.setAttribute( a, this.Attributes[a], 0 ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype._RemoveDuplicates = function( parent )
|
||||
{
|
||||
for ( var i = 0 ; i < parent.children.length ; i++ )
|
||||
{
|
||||
var oChild = parent.children[i] ;
|
||||
this._RemoveDuplicates( oChild ) ;
|
||||
|
||||
if ( this.IsEqual( oChild ) )
|
||||
FCKTools.RemoveOuterTags( oChild ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype.IsEqual = function( e )
|
||||
{
|
||||
if ( e.tagName != this.Element )
|
||||
return false ;
|
||||
|
||||
for ( var a in this.Attributes )
|
||||
{
|
||||
switch ( a.toLowerCase() )
|
||||
{
|
||||
case 'style' :
|
||||
if ( e.style.cssText.toLowerCase() != this.Attributes[a].toLowerCase() )
|
||||
return false ;
|
||||
break ;
|
||||
case 'class' :
|
||||
if ( e.getAttribute( 'className', 0 ) != this.Attributes[a] )
|
||||
return false ;
|
||||
break ;
|
||||
default :
|
||||
if ( e.getAttribute( a, 0 ) != this.Attributes[a] )
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
FCKStyleDef.prototype._RemoveMe = function( elementToCheck )
|
||||
{
|
||||
if ( ! elementToCheck )
|
||||
return ;
|
||||
|
||||
var oParent = elementToCheck.parentElement ;
|
||||
|
||||
if ( this.IsEqual( elementToCheck ) )
|
||||
{
|
||||
if ( this.IsObjectElement )
|
||||
{
|
||||
for ( var a in this.Attributes )
|
||||
{
|
||||
switch ( a.toLowerCase() )
|
||||
{
|
||||
case 'class' :
|
||||
elementToCheck.removeAttribute( 'className', 0 ) ;
|
||||
break ;
|
||||
default :
|
||||
elementToCheck.removeAttribute( a, 0 ) ;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
else
|
||||
FCKTools.RemoveOuterTags( elementToCheck ) ;
|
||||
}
|
||||
|
||||
this._RemoveMe( oParent ) ;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckstylesloader.js
|
||||
* FCKStylesLoader Class: this class define objects that are responsible
|
||||
* for loading the styles defined in the XML file.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKStylesLoader = function()
|
||||
{
|
||||
this.Styles = new Object() ;
|
||||
this.StyleGroups = new Object() ;
|
||||
this.Loaded = false ;
|
||||
this.HasObjectElements = false ;
|
||||
}
|
||||
|
||||
FCKStylesLoader.prototype.Load = function( stylesXmlUrl )
|
||||
{
|
||||
// Load the XML file into a FCKXml object.
|
||||
var oXml = new FCKXml() ;
|
||||
oXml.LoadUrl( stylesXmlUrl ) ;
|
||||
|
||||
// Get the "Style" nodes defined in the XML file.
|
||||
var aStyleNodes = oXml.SelectNodes( 'Styles/Style' ) ;
|
||||
|
||||
// Add each style to our "Styles" collection.
|
||||
for ( var i = 0 ; i < aStyleNodes.length ; i++ )
|
||||
{
|
||||
var sElement = aStyleNodes[i].attributes.getNamedItem('element').value.toUpperCase() ;
|
||||
|
||||
// Create the style definition object.
|
||||
var oStyleDef = new FCKStyleDef( aStyleNodes[i].attributes.getNamedItem('name').value, sElement ) ;
|
||||
|
||||
if ( oStyleDef.IsObjectElement )
|
||||
this.HasObjectElements = true ;
|
||||
|
||||
// Get the attributes defined for the style (if any).
|
||||
var aAttNodes = oXml.SelectNodes( 'Attribute', aStyleNodes[i] ) ;
|
||||
|
||||
// Add the attributes to the style definition object.
|
||||
for ( var j = 0 ; j < aAttNodes.length ; j++ )
|
||||
{
|
||||
var sAttName = aAttNodes[j].attributes.getNamedItem('name').value ;
|
||||
var sAttValue = aAttNodes[j].attributes.getNamedItem('value').value ;
|
||||
|
||||
// IE changes the "style" attribute value when applied to an element
|
||||
// so we must get the final resulting value (for comparision issues).
|
||||
if ( sAttName.toLowerCase() == 'style' )
|
||||
{
|
||||
var oTempE = document.createElement( 'SPAN' ) ;
|
||||
oTempE.style.cssText = sAttValue ;
|
||||
sAttValue = oTempE.style.cssText ;
|
||||
}
|
||||
|
||||
oStyleDef.AddAttribute( sAttName, sAttValue ) ;
|
||||
}
|
||||
|
||||
// Add the style to the "Styles" collection using it's name as the key.
|
||||
this.Styles[ oStyleDef.Name ] = oStyleDef ;
|
||||
|
||||
// Add the style to the "StyleGroups" collection.
|
||||
var aGroup = this.StyleGroups[sElement] ;
|
||||
if ( aGroup == null )
|
||||
{
|
||||
this.StyleGroups[sElement] = new Array() ;
|
||||
aGroup = this.StyleGroups[sElement] ;
|
||||
}
|
||||
aGroup[aGroup.length] = oStyleDef ;
|
||||
}
|
||||
|
||||
this.Loaded = true ;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbar.js
|
||||
* FCKToolbar Class: represents a toolbar. A toolbar is not the complete
|
||||
* toolbar set visible, but just a strip on it... a group of items.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbar = function()
|
||||
{
|
||||
this.Items = new Array() ;
|
||||
|
||||
var e = this.DOMTable = document.createElement( 'table' ) ;
|
||||
e.className = 'TB_Toolbar' ;
|
||||
|
||||
// Sets the toolbar direction. IE uses "styleFloat" and Gecko uses "cssFloat".
|
||||
e.style.styleFloat = e.style.cssFloat = FCKLang.Dir == 'rtl' ? 'right' : 'left' ;
|
||||
|
||||
e.cellPadding = 0 ;
|
||||
e.cellSpacing = 0 ;
|
||||
e.border = 0 ;
|
||||
|
||||
this.DOMRow = e.insertRow(-1) ;
|
||||
|
||||
var oCell = this.DOMRow.insertCell(-1) ;
|
||||
oCell.className = 'TB_Start' ;
|
||||
oCell.innerHTML = '<img src="' + FCKConfig.SkinPath + 'images/toolbar.start.gif" width="7" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';">' ;
|
||||
|
||||
FCKToolbarSet.DOMElement.appendChild( e ) ;
|
||||
}
|
||||
|
||||
FCKToolbar.prototype.AddItem = function( toolbarItem )
|
||||
{
|
||||
this.Items[ this.Items.length ] = toolbarItem ;
|
||||
toolbarItem.CreateInstance( this ) ;
|
||||
}
|
||||
|
||||
FCKToolbar.prototype.AddSeparator = function()
|
||||
{
|
||||
var oCell = this.DOMRow.insertCell(-1) ;
|
||||
oCell.innerHTML = '<img src="' + FCKConfig.SkinPath + 'images/toolbar.separator.gif" width="5" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';">' ;
|
||||
}
|
||||
|
||||
FCKToolbar.prototype.AddTerminator = function()
|
||||
{
|
||||
var oCell = this.DOMRow.insertCell(-1) ;
|
||||
oCell.className = 'TB_End' ;
|
||||
oCell.innerHTML = '<img src="' + FCKConfig.SkinPath + 'images/toolbar.end.gif" width="12" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';">' ;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarbreak_gecko.js
|
||||
* FCKToolbarBreak Class: breaks the toolbars.
|
||||
* It makes it possible to force the toolbar to brak to a new line.
|
||||
* This is the Gecko specific implementation.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarBreak = function()
|
||||
{
|
||||
var oBreakDiv = document.createElement( 'div' ) ;
|
||||
|
||||
oBreakDiv.style.clear = oBreakDiv.style.cssFloat = FCKLang.Dir == 'rtl' ? 'right' : 'left' ;
|
||||
|
||||
FCKToolbarSet.DOMElement.appendChild( oBreakDiv ) ;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarbreak_ie.js
|
||||
* FCKToolbarBreak Class: breaks the toolbars.
|
||||
* It makes it possible to force the toolbar to brak to a new line.
|
||||
* This is the IE specific implementation.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarBreak = function()
|
||||
{
|
||||
var oBreakDiv = document.createElement( 'div' ) ;
|
||||
|
||||
oBreakDiv.className = 'TB_Break' ;
|
||||
|
||||
oBreakDiv.style.clear = FCKLang.Dir == 'rtl' ? 'left' : 'right' ;
|
||||
|
||||
FCKToolbarSet.DOMElement.appendChild( oBreakDiv ) ;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarbutton.js
|
||||
* FCKToolbarButton Class: represents a button in the toolbar.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( commandName ) ;
|
||||
this.Label = label ? label : commandName ;
|
||||
this.Tooltip = tooltip ? tooltip : ( label ? label : commandName) ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ONLYICON ;
|
||||
this.SourceView = sourceView ? true : false ;
|
||||
this.ContextSensitive = contextSensitive ? true : false ;
|
||||
this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
|
||||
this.State = FCK_UNKNOWN ;
|
||||
}
|
||||
|
||||
FCKToolbarButton.prototype.CreateInstance = function( parentToolbar )
|
||||
{
|
||||
this.DOMDiv = document.createElement( 'div' ) ;
|
||||
this.DOMDiv.className = 'TB_Button_Off' ;
|
||||
|
||||
this.DOMDiv.FCKToolbarButton = this ;
|
||||
|
||||
var sHtml =
|
||||
'<table title="' + this.Tooltip + '" cellspacing="0" cellpadding="0" border="0">' +
|
||||
'<tr>' ;
|
||||
|
||||
if ( this.Style != FCK_TOOLBARITEM_ONLYTEXT )
|
||||
sHtml += '<td class="TB_Icon"><img src="' + this.IconPath + '" width="21" height="21"></td>' ;
|
||||
|
||||
if ( this.Style != FCK_TOOLBARITEM_ONLYICON )
|
||||
sHtml += '<td class="TB_Text" nowrap>' + this.Label + '</td>' ;
|
||||
|
||||
sHtml +=
|
||||
'</tr>' +
|
||||
'</table>' ;
|
||||
|
||||
this.DOMDiv.innerHTML = sHtml ;
|
||||
|
||||
var oCell = parentToolbar.DOMRow.insertCell(-1) ;
|
||||
oCell.appendChild( this.DOMDiv ) ;
|
||||
|
||||
this.RefreshState() ;
|
||||
}
|
||||
|
||||
FCKToolbarButton.prototype.RefreshState = function()
|
||||
{
|
||||
/*
|
||||
TODO: Delete this comment block on stable version.
|
||||
// Gets the actual state.
|
||||
// var eState ;
|
||||
|
||||
// if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
|
||||
// eState = FCK_TRISTATE_DISABLED ;
|
||||
// else
|
||||
*/
|
||||
// Gets the actual state.
|
||||
var eState = this.Command.GetState() ;
|
||||
|
||||
// If there are no state changes than do nothing and return.
|
||||
if ( eState == this.State ) return ;
|
||||
|
||||
// Sets the actual state.
|
||||
this.State = eState ;
|
||||
|
||||
switch ( this.State )
|
||||
{
|
||||
case FCK_TRISTATE_ON :
|
||||
this.DOMDiv.className = 'TB_Button_On' ;
|
||||
|
||||
this.DOMDiv.onmouseover = FCKToolbarButton_OnMouseOnOver ;
|
||||
this.DOMDiv.onmouseout = FCKToolbarButton_OnMouseOnOut ;
|
||||
this.DOMDiv.onclick = FCKToolbarButton_OnClick ;
|
||||
|
||||
break ;
|
||||
case FCK_TRISTATE_OFF :
|
||||
this.DOMDiv.className = 'TB_Button_Off' ;
|
||||
|
||||
this.DOMDiv.onmouseover = FCKToolbarButton_OnMouseOffOver ;
|
||||
this.DOMDiv.onmouseout = FCKToolbarButton_OnMouseOffOut ;
|
||||
this.DOMDiv.onclick = FCKToolbarButton_OnClick ;
|
||||
|
||||
break ;
|
||||
default :
|
||||
this.Disable() ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
function FCKToolbarButton_OnMouseOnOver()
|
||||
{
|
||||
this.className = 'TB_Button_On TB_Button_On_Over' ;
|
||||
}
|
||||
|
||||
function FCKToolbarButton_OnMouseOnOut()
|
||||
{
|
||||
this.className = 'TB_Button_On' ;
|
||||
}
|
||||
|
||||
function FCKToolbarButton_OnMouseOffOver()
|
||||
{
|
||||
this.className = 'TB_Button_On TB_Button_Off_Over' ;
|
||||
}
|
||||
|
||||
function FCKToolbarButton_OnMouseOffOut()
|
||||
{
|
||||
this.className = 'TB_Button_Off' ;
|
||||
}
|
||||
|
||||
function FCKToolbarButton_OnClick(e)
|
||||
{
|
||||
this.FCKToolbarButton.Click(e) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
FCKToolbarButton.prototype.Click = function()
|
||||
{
|
||||
this.Command.Execute() ;
|
||||
}
|
||||
|
||||
FCKToolbarButton.prototype.Enable = function()
|
||||
{
|
||||
this.RefreshState() ;
|
||||
}
|
||||
|
||||
FCKToolbarButton.prototype.Disable = function()
|
||||
{
|
||||
this.State = FCK_TRISTATE_DISABLED ;
|
||||
this.DOMDiv.className = 'TB_Button_Disabled' ;
|
||||
this.DOMDiv.onmouseover = null ;
|
||||
this.DOMDiv.onmouseout = null ;
|
||||
this.DOMDiv.onclick = null ;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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: fcktoolbarcombo.js
|
||||
* FCKToolbarCombo Class: represents a combo in the toolbar.
|
||||
*
|
||||
* Version: 2.0 RC3
|
||||
* Modified: 2004-11-10 17:14:48
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarCombo = function( commandName, label, itemsValues, itemsNames, tooltip, style, firstIsBlank, itemsSeparator, sourceView )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( commandName ) ;
|
||||
|
||||
this.Label = label ? label : commandName ;
|
||||
this.Tooltip = tooltip ? tooltip : ( label ? label : commandName) ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
|
||||
this.SourceView = sourceView ? true : false ;
|
||||
this.State = FCK_UNKNOWN ;
|
||||
|
||||
this.ItemsValues = itemsValues ;
|
||||
this.ItemsNames = itemsNames ? itemsNames : itemsValues ;
|
||||
this.ItemsSeparator = itemsSeparator ? itemsSeparator : ';' ;
|
||||
|
||||
this.FirstIsBlank = firstIsBlank != null ? firstIsBlank : true ;
|
||||
}
|
||||
|
||||
FCKToolbarCombo.prototype.CreateInstance = function( parentToolbar )
|
||||
{
|
||||
/*
|
||||
<td class="TB_Combo_Disabled" unselectable="on">
|
||||
<table class="ButtonType_IconText" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td class="TB_Text" unselectable="on">Style</td>
|
||||
<td><select title="Style"><option>Style 1</option><option>Style 2</option></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
*/
|
||||
this.DOMDiv = document.createElement( 'div' ) ;
|
||||
this.DOMDiv.className = 'TB_Combo_Off' ;
|
||||
|
||||
// Gets the correct CSS class to use for the specified style (param).
|
||||
var sClass ;
|
||||
switch ( this.Style )
|
||||
{
|
||||
case FCK_TOOLBARITEM_ONLYICON :
|
||||
sClass = 'TB_ButtonType_Icon' ;
|
||||
break ;
|
||||
case FCK_TOOLBARITEM_ONLYTEXT :
|
||||
sClass = 'TB_ButtonType_Text' ;
|
||||
break ;
|
||||
case FCK_TOOLBARITEM_ICONTEXT :
|
||||
sClass = '' ;
|
||||
break ;
|
||||
}
|
||||
|
||||
this.DOMDiv.innerHTML =
|
||||
'<table class="' + sClass + '" cellspacing="0" cellpadding="0" border="0" unselectable="on">' +
|
||||
'<tr>' +
|
||||
'<td class="TB_Text" unselectable="on" nowrap>' + this.Label + '</td>' +
|
||||
'<td unselectable="on"><select title="' + this.Tooltip + '"></select></td>' +
|
||||
'</tr>' +
|
||||
'</table>' ;
|
||||
|
||||
// Gets the SELECT element.
|
||||
this.SelectElement = this.DOMDiv.firstChild.firstChild.firstChild.childNodes.item(1).firstChild ;
|
||||
|
||||
this.SelectElement.FCKToolbarCombo = this ;
|
||||
|
||||
this.SelectElement.onchange = function()
|
||||
{
|
||||
this.FCKToolbarCombo.Command.Execute( this.value ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
var oCell = parentToolbar.DOMRow.insertCell(-1) ;
|
||||
oCell.appendChild( this.DOMDiv ) ;
|
||||
|
||||
// Loads all combo items.
|
||||
this.RefreshItems() ;
|
||||
|
||||
// Sets its initial state (probably disabled).
|
||||
this.RefreshState() ;
|
||||
}
|
||||
|
||||
FCKToolbarCombo.prototype.RefreshItems = function()
|
||||
{
|
||||
// Create the empty arrays of items to add (names and values)
|
||||
var aNames = FCKTools.GetResultingArray( this.ItemsNames, this.ItemsSeparator ) ;
|
||||
var aValues = FCKTools.GetResultingArray( this.ItemsValues, this.ItemsSeparator ) ;
|
||||
|
||||
// Clean up the combo.
|
||||
FCKTools.RemoveAllSelectOptions( this.SelectElement ) ;
|
||||
|
||||
// Verifies if the first item in the combo must be blank.
|
||||
if ( this.FirstIsBlank )
|
||||
FCKTools.AddSelectOption( document, this.SelectElement, '', '' ) ;
|
||||
|
||||
// Add all items to the combo.
|
||||
for ( var i = 0 ; i < aValues.length ; i++ )
|
||||
{
|
||||
FCKTools.AddSelectOption( document, this.SelectElement, aNames[i], aValues[i] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKToolbarCombo.prototype.RefreshState = function()
|
||||
{
|
||||
// Gets the actual state.
|
||||
var eState ;
|
||||
|
||||
if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
|
||||
{
|
||||
eState = FCK_TRISTATE_DISABLED ;
|
||||
|
||||
// Cleans the actual selection.
|
||||
this.SelectElement.value = '' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sValue = this.Command.GetState() ;
|
||||
|
||||
// Sets the combo value.
|
||||
FCKTools.SelectNoCase( this.SelectElement, sValue ? sValue : '', '' ) ;
|
||||
|
||||
// Gets the actual state.
|
||||
eState = sValue == null ? FCK_TRISTATE_DISABLED : FCK_TRISTATE_ON ;
|
||||
}
|
||||
|
||||
// If there are no state changes then do nothing and return.
|
||||
if ( eState == this.State ) return ;
|
||||
|
||||
// Sets the actual state.
|
||||
this.State = eState ;
|
||||
|
||||
// Updates the graphical state.
|
||||
this.DOMDiv.className = ( eState == FCK_TRISTATE_ON ? 'TB_Combo_Off' : 'TB_Combo_Disabled' ) ;
|
||||
this.SelectElement.disabled = ( eState == FCK_TRISTATE_DISABLED ) ;
|
||||
}
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarfontformatcombo.js
|
||||
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarFontFormatCombo = function( tooltip, style )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( 'FontFormat' ) ;
|
||||
this.Label = this.GetLabel() ;
|
||||
this.Tooltip = tooltip ? tooltip : this.Label ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
|
||||
|
||||
this.NormalLabel = 'Normal' ;
|
||||
|
||||
this.PanelWidth = 190 ;
|
||||
}
|
||||
|
||||
// Inherit from FCKToolbarSpecialCombo.
|
||||
FCKToolbarFontFormatCombo.prototype = new FCKToolbarSpecialCombo ;
|
||||
|
||||
FCKToolbarFontFormatCombo.prototype.GetLabel = function()
|
||||
{
|
||||
return FCKLang.FontFormat ;
|
||||
}
|
||||
|
||||
FCKToolbarFontFormatCombo.prototype.CreateItems = function( targetSpecialCombo )
|
||||
{
|
||||
// Get the format names from the language file.
|
||||
var aNames = FCKLang['FontFormats'].split(';') ;
|
||||
var oNames = {
|
||||
p : aNames[0],
|
||||
pre : aNames[1],
|
||||
address : aNames[2],
|
||||
h1 : aNames[3],
|
||||
h2 : aNames[4],
|
||||
h3 : aNames[5],
|
||||
h4 : aNames[6],
|
||||
h5 : aNames[7],
|
||||
h6 : aNames[8],
|
||||
div : aNames[9]
|
||||
} ;
|
||||
|
||||
// Get the available formats from the configuration file.
|
||||
var aTags = FCKConfig.FontFormats.split(';') ;
|
||||
|
||||
for ( var i = 0 ; i < aTags.length ; i++ )
|
||||
{
|
||||
// Support for DIV in Firefox has been reintroduced on version 2.2.
|
||||
// if ( aTags[i] == 'div' && FCKBrowserInfo.IsGecko )
|
||||
// continue ;
|
||||
|
||||
var sTag = aTags[i] ;
|
||||
var sLabel = oNames[sTag] ;
|
||||
|
||||
if ( sTag == 'p' )
|
||||
this.NormalLabel = sLabel ;
|
||||
|
||||
this._Combo.AddItem( sTag, '<div class="BaseFont"><' + sTag + '>' + sLabel + '</' + sTag + '></div>', sLabel ) ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
{
|
||||
FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( combo, value )
|
||||
{
|
||||
// FCKDebug.Output( 'FCKToolbarFontFormatCombo Value: ' + value ) ;
|
||||
|
||||
// IE returns normal for DIV and P, so to avoid confusion, we will not show it if normal.
|
||||
if ( value == this.NormalLabel )
|
||||
{
|
||||
if ( combo.Label != ' ' )
|
||||
combo.DeselectAll(true) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( this._LastValue == value )
|
||||
return ;
|
||||
|
||||
combo.SelectItemByLabel( value, true ) ;
|
||||
}
|
||||
|
||||
this._LastValue = value ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarfontscombo.js
|
||||
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarFontsCombo = function( tooltip, style )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( 'FontName' ) ;
|
||||
this.Label = this.GetLabel() ;
|
||||
this.Tooltip = tooltip ? tooltip : this.Label ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
|
||||
}
|
||||
|
||||
// Inherit from FCKToolbarSpecialCombo.
|
||||
FCKToolbarFontsCombo.prototype = new FCKToolbarSpecialCombo ;
|
||||
|
||||
FCKToolbarFontsCombo.prototype.GetLabel = function()
|
||||
{
|
||||
return FCKLang.Font ;
|
||||
}
|
||||
|
||||
FCKToolbarFontsCombo.prototype.CreateItems = function( targetSpecialCombo )
|
||||
{
|
||||
var aFonts = FCKConfig.FontNames.split(';') ;
|
||||
|
||||
for ( var i = 0 ; i < aFonts.length ; i++ )
|
||||
this._Combo.AddItem( aFonts[i], '<font face="' + aFonts[i] + '" style="font-size: 12px">' + aFonts[i] + '</font>' ) ;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarfontsizecombo.js
|
||||
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarFontSizeCombo = function( tooltip, style )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( 'FontSize' ) ;
|
||||
this.Label = this.GetLabel() ;
|
||||
this.Tooltip = tooltip ? tooltip : this.Label ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
|
||||
}
|
||||
|
||||
// Inherit from FCKToolbarSpecialCombo.
|
||||
FCKToolbarFontSizeCombo.prototype = new FCKToolbarSpecialCombo ;
|
||||
|
||||
FCKToolbarFontSizeCombo.prototype.GetLabel = function()
|
||||
{
|
||||
return FCKLang.FontSize ;
|
||||
}
|
||||
|
||||
FCKToolbarFontSizeCombo.prototype.CreateItems = function( targetSpecialCombo )
|
||||
{
|
||||
targetSpecialCombo.FieldWidth = 70 ;
|
||||
|
||||
var aSizes = FCKConfig.FontSizes.split(';') ;
|
||||
|
||||
for ( var i = 0 ; i < aSizes.length ; i++ )
|
||||
{
|
||||
var aSizeParts = aSizes[i].split('/') ;
|
||||
this._Combo.AddItem( aSizeParts[0], '<font size="' + aSizeParts[0] + '">' + aSizeParts[1] + '</font>', aSizeParts[1] ) ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarpanelbutton.js
|
||||
* FCKToolbarPanelButton Class: represents a special button in the toolbar
|
||||
* that shows a panel when pressed.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarPanelButton = function( commandName, label, tooltip, style )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( commandName ) ;
|
||||
this.Label = label ? label : commandName ;
|
||||
this.Tooltip = tooltip ? tooltip : ( label ? label : commandName) ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ONLYICON ;
|
||||
this.State = FCK_UNKNOWN ;
|
||||
this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
|
||||
}
|
||||
|
||||
FCKToolbarPanelButton.prototype.Click = function(e)
|
||||
{
|
||||
// For Mozilla we must stop the event propagation to avoid it hiding
|
||||
// the panel because of a click outside of it.
|
||||
// if ( e )
|
||||
// {
|
||||
// e.stopPropagation() ;
|
||||
// FCKPanelEventHandlers.OnDocumentClick( e ) ;
|
||||
// }
|
||||
|
||||
if ( this.State != FCK_TRISTATE_DISABLED )
|
||||
{
|
||||
this.Command.Execute(0, this.DOMDiv.offsetHeight, this.DOMDiv) ;
|
||||
// this.FCKToolbarButton.HandleOnClick( this, e ) ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
FCKToolbarPanelButton.prototype.CreateInstance = function( parentToolbar )
|
||||
{
|
||||
this.DOMDiv = document.createElement( 'div' ) ;
|
||||
this.DOMDiv.className = 'TB_Button_Off' ;
|
||||
|
||||
this.DOMDiv.FCKToolbarButton = this ;
|
||||
|
||||
var sHtml =
|
||||
'<table title="' + this.Tooltip + '" cellspacing="0" cellpadding="0" border="0">' +
|
||||
'<tr>' ;
|
||||
|
||||
if ( this.Style != FCK_TOOLBARITEM_ONLYTEXT )
|
||||
sHtml += '<td class="TB_Icon"><img src="' + this.IconPath + '" width="21" height="21"></td>' ;
|
||||
|
||||
if ( this.Style != FCK_TOOLBARITEM_ONLYICON )
|
||||
sHtml += '<td class="TB_Text" nowrap>' + this.Label + '</td>' ;
|
||||
|
||||
sHtml +=
|
||||
'<td class="TB_ButtonArrow"><img src="' + FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif" width="5" height="3"></td>' +
|
||||
'</tr>' +
|
||||
'</table>' ;
|
||||
|
||||
this.DOMDiv.innerHTML = sHtml ;
|
||||
|
||||
var oCell = parentToolbar.DOMRow.insertCell(-1) ;
|
||||
oCell.appendChild( this.DOMDiv ) ;
|
||||
|
||||
this.RefreshState() ;
|
||||
}
|
||||
|
||||
// The Panel Button works like a normal button so the refresh state functions
|
||||
// defined for the normal button can be reused here.
|
||||
FCKToolbarPanelButton.prototype.RefreshState = FCKToolbarButton.prototype.RefreshState ;
|
||||
FCKToolbarPanelButton.prototype.Enable = FCKToolbarButton.prototype.Enable ;
|
||||
FCKToolbarPanelButton.prototype.Disable = FCKToolbarButton.prototype.Disable ;
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarspecialcombo.js
|
||||
* FCKToolbarSpecialCombo Class: This is a "abstract" base class to be used
|
||||
* by the special combo toolbar elements like font name, font size, paragraph format, etc...
|
||||
*
|
||||
* The following properties and methods must be implemented when inheriting from
|
||||
* this class:
|
||||
* - Property: Command [ The command to be executed ]
|
||||
* - Method: GetLabel() [ Returns the label ]
|
||||
* - CreateItems( targetSpecialCombo ) [ Add all items in the special combo ]
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarSpecialCombo = function()
|
||||
{
|
||||
this.SourceView = false ;
|
||||
this.ContextSensitive = true ;
|
||||
}
|
||||
|
||||
function FCKToolbarSpecialCombo_OnSelect( itemId, item )
|
||||
{
|
||||
this.Command.Execute( itemId, item ) ;
|
||||
}
|
||||
|
||||
FCKToolbarSpecialCombo.prototype.CreateInstance = function( parentToolbar )
|
||||
{
|
||||
this._Combo = new FCKSpecialCombo( this.GetLabel(), this.FieldWidth, this.PanelWidth, this.PanelMaxHeight ) ;
|
||||
|
||||
/*
|
||||
this._Combo.FieldWidth = this.FieldWidth != null ? this.FieldWidth : 100 ;
|
||||
this._Combo.PanelWidth = this.PanelWidth != null ? this.PanelWidth : 150 ;
|
||||
this._Combo.PanelMaxHeight = this.PanelMaxHeight != null ? this.PanelMaxHeight : 150 ;
|
||||
*/
|
||||
|
||||
//this._Combo.Command.Name = this.Command.Name;
|
||||
// this._Combo.Label = this.Label ;
|
||||
this._Combo.Tooltip = this.Tooltip ;
|
||||
this._Combo.Style = this.Style ;
|
||||
|
||||
this.CreateItems( this._Combo ) ;
|
||||
|
||||
this._Combo.Create( parentToolbar.DOMRow.insertCell(-1) ) ;
|
||||
|
||||
this._Combo.Command = this.Command ;
|
||||
|
||||
this._Combo.OnSelect = FCKToolbarSpecialCombo_OnSelect ;
|
||||
}
|
||||
|
||||
function FCKToolbarSpecialCombo_RefreshActiveItems( combo, value )
|
||||
{
|
||||
combo.DeselectAll() ;
|
||||
combo.SelectItem( value ) ;
|
||||
combo.SetLabelById( value ) ;
|
||||
}
|
||||
|
||||
FCKToolbarSpecialCombo.prototype.RefreshState = function()
|
||||
{
|
||||
// Gets the actual state.
|
||||
var eState ;
|
||||
|
||||
// if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
|
||||
// eState = FCK_TRISTATE_DISABLED ;
|
||||
// else
|
||||
// {
|
||||
var sValue = this.Command.GetState() ;
|
||||
|
||||
if ( sValue != FCK_TRISTATE_DISABLED )
|
||||
{
|
||||
eState = FCK_TRISTATE_ON ;
|
||||
|
||||
if ( this.RefreshActiveItems )
|
||||
this.RefreshActiveItems( this._Combo, sValue ) ;
|
||||
else
|
||||
{
|
||||
if ( this._LastValue == sValue )
|
||||
return ;
|
||||
|
||||
this._LastValue = sValue ;
|
||||
|
||||
FCKToolbarSpecialCombo_RefreshActiveItems( this._Combo, sValue ) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
eState = FCK_TRISTATE_DISABLED ;
|
||||
// }
|
||||
|
||||
// If there are no state changes then do nothing and return.
|
||||
if ( eState == this.State ) return ;
|
||||
|
||||
if ( eState == FCK_TRISTATE_DISABLED )
|
||||
{
|
||||
this._Combo.DeselectAll() ;
|
||||
this._Combo.SetLabel( '' ) ;
|
||||
}
|
||||
|
||||
// Sets the actual state.
|
||||
this.State = eState ;
|
||||
|
||||
// Updates the graphical state.
|
||||
this._Combo.SetEnabled( eState != FCK_TRISTATE_DISABLED ) ;
|
||||
}
|
||||
|
||||
FCKToolbarSpecialCombo.prototype.Enable = function()
|
||||
{
|
||||
this.RefreshState() ;
|
||||
}
|
||||
|
||||
FCKToolbarSpecialCombo.prototype.Disable = function()
|
||||
{
|
||||
this.State = FCK_TRISTATE_DISABLED ;
|
||||
this._Combo.DeselectAll() ;
|
||||
this._Combo.SetLabel( '' ) ;
|
||||
this._Combo.SetEnabled( false ) ;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fcktoolbarstylecombo.js
|
||||
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKToolbarStyleCombo = function( tooltip, style )
|
||||
{
|
||||
this.Command = FCKCommands.GetCommand( 'Style' ) ;
|
||||
this.Label = this.GetLabel() ;
|
||||
this.Tooltip = tooltip ? tooltip : this.Label ;
|
||||
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
|
||||
}
|
||||
|
||||
// Inherit from FCKToolbarSpecialCombo.
|
||||
FCKToolbarStyleCombo.prototype = new FCKToolbarSpecialCombo ;
|
||||
|
||||
FCKToolbarStyleCombo.prototype.GetLabel = function()
|
||||
{
|
||||
return FCKLang.Style ;
|
||||
}
|
||||
|
||||
FCKToolbarStyleCombo.prototype.CreateItems = function( targetSpecialCombo )
|
||||
{
|
||||
// Add the Editor Area CSS to the Styles panel so the style classes are previewed correctly.
|
||||
FCKTools.AppendStyleSheet( targetSpecialCombo._Panel.Document, FCKConfig.EditorAreaCSS ) ;
|
||||
|
||||
targetSpecialCombo._Panel.Document.body.className += ' ForceBaseFont' ;
|
||||
|
||||
// For some reason Gecko is blocking inside the "RefreshVisibleItems" function.
|
||||
if ( ! FCKBrowserInfo.IsGecko )
|
||||
targetSpecialCombo.OnBeforeClick = this.RefreshVisibleItems ;
|
||||
|
||||
// Add the styles to the special combo.
|
||||
for ( var s in this.Command.Styles )
|
||||
{
|
||||
var oStyle = this.Command.Styles[s] ;
|
||||
var oItem ;
|
||||
|
||||
if ( oStyle.IsObjectElement )
|
||||
oItem = targetSpecialCombo.AddItem( s, s ) ;
|
||||
else
|
||||
oItem = targetSpecialCombo.AddItem( s, oStyle.GetOpenerTag() + s + oStyle.GetCloserTag() ) ;
|
||||
|
||||
oItem.Style = oStyle ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKToolbarStyleCombo.prototype.RefreshActiveItems = function( targetSpecialCombo )
|
||||
{
|
||||
// Clear the actual selection.
|
||||
targetSpecialCombo.DeselectAll() ;
|
||||
|
||||
// Get the active styles.
|
||||
var aStyles = this.Command.GetActiveStyles() ;
|
||||
|
||||
if ( aStyles.length > 0 )
|
||||
{
|
||||
// Select the active styles in the combo.
|
||||
for ( var i = 0 ; i < aStyles.length ; i++ )
|
||||
targetSpecialCombo.SelectItem( aStyles[i].Name ) ;
|
||||
|
||||
// Set the combo label to the first style in the collection.
|
||||
targetSpecialCombo.SetLabelById( aStyles[0].Name ) ;
|
||||
}
|
||||
else
|
||||
targetSpecialCombo.SetLabel('') ;
|
||||
}
|
||||
|
||||
FCKToolbarStyleCombo.prototype.RefreshVisibleItems = function( targetSpecialCombo )
|
||||
{
|
||||
if ( FCKSelection.GetType() == 'Control' )
|
||||
var sTagName = FCKSelection.GetSelectedElement().tagName ;
|
||||
|
||||
for ( var i in targetSpecialCombo.Items )
|
||||
{
|
||||
var oItem = targetSpecialCombo.Items[i] ;
|
||||
if ( ( sTagName && oItem.Style.Element == sTagName ) || ( ! sTagName && ! oItem.Style.IsObjectElement ) )
|
||||
oItem.style.display = '' ;
|
||||
else
|
||||
oItem.style.display = 'none' ; // For some reason Gecko is blocking here.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckxml_gecko.js
|
||||
* FCKXml Class: class to load and manipulate XML files.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKXml ;
|
||||
|
||||
if ( !( FCKXml = NS.FCKXml ) )
|
||||
{
|
||||
FCKXml = NS.FCKXml = function()
|
||||
{}
|
||||
|
||||
FCKXml.prototype.LoadUrl = function( urlToCall )
|
||||
{
|
||||
var oFCKXml = this ;
|
||||
|
||||
var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
|
||||
oXmlHttp.open( "GET", urlToCall, false ) ;
|
||||
oXmlHttp.send( null ) ;
|
||||
|
||||
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
||||
this.DOMDocument = oXmlHttp.responseXML ;
|
||||
else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
|
||||
this.DOMDocument = oXmlHttp.responseXML ;
|
||||
else
|
||||
alert( 'Error loading "' + urlToCall + '"' ) ;
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectNodes = function( xpath, contextNode )
|
||||
{
|
||||
var aNodeArray = new Array();
|
||||
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
|
||||
if ( xPathResult )
|
||||
{
|
||||
var oNode = xPathResult.iterateNext() ;
|
||||
while( oNode )
|
||||
{
|
||||
aNodeArray[aNodeArray.length] = oNode ;
|
||||
oNode = xPathResult.iterateNext();
|
||||
}
|
||||
}
|
||||
return aNodeArray ;
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
|
||||
{
|
||||
var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
|
||||
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
|
||||
|
||||
if ( xPathResult && xPathResult.singleNodeValue )
|
||||
return xPathResult.singleNodeValue ;
|
||||
else
|
||||
return null ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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: fckxml_ie.js
|
||||
* FCKXml Class: class to load and manipulate XML files.
|
||||
* (IE specific implementation)
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben ([email protected])
|
||||
*/
|
||||
|
||||
var FCKXml ;
|
||||
|
||||
if ( !( FCKXml = NS.FCKXml ) )
|
||||
{
|
||||
FCKXml = NS.FCKXml = function()
|
||||
{
|
||||
this.Error = false ;
|
||||
}
|
||||
|
||||
FCKXml.prototype.LoadUrl = function( urlToCall )
|
||||
{
|
||||
this.Error = false ;
|
||||
|
||||
var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
|
||||
|
||||
if ( !oXmlHttp )
|
||||
{
|
||||
this.Error = true ;
|
||||
return ;
|
||||
}
|
||||
|
||||
oXmlHttp.open( "GET", urlToCall, false ) ;
|
||||
|
||||
oXmlHttp.send( null ) ;
|
||||
|
||||
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
||||
this.DOMDocument = oXmlHttp.responseXML ;
|
||||
else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
|
||||
{
|
||||
this.DOMDocument = FCKTools.CreateXmlObject( 'DOMDocument' ) ;
|
||||
this.DOMDocument.async = false ;
|
||||
this.DOMDocument.resolveExternals = false ;
|
||||
this.DOMDocument.loadXML( oXmlHttp.responseText ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Error = true ;
|
||||
alert( 'Error loading "' + urlToCall + '"' ) ;
|
||||
}
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectNodes = function( xpath, contextNode )
|
||||
{
|
||||
if ( this.Error )
|
||||
return new Array() ;
|
||||
|
||||
if ( contextNode )
|
||||
return contextNode.selectNodes( xpath ) ;
|
||||
else
|
||||
return this.DOMDocument.selectNodes( xpath ) ;
|
||||
}
|
||||
|
||||
FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
|
||||
{
|
||||
if ( this.Error )
|
||||
return ;
|
||||
|
||||
if ( contextNode )
|
||||
return contextNode.selectSingleNode( xpath ) ;
|
||||
else
|
||||
return this.DOMDocument.selectSingleNode( xpath ) ;
|
||||
}
|
||||
}
|
||||
+283
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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 ([email protected])
|
||||
*/
|
||||
|
||||
// ### 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 ( 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 = FCKDocumentProcessors_CreateFakeImage( 'FCK__PageBreak', e ) ;
|
||||
oFakeImage = FCK.InsertElement( oFakeImage ) ;
|
||||
}
|
||||
|
||||
FCKPageBreakCommand.prototype.GetState = function()
|
||||
{
|
||||
return 0 ; // FCK_TRISTATE_OFF
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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 ([email protected])
|
||||
*/
|
||||
|
||||
var FCKNamedCommand = function( commandName )
|
||||
{
|
||||
this.Name = commandName ;
|
||||
}
|
||||
|
||||
FCKNamedCommand.prototype.Execute = function()
|
||||
{
|
||||
FCK.ExecuteNamedCommand( this.Name ) ;
|
||||
}
|
||||
|
||||
FCKNamedCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK.GetNamedCommandState( this.Name ) ;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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 ([email protected])
|
||||
*/
|
||||
|
||||
var FCKPastePlainTextCommand = function()
|
||||
{
|
||||
this.Name = 'PasteText' ;
|
||||
}
|
||||
|
||||
FCKPastePlainTextCommand.prototype.Execute = function()
|
||||
{
|
||||
FCK.PasteAsPlainText() ;
|
||||
}
|
||||
|
||||
FCKPastePlainTextCommand.prototype.GetState = function()
|
||||
{
|
||||
return FCK.GetNamedCommandState( 'Paste' ) ;
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2005 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 ([email protected])
|
||||
*/
|
||||
|
||||
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' ) ;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
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 ;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user