initial commit
This commit is contained in:
commit
252dac3143
1516 changed files with 694271 additions and 0 deletions
92
FCKeditor/editor/plugins/autogrow/fckplugin.js
Normal file
92
FCKeditor/editor/plugins/autogrow/fckplugin.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Plugin: automatically resizes the editor until a configurable maximun
|
||||
* height (FCKConfig.AutoGrowMax), based on its contents.
|
||||
*/
|
||||
|
||||
var FCKAutoGrow_Min = window.frameElement.offsetHeight ;
|
||||
|
||||
function FCKAutoGrow_Check()
|
||||
{
|
||||
var oInnerDoc = FCK.EditorDocument ;
|
||||
|
||||
var iFrameHeight, iInnerHeight ;
|
||||
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
{
|
||||
iFrameHeight = FCK.EditorWindow.frameElement.offsetHeight ;
|
||||
iInnerHeight = oInnerDoc.body.scrollHeight ;
|
||||
}
|
||||
else
|
||||
{
|
||||
iFrameHeight = FCK.EditorWindow.innerHeight ;
|
||||
iInnerHeight = oInnerDoc.body.offsetHeight ;
|
||||
}
|
||||
|
||||
var iDiff = iInnerHeight - iFrameHeight ;
|
||||
|
||||
if ( iDiff != 0 )
|
||||
{
|
||||
var iMainFrameSize = window.frameElement.offsetHeight ;
|
||||
|
||||
if ( iDiff > 0 && iMainFrameSize < FCKConfig.AutoGrowMax )
|
||||
{
|
||||
iMainFrameSize += iDiff ;
|
||||
if ( iMainFrameSize > FCKConfig.AutoGrowMax )
|
||||
iMainFrameSize = FCKConfig.AutoGrowMax ;
|
||||
}
|
||||
else if ( iDiff < 0 && iMainFrameSize > FCKAutoGrow_Min )
|
||||
{
|
||||
iMainFrameSize += iDiff ;
|
||||
if ( iMainFrameSize < FCKAutoGrow_Min )
|
||||
iMainFrameSize = FCKAutoGrow_Min ;
|
||||
}
|
||||
else
|
||||
return ;
|
||||
|
||||
window.frameElement.height = iMainFrameSize ;
|
||||
}
|
||||
}
|
||||
|
||||
FCK.AttachToOnSelectionChange( FCKAutoGrow_Check ) ;
|
||||
|
||||
function FCKAutoGrow_SetListeners()
|
||||
{
|
||||
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
|
||||
return ;
|
||||
|
||||
FCK.EditorWindow.attachEvent( 'onscroll', FCKAutoGrow_Check ) ;
|
||||
FCK.EditorDocument.attachEvent( 'onkeyup', FCKAutoGrow_Check ) ;
|
||||
}
|
||||
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
{
|
||||
// FCKAutoGrow_SetListeners() ;
|
||||
FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKAutoGrow_SetListeners ) ;
|
||||
}
|
||||
|
||||
function FCKAutoGrow_CheckEditorStatus( sender, status )
|
||||
{
|
||||
if ( status == FCK_STATUS_COMPLETE )
|
||||
FCKAutoGrow_Check() ;
|
||||
}
|
||||
|
||||
FCK.Events.AttachEvent( 'OnStatusChange', FCKAutoGrow_CheckEditorStatus ) ;
|
26
FCKeditor/editor/plugins/bbcode/_sample/sample.config.js
Normal file
26
FCKeditor/editor/plugins/bbcode/_sample/sample.config.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Sample custom configuration settings used by the BBCode plugin. It simply
|
||||
* loads the plugin. All the rest is done by the plugin itself.
|
||||
*/
|
||||
|
||||
// Add the BBCode plugin.
|
||||
FCKConfig.Plugins.Add( 'bbcode' ) ;
|
67
FCKeditor/editor/plugins/bbcode/_sample/sample.html
Normal file
67
FCKeditor/editor/plugins/bbcode/_sample/sample.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Sample page.
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>FCKeditor - BBCode Sample</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<link href="../../../../_samples/sample.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="../../../../fckeditor.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
FCKeditor - BBCode Sample</h1>
|
||||
<p>
|
||||
This is a sample of custom Data Processor implementation for (very) basic BBCode
|
||||
syntax. Only <strong>[b]</strong>, <strong>[i]</strong>, <strong>[u]</strong> and
|
||||
<strong>[url]</strong> may be used. It may be extended, but this is out of this
|
||||
sample purpose.
|
||||
</p>
|
||||
<p>
|
||||
Note that the input and output of the editor is not HTML, but BBCode
|
||||
</p>
|
||||
<hr />
|
||||
<form action="../../../../_samples/html/sampleposteddata.asp" method="post" target="_blank">
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
// Automatically calculates the editor base path based on the _samples directory.
|
||||
// This is usefull only for these samples. A real application should use something like this:
|
||||
// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
|
||||
var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('editor')) ;
|
||||
|
||||
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
|
||||
oFCKeditor.BasePath = sBasePath ;
|
||||
|
||||
// Set the custom configurations file path (in this way the original file is mantained).
|
||||
oFCKeditor.Config['CustomConfigurationsPath'] = sBasePath + 'editor/plugins/bbcode/_sample/sample.config.js' ;
|
||||
|
||||
oFCKeditor.Value = 'This is some [b]sample text[/b]. You are using [url=http://www.fckeditor.net/]FCKeditor[/url].' ;
|
||||
oFCKeditor.Create() ;
|
||||
//-->
|
||||
</script>
|
||||
<br />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
123
FCKeditor/editor/plugins/bbcode/fckplugin.js
Normal file
123
FCKeditor/editor/plugins/bbcode/fckplugin.js
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is a sample implementation for a custom Data Processor for basic BBCode.
|
||||
*/
|
||||
|
||||
FCK.DataProcessor =
|
||||
{
|
||||
/*
|
||||
* Returns a string representing the HTML format of "data". The returned
|
||||
* value will be loaded in the editor.
|
||||
* The HTML must be from <html> to </html>, eventually including
|
||||
* the DOCTYPE.
|
||||
* @param {String} data The data to be converted in the
|
||||
* DataProcessor specific format.
|
||||
*/
|
||||
ConvertToHtml : function( data )
|
||||
{
|
||||
// Convert < and > to their HTML entities.
|
||||
data = data.replace( /</g, '<' ) ;
|
||||
data = data.replace( />/g, '>' ) ;
|
||||
|
||||
// Convert line breaks to <br>.
|
||||
data = data.replace( /(?:\r\n|\n|\r)/g, '<br>' ) ;
|
||||
|
||||
// [url]
|
||||
data = data.replace( /\[url\](.+?)\[\/url]/gi, '<a href="$1">$1</a>' ) ;
|
||||
data = data.replace( /\[url\=([^\]]+)](.+?)\[\/url]/gi, '<a href="$1">$2</a>' ) ;
|
||||
|
||||
// [b]
|
||||
data = data.replace( /\[b\](.+?)\[\/b]/gi, '<b>$1</b>' ) ;
|
||||
|
||||
// [i]
|
||||
data = data.replace( /\[i\](.+?)\[\/i]/gi, '<i>$1</i>' ) ;
|
||||
|
||||
// [u]
|
||||
data = data.replace( /\[u\](.+?)\[\/u]/gi, '<u>$1</u>' ) ;
|
||||
|
||||
return '<html><head><title></title></head><body>' + data + '</body></html>' ;
|
||||
},
|
||||
|
||||
/*
|
||||
* Converts a DOM (sub-)tree to a string in the data format.
|
||||
* @param {Object} rootNode The node that contains the DOM tree to be
|
||||
* converted to the data format.
|
||||
* @param {Boolean} excludeRoot Indicates that the root node must not
|
||||
* be included in the conversion, only its children.
|
||||
* @param {Boolean} format Indicates that the data must be formatted
|
||||
* for human reading. Not all Data Processors may provide it.
|
||||
*/
|
||||
ConvertToDataFormat : function( rootNode, excludeRoot, ignoreIfEmptyParagraph, format )
|
||||
{
|
||||
var data = rootNode.innerHTML ;
|
||||
|
||||
// Convert <br> to line breaks.
|
||||
data = data.replace( /<br(?=[ \/>]).*?>/gi, '\r\n') ;
|
||||
|
||||
// [url]
|
||||
data = data.replace( /<a .*?href=(["'])(.+?)\1.*?>(.+?)<\/a>/gi, '[url=$2]$3[/url]') ;
|
||||
|
||||
// [b]
|
||||
data = data.replace( /<(?:b|strong)>/gi, '[b]') ;
|
||||
data = data.replace( /<\/(?:b|strong)>/gi, '[/b]') ;
|
||||
|
||||
// [i]
|
||||
data = data.replace( /<(?:i|em)>/gi, '[i]') ;
|
||||
data = data.replace( /<\/(?:i|em)>/gi, '[/i]') ;
|
||||
|
||||
// [u]
|
||||
data = data.replace( /<u>/gi, '[u]') ;
|
||||
data = data.replace( /<\/u>/gi, '[/u]') ;
|
||||
|
||||
// Remove remaining tags.
|
||||
data = data.replace( /<[^>]+>/g, '') ;
|
||||
|
||||
return data ;
|
||||
},
|
||||
|
||||
/*
|
||||
* Makes any necessary changes to a piece of HTML for insertion in the
|
||||
* editor selection position.
|
||||
* @param {String} html The HTML to be fixed.
|
||||
*/
|
||||
FixHtml : function( html )
|
||||
{
|
||||
return html ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// This Data Processor doesn't support <p>, so let's use <br>.
|
||||
FCKConfig.EnterMode = 'br' ;
|
||||
|
||||
// To avoid pasting invalid markup (which is discarded in any case), let's
|
||||
// force pasting to plain text.
|
||||
FCKConfig.ForcePasteAsPlainText = true ;
|
||||
|
||||
// Rename the "Source" buttom to "BBCode".
|
||||
FCKToolbarItems.RegisterItem( 'Source', new FCKToolbarButton( 'Source', 'BBCode', null, FCK_TOOLBARITEM_ICONTEXT, true, true, 1 ) ) ;
|
||||
|
||||
// Let's enforce the toolbar to the limits of this Data Processor. A custom
|
||||
// toolbar set may be defined in the configuration file with more or less entries.
|
||||
FCKConfig.ToolbarSets["Default"] = [
|
||||
['Source'],
|
||||
['Bold','Italic','Underline','-','Link'],
|
||||
['About']
|
||||
] ;
|
503
FCKeditor/editor/plugins/dragresizetable/fckplugin.js
Normal file
503
FCKeditor/editor/plugins/dragresizetable/fckplugin.js
Normal file
|
@ -0,0 +1,503 @@
|
|||
var FCKDragTableHandler =
|
||||
{
|
||||
"_DragState" : 0,
|
||||
"_LeftCell" : null,
|
||||
"_RightCell" : null,
|
||||
"_MouseMoveMode" : 0, // 0 - find candidate cells for resizing, 1 - drag to resize
|
||||
"_ResizeBar" : null,
|
||||
"_OriginalX" : null,
|
||||
"_MinimumX" : null,
|
||||
"_MaximumX" : null,
|
||||
"_LastX" : null,
|
||||
"_TableMap" : null,
|
||||
"_IsInsideNode" : function( w, domNode, pos )
|
||||
{
|
||||
var myCoords = FCKTools.GetWindowPosition( w, domNode ) ;
|
||||
var xMin = myCoords.x ;
|
||||
var yMin = myCoords.y ;
|
||||
var xMax = parseInt( xMin, 10 ) + parseInt( domNode.offsetWidth, 10 ) ;
|
||||
var yMax = parseInt( yMin, 10 ) + parseInt( domNode.offsetHeight, 10 ) ;
|
||||
if ( pos.x >= xMin && pos.x <= xMax && pos.y >= yMin && pos.y <= yMax )
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
"_GetBorderCells" : function( w, tableNode, tableMap, mouse )
|
||||
{
|
||||
// Enumerate all the cells in the table.
|
||||
var cells = [] ;
|
||||
for ( var i = 0 ; i < tableNode.rows.length ; i++ )
|
||||
{
|
||||
var r = tableNode.rows[i] ;
|
||||
for ( var j = 0 ; j < r.cells.length ; j++ )
|
||||
cells.push( r.cells[j] ) ;
|
||||
}
|
||||
|
||||
if ( cells.length < 1 )
|
||||
return null ;
|
||||
|
||||
// Get the cells whose right or left border is nearest to the mouse cursor's x coordinate.
|
||||
var minRxDist = null ;
|
||||
var lxDist = null ;
|
||||
var minYDist = null ;
|
||||
var rbCell = null ;
|
||||
var lbCell = null ;
|
||||
for ( var i = 0 ; i < cells.length ; i++ )
|
||||
{
|
||||
var pos = FCKTools.GetWindowPosition( w, cells[i] ) ;
|
||||
var rightX = pos.x + parseInt( cells[i].clientWidth, 10 ) ;
|
||||
var rxDist = mouse.x - rightX ;
|
||||
var yDist = mouse.y - ( pos.y + ( cells[i].clientHeight / 2 ) ) ;
|
||||
if ( minRxDist == null ||
|
||||
( Math.abs( rxDist ) <= Math.abs( minRxDist ) &&
|
||||
( minYDist == null || Math.abs( yDist ) <= Math.abs( minYDist ) ) ) )
|
||||
{
|
||||
minRxDist = rxDist ;
|
||||
minYDist = yDist ;
|
||||
rbCell = cells[i] ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
var rowNode = FCKTools.GetElementAscensor( rbCell, "tr" ) ;
|
||||
var cellIndex = rbCell.cellIndex + 1 ;
|
||||
if ( cellIndex >= rowNode.cells.length )
|
||||
return null ;
|
||||
lbCell = rowNode.cells.item( cellIndex ) ;
|
||||
*/
|
||||
var rowIdx = rbCell.parentNode.rowIndex ;
|
||||
var colIdx = FCKTableHandler._GetCellIndexSpan( tableMap, rowIdx, rbCell ) ;
|
||||
var colSpan = isNaN( rbCell.colSpan ) ? 1 : rbCell.colSpan ;
|
||||
lbCell = tableMap[rowIdx][colIdx + colSpan] ;
|
||||
|
||||
if ( ! lbCell )
|
||||
return null ;
|
||||
|
||||
// Abort if too far from the border.
|
||||
lxDist = mouse.x - FCKTools.GetWindowPosition( w, lbCell ).x ;
|
||||
if ( lxDist < 0 && minRxDist < 0 && minRxDist < -2 )
|
||||
return null ;
|
||||
if ( lxDist > 0 && minRxDist > 0 && lxDist > 3 )
|
||||
return null ;
|
||||
|
||||
return { "leftCell" : rbCell, "rightCell" : lbCell } ;
|
||||
},
|
||||
"_GetResizeBarPosition" : function()
|
||||
{
|
||||
var row = FCKTools.GetElementAscensor( this._RightCell, "tr" ) ;
|
||||
return FCKTableHandler._GetCellIndexSpan( this._TableMap, row.rowIndex, this._RightCell ) ;
|
||||
},
|
||||
"_ResizeBarMouseDownListener" : function( evt )
|
||||
{
|
||||
if ( ! evt )
|
||||
evt = window.event ;
|
||||
if ( FCKDragTableHandler._LeftCell )
|
||||
FCKDragTableHandler._MouseMoveMode = 1 ;
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
FCKDragTableHandler._ResizeBar.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 50 ;
|
||||
else
|
||||
FCKDragTableHandler._ResizeBar.style.opacity = 0.5 ;
|
||||
FCKDragTableHandler._OriginalX = evt.clientX ;
|
||||
|
||||
// Calculate maximum and minimum x-coordinate delta.
|
||||
var borderIndex = FCKDragTableHandler._GetResizeBarPosition() ;
|
||||
var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;
|
||||
var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" );
|
||||
var minX = null ;
|
||||
var maxX = null ;
|
||||
for ( var r = 0 ; r < FCKDragTableHandler._TableMap.length ; r++ )
|
||||
{
|
||||
var leftCell = FCKDragTableHandler._TableMap[r][borderIndex - 1] ;
|
||||
var rightCell = FCKDragTableHandler._TableMap[r][borderIndex] ;
|
||||
var leftPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, leftCell ) ;
|
||||
var rightPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, rightCell ) ;
|
||||
var leftPadding = FCKDragTableHandler._GetCellPadding( table, leftCell ) ;
|
||||
var rightPadding = FCKDragTableHandler._GetCellPadding( table, rightCell ) ;
|
||||
if ( minX == null || leftPosition.x + leftPadding > minX )
|
||||
minX = leftPosition.x + leftPadding ;
|
||||
if ( maxX == null || rightPosition.x + rightCell.clientWidth - rightPadding < maxX )
|
||||
maxX = rightPosition.x + rightCell.clientWidth - rightPadding ;
|
||||
}
|
||||
|
||||
FCKDragTableHandler._MinimumX = minX + offset.x ;
|
||||
FCKDragTableHandler._MaximumX = maxX + offset.x ;
|
||||
FCKDragTableHandler._LastX = null ;
|
||||
},
|
||||
"_ResizeBarMouseUpListener" : function( evt )
|
||||
{
|
||||
if ( ! evt )
|
||||
evt = window.event ;
|
||||
FCKDragTableHandler._MouseMoveMode = 0 ;
|
||||
FCKDragTableHandler._HideResizeBar() ;
|
||||
|
||||
if ( FCKDragTableHandler._LastX == null )
|
||||
return ;
|
||||
|
||||
// Calculate the delta value.
|
||||
var deltaX = FCKDragTableHandler._LastX - FCKDragTableHandler._OriginalX ;
|
||||
|
||||
// Then, build an array of current column width values.
|
||||
// This algorithm can be very slow if the cells have insane colSpan values. (e.g. colSpan=1000).
|
||||
var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" ) ;
|
||||
var colArray = [] ;
|
||||
var tableMap = FCKDragTableHandler._TableMap ;
|
||||
for ( var i = 0 ; i < tableMap.length ; i++ )
|
||||
{
|
||||
for ( var j = 0 ; j < tableMap[i].length ; j++ )
|
||||
{
|
||||
var cell = tableMap[i][j] ;
|
||||
var width = FCKDragTableHandler._GetCellWidth( table, cell ) ;
|
||||
var colSpan = isNaN( cell.colSpan) ? 1 : cell.colSpan ;
|
||||
if ( colArray.length <= j )
|
||||
colArray.push( { width : width / colSpan, colSpan : colSpan } ) ;
|
||||
else
|
||||
{
|
||||
var guessItem = colArray[j] ;
|
||||
if ( guessItem.colSpan > colSpan )
|
||||
{
|
||||
guessItem.width = width / colSpan ;
|
||||
guessItem.colSpan = colSpan ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find out the equivalent column index of the two cells selected for resizing.
|
||||
colIndex = FCKDragTableHandler._GetResizeBarPosition() ;
|
||||
|
||||
// Note that colIndex must be at least 1 here, so it's safe to subtract 1 from it.
|
||||
colIndex-- ;
|
||||
|
||||
// Modify the widths in the colArray according to the mouse coordinate delta value.
|
||||
colArray[colIndex].width += deltaX ;
|
||||
colArray[colIndex + 1].width -= deltaX ;
|
||||
|
||||
// Clear all cell widths, delete all <col> elements from the table.
|
||||
for ( var r = 0 ; r < table.rows.length ; r++ )
|
||||
{
|
||||
var row = table.rows.item( r ) ;
|
||||
for ( var c = 0 ; c < row.cells.length ; c++ )
|
||||
{
|
||||
var cell = row.cells.item( c ) ;
|
||||
cell.width = "" ;
|
||||
cell.style.width = "" ;
|
||||
}
|
||||
}
|
||||
var colElements = table.getElementsByTagName( "col" ) ;
|
||||
for ( var i = colElements.length - 1 ; i >= 0 ; i-- )
|
||||
colElements[i].parentNode.removeChild( colElements[i] ) ;
|
||||
|
||||
// Set new cell widths.
|
||||
var processedCells = [] ;
|
||||
for ( var i = 0 ; i < tableMap.length ; i++ )
|
||||
{
|
||||
for ( var j = 0 ; j < tableMap[i].length ; j++ )
|
||||
{
|
||||
var cell = tableMap[i][j] ;
|
||||
if ( cell._Processed )
|
||||
continue ;
|
||||
if ( tableMap[i][j-1] != cell )
|
||||
cell.width = colArray[j].width ;
|
||||
else
|
||||
cell.width = parseInt( cell.width, 10 ) + parseInt( colArray[j].width, 10 ) ;
|
||||
if ( tableMap[i][j+1] != cell )
|
||||
{
|
||||
processedCells.push( cell ) ;
|
||||
cell._Processed = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( var i = 0 ; i < processedCells.length ; i++ )
|
||||
{
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
processedCells[i].removeAttribute( '_Processed' ) ;
|
||||
else
|
||||
delete processedCells[i]._Processed ;
|
||||
}
|
||||
|
||||
FCKDragTableHandler._LastX = null ;
|
||||
},
|
||||
"_ResizeBarMouseMoveListener" : function( evt )
|
||||
{
|
||||
if ( ! evt )
|
||||
evt = window.event ;
|
||||
if ( FCKDragTableHandler._MouseMoveMode == 0 )
|
||||
return FCKDragTableHandler._MouseFindHandler( FCK, evt ) ;
|
||||
else
|
||||
return FCKDragTableHandler._MouseDragHandler( FCK, evt ) ;
|
||||
},
|
||||
// Calculate the padding of a table cell.
|
||||
// It returns the value of paddingLeft + paddingRight of a table cell.
|
||||
// This function is used, in part, to calculate the width parameter that should be used for setting cell widths.
|
||||
// The equation in question is clientWidth = paddingLeft + paddingRight + width.
|
||||
// So that width = clientWidth - paddingLeft - paddingRight.
|
||||
// The return value of this function must be pixel accurate acorss all supported browsers, so be careful if you need to modify it.
|
||||
"_GetCellPadding" : function( table, cell )
|
||||
{
|
||||
var attrGuess = parseInt( table.cellPadding, 10 ) * 2 ;
|
||||
var cssGuess = null ;
|
||||
if ( typeof( window.getComputedStyle ) == "function" )
|
||||
{
|
||||
var styleObj = window.getComputedStyle( cell, null ) ;
|
||||
cssGuess = parseInt( styleObj.getPropertyValue( "padding-left" ), 10 ) +
|
||||
parseInt( styleObj.getPropertyValue( "padding-right" ), 10 ) ;
|
||||
}
|
||||
else
|
||||
cssGuess = parseInt( cell.currentStyle.paddingLeft, 10 ) + parseInt (cell.currentStyle.paddingRight, 10 ) ;
|
||||
|
||||
var cssRuntime = cell.style.padding ;
|
||||
if ( isFinite( cssRuntime ) )
|
||||
cssGuess = parseInt( cssRuntime, 10 ) * 2 ;
|
||||
else
|
||||
{
|
||||
cssRuntime = cell.style.paddingLeft ;
|
||||
if ( isFinite( cssRuntime ) )
|
||||
cssGuess = parseInt( cssRuntime, 10 ) ;
|
||||
cssRuntime = cell.style.paddingRight ;
|
||||
if ( isFinite( cssRuntime ) )
|
||||
cssGuess += parseInt( cssRuntime, 10 ) ;
|
||||
}
|
||||
|
||||
attrGuess = parseInt( attrGuess, 10 ) ;
|
||||
cssGuess = parseInt( cssGuess, 10 ) ;
|
||||
if ( isNaN( attrGuess ) )
|
||||
attrGuess = 0 ;
|
||||
if ( isNaN( cssGuess ) )
|
||||
cssGuess = 0 ;
|
||||
return Math.max( attrGuess, cssGuess ) ;
|
||||
},
|
||||
// Calculate the real width of the table cell.
|
||||
// The real width of the table cell is the pixel width that you can set to the width attribute of the table cell and after
|
||||
// that, the table cell should be of exactly the same width as before.
|
||||
// The real width of a table cell can be calculated as:
|
||||
// width = clientWidth - paddingLeft - paddingRight.
|
||||
"_GetCellWidth" : function( table, cell )
|
||||
{
|
||||
var clientWidth = cell.clientWidth ;
|
||||
if ( isNaN( clientWidth ) )
|
||||
clientWidth = 0 ;
|
||||
return clientWidth - this._GetCellPadding( table, cell ) ;
|
||||
},
|
||||
"MouseMoveListener" : function( FCK, evt )
|
||||
{
|
||||
if ( FCKDragTableHandler._MouseMoveMode == 0 )
|
||||
return FCKDragTableHandler._MouseFindHandler( FCK, evt ) ;
|
||||
else
|
||||
return FCKDragTableHandler._MouseDragHandler( FCK, evt ) ;
|
||||
},
|
||||
"_MouseFindHandler" : function( FCK, evt )
|
||||
{
|
||||
if ( FCK.MouseDownFlag )
|
||||
return ;
|
||||
var node = evt.srcElement || evt.target ;
|
||||
try
|
||||
{
|
||||
if ( ! node || node.nodeType != 1 )
|
||||
{
|
||||
this._HideResizeBar() ;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
this._HideResizeBar() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
// Since this function might be called from the editing area iframe or the outer fckeditor iframe,
|
||||
// the mouse point coordinates from evt.clientX/Y can have different reference points.
|
||||
// We need to resolve the mouse pointer position relative to the editing area iframe.
|
||||
var mouseX = evt.clientX ;
|
||||
var mouseY = evt.clientY ;
|
||||
if ( node.ownerDocument == document )
|
||||
{
|
||||
var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;
|
||||
mouseX -= offset.x ;
|
||||
mouseY -= offset.y ;
|
||||
}
|
||||
|
||||
|
||||
if ( this._ResizeBar && this._LeftCell )
|
||||
{
|
||||
var leftPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._LeftCell ) ;
|
||||
var rightPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._RightCell ) ;
|
||||
var rxDist = mouseX - ( leftPos.x + this._LeftCell.clientWidth ) ;
|
||||
var lxDist = mouseX - rightPos.x ;
|
||||
var inRangeFlag = false ;
|
||||
if ( lxDist >= 0 && rxDist <= 0 )
|
||||
inRangeFlag = true ;
|
||||
else if ( rxDist > 0 && lxDist <= 3 )
|
||||
inRangeFlag = true ;
|
||||
else if ( lxDist < 0 && rxDist >= -2 )
|
||||
inRangeFlag = true ;
|
||||
if ( inRangeFlag )
|
||||
{
|
||||
this._ShowResizeBar( FCK.EditorWindow,
|
||||
FCKTools.GetElementAscensor( this._LeftCell, "table" ),
|
||||
{ "x" : mouseX, "y" : mouseY } ) ;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
var tagName = node.tagName.toLowerCase() ;
|
||||
if ( tagName != "table" && tagName != "td" && tagName != "th" )
|
||||
{
|
||||
if ( this._LeftCell )
|
||||
this._LeftCell = this._RightCell = this._TableMap = null ;
|
||||
this._HideResizeBar() ;
|
||||
return ;
|
||||
}
|
||||
node = FCKTools.GetElementAscensor( node, "table" ) ;
|
||||
var tableMap = FCKTableHandler._CreateTableMap( node ) ;
|
||||
var cellTuple = this._GetBorderCells( FCK.EditorWindow, node, tableMap, { "x" : mouseX, "y" : mouseY } ) ;
|
||||
|
||||
if ( cellTuple == null )
|
||||
{
|
||||
if ( this._LeftCell )
|
||||
this._LeftCell = this._RightCell = this._TableMap = null ;
|
||||
this._HideResizeBar() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._LeftCell = cellTuple["leftCell"] ;
|
||||
this._RightCell = cellTuple["rightCell"] ;
|
||||
this._TableMap = tableMap ;
|
||||
this._ShowResizeBar( FCK.EditorWindow,
|
||||
FCKTools.GetElementAscensor( this._LeftCell, "table" ),
|
||||
{ "x" : mouseX, "y" : mouseY } ) ;
|
||||
}
|
||||
},
|
||||
"_MouseDragHandler" : function( FCK, evt )
|
||||
{
|
||||
var mouse = { "x" : evt.clientX, "y" : evt.clientY } ;
|
||||
|
||||
// Convert mouse coordinates in reference to the outer iframe.
|
||||
var node = evt.srcElement || evt.target ;
|
||||
if ( node.ownerDocument == FCK.EditorDocument )
|
||||
{
|
||||
var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;
|
||||
mouse.x += offset.x ;
|
||||
mouse.y += offset.y ;
|
||||
}
|
||||
|
||||
// Calculate the mouse position delta and see if we've gone out of range.
|
||||
if ( mouse.x >= this._MaximumX - 5 )
|
||||
mouse.x = this._MaximumX - 5 ;
|
||||
if ( mouse.x <= this._MinimumX + 5 )
|
||||
mouse.x = this._MinimumX + 5 ;
|
||||
|
||||
var docX = mouse.x + FCKTools.GetScrollPosition( window ).X ;
|
||||
this._ResizeBar.style.left = ( docX - this._ResizeBar.offsetWidth / 2 ) + "px" ;
|
||||
this._LastX = mouse.x ;
|
||||
},
|
||||
"_ShowResizeBar" : function( w, table, mouse )
|
||||
{
|
||||
if ( this._ResizeBar == null )
|
||||
{
|
||||
this._ResizeBar = document.createElement( "div" ) ;
|
||||
var paddingBar = this._ResizeBar ;
|
||||
var paddingStyles = { 'position' : 'absolute', 'cursor' : 'e-resize' } ;
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
paddingStyles.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=10,enabled=true)" ;
|
||||
else
|
||||
paddingStyles.opacity = 0.10 ;
|
||||
FCKDomTools.SetElementStyles( paddingBar, paddingStyles ) ;
|
||||
document.body.appendChild( paddingBar ) ;
|
||||
FCKTools.AddEventListener( paddingBar, "mousemove", this._ResizeBarMouseMoveListener ) ;
|
||||
FCKTools.AddEventListener( paddingBar, "mousedown", this._ResizeBarMouseDownListener ) ;
|
||||
FCKTools.AddEventListener( document, "mouseup", this._ResizeBarMouseUpListener ) ;
|
||||
FCKTools.AddEventListener( FCK.EditorDocument, "mouseup", this._ResizeBarMouseUpListener ) ;
|
||||
|
||||
// IE doesn't let the tranparent part of the padding block to receive mouse events unless there's something inside.
|
||||
// So we need to create a spacer image to fill the block up.
|
||||
var filler = document.createElement( "img" ) ;
|
||||
filler.border = 0 ;
|
||||
filler.src = FCKConfig.BasePath + "images/spacer.gif" ;
|
||||
filler.style.position = "absolute" ;
|
||||
paddingBar.appendChild( filler ) ;
|
||||
|
||||
// Disable drag and drop, and selection for the filler image.
|
||||
var disabledListener = function( evt )
|
||||
{
|
||||
if ( ! evt )
|
||||
evt = window.event ;
|
||||
if ( evt.preventDefault )
|
||||
evt.preventDefault() ;
|
||||
else
|
||||
evt.returnValue = false ;
|
||||
}
|
||||
FCKTools.AddEventListener( filler, "dragstart", disabledListener ) ;
|
||||
FCKTools.AddEventListener( filler, "selectstart", disabledListener ) ;
|
||||
}
|
||||
|
||||
var paddingBar = this._ResizeBar ;
|
||||
var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;
|
||||
var tablePos = FCKTools.GetWindowPosition( w, table ) ;
|
||||
var barHeight = table.offsetHeight ;
|
||||
var barTop = offset.y + tablePos.y ;
|
||||
// Do not let the resize bar intrude into the toolbar area.
|
||||
if ( tablePos.y < 0 )
|
||||
{
|
||||
barHeight += tablePos.y ;
|
||||
barTop -= tablePos.y ;
|
||||
}
|
||||
var bw = parseInt( table.border, 10 ) ;
|
||||
if ( isNaN( bw ) )
|
||||
bw = 0 ;
|
||||
var cs = parseInt( table.cellSpacing, 10 ) ;
|
||||
if ( isNaN( cs ) )
|
||||
cs = 0 ;
|
||||
var barWidth = Math.max( bw+100, cs+100 ) ;
|
||||
var paddingStyles =
|
||||
{
|
||||
'top' : barTop + 'px',
|
||||
'height' : barHeight + 'px',
|
||||
'width' : barWidth + 'px',
|
||||
'left' : ( offset.x + mouse.x + FCKTools.GetScrollPosition( w ).X - barWidth / 2 ) + 'px'
|
||||
} ;
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
paddingBar.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 10 ;
|
||||
else
|
||||
paddingStyles.opacity = 0.1 ;
|
||||
|
||||
FCKDomTools.SetElementStyles( paddingBar, paddingStyles ) ;
|
||||
var filler = paddingBar.getElementsByTagName( "img" )[0] ;
|
||||
|
||||
FCKDomTools.SetElementStyles( filler,
|
||||
{
|
||||
width : paddingBar.offsetWidth + 'px',
|
||||
height : barHeight + 'px'
|
||||
} ) ;
|
||||
|
||||
barWidth = Math.max( bw, cs, 3 ) ;
|
||||
var visibleBar = null ;
|
||||
if ( paddingBar.getElementsByTagName( "div" ).length < 1 )
|
||||
{
|
||||
visibleBar = document.createElement( "div" ) ;
|
||||
paddingBar.appendChild( visibleBar ) ;
|
||||
}
|
||||
else
|
||||
visibleBar = paddingBar.getElementsByTagName( "div" )[0] ;
|
||||
|
||||
FCKDomTools.SetElementStyles( visibleBar,
|
||||
{
|
||||
position : 'absolute',
|
||||
backgroundColor : 'blue',
|
||||
width : barWidth + 'px',
|
||||
height : barHeight + 'px',
|
||||
left : '50px',
|
||||
top : '0px'
|
||||
} ) ;
|
||||
},
|
||||
"_HideResizeBar" : function()
|
||||
{
|
||||
if ( this._ResizeBar )
|
||||
// IE bug: display : none does not hide the resize bar for some reason.
|
||||
// so set the position to somewhere invisible.
|
||||
FCKDomTools.SetElementStyles( this._ResizeBar,
|
||||
{
|
||||
top : '-100000px',
|
||||
left : '-100000px'
|
||||
} ) ;
|
||||
}
|
||||
};
|
||||
|
||||
FCK.Events.AttachEvent( "OnMouseMove", FCKDragTableHandler.MouseMoveListener ) ;
|
100
FCKeditor/editor/plugins/placeholder/fck_placeholder.html
Normal file
100
FCKeditor/editor/plugins/placeholder/fck_placeholder.html
Normal file
|
@ -0,0 +1,100 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Placeholder Plugin.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Placeholder Properties</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta content="noindex, nofollow" name="robots">
|
||||
<script language="javascript">
|
||||
|
||||
var oEditor = window.parent.InnerDialogLoaded() ;
|
||||
var FCKLang = oEditor.FCKLang ;
|
||||
var FCKPlaceholders = oEditor.FCKPlaceholders ;
|
||||
|
||||
window.onload = function ()
|
||||
{
|
||||
// First of all, translate the dialog box texts
|
||||
oEditor.FCKLanguageManager.TranslatePage( document ) ;
|
||||
|
||||
LoadSelected() ;
|
||||
|
||||
// Show the "Ok" button.
|
||||
window.parent.SetOkButton( true ) ;
|
||||
}
|
||||
|
||||
var eSelected = oEditor.FCKSelection.GetSelectedElement() ;
|
||||
|
||||
function LoadSelected()
|
||||
{
|
||||
if ( !eSelected )
|
||||
return ;
|
||||
|
||||
if ( eSelected.tagName == 'SPAN' && eSelected._fckplaceholder )
|
||||
document.getElementById('txtName').value = eSelected._fckplaceholder ;
|
||||
else
|
||||
eSelected == null ;
|
||||
}
|
||||
|
||||
function Ok()
|
||||
{
|
||||
var sValue = document.getElementById('txtName').value ;
|
||||
|
||||
if ( eSelected && eSelected._fckplaceholder == sValue )
|
||||
return true ;
|
||||
|
||||
if ( sValue.length == 0 )
|
||||
{
|
||||
alert( FCKLang.PlaceholderErrNoName ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
if ( FCKPlaceholders.Exist( sValue ) )
|
||||
{
|
||||
alert( FCKLang.PlaceholderErrNameInUse ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
FCKPlaceholders.Add( sValue ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body scroll="no" style="OVERFLOW: hidden">
|
||||
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table cellSpacing="0" cellPadding="0" align="center" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<span fckLang="PlaceholderDlgName">Placeholder Name</span><br>
|
||||
<input id="txtName" type="text">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
187
FCKeditor/editor/plugins/placeholder/fckplugin.js
Normal file
187
FCKeditor/editor/plugins/placeholder/fckplugin.js
Normal file
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Plugin to insert "Placeholders" in the editor.
|
||||
*/
|
||||
|
||||
// Register the related command.
|
||||
FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 170 ) ) ;
|
||||
|
||||
// Create the "Plaholder" toolbar button.
|
||||
var oPlaceholderItem = new FCKToolbarButton( 'Placeholder', FCKLang.PlaceholderBtn ) ;
|
||||
oPlaceholderItem.IconPath = FCKPlugins.Items['placeholder'].Path + 'placeholder.gif' ;
|
||||
|
||||
FCKToolbarItems.RegisterItem( 'Placeholder', oPlaceholderItem ) ;
|
||||
|
||||
|
||||
// The object used for all Placeholder operations.
|
||||
var FCKPlaceholders = new Object() ;
|
||||
|
||||
// Add a new placeholder at the actual selection.
|
||||
FCKPlaceholders.Add = function( name )
|
||||
{
|
||||
var oSpan = FCK.InsertElement( 'span' ) ;
|
||||
this.SetupSpan( oSpan, name ) ;
|
||||
}
|
||||
|
||||
FCKPlaceholders.SetupSpan = function( span, name )
|
||||
{
|
||||
span.innerHTML = '[[ ' + name + ' ]]' ;
|
||||
|
||||
span.style.backgroundColor = '#ffff00' ;
|
||||
span.style.color = '#000000' ;
|
||||
|
||||
if ( FCKBrowserInfo.IsGecko )
|
||||
span.style.cursor = 'default' ;
|
||||
|
||||
span._fckplaceholder = name ;
|
||||
span.contentEditable = false ;
|
||||
|
||||
// To avoid it to be resized.
|
||||
span.onresizestart = function()
|
||||
{
|
||||
FCK.EditorWindow.event.returnValue = false ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// On Gecko we must do this trick so the user select all the SPAN when clicking on it.
|
||||
FCKPlaceholders._SetupClickListener = function()
|
||||
{
|
||||
FCKPlaceholders._ClickListener = function( e )
|
||||
{
|
||||
if ( e.target.tagName == 'SPAN' && e.target._fckplaceholder )
|
||||
FCKSelection.SelectNode( e.target ) ;
|
||||
}
|
||||
|
||||
FCK.EditorDocument.addEventListener( 'click', FCKPlaceholders._ClickListener, true ) ;
|
||||
}
|
||||
|
||||
// Open the Placeholder dialog on double click.
|
||||
FCKPlaceholders.OnDoubleClick = function( span )
|
||||
{
|
||||
if ( span.tagName == 'SPAN' && span._fckplaceholder )
|
||||
FCKCommands.GetCommand( 'Placeholder' ).Execute() ;
|
||||
}
|
||||
|
||||
FCK.RegisterDoubleClickHandler( FCKPlaceholders.OnDoubleClick, 'SPAN' ) ;
|
||||
|
||||
// Check if a Placholder name is already in use.
|
||||
FCKPlaceholders.Exist = function( name )
|
||||
{
|
||||
var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' ) ;
|
||||
|
||||
for ( var i = 0 ; i < aSpans.length ; i++ )
|
||||
{
|
||||
if ( aSpans[i]._fckplaceholder == name )
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
if ( FCKBrowserInfo.IsIE )
|
||||
{
|
||||
FCKPlaceholders.Redraw = function()
|
||||
{
|
||||
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
|
||||
return ;
|
||||
|
||||
var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ;
|
||||
if ( !aPlaholders )
|
||||
return ;
|
||||
|
||||
var oRange = FCK.EditorDocument.body.createTextRange() ;
|
||||
|
||||
for ( var i = 0 ; i < aPlaholders.length ; i++ )
|
||||
{
|
||||
if ( oRange.findText( aPlaholders[i] ) )
|
||||
{
|
||||
var sName = aPlaholders[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ;
|
||||
oRange.pasteHTML( '<span style="color: #000000; background-color: #ffff00" contenteditable="false" _fckplaceholder="' + sName + '">' + aPlaholders[i] + '</span>' ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FCKPlaceholders.Redraw = function()
|
||||
{
|
||||
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
|
||||
return ;
|
||||
|
||||
var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKPlaceholders._AcceptNode, true ) ;
|
||||
|
||||
var aNodes = new Array() ;
|
||||
|
||||
while ( ( oNode = oInteractor.nextNode() ) )
|
||||
{
|
||||
aNodes[ aNodes.length ] = oNode ;
|
||||
}
|
||||
|
||||
for ( var n = 0 ; n < aNodes.length ; n++ )
|
||||
{
|
||||
var aPieces = aNodes[n].nodeValue.split( /(\[\[[^\[\]]+\]\])/g ) ;
|
||||
|
||||
for ( var i = 0 ; i < aPieces.length ; i++ )
|
||||
{
|
||||
if ( aPieces[i].length > 0 )
|
||||
{
|
||||
if ( aPieces[i].indexOf( '[[' ) == 0 )
|
||||
{
|
||||
var sName = aPieces[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ;
|
||||
|
||||
var oSpan = FCK.EditorDocument.createElement( 'span' ) ;
|
||||
FCKPlaceholders.SetupSpan( oSpan, sName ) ;
|
||||
|
||||
aNodes[n].parentNode.insertBefore( oSpan, aNodes[n] ) ;
|
||||
}
|
||||
else
|
||||
aNodes[n].parentNode.insertBefore( FCK.EditorDocument.createTextNode( aPieces[i] ) , aNodes[n] ) ;
|
||||
}
|
||||
}
|
||||
|
||||
aNodes[n].parentNode.removeChild( aNodes[n] ) ;
|
||||
}
|
||||
|
||||
FCKPlaceholders._SetupClickListener() ;
|
||||
}
|
||||
|
||||
FCKPlaceholders._AcceptNode = function( node )
|
||||
{
|
||||
if ( /\[\[[^\[\]]+\]\]/.test( node.nodeValue ) )
|
||||
return NodeFilter.FILTER_ACCEPT ;
|
||||
else
|
||||
return NodeFilter.FILTER_SKIP ;
|
||||
}
|
||||
}
|
||||
|
||||
FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKPlaceholders.Redraw ) ;
|
||||
|
||||
// We must process the SPAN tags to replace then with the real resulting value of the placeholder.
|
||||
FCKXHtml.TagProcessors['span'] = function( node, htmlNode )
|
||||
{
|
||||
if ( htmlNode._fckplaceholder )
|
||||
node = FCKXHtml.XML.createTextNode( '[[' + htmlNode._fckplaceholder + ']]' ) ;
|
||||
else
|
||||
FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
|
||||
|
||||
return node ;
|
||||
}
|
27
FCKeditor/editor/plugins/placeholder/lang/de.js
Normal file
27
FCKeditor/editor/plugins/placeholder/lang/de.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Placholder German language file.
|
||||
*/
|
||||
FCKLang.PlaceholderBtn = 'Einfügen/editieren Platzhalter' ;
|
||||
FCKLang.PlaceholderDlgTitle = 'Platzhalter Eigenschaften' ;
|
||||
FCKLang.PlaceholderDlgName = 'Platzhalter Name' ;
|
||||
FCKLang.PlaceholderErrNoName = 'Bitte den Namen des Platzhalters schreiben' ;
|
||||
FCKLang.PlaceholderErrNameInUse = 'Der angegebene Namen ist schon in Gebrauch' ;
|
27
FCKeditor/editor/plugins/placeholder/lang/en.js
Normal file
27
FCKeditor/editor/plugins/placeholder/lang/en.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Placholder English language file.
|
||||
*/
|
||||
FCKLang.PlaceholderBtn = 'Insert/Edit Placeholder' ;
|
||||
FCKLang.PlaceholderDlgTitle = 'Placeholder Properties' ;
|
||||
FCKLang.PlaceholderDlgName = 'Placeholder Name' ;
|
||||
FCKLang.PlaceholderErrNoName = 'Please type the placeholder name' ;
|
||||
FCKLang.PlaceholderErrNameInUse = 'The specified name is already in use' ;
|
27
FCKeditor/editor/plugins/placeholder/lang/fr.js
Normal file
27
FCKeditor/editor/plugins/placeholder/lang/fr.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Placeholder French language file.
|
||||
*/
|
||||
FCKLang.PlaceholderBtn = "Insérer/Modifier l'Espace réservé" ;
|
||||
FCKLang.PlaceholderDlgTitle = "Propriétés de l'Espace réservé" ;
|
||||
FCKLang.PlaceholderDlgName = "Nom de l'Espace réservé" ;
|
||||
FCKLang.PlaceholderErrNoName = "Veuillez saisir le nom de l'Espace réservé" ;
|
||||
FCKLang.PlaceholderErrNameInUse = "Ce nom est déjà utilisé" ;
|
27
FCKeditor/editor/plugins/placeholder/lang/it.js
Normal file
27
FCKeditor/editor/plugins/placeholder/lang/it.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Placholder Italian language file.
|
||||
*/
|
||||
FCKLang.PlaceholderBtn = 'Aggiungi/Modifica Placeholder' ;
|
||||
FCKLang.PlaceholderDlgTitle = 'Proprietà del Placeholder' ;
|
||||
FCKLang.PlaceholderDlgName = 'Nome del Placeholder' ;
|
||||
FCKLang.PlaceholderErrNoName = 'Digitare il nome del placeholder' ;
|
||||
FCKLang.PlaceholderErrNameInUse = 'Il nome inserito è già in uso' ;
|
27
FCKeditor/editor/plugins/placeholder/lang/pl.js
Normal file
27
FCKeditor/editor/plugins/placeholder/lang/pl.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* Placholder Polish language file.
|
||||
*/
|
||||
FCKLang.PlaceholderBtn = 'Wstaw/Edytuj nagłówek' ;
|
||||
FCKLang.PlaceholderDlgTitle = 'Właśności nagłówka' ;
|
||||
FCKLang.PlaceholderDlgName = 'Nazwa nagłówka' ;
|
||||
FCKLang.PlaceholderErrNoName = 'Proszę wprowadzić nazwę nagłówka' ;
|
||||
FCKLang.PlaceholderErrNameInUse = 'Podana nazwa jest już w użyciu' ;
|
BIN
FCKeditor/editor/plugins/placeholder/placeholder.gif
Normal file
BIN
FCKeditor/editor/plugins/placeholder/placeholder.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 B |
29
FCKeditor/editor/plugins/simplecommands/fckplugin.js
Normal file
29
FCKeditor/editor/plugins/simplecommands/fckplugin.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This plugin register Toolbar items for the combos modifying the style to
|
||||
* not show the box.
|
||||
*/
|
||||
|
||||
FCKToolbarItems.RegisterItem( 'SourceSimple' , new FCKToolbarButton( 'Source', FCKLang.Source, null, FCK_TOOLBARITEM_ONLYICON, true, true, 1 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'StyleSimple' , new FCKToolbarStyleCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'FontNameSimple' , new FCKToolbarFontsCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'FontSizeSimple' , new FCKToolbarFontSizeCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'FontFormatSimple', new FCKToolbarFontFormatCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
|
33
FCKeditor/editor/plugins/tablecommands/fckplugin.js
Normal file
33
FCKeditor/editor/plugins/tablecommands/fckplugin.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This plugin register the required Toolbar items to be able to insert the
|
||||
* table commands in the toolbar.
|
||||
*/
|
||||
|
||||
FCKToolbarItems.RegisterItem( 'TableInsertRowAfter' , new FCKToolbarButton( 'TableInsertRowAfter' , FCKLang.InsertRowAfter, null, null, null, true, 62 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableDeleteRows' , new FCKToolbarButton( 'TableDeleteRows' , FCKLang.DeleteRows, null, null, null, true, 63 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableInsertColumnAfter' , new FCKToolbarButton( 'TableInsertColumnAfter' , FCKLang.InsertColumnAfter, null, null, null, true, 64 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableDeleteColumns' , new FCKToolbarButton( 'TableDeleteColumns', FCKLang.DeleteColumns, null, null, null, true, 65 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableInsertCellAfter' , new FCKToolbarButton( 'TableInsertCellAfter' , FCKLang.InsertCellAfter, null, null, null, true, 58 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableDeleteCells' , new FCKToolbarButton( 'TableDeleteCells' , FCKLang.DeleteCells, null, null, null, true, 59 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableMergeCells' , new FCKToolbarButton( 'TableMergeCells' , FCKLang.MergeCells, null, null, null, true, 60 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableHorizontalSplitCell' , new FCKToolbarButton( 'TableHorizontalSplitCell' , FCKLang.SplitCell, null, null, null, true, 61 ) ) ;
|
||||
FCKToolbarItems.RegisterItem( 'TableCellProp' , new FCKToolbarButton( 'TableCellProp' , FCKLang.CellProperties, null, null, null, true, 57 ) ) ;
|
Loading…
Add table
Add a link
Reference in a new issue