Opened 13 years ago

Closed 13 years ago

#6737 closed New Feature (fixed)

Format Combo doesn't respect config.format_xx definitions

Reported by: Seb Duggan Owned by: Frederico Caldeira Knabben
Priority: Normal Milestone: CKEditor 3.6
Component: UI : Toolbar Version: 3.4.2
Keywords: Cc:

Description

The format combo box doesn't display its options in the correct style as attributed in the config.format_xx options.

For example, if I set the following config option:

CKEDITOR.config.format_h1 = { element : 'h2'};

...then when I choose "Heading 1" from the combo, the selected text is formatted as an <h2> element. However, the format combo box still shows "Heading 1" with the <h1> CSS applied to it.

The fix for this is simple. In /_source/plugins/format/plugin.js, line 48 should be changed from:

this.add( tag, '<' + tag + '>' + label + '</' + tag + '>', label );

to:

this.add( tag, '<' + styles[tag].element + '>' + label + '</' + styles[tag].element + '>', label );

(You may like to do this differently according to house coding conventions).

Attachments (2)

6737.patch (16.9 KB) - added by Garry Yao 13 years ago.
6737_2.patch (1.2 KB) - added by Frederico Caldeira Knabben 13 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 years ago by Sa'ar Zac Elias

Keywords: HasPatch added
Status: newconfirmed

We should also support attributes and styles defined that way.

comment:2 Changed 13 years ago by Wiktor Walc

Milestone: CKEditor 3.6
Type: BugNew Feature

This change may have a surprising results for some users, so targeting to 3.6.

Changed 13 years ago by Garry Yao

Attachment: 6737.patch added

comment:3 Changed 13 years ago by Garry Yao

Owner: set to Garry Yao
Status: confirmedreview

Patch unifies the styles definition of format combo with editor's standard styles definition (via styles set).

comment:4 Changed 13 years ago by Garry Yao

Keywords: HasPatch removed

Note that though back-compat on configuration (old format_tags) is not maintained by the propose patch, old editor wouldn't be broken because of upgrading.

comment:5 Changed 13 years ago by Frederico Caldeira Knabben

Status: reviewreview_failed

I'm sorry to say so, but we don't need to make such a strong change to our code to achieve what the reported looks for here. We don't need another Style combo here, not even additional js files to get downloaded. The format combo has a precise and delimited scope. The solution is in fact as simple as proposed by the reporter.

KISS!

comment:6 Changed 13 years ago by Frederico Caldeira Knabben

Owner: changed from Garry Yao to Frederico Caldeira Knabben
Status: review_failedassigned

Changed 13 years ago by Frederico Caldeira Knabben

Attachment: 6737_2.patch added

comment:7 Changed 13 years ago by Frederico Caldeira Knabben

Status: assignedreview

comment:8 Changed 13 years ago by Sa'ar Zac Elias

Status: reviewreview_passed

comment:9 Changed 13 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: review_passedclosed

Fixed with [6683].

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