first commit
This commit is contained in:
34
stud/FCKeditor/_samples/_plugins/findreplace/fckplugin.js
Normal file
34
stud/FCKeditor/_samples/_plugins/findreplace/fckplugin.js
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: fckplugin.js
|
||||
* This is the sample plugin definition file.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
// Register the related commands.
|
||||
FCKCommands.RegisterCommand( 'My_Find' , new FCKDialogCommand( FCKLang['DlgMyFindTitle'] , FCKLang['DlgMyFindTitle'] , FCKConfig.PluginsPath + 'findreplace/find.html' , 340, 170 ) ) ;
|
||||
FCKCommands.RegisterCommand( 'My_Replace' , new FCKDialogCommand( FCKLang['DlgMyReplaceTitle'], FCKLang['DlgMyReplaceTitle'] , FCKConfig.PluginsPath + 'findreplace/replace.html', 340, 200 ) ) ;
|
||||
|
||||
// Create the "Find" toolbar button.
|
||||
var oFindItem = new FCKToolbarButton( 'My_Find', FCKLang['DlgMyFindTitle'] ) ;
|
||||
oFindItem.IconPath = FCKConfig.PluginsPath + 'findreplace/find.gif' ;
|
||||
|
||||
FCKToolbarItems.RegisterItem( 'My_Find', oFindItem ) ; // 'My_Find' is the name used in the Toolbar config.
|
||||
|
||||
// Create the "Replace" toolbar button.
|
||||
var oReplaceItem = new FCKToolbarButton( 'My_Replace', FCKLang['DlgMyReplaceTitle'] ) ;
|
||||
oReplaceItem.IconPath = FCKConfig.PluginsPath + 'findreplace/replace.gif' ;
|
||||
|
||||
FCKToolbarItems.RegisterItem( 'My_Replace', oReplaceItem ) ; // 'My_Replace' is the name used in the Toolbar config.
|
BIN
stud/FCKeditor/_samples/_plugins/findreplace/find.gif
Normal file
BIN
stud/FCKeditor/_samples/_plugins/findreplace/find.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 595 B |
168
stud/FCKeditor/_samples/_plugins/findreplace/find.html
Normal file
168
stud/FCKeditor/_samples/_plugins/findreplace/find.html
Normal file
@ -0,0 +1,168 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: find.html
|
||||
* This is the sample "Find" plugin window.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta content="noindex, nofollow" name="robots">
|
||||
<script type="text/javascript">
|
||||
|
||||
var oEditor = window.parent.InnerDialogLoaded() ;
|
||||
|
||||
function OnLoad()
|
||||
{
|
||||
// Whole word is available on IE only.
|
||||
if ( oEditor.FCKBrowserInfo.IsIE )
|
||||
document.getElementById('divWord').style.display = '' ;
|
||||
|
||||
// First of all, translate the dialog box texts.
|
||||
oEditor.FCKLanguageManager.TranslatePage( document ) ;
|
||||
|
||||
window.parent.SetAutoSize( true ) ;
|
||||
}
|
||||
|
||||
function btnStat(frm)
|
||||
{
|
||||
document.getElementById('btnFind').disabled =
|
||||
( document.getElementById('txtFind').value.length == 0 ) ;
|
||||
}
|
||||
|
||||
function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll )
|
||||
{
|
||||
for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
|
||||
{
|
||||
var oNode = parentNode.childNodes[i] ;
|
||||
if ( oNode.nodeType == 3 )
|
||||
{
|
||||
var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
|
||||
if ( oNode.nodeValue != sReplaced )
|
||||
{
|
||||
oNode.nodeValue = sReplaced ;
|
||||
if ( ! replaceAll )
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ReplaceTextNodes( oNode, regex, replaceValue ) )
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
function GetRegexExpr()
|
||||
{
|
||||
if ( document.getElementById('chkWord').checked )
|
||||
var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
|
||||
else
|
||||
var sExpr = document.getElementById('txtFind').value ;
|
||||
|
||||
return sExpr ;
|
||||
}
|
||||
|
||||
function GetCase()
|
||||
{
|
||||
return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
|
||||
}
|
||||
|
||||
function Ok()
|
||||
{
|
||||
if ( document.getElementById('txtFind').value.length == 0 )
|
||||
return ;
|
||||
|
||||
if ( oEditor.FCKBrowserInfo.IsIE )
|
||||
FindIE() ;
|
||||
else
|
||||
FindGecko() ;
|
||||
}
|
||||
|
||||
var oRange = null ;
|
||||
|
||||
function FindIE()
|
||||
{
|
||||
if ( oRange == null )
|
||||
oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;
|
||||
|
||||
var iFlags = 0 ;
|
||||
|
||||
if ( chkCase.checked )
|
||||
iFlags = iFlags | 4 ;
|
||||
|
||||
if ( chkWord.checked )
|
||||
iFlags = iFlags | 2 ;
|
||||
|
||||
var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ;
|
||||
|
||||
if ( bFound )
|
||||
{
|
||||
oRange.scrollIntoView() ;
|
||||
oRange.select() ;
|
||||
oRange.collapse(false) ;
|
||||
oLastRangeFound = oRange ;
|
||||
}
|
||||
else
|
||||
{
|
||||
oRange = null ;
|
||||
alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
|
||||
}
|
||||
}
|
||||
|
||||
function FindGecko()
|
||||
{
|
||||
var bCase = document.getElementById('chkCase').checked ;
|
||||
var bWord = document.getElementById('chkWord').checked ;
|
||||
|
||||
// window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
|
||||
oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ;
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
|
||||
<div align="center">
|
||||
This is my Plugin!
|
||||
</div>
|
||||
<table cellSpacing="3" cellPadding="2" width="100%" border="0">
|
||||
<tr>
|
||||
<td nowrap>
|
||||
<label for="txtFind" fckLang="DlgMyReplaceFindLbl">Find what:</label>
|
||||
</td>
|
||||
<td width="100%">
|
||||
<input id="txtFind" onkeyup="btnStat(this.form)" style="WIDTH: 100%" tabIndex="1" type="text">
|
||||
</td>
|
||||
<td>
|
||||
<input id="btnFind" style="WIDTH: 100%; PADDING-RIGHT: 5px; PADDING-LEFT: 5px" disabled
|
||||
onclick="Ok();" type="button" value="Find" fckLang="DlgMyFindFindBtn">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="bottom" colSpan="3">
|
||||
<input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgMyReplaceCaseChk">Match
|
||||
case</label>
|
||||
<br>
|
||||
<div id="divWord" style="DISPLAY: none">
|
||||
<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgMyReplaceWordChk">Match
|
||||
whole word</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
29
stud/FCKeditor/_samples/_plugins/findreplace/lang/en.js
Normal file
29
stud/FCKeditor/_samples/_plugins/findreplace/lang/en.js
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: en.js
|
||||
* English language file for the sample plugin.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
FCKLang['DlgMyReplaceTitle'] = 'Plugin - Replace' ;
|
||||
FCKLang['DlgMyReplaceFindLbl'] = 'Find what:' ;
|
||||
FCKLang['DlgMyReplaceReplaceLbl'] = 'Replace with:' ;
|
||||
FCKLang['DlgMyReplaceCaseChk'] = 'Match case' ;
|
||||
FCKLang['DlgMyReplaceReplaceBtn'] = 'Replace' ;
|
||||
FCKLang['DlgMyReplaceReplAllBtn'] = 'Replace All' ;
|
||||
FCKLang['DlgMyReplaceWordChk'] = 'Match whole word' ;
|
||||
|
||||
FCKLang['DlgMyFindTitle'] = 'Plugin - Find' ;
|
||||
FCKLang['DlgMyFindFindBtn'] = 'Find' ;
|
29
stud/FCKeditor/_samples/_plugins/findreplace/lang/fr.js
Normal file
29
stud/FCKeditor/_samples/_plugins/findreplace/lang/fr.js
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: fr.js
|
||||
* French language file for the sample plugin.
|
||||
*
|
||||
* File Authors:
|
||||
* Benjamin Cartereau (b.cartereau@infass.com)
|
||||
*/
|
||||
|
||||
FCKLang['DlgMyReplaceTitle'] = 'Plugin - Remplacer' ;
|
||||
FCKLang['DlgMyReplaceFindLbl'] = 'Chercher:' ;
|
||||
FCKLang['DlgMyReplaceReplaceLbl'] = 'Remplacer par:' ;
|
||||
FCKLang['DlgMyReplaceCaseChk'] = 'Respecter la casse' ;
|
||||
FCKLang['DlgMyReplaceReplaceBtn'] = 'Remplacer' ;
|
||||
FCKLang['DlgMyReplaceReplAllBtn'] = 'Remplacer Tout' ;
|
||||
FCKLang['DlgMyReplaceWordChk'] = 'Mot entier' ;
|
||||
|
||||
FCKLang['DlgMyFindTitle'] = 'Plugin - Chercher' ;
|
||||
FCKLang['DlgMyFindFindBtn'] = 'Chercher' ;
|
29
stud/FCKeditor/_samples/_plugins/findreplace/lang/it.js
Normal file
29
stud/FCKeditor/_samples/_plugins/findreplace/lang/it.js
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: it.js
|
||||
* Italian language file for the sample plugin.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
*/
|
||||
|
||||
FCKLang['DlgMyReplaceTitle'] = 'Plugin - Sostituisci' ;
|
||||
FCKLang['DlgMyReplaceFindLbl'] = 'Trova:' ;
|
||||
FCKLang['DlgMyReplaceReplaceLbl'] = 'Sostituisci con:' ;
|
||||
FCKLang['DlgMyReplaceCaseChk'] = 'Maiuscole/minuscole' ;
|
||||
FCKLang['DlgMyReplaceReplaceBtn'] = 'Sostituisci' ;
|
||||
FCKLang['DlgMyReplaceReplAllBtn'] = 'Sostituisci tutto' ;
|
||||
FCKLang['DlgMyReplaceWordChk'] = 'Parola intera' ;
|
||||
|
||||
FCKLang['DlgMyFindTitle'] = 'Plugin - Cerca' ;
|
||||
FCKLang['DlgMyFindFindBtn'] = 'Cerca' ;
|
BIN
stud/FCKeditor/_samples/_plugins/findreplace/replace.gif
Normal file
BIN
stud/FCKeditor/_samples/_plugins/findreplace/replace.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 326 B |
131
stud/FCKeditor/_samples/_plugins/findreplace/replace.html
Normal file
131
stud/FCKeditor/_samples/_plugins/findreplace/replace.html
Normal file
@ -0,0 +1,131 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!--
|
||||
* FCKeditor - The text editor for internet
|
||||
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
||||
*
|
||||
* Licensed under the terms of the GNU Lesser General Public License:
|
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* For further information visit:
|
||||
* http://www.fckeditor.net/
|
||||
*
|
||||
* "Support Open Source software. What about a donation today?"
|
||||
*
|
||||
* File Name: replace.html
|
||||
* This is the sample "Replace" plugin window.
|
||||
*
|
||||
* File Authors:
|
||||
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta content="noindex, nofollow" name="robots">
|
||||
<script type="text/javascript">
|
||||
|
||||
var oEditor = window.parent.InnerDialogLoaded() ;
|
||||
|
||||
function OnLoad()
|
||||
{
|
||||
// First of all, translate the dialog box texts
|
||||
oEditor.FCKLanguageManager.TranslatePage( document ) ;
|
||||
|
||||
window.parent.SetAutoSize( true ) ;
|
||||
}
|
||||
|
||||
function btnStat(frm)
|
||||
{
|
||||
document.getElementById('btnReplace').disabled =
|
||||
document.getElementById('btnReplaceAll').disabled =
|
||||
( document.getElementById('txtFind').value.length == 0 ) ;
|
||||
}
|
||||
|
||||
function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll, hasFound )
|
||||
{
|
||||
for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
|
||||
{
|
||||
var oNode = parentNode.childNodes[i] ;
|
||||
if ( oNode.nodeType == 3 )
|
||||
{
|
||||
var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
|
||||
if ( oNode.nodeValue != sReplaced )
|
||||
{
|
||||
oNode.nodeValue = sReplaced ;
|
||||
if ( ! replaceAll )
|
||||
return true ;
|
||||
hasFound = true ;
|
||||
}
|
||||
}
|
||||
|
||||
hasFound = ReplaceTextNodes( oNode, regex, replaceValue, replaceAll, hasFound ) ;
|
||||
if ( ! replaceAll && hasFound )
|
||||
return true ;
|
||||
}
|
||||
|
||||
return hasFound ;
|
||||
}
|
||||
|
||||
function GetRegexExpr()
|
||||
{
|
||||
if ( document.getElementById('chkWord').checked )
|
||||
var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
|
||||
else
|
||||
var sExpr = document.getElementById('txtFind').value ;
|
||||
|
||||
return sExpr ;
|
||||
}
|
||||
|
||||
function GetCase()
|
||||
{
|
||||
return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
|
||||
}
|
||||
|
||||
function Replace()
|
||||
{
|
||||
var oRegex = new RegExp( GetRegexExpr(), GetCase() ) ;
|
||||
ReplaceTextNodes( oEditor.FCK.EditorDocument.body, oRegex, document.getElementById('txtReplace').value, false ) ;
|
||||
}
|
||||
|
||||
function ReplaceAll()
|
||||
{
|
||||
var oRegex = new RegExp( GetRegexExpr(), GetCase() + 'g' ) ;
|
||||
ReplaceTextNodes( oEditor.FCK.EditorDocument.body, oRegex, document.getElementById('txtReplace').value, true ) ;
|
||||
window.parent.Cancel() ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
|
||||
<div align="center">
|
||||
This is my Plugin!
|
||||
</div>
|
||||
<table cellSpacing="3" cellPadding="2" width="100%" border="0">
|
||||
<tr>
|
||||
<td noWrap><label for="txtFind" fckLang="DlgMyReplaceFindLbl">Find what:</label>
|
||||
</td>
|
||||
<td width="100%"><input id="txtFind" onkeyup="btnStat(this.form)" style="WIDTH: 100%" tabIndex="1" type="text">
|
||||
</td>
|
||||
<td><input id="btnReplace" style="WIDTH: 100%" disabled onclick="Replace();" type="button"
|
||||
value="Replace" fckLang="DlgMyReplaceReplaceBtn">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td vAlign="top" nowrap><label for="txtReplace" fckLang="DlgMyReplaceReplaceLbl">Replace
|
||||
with:</label>
|
||||
</td>
|
||||
<td vAlign="top"><input id="txtReplace" style="WIDTH: 100%" tabIndex="2" type="text">
|
||||
</td>
|
||||
<td><input id="btnReplaceAll" disabled onclick="ReplaceAll()" type="button" value="Replace All"
|
||||
fckLang="DlgMyReplaceReplAllBtn">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td vAlign="bottom" colSpan="3"> <input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgMyReplaceCaseChk">Match
|
||||
case</label>
|
||||
<br>
|
||||
<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgMyReplaceWordChk">Match
|
||||
whole word</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user