ASP.NET 3.5 and above only

HTML Editor - Knowledge Base

« Back to Knowledge Base list

Turn off the code optimization

Q:

I enter the following into the Editor (version 2.12.702.1) in HTML mode:
 
<tr><td>China</td><td><span class="box green"><span>Aug</span><span>Sep</span><span>Oct</span></span><span class="box aqua"><span>Nov</span></span></td></tr>
 
 
Then switch to Design mode, then switch back to HTML mode.   I lose my spans around the months.
 
<tr><td>China</td><td><span class="box green">AugSepOct</span><span class="box aqua">Nov</span></td></tr>
 
 
How do I prevent that from happening?

A:

It is a default behavior of the Editor’s code optimizer: join neighbouring span elements if they have identical attributes and remove span tag if it does not have any attributes.
You can prevent such behavior in the client-side the following way:

<script type="text/JavaScript">
  // Standard MS AJAX function called on page load
  function pageLoad(sender, args) {
      // set an empty function for the optimizer
      Obout.Ajax.UI.HTMLEditor.spanJoiner = function () { };
  }
</script

"I just experimenting with your window and I must say that I am really so impressed with it.I am currently using teleik window but after I tried yours , I made my mind to move towards yours, what I really like about your components is the really simple API and it is light on browser, I made some tests comparing window to ... one and I must say your outtakes ..."

Ferasman

Random testimonial   All testimonials