i'm developing a plugin that inserts a figure element into the editor. CKEditor is surrounding the figure element with <p></p> tags. is there a way to have this not happen? i would prefer if figure acts the ways a div element does when it is inserted.
i assume there is a list or configuration somewhere where block versus inline elements are defined. it would appear that figure is being treated more like an inline element.
i assume there is a list or configuration somewhere where block versus inline elements are defined. it would appear that figure is being treated more like an inline element.
Re: HTML5 and figure element
so, time to upgrade!
on another note, is there any reason why it wouldn't be possible to dynamically change what is a block element?
Re: HTML5 and figure element
i am aware of the solution of change config.entermode, but this does not work for me. in general, i do want a space to translate to a paragraph tag, but not if the element in question is already surrounded by a block element. when i was looking at CKEDITOR.dtd, some of the comments seemed to suggest that the editor will take into account what an element is surrounded with. does that mean i am experiencing a bug?
Re: HTML5 and figure element
as for the img inside of figure. i believe it is acting well except in cases where a specific plugin is acting on the img. as in alignment. if i try to align the image, it's only choice is to wrap it in p tags and apply the class to that. i guess this is correct. perhaps i need to find a way to make the figure selectable, instead of the image, so that alignment can be applied there.
if anyone has any experience with this, i would appreciate the help.
Re: HTML5 and figure element
in the end, my issue may go deeper into how ckeditor works. i would love if anyone can comment on this behaviour...
i have the following markup:
<figure class="full">
<img alt="logo" src="images/logo.png" />
<figcaption>
<span class="caption">Cool Logo!</span><span class="credit">by Me</span>
</figcaption>
</figure>
if i click on the caption or credit in the editor, both of my spans inside of the figcaption are surrounded by a p tag. is there anyway to avoid this? in my mind, figcaption is a block level element (since i've now defined it so). i would imagine that as long as i am click and editing the contents of the span, i shouldn't need to add p tags. i suppose if i click outside of the spans, then a p tag should be created.
the same is true for the image. if i click to the side of the img, p tags are added around the img. i suppose i can understand why this works this way, but i have two questions:
1) if no text is added, i don't think the p tags should remain around the image.
2) there needs to be some logic that accounts for the fact that my img is surrounded by a figure.
i would love to hear from one of the developers on this.
Re: HTML5 and figure element
Hi Darcy,
sorry for the delay in answering and thanks for excellent work! As you might have noticed, with version 3.6.1 we started the effort to bring HTML5 support to CKEditor. Your work to extend this support with the figcaption element is greatly appreciated!
The best way to proceed now is to open a new ticket on our Development site (set it to New Feature), summarize your findings and attach the code (patch). The developers will then be able to review the proposal and/or suggest some changes or whatever makes most sense to include in the next release. Thanks again for your effort!
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!