I am using syntaxhighlighter and editing my pages using fckeditor. When I create the page and assign some code the following tag <pre name="code" class="html"> then the code displays as expected and formatted. hen I go back and edit that page then the code is duplicated and inserted into the page.
So if i initially save something like this in my page:
<pre name="code" class="html"> test code test code <pre>
I see the expected output. If I then go back and edit the page and save it. I then get a double entry that looks like this:
<pre name="code" class="html"> test code test code <pre> <pre style="display: none;" name="code" class="html"> test code test code</pre>
Also extra html is added before each pre tag as follows: <div class="dp-highlighter"> <div class="bar"> <div class="tools"> </div> </div> <ol start="1" class="dp-xml"> <li class="alt"><span><span>hfdhdfh </span><span class="tag"><</span><span class="tag-name">preface</span><span class="tag">></span><span> egeyeyeyeyery </span><span class="tag"></</span><span class="tag-name">preface</span><span class="tag">></span><span> hfdh fdhfd hdfh dfhfdhfdhdfhdf </span></span></li> </ol> </div>
Any fix for this?
Comment #1
Posted on Apr 15, 2008 by Massive BearI made a mistake in my post above. The extra code that gets added before each pre tag looks like this:
Comment #2
Posted on Jul 2, 2008 by Swift CatOne solution to this problem is to use removeChild() instead of display:none.
To resolve it, add the following line in shCore.js (after the line #703):
element.parentNode.insertBefore(highlighter.div, element); element.parentNode.removeChild(element);
Using this method one can eliminate the problem of duplicated codes when CSS if off.
best regards, gajdaw
Status: New
Labels:
Type-Defect
Priority-Medium