Opened 12 years ago
Closed 11 years ago
#10091 closed Bug (fixed)
Blockquote treated like an inline element when added via a custom styleSet
Reported by: | Michael C. | Owned by: | Jakub Ś |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.4.2 |
Component: | Core : Styles | Version: | 3.2.1 |
Keywords: | Cc: |
Description
I need to insert blockquotes with a certain class attribute. To that end, I've added a custom stylesSet that has the following:
CKEDITOR.stylesSet.add('quotes',[ // Block Styles { name:'Pullquote', element:'blockquote', attributes:{ 'class':'pullquote' } } ]);
However, a blockquote inserted in this manner:
- Appears under the "Inline Styles" section of the Styles dropdown
- Behaves like an inline element (selecting "Pullquote" from the list when the caret is positioned in the middle of a word splits the word with the blockquote tag.
- Is inserted inside P tags
- Can't even be applied to a block of selected text
The expected behavior would be for a blockquote to behave exactly like a heading tag does. For example, adding the following to the styleSet works as expected:
{ name:'header', element:'h3', attributes:{ 'class':'test' } },
Other issues possibly related to this are the need to be able to have text inside a P tag nested inside blockquote tag, etc, but those are probably for another ticket. :)
Attachments (1)
Change History (8)
comment:1 Changed 12 years ago by
Status: | new → confirmed |
---|---|
Version: | 3.6.4 → 3.2.1 |
comment:2 Changed 12 years ago by
Owner: | set to Jakub Ś |
---|---|
Status: | confirmed → assigned |
Changed 12 years ago by
Attachment: | 10091.patch added |
---|
comment:3 Changed 12 years ago by
Status: | assigned → review |
---|
comment:4 Changed 12 years ago by
It would be great to be able to use the GUI to both apply/remove attributes (id, class, etc) from the <blockquote> itself, as well as to be able to have multiple <p> tags inside a single <blockquote>. As it stands now, I noticed that when clicking the "blockquote" link in the element ancestor list at the bottom of the editing area, it selects the <p> tag inside the <blockquote> instead of the <blockquote> itself, thus making it impossible to apply styling directly to the <blockquote>.
comment:5 Changed 11 years ago by
Status: | review → assigned |
---|
This patch needs to be transformed into a ticket branch to be put on review.
comment:6 Changed 11 years ago by
Duplicate reported in #12092 with a pull request https://github.com/ckeditor/ckeditor-dev/pull/105
comment:7 Changed 11 years ago by
Milestone: | → CKEditor 4.4.2 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
First I found this strange that blockquote was put in object styles rather than block styles. But then I tested and I understood it. Since blockquote requires more logic than styles system contain to be applied from scratch (it need to wrap <p>s instead of replace them), styles system cannot apply it. Additionally, it's not always the innermost block like h1 or p. It may contain blocks. So it will work best as a block style, applicable only to already existing blockquote. And I actually started thinking that all block styles should be object styles in the future. It's just a lot more clear. Format drop down is to change formats, styles to apply style to already existing formats.
Fixed with git:449b4912.
Simple fix for this issue is adding it :) Please see attached patch.