Opened 15 years ago
Closed 15 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)
Change History (11)
comment:1 Changed 15 years ago by
| Keywords: | HasPatch added |
|---|---|
| Status: | new → confirmed |
comment:2 Changed 15 years ago by
| Milestone: | → CKEditor 3.6 |
|---|---|
| Type: | Bug → New Feature |
This change may have a surprising results for some users, so targeting to 3.6.
Changed 15 years ago by
| Attachment: | 6737.patch added |
|---|
comment:3 Changed 15 years ago by
| Owner: | set to Garry Yao |
|---|---|
| Status: | confirmed → review |
Patch unifies the styles definition of format combo with editor's standard styles definition (via styles set).
comment:4 Changed 15 years ago by
| 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 15 years ago by
| Status: | review → review_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 15 years ago by
| Owner: | changed from Garry Yao to Frederico Caldeira Knabben |
|---|---|
| Status: | review_failed → assigned |
Changed 15 years ago by
| Attachment: | 6737_2.patch added |
|---|
comment:7 Changed 15 years ago by
| Status: | assigned → review |
|---|
comment:8 Changed 15 years ago by
| Status: | review → review_passed |
|---|
comment:9 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Fixed with [6683].

We should also support attributes and styles defined that way.