The wysiwyg editor I'm using uses this to replace the <strong> with a span style. I modified to add a code block.
v=v.replace(/<strong>(.*)<\/strong>/gi,'<span style="font-weight: bold;">$1</span>');
This works fine until I highlight code with
v=v.replace(/<pre>(.*)<\/pre>/gi,'<div id="precode"> $1 </div>');
I have been looking and can't fine any info on replace. Can someone explain
Can someone explain this part of the code? I'm sure it will help others as well
.replace(/<strong>(.*)<\/strong>/gi,'
Is there something in this causing the it to add the new style to each line
if(id=='style'){
var sel=document.createElement('select'),
styles=obj.styles||[['Style',''],['Paragraph','<p>'],['Header 1','<h1>'],['Header 2','<h2>'],['Header 3','<h3>'],['Header 4','<h4>'],['Header 5','<h5>'],['Header 6','<h6>'],['CodeBlock','<pre>']],
sl=styles.length, x=0;
sel.className='testyle'; sel.onchange=new Function(this.n+'.ddaction(this,"formatblock")');
for(x;x<sl;x++){
var style=styles[x];
sel.options[x]=new Option(style[0],style[1])
}
<strong>tags and replace them with<span>tags (its a regular expression)