Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#1499 closed Bug (wontfix)

Applying format H2 or similar to a word in a line makes whole line H2

Reported by: bongobongo Owned by:
Priority: Normal Milestone:
Component: General Version: FCKeditor 2.5 Beta
Keywords: Cc:

Description

Hi.

If you go to the demo page on this site.

Then select one word in the line.

Then from the Format combo select e.g. H2, then whole line is in H2 tag.

I belive only selected word(s) should be in H2 tag. If I do the same in my 2.4.3 install then just the selected text is applied the H2 tag.

Happens in IE6, IE7 and Firefox. (not tested in other browsers)

Change History (5)

comment:1 Changed 16 years ago by Martin Kou

Resolution: invalid
Status: newclosed

Actually this is the correct behavior.

The reason is because the H2 tag is a block level element, it is not just an element to make text bolder and bigger. If we apply the H2 tag formatting to just the selected text instead of the whole paragraph, you'll have even stranger behaviors.

For example, look at the following HTML code:

<p>Hello to the world!</p>

Let's say "to the" is selected in the above text, and we apply H2 formatting to the selected text only, then we'll have:

<p>Hello <h2>to the</h2> world!</p>

And since H2 is a block level element, the HTML would be rendered as:


Hello

to the

world!


Which does not make sense. So, we're applying H2 to the whole paragraph instead, as in:


Hello to the world!


By the way, I believe 2.4.3 is also applying the H2 format to the whole paragraph?

comment:2 Changed 16 years ago by bongobongo

Resolution: invalid
Status: closedreopened

Are you sure about this: You said: By the way, I believe 2.4.3 is also applying the H2 format to the whole paragraph?

I'm currently using 2.4.3 with this setting in fckconfig.js: FCKConfig.EnterMode = 'br'; FCKConfig.ShiftEnterMode = 'br';

If I write a line of words and then select one ore more words and apply a H2 paragraph to selected text, then only selected text will get the applied H2 paragraph.

And of course, the H2 paragraph is now on a separate line.

One other thing. Would be nice if it was possible to change the Enter key behaviour online in the demopage on FCKedtior site. When the new Enter key features where introduced I belive it was possible to change this setting online for a short while (maybe for the beta back then)...

comment:3 Changed 16 years ago by Frederico Caldeira Knabben

Resolution: wontfix
Status: reopenedclosed

I can also confirm the two things Martin have confirmed previously:

  1. The current is the desired behavior. The Format combo will act in the entire block, not only in the selection.
  1. Version 2.4.3 presents the same behavior as the 2.5 Beta. I've tested it with FF2 and IE7.

It sounds strange that you had different results with the 2.4.3. To note that with that version, we are leaving the styling job to the browser implementation, which could easily give different results depending on the browser. With the 2.5, we are now having the exact same results in all four main browsers.

comment:4 Changed 16 years ago by bongobongo

Thanks for taking the time to respond to this.

In my current application, using FCKeditor 2.4.3 I get the behaviour I described, for Firefox 2.0.0.9, IE6 and IE7. Did a quick test today as well, just to make sure I have not fooled you guys.

The reason I get the behaviour I describe might have something to do to the fact that I I'm using 2.4.3 with this setting in fckconfig.js: FCKConfig.EnterMode = 'br'; FCKConfig.ShiftEnterMode = 'br';

Anyway, I do not mind how it is to work in the version though... :-) Just wanted to make sure it was not a new bug.

Doing some tests now with the 2.5 beta and found this strange behaviour: Note, I'm still using this setting in fckeditor.js FCKConfig.EnterMode = 'br'; FCKConfig.ShiftEnterMode = 'br';

This is my source:

This is a small test. <br />
Rather cool this is.

Then I select the first line and select Format: Heading 3 and get this source:

<h3>This is a small test.</h3>
Rather cool this is.

Which is nice:

Then I select the first line again and select Format: Normal and get this:

<p>This is a small test.</p>
Rather cool this is.

Why is the P tag inserted when I'm in BR mode only? Is this a bug or something else?

comment:5 Changed 16 years ago by Frederico Caldeira Knabben

It may happen that, even when EnterMode=br, we want things inside a <p>. So, the Normal format should be used for that.

It is a fact though, that there is no way to remove the block element when EnterMode=br. So, once a block is applied, all you can do is only switch their types.

We could think on it as a missing feature. Feel free to open a ticket for it if you think it deserves it.

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