summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/searchreplace
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/tiny_mce/plugins/searchreplace')
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js19
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/searchreplace.htm1
3 files changed, 15 insertions, 7 deletions
diff --git a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
index 7fd913b2b..c3f8358c6 100644
--- a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.SearchReplacePlugin);})(); \ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:160+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js
index 890eb37f1..a8585cccc 100644
--- a/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js
+++ b/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js
@@ -42,6 +42,9 @@ var SearchReplaceDialog = {
ca = f[m + '_panel_casesensitivebox'].checked;
rs = f['replace_panel_replacestring'].value;
+ if (s == '')
+ return;
+
function fix() {
// Correct Firefox graphics glitches
r = se.getRng().cloneRange();
@@ -62,6 +65,10 @@ var SearchReplaceDialog = {
switch (a) {
case 'all':
+ // Move caret to beginning of text
+ ed.execCommand('SelectAll');
+ ed.selection.collapse(true);
+
if (tinymce.isIE) {
while (r.findText(s, b ? -1 : 1, fl)) {
r.scrollIntoView();
@@ -79,14 +86,16 @@ var SearchReplaceDialog = {
}
if (fo)
- wm.alert(ed.getLang('searchreplace_dlg.allreplaced'));
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced'));
else
- wm.alert(ed.getLang('searchreplace_dlg.notfound'));
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
return;
case 'current':
- replace();
+ if (!ed.selection.isCollapsed())
+ replace();
+
break;
}
@@ -102,12 +111,12 @@ var SearchReplaceDialog = {
r.scrollIntoView();
r.select();
} else
- wm.alert(ed.getLang('searchreplace_dlg.notfound'));
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
tinyMCEPopup.storeSelection();
} else {
if (!w.find(s, ca, b, false, false, false, false))
- wm.alert(ed.getLang('searchreplace_dlg.notfound'));
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
else
fix();
}
diff --git a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
index 9c95a6a30..0b42486b6 100644
--- a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
+++ b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
@@ -7,7 +7,6 @@
<script type="text/javascript" src="../../utils/form_utils.js"></script>
<script type="text/javascript" src="js/searchreplace.js"></script>
<link rel="stylesheet" type="text/css" href="css/searchreplace.css" />
- <base target="_self" />
</head>
<body style="display:none;">
<form onsubmit="SearchReplaceDialog.searchNext('none');return false;" action="#">