34883c69019f2ab6984a6d6883b88b23a02f2a4b
1 /***************************************************************
4 * (c) 2004 Cau guanabara <caugb@ibest.com.br>
5 * (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This script is a modified version of a script published under the htmlArea License.
26 * A copy of the htmlArea License may be found in the textfile HTMLAREA_LICENSE.txt.
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
31 * Find and Replace Plugin for TYPO3 htmlArea RTE
35 FindReplace
= HTMLArea
.Plugin
.extend({
37 constructor : function(editor
, pluginName
) {
38 this.base(editor
, pluginName
);
42 * This function gets called by the class constructor
44 configurePlugin : function(editor
) {
47 * Registering plugin "About" information
49 var pluginInformation
= {
51 developer
: "Cau Guanabara & Stanislas Rolland",
52 developerUrl
: "mailto:caugb@ibest.com.br",
53 copyrightOwner
: "Cau Guanabara & Stanislas Rolland",
54 sponsor
: "Independent production & Fructifor Inc.",
55 sponsorUrl
: "http://www.netflash.com.br/gb/HA3-rc1/examples/find-replace.html",
58 this.registerPluginInformation(pluginInformation
);
61 * Registering the button
63 var buttonId
= "FindReplace";
64 var buttonConfiguration
= {
66 tooltip
: this.localize("Find and Replace"),
67 action
: "onButtonPress",
70 this.registerButton(buttonConfiguration
);
72 this.popupWidth
= 300;
73 this.popupHeight
= 400;
79 * This function gets called when the button was pressed.
81 * @param object editor: the editor instance
82 * @param string id: the button id or the key
84 * @return boolean false if action is completed
86 onButtonPress : function (editor
, id
, target
) {
87 // Could be a button or its hotkey
88 var buttonId
= this.translateHotKey(id
);
89 buttonId
= buttonId
? buttonId
: id
;
91 var sel
= this.editor
.getSelectedHTML(), param
= null;
93 sel
= sel
.replace(/<[^>]*>/g,"");
94 sel
= sel
.replace(/ /g,"");
97 param
= { fr_pattern
: sel
};
100 this.dialog
= this.openDialog("FindReplace", this.makeUrlFromPopupName("find_replace"), null, param
, {width
:this.popupWidth
, height
:this.popupHeight
});