From 942ff1f80faadff2c045c23176c215de77b7a9d5 Mon Sep 17 00:00:00 2001 From: Len Kranendonk Date: Fri, 9 May 2003 11:41:02 +0000 Subject: [PATCH] Added Find / Replace functionality --- www/extras/htmlArea/editor.js | 44 +++++++- www/extras/htmlArea/images/ed_find.gif | Bin 0 -> 900 bytes www/extras/htmlArea/popups/find.html | 134 +++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 www/extras/htmlArea/images/ed_find.gif create mode 100644 www/extras/htmlArea/popups/find.html diff --git a/www/extras/htmlArea/editor.js b/www/extras/htmlArea/editor.js index ed76f80ef..e1d86af75 100644 --- a/www/extras/htmlArea/editor.js +++ b/www/extras/htmlArea/editor.js @@ -42,8 +42,9 @@ this.toolbar = [ ['fontsize'], // ['fontstyle'], // ['linebreak'], + ['find','separator'], ['bold','italic','underline','separator'], -// ['strikethrough','subscript','superscript','separator'], + ['strikethrough','subscript','superscript','separator'], ['justifyleft','justifycenter','justifyright','separator'], ['OrderedList','UnOrderedList','Outdent','Indent','separator'], ['forecolor','backcolor','separator'], @@ -84,7 +85,8 @@ this.fontstyles = [ // make sure these exist in the header of page the conte this.btnList = { // buttonName: commandID, title, onclick, image, - "smileys": ['Smileys', 'Insert Smiley', 'editor_action(this.id)', 'ed_smiley.gif'], + "find": ['Find', 'Find', 'editor_action(this.id)', 'ed_find.gif'], + "smileys": ['Smileys', 'Insert Smiley', 'editor_action(this.id)', 'ed_smiley.gif'], "bold": ['Bold', 'Bold', 'editor_action(this.id)', 'ed_format_bold.gif'], "italic": ['Italic', 'Italic', 'editor_action(this.id)', 'ed_format_italic.gif'], "underline": ['Underline', 'Underline', 'editor_action(this.id)', 'ed_format_underline.gif'], @@ -320,6 +322,14 @@ function editor_action(button_id) { if (myText) { editor_insertHTML(objname, myText); } } + // Find function + if (cmdID == 'Find') { + setGlobalVar ("_editor_field",objname); + var findRange = editor_obj.contentWindow.document.body.createTextRange(); + showModelessDialog(_editor_url + "popups/find.html",window, "resizable: no; help: no; status: no; scroll: no; "); + return; + } + // Custom1 else if (cmdID == 'custom1') { alert("Hello, I am custom button 1!"); @@ -1161,3 +1171,33 @@ function editor_cMenu(obj,menuIdx,objname) { } /* ---------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- */ +// insert by lvn : find + insertTable +// insert by lvn : check editor changes +/* ---------------------------------------------------------------------- *\ + Function : setGlobalVar + Description : set a variable with a global scope + Usage : setGlobalVar(varName, value); + Arguments : varName - name of the global variable to set + value - value of the global variable to set +\* ---------------------------------------------------------------------- */ +function setGlobalVar(varName, value) { + if (this.cache == null) {this.cache = new Object();} + this.cache[varName] = value; +} +/* ---------------------------------------------------------------------- *\ + Function : getGlobalVar + Description : get a variable in a global scope + Usage : value = getGlobalVar(varName); + Arguments : varName - name of the global variable to get + value - value of the global variable to get +\* ---------------------------------------------------------------------- */ +function getGlobalVar(varName, value) { + if (this.cache == null) { + return null; + } else { + return this.cache[varName]; + } +} + diff --git a/www/extras/htmlArea/images/ed_find.gif b/www/extras/htmlArea/images/ed_find.gif new file mode 100644 index 0000000000000000000000000000000000000000..b862ca3e911f80308d134b9bf939a438fe850e83 GIT binary patch literal 900 zcmb7@u}jrq6o${>pn(n*1-FKRlxw)eQ7EDzh0+MRt-&26I*U_I(ir6+4$+;?5NSc> zA`VSCHHmT>qA+MOkoG%;)9E=s`v>}#%i;UZd!F|_zk7S`*41nCXXLE>k>jHxCgLI? zl0u~_YN9S0qFI-wVkYKdA(r*lRoui~JjAnFLnTbYB|;)ml2l2PbjgsUKpSbaXy$d+ zoI0lJs-c=SmdZ@c)j}rMbHtR2nW}~&wW=RFr2$i??!v;t($doM@^Y`& zTVG$_+}zyW-rn8a-QV9oJUs08`^UZiKIH%Zxp*`%G$_AiqFU=eA%pYsW$66u*4pQ% za&qME;KABW`O!M@to`-Z^z&0!9!&0Z=66;`#-FTy=pXF#Mu)~OjlX=fw>mNRX<%dV t-R$z%y~XcGFGi~^yuI`4=i~*s{ufZWkUjta literal 0 HcmV?d00001 diff --git a/www/extras/htmlArea/popups/find.html b/www/extras/htmlArea/popups/find.html new file mode 100644 index 000000000..2f7140326 --- /dev/null +++ b/www/extras/htmlArea/popups/find.html @@ -0,0 +1,134 @@ + + +Find & Replace + + + + + + +
+ + + + +
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +