iceboxqs
06-02-2004, 07:40 PM
Hello,
I am using execCommand(bold,false, null) in Mozilla 1.6 to make a selection, that the user created, bold.
This command works fine and the selected text does go bold, however I get weird stuff happening to the content before and/or around the content that was just bolded.
Here is an example:
A small line of text is in the window.
Text view:
--------------------------------------------
This is a formatting test. This is Word format.
--------------------------------------------
Html view:
--------------------------------------------
<div class="section1064style178">This is a formatting test. <span class="section1064style178" style="font-style: italic;">This</span> is word format.</div>
--------------------------------------------
The user selects "formatting" from the text below and hits the bold button which calls the execCommand.
This is what happens:
Text view:
--------------------------------------------
formatting This is a test. This is word format .
--------------------------------------------
When I switch between html view and text view all of a sudden it formats it correctly.
Text view:
--------------------------------------------
This is a formatting test. This is word format .
--------------------------------------------
Html view:
--------------------------------------------
<div class="section1064style178">This is a <span style="font-weight: bold;">formatting </span>test. <span class="section1064style178" style="font-style: italic;">This</span> is word format.</div>
--------------------------------------------
Is this a rendering issue? Do I need to call a refresh or something after I use an execCommand in mozilla? This is quite baffling to me.
I am using execCommand(bold,false, null) in Mozilla 1.6 to make a selection, that the user created, bold.
This command works fine and the selected text does go bold, however I get weird stuff happening to the content before and/or around the content that was just bolded.
Here is an example:
A small line of text is in the window.
Text view:
--------------------------------------------
This is a formatting test. This is Word format.
--------------------------------------------
Html view:
--------------------------------------------
<div class="section1064style178">This is a formatting test. <span class="section1064style178" style="font-style: italic;">This</span> is word format.</div>
--------------------------------------------
The user selects "formatting" from the text below and hits the bold button which calls the execCommand.
This is what happens:
Text view:
--------------------------------------------
formatting This is a test. This is word format .
--------------------------------------------
When I switch between html view and text view all of a sudden it formats it correctly.
Text view:
--------------------------------------------
This is a formatting test. This is word format .
--------------------------------------------
Html view:
--------------------------------------------
<div class="section1064style178">This is a <span style="font-weight: bold;">formatting </span>test. <span class="section1064style178" style="font-style: italic;">This</span> is word format.</div>
--------------------------------------------
Is this a rendering issue? Do I need to call a refresh or something after I use an execCommand in mozilla? This is quite baffling to me.