Rich editor.. need to replace ccorrect string...
- by JamesM
On my website I have a login and an article tag for editing.
my article code is in HTML5 witch is enough as my editor rule is HTML5:
HTML5: index.php line 212
<article contentEditable="false"> >> Changes to true when in edit mode..
<div>One row of text goes here.</div>
<div>Row two's content goes here.</div>
</article>
I want to be able to get the selected text via JS.
JS: js.php
format : (function(format){
if (user = "{$ADMIN}"){
selection = getSelection();
text = selection.toString();
switch(format){
case "big":
result = text.big();
break;
case "small":
result = text.small();
break;
case "bold":
result = text.bold();
break;
case "italics":
result = text.italics();
break;
case "fixed":
result = text.fixed();
break;
case "strike":
result = text.strike();
break;
case "fontcolor":
result = text.fontcolor();
break;
case "fontsize":
result = text.fontsize();
break;
case "sub":
result = text.sub();
break;
case "sup":
result = text.sup();
break;
case "link":
result = text.link();
break;
}
}
}),
I can replace the text with the result but that will replace all of them I a=can do only the first but i want to do it to the selected...