ca = f[m + '_panel_casesensitivebox'].checked;\r
rs = f['replace_panel_replacestring'].value;\r
\r
+ if (s == '')\r
+ return;\r
+\r
function fix() {\r
// Correct Firefox graphics glitches\r
r = se.getRng().cloneRange();\r
\r
switch (a) {\r
case 'all':\r
+ // Move caret to beginning of text\r
+ ed.execCommand('SelectAll');\r
+ ed.selection.collapse(true);\r
+\r
if (tinymce.isIE) {\r
while (r.findText(s, b ? -1 : 1, fl)) {\r
r.scrollIntoView();\r
r.select();\r
replace();\r
fo = 1;\r
+\r
+ if (b) {\r
+ r.moveEnd("character", -(rs.length)); // Otherwise will loop forever\r
+ }\r
}\r
\r
tinyMCEPopup.storeSelection();\r
}\r
\r
if (fo)\r
- wm.alert(ed.getLang('searchreplace_dlg.allreplaced'));\r
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced'));\r
else\r
- wm.alert(ed.getLang('searchreplace_dlg.notfound'));\r
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));\r
\r
return;\r
\r
case 'current':\r
- replace();\r
+ if (!ed.selection.isCollapsed())\r
+ replace();\r
+\r
break;\r
}\r
\r
r.scrollIntoView();\r
r.select();\r
} else\r
- wm.alert(ed.getLang('searchreplace_dlg.notfound'));\r
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));\r
\r
tinyMCEPopup.storeSelection();\r
} else {\r
if (!w.find(s, ca, b, false, false, false, false))\r
- wm.alert(ed.getLang('searchreplace_dlg.notfound'));\r
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));\r
else\r
fix();\r
}\r