Opened 17 years ago

Closed 17 years ago

#298 closed Bug (fixed)

DIV Tag deleted in IE when h1 is inserted

Reported by: Kerbetz Owned by:
Priority: Normal Milestone: FCKeditor 2.5 Beta
Component: Core : Styles Version: FCKeditor 2.4.1
Keywords: Cc:

Description (last modified by Frederico Caldeira Knabben)

Just use the demo site:

  1. click "source code"
  2. insert on first position <div id="news"> (just as an example)
  3. insert on last position </div>
  4. switch back to WYSYWIG mode
  5. insert or add somewhere any text, mark it as headline 1 (or 2,3,4...)
  6. if you look at the sourcecode now the DIV tag has been removed (begin and end tag)

The problem only exists for IE (tested on IE 6 - Version 6.0.2900.2180 only)

In FF it works fine (tested on Version 2.0.0.3 only)

Change History (8)

comment:1 Changed 17 years ago by Frederico Caldeira Knabben

Description: modified (diff)
Keywords: Confirmed added; IE DIV tag deleted removed
Milestone: FCKeditor 2.4.2FCKeditor 2.5
Priority: HighNormal

comment:2 Changed 17 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

comment:3 Changed 17 years ago by Martin Kou

Keywords: Discussion added; Confirmed removed

It seems to me that IE's behavior is the correct one, and Firefox's behavior is buggy.

The standard behavior for choosing a format tag ( i.e. <p>, <div>, <h1>, <pre>, etc. ) is to replace the existing format tag. So, say you are inside a <p> block, choosing the "Address" format in the format drop-down menu would replace the <p> block with an <address> block. Same if you're inside an <h3> block and choose to use the "Normal (DIV)" format - the <h3> block is replaced by <div>.

Now if you select the "Headline X" format inside a <div> in Firefox, the <div> stays instead of getting replaced by the <hX> tag. This seems out of place compared to the other format settings' behaviors.

comment:4 Changed 17 years ago by mk@…

Sorry, I don't agree: if you have a source which is: <div id="test"> <p>aaa</p> <p>bbb</p> </div> and you mark the bbb <p> block and choose the h1 format in the drop-down menu it should replace the <p>block with <h1> but it should not remove the surrounding div, because it is valid to have any text inside a div which can have an <h1> tag

comment:5 Changed 17 years ago by Martin Kou

Oh, I wasn't aware of your problem. If the change format command deletes the <div> tag beyond the nearest format tag, then it's certainly buggy. And yes, I could reproduce the bug with your test case in IE.

I think it would be the most sensible if the format command replaces only the nearest format tag. So, say you have

<div>line 1</div>

and change the format of "line 1" to "Headline 3", then you get:

<h3>line 1</h3>

And, for your test case:

<div id="test"> 
<p>aaa</p> 
<p>bbb</p> 
</div>

changing the format of "aaa" to "Formatted" would give:

<div id="test"> 
<pre>aaa</pre> 
<p>bbb</p> 
</div>

This way, the format command would work the same in IE and Firefox. Also it wouldn't produce surprises by deleting <div> tags two level up, or leaving empty <pre> tags after the current block (which, by the way, is another bug I just found in IE regarding the formatting command).

comment:6 Changed 17 years ago by Frederico Caldeira Knabben

Component: GeneralCore : Styles
Keywords: Discussion removed
Owner: Martin Kou deleted
Status: assignednew

comment:7 Changed 17 years ago by mk@…

Great if you could change the editor to work in that way! I appreciate your fantastic work.

comment:8 Changed 17 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: newclosed

While testing the SVN version, we are having now the behavior proposed by Martin. I believe it has been introduced with [774] and the recent changes done with [825].

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy