Opened 11 years ago

Closed 10 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)

10091.patch (868 bytes) - added by Jakub Ś 11 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 11 years ago by Jakub Ś

Status: newconfirmed
Version: 3.6.43.2.1
  1. Problem can be reproduced from CKEditor 3.2.1, when styles combo started reflecting selection.
  2. Blockqupte styles are rather object styles as this blockquote can have other elements inside.
  3. Object styles for particular object are only visible when you click on it. Please see #9405 for more details. I'm not sure if this is a bug or how it should work.
  1. One thing is certain. Styles for blockquote should not be shown in inline section. This tag is missed in object styles.

Simple fix for this issue is adding it :) Please see attached patch.

comment:2 Changed 11 years ago by Jakub Ś

Owner: set to Jakub Ś
Status: confirmedassigned

Changed 11 years ago by Jakub Ś

Attachment: 10091.patch added

comment:3 Changed 11 years ago by Jakub Ś

Status: assignedreview

comment:4 Changed 11 years ago by Michael C.

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 10 years ago by Frederico Caldeira Knabben

Status: reviewassigned

This patch needs to be transformed into a ticket branch to be put on review.

comment:6 Changed 10 years ago by Piotrek Koszuliński

Duplicate reported in #12092 with a pull request https://github.com/ckeditor/ckeditor-dev/pull/105

comment:7 Changed 10 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.4.2
Resolution: fixed
Status: assignedclosed

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.

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