upgrade tinymce to 1.40

This commit is contained in:
JT Smith 2005-01-30 23:32:49 +00:00
parent 7ceff84e8a
commit 7d9c0268ac
107 changed files with 3717 additions and 492 deletions

View file

@ -0,0 +1,156 @@
/* Import theme specific language pack */
tinyMCE.importPluginLanguagePack('searchreplace', 'uk,se');
function TinyMCE_searchreplace_getControlHTML(control_name) {
switch (control_name) {
case "search":
return '<img id="{$editor_id}_search" src="{$pluginurl}/images/search.gif" title="{$lang_searchreplace_search_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSearch\',true);" />';
case "replace":
return '<img id="{$editor_id}_replace" src="{$pluginurl}/images/replace.gif" title="{$lang_searchreplace_replace_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSearchReplace\',true);" />';
}
return "";
}
/**
* Executes the search/replace commands.
*/
function TinyMCE_searchreplace_execCommand(editor_id, element, command, user_interface, value) {
function defValue(key, default_value) {
value[key] = typeof(value[key]) == "undefined" ? default_value : value[key];
}
function replaceSel(str) {
// Get current selection
if (!tinyMCE.isMSIE) {
var sel = instance.contentWindow.getSelection();
var rng = sel.getRangeAt(0);
} else {
var rng = instance.contentWindow.document.selection.createRange();
}
// Replace current one
if (!tinyMCE.isMSIE) {
rng.deleteContents();
rng.insertNode(rng.createContextualFragment(str));
rng.collapse(false);
} else {
if (rng.item)
rng.item(0).outerHTML = str;
else
rng.pasteHTML(str);
}
}
var instance = tinyMCE.getInstanceById(editor_id);
if (!value)
value = new Array();
// Setup defualt values
defValue("editor_id", editor_id);
defValue("searchstring", "");
defValue("replacestring", null);
defValue("replacemode", "none");
defValue("casesensitive", false);
defValue("backwards", false);
defValue("wrap", false);
defValue("wholeword", false);
// Handle commands
switch (command) {
case "mceResetSearch":
tinyMCE.lastSearchRng = null;
return true;
case "mceSearch":
if (user_interface) {
// Open search dialog
var template = new Array();
if (value['replacestring'] != null) {
template['file'] = '../../plugins/searchreplace/replace.htm'; // Relative to theme
template['width'] = 310;
template['height'] = 180;
} else {
template['file'] = '../../plugins/searchreplace/search.htm'; // Relative to theme
template['width'] = 280;
template['height'] = 180;
}
tinyMCE.openWindow(template, value);
} else {
var win = tinyMCE.getInstanceById(editor_id).contentWindow;
var doc = tinyMCE.getInstanceById(editor_id).contentWindow.document;
// Handle replace current
if (value['replacemode'] == "current") {
replaceSel(value['replacestring']);
// Search next one
value['replacemode'] = "none";
tinyMCE.execInstanceCommand(editor_id, 'mceSearch', user_interface, value, false);
return true;
}
if (tinyMCE.isMSIE) {
var rng = tinyMCE.lastSearchRng ? tinyMCE.lastSearchRng : doc.selection.createRange();
var flags = 0;
if (value['wholeword'])
flags = flags | 2;
if (value['casesensitive'])
flags = flags | 4;
// Handle replace all mode
if (value['replacemode'] == "all") {
while (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
rng.scrollIntoView();
rng.select();
rng.collapse(false);
replaceSel(value['replacestring']);
}
alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));
return true;
}
if (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
rng.scrollIntoView();
rng.select();
rng.collapse(value['backwards']);
tinyMCE.lastSearchRng = rng;
} else
alert(tinyMCE.getLang('lang_searchreplace_notfound'));
} else {
if (value['replacemode'] == "all") {
while (win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false))
replaceSel(value['replacestring']);
alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));
return true;
}
if (!win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false))
alert(tinyMCE.getLang('lang_searchreplace_notfound'));
}
}
return true;
case "mceSearchReplace":
value['replacestring'] = "";
tinyMCE.execInstanceCommand(editor_id, 'mceSearch', user_interface, value, false);
return true;
}
// Pass to next handler in chain
return false;
}
function TinyMCE_searchreplace_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
return true;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

View file

@ -0,0 +1,19 @@
// SE lang variables
tinyMCELang['lang_searchreplace_search_desc'] = 'Sök';
tinyMCELang['lang_searchreplace_searchnext_desc'] = 'Sög igen';
tinyMCELang['lang_searchreplace_replace_desc'] = 'Sök/Ersätt';
tinyMCELang['lang_searchreplace_notfound'] = 'Sökningen är slutförd. Söksträngen kunde inte hittas.';
tinyMCELang['lang_searchreplace_search_title'] = 'Sök';
tinyMCELang['lang_searchreplace_replace_title'] = 'Sök/Ersätt';
tinyMCELang['lang_searchreplace_allreplaced'] = 'Alla träffar på söksträngen ersattes';
tinyMCELang['lang_searchreplace_findwhat'] = 'Sök på';
tinyMCELang['lang_searchreplace_replacewith'] = 'Ersätt med';
tinyMCELang['lang_searchreplace_direction'] = 'Sökriktning';
tinyMCELang['lang_searchreplace_up'] = 'Uppåt';
tinyMCELang['lang_searchreplace_down'] = 'Neråt';
tinyMCELang['lang_searchreplace_case'] = 'Matcha gemener/VERSALER';
tinyMCELang['lang_searchreplace_findnext'] = 'Sök&nbsp;nästa';
tinyMCELang['lang_searchreplace_replace'] = 'Ersätt';
tinyMCELang['lang_searchreplace_replaceall'] = 'Ersätt&nbsp;alla';
tinyMCELang['lang_searchreplace_cancel'] = 'Avbryt';

View file

@ -0,0 +1,19 @@
// UK lang variables
tinyMCELang['lang_searchreplace_search_desc'] = 'Find';
tinyMCELang['lang_searchreplace_searchnext_desc'] = 'Find again';
tinyMCELang['lang_searchreplace_replace_desc'] = 'Find/Replace';
tinyMCELang['lang_searchreplace_notfound'] = 'The search has been compleated. The search string could not be found.';
tinyMCELang['lang_searchreplace_search_title'] = 'Find';
tinyMCELang['lang_searchreplace_replace_title'] = 'Find/Replace';
tinyMCELang['lang_searchreplace_allreplaced'] = 'All occurrences of the search string was replaced.';
tinyMCELang['lang_searchreplace_findwhat'] = 'Find what';
tinyMCELang['lang_searchreplace_replacewith'] = 'Replace with';
tinyMCELang['lang_searchreplace_direction'] = 'Direction';
tinyMCELang['lang_searchreplace_up'] = 'Up';
tinyMCELang['lang_searchreplace_down'] = 'Down';
tinyMCELang['lang_searchreplace_case'] = 'Match case';
tinyMCELang['lang_searchreplace_findnext'] = 'Find&nbsp;next';
tinyMCELang['lang_searchreplace_replace'] = 'Replace';
tinyMCELang['lang_searchreplace_replaceall'] = 'Replace&nbsp;all';
tinyMCELang['lang_searchreplace_cancel'] = 'Cancel';

View file

@ -0,0 +1,18 @@
searchreplace plugin for TinyMCE
-----------------------------
About:
This plugin adds search/replace dialogs to TinyMCE.
Installation instructions:
* Copy the searchreplace directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins).
* Add plugin to TinyMCE plugin option list example: plugins : "searchreplace".
* Add buttons "search,replace" to the button list.
Initialization example:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "searchreplace",
theme_advanced_buttons1_add : "search,replace",
});

View file

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$lang_searchreplace_replace_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript">
<!--
function init() {
var formObj = document.forms[0];
formObj.searchstring.value = tinyMCE.getWindowArg("searchstring");
formObj.replacestring.value = tinyMCE.getWindowArg("replacestring");
formObj.casesensitivebox.checked = tinyMCE.getWindowArg("casesensitive");
formObj.backwards[0].checked = tinyMCE.getWindowArg("backwards");
formObj.backwards[1].checked = !tinyMCE.getWindowArg("backwards");
// formObj.wrapatend.checked = tinyMCE.getWindowArg("wrap");
// formObj.wholeword.checked = tinyMCE.getWindowArg("wholeword");
tinyMCE.execInstanceCommand(tinyMCE.getWindowArg("editor_id"), "mceResetSearch", false, {dummy : ""}, false);
window.focus();
}
function searchNext(replacemode) {
var formObj = document.forms[0];
// Whats the point?
if (formObj.searchstring.value == formObj.replacestring.value)
return;
// Do search
tinyMCE.execInstanceCommand(tinyMCE.getWindowArg("editor_id"), 'mceSearch', false, {
string : formObj.searchstring.value,
replacestring : formObj.replacestring.value,
replacemode : replacemode,
casesensitive : formObj.casesensitivebox.checked,
backwards : formObj.backwards[0].checked
// wrap : formObj.wrapatend.checked,
// wholeword : formObj.wholeword.checked
}, false);
}
function cancelAction() {
top.close();
}
//-->
</script>
</head>
<body onload="init();" style="margin: 4px;">
<form onsubmit="searchNext('none');return false;">
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td>{$lang_searchreplace_findwhat}:&nbsp;</td>
<td><input type="text" name="searchstring" style="width: 200px" /></td>
</tr>
<tr>
<td>{$lang_searchreplace_replacewith}:&nbsp;</td>
<td><input type="text" name="replacestring" style="width: 200px" /></td>
</tr>
<tr>
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>{$lang_searchreplace_direction}:&nbsp;</td>
<td><input name="backwards" class="radio" type="radio" value="true" /></td>
<td>{$lang_searchreplace_up}</td>
<td><input name="backwards" class="radio" type="radio" value="false" /></td>
<td>{$lang_searchreplace_down}</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input class="checkbox" type="checkbox" name="casesensitivebox" value="true" /></td>
<td>{$lang_searchreplace_case}</td>
</tr>
</table></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="4">
<tr>
<td><input name="findBtn" type="button" id="findBtn" value="{$lang_searchreplace_findnext}" onclick="searchNext('none');" /></td>
<td><input name="replaceBtn" type="button" id="replaceBtn" value="{$lang_searchreplace_replace}" onclick="searchNext('current');" /></td>
<td><input name="replaceBtn" type="button" id="replaceAllBtn" value="{$lang_searchreplace_replaceall}" onclick="searchNext('all');" /></td>
<td align="right"><input name="cancelBtn" type="button" id="cancelBtn" value="{$lang_searchreplace_cancel}" onclick="cancelAction();" /></td>
</tr>
</table>
</form>
</body>
</html>

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$lang_searchreplace_search_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript">
<!--
function init() {
var formObj = document.forms[0];
formObj.searchstring.value = tinyMCE.getWindowArg("searchstring");
formObj.casesensitivebox.checked = tinyMCE.getWindowArg("casesensitive");
formObj.backwards[0].checked = tinyMCE.getWindowArg("backwards");
formObj.backwards[1].checked = !tinyMCE.getWindowArg("backwards");
// formObj.wrapatend.checked = tinyMCE.getWindowArg("wrap");
// formObj.wholeword.checked = tinyMCE.getWindowArg("wholeword");
tinyMCE.execInstanceCommand(tinyMCE.getWindowArg("editor_id"), "mceResetSearch", false, {dummy : ""}, false);
window.focus();
}
function searchNext() {
var formObj = document.forms[0];
// Do search
tinyMCE.execInstanceCommand(tinyMCE.getWindowArg("editor_id"), 'mceSearch', false, {
string : formObj.searchstring.value,
casesensitive : formObj.casesensitivebox.checked,
backwards : formObj.backwards[0].checked
// wrap : formObj.wrapatend.checked,
// wholeword : formObj.wholeword.checked
}, false);
}
function cancelAction() {
top.close();
}
//-->
</script>
</head>
<body onload="init();" style="margin: 4px;">
<form onsubmit="searchNext();return false;">
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td>{$lang_searchreplace_findwhat}:&nbsp;<input type="text" name="searchstring" style="width: 200px" /></td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>{$lang_searchreplace_direction}:&nbsp;</td>
<td><input name="backwards" class="radio" type="radio" value="true" /></td>
<td>{$lang_searchreplace_up}</td>
<td><input name="backwards" class="radio" type="radio" value="false" /></td>
<td>{$lang_searchreplace_down}</td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input class="checkbox" type="checkbox" name="casesensitivebox" value="true" /></td>
<td>{$lang_searchreplace_case}</td>
</tr>
</table></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="4">
<tr>
<td><input name="findBtn" type="submit" id="findBtn" value="{$lang_searchreplace_findnext}" /></td>
<td align="right"><input name="cancelBtn" type="button" id="cancelBtn" value="{$lang_searchreplace_cancel}" onclick="cancelAction();" /></td>
</tr>
</table>
</form>
</body>
</html>