Opened 6 years ago

Closed 3 years ago

Last modified 3 years ago

#8117 closed New Feature (fixed)

HTML 5 Support / meta element in body

Reported by: Russ Tennant Owned by: Marek Lewandowski
Priority: Normal Milestone: CKEditor 4.4.3
Component: General Version: 3.0
Keywords: HTML5 Cc: micky@…

Description

It would be nice to be able to enter meta tags like "<meta content=5 itemprop=bestRating />" in the source code view without side effects. Currently it adds empty paragraphs. Example markup: http://schema.org/Event

This happens in google chrome.

Change History (22)

comment:1 Changed 6 years ago by Paul Veldema

With:

<p>
	<meta />
</p>
<p>
	bla</p>

See the 'bla' move down in the editor when you keep switching to code view and back :)

This problem is not browser specific.

comment:2 Changed 6 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

Sorry but meta tags are only allowed in head section (HTML4 and HTML5) - http://www.w3schools.com/html5/tag_meta.asp

You have used invalid HTML and you have got weird result. Sorry but this will not get implemented.

comment:3 Changed 6 years ago by Russ Tennant

It is valid HTML5 microdata to use a meta tag in the body and does validate on the W3 validator and validator.nu. Many HTML5 microdata examples exist using the meta tag in the body as microdata. For example, there are many examples on http://schema.org like http://schema.org/Rating and in the spec http://www.w3.org/TR/html5/microdata.html.

Edit: Current links for mocro data:

Last edited 4 years ago by Jakub Ś (previous) (diff)

comment:4 Changed 6 years ago by Russ Tennant

Also, it is worth mentioning that we do use this feature - it's a real use-case. We've patched the CKEditor to allow all meta tags in the body which is not ideal. Our users get microdata examples from Google and copy&paste or integrate them into the content they add to their sites via the CKEditor.

comment:5 Changed 6 years ago by Jakub Ś

Resolution: invalid
Status: closedreopened

comment:6 Changed 6 years ago by Jakub Ś

Keywords: HTML5 added
Status: reopenedconfirmed
Version: 3.6.13.0

Sorry my bad. I have focused on the example with empty meta tag instead of microformat <meta content=5 itemprop=bestRating /> mentioned in ticket description.

This is HTML5. I’m not sure about CKEditor 3.x but this feature should and will most likely be implemented in v4 of the editor for which RC will soon be released.

Ironically this feature was supported till CKEditor 3.5.3 rev [6629]. Meta tag was ignored. Perhaps we should come back to ignoring technique? More details in #9006.

Last edited 5 years ago by Jakub Ś (previous) (diff)

comment:7 Changed 5 years ago by Jakub Ś

#9119 was marked as duplicate.

comment:8 Changed 5 years ago by Jakub Ś

Other tickets where meta tags also cause problems: #9186, #9006.

comment:9 Changed 3 years ago by Mick

I believe this is still an issue. I'm looking to do something similar to this (from Google page about microformats):

<div itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
   Rating: <span itemprop="value">8.5</span>
   <meta itemprop="best" content="10" />
</div>

But it strips out the META part. I just verified on the current demo page which appears to have 4.4.1

Last edited 3 years ago by Mick (previous) (diff)

comment:10 Changed 3 years ago by Mick

Cc: micky@… added
Version: 3.04.4.1

comment:11 Changed 3 years ago by Jakub Ś

Version: 4.4.13.0

Version number indicates when problem has started occurring. Please don't change it.

comment:12 Changed 3 years ago by Mick

My mistake. Sorry. Should this be set as a bug or new feature?

comment:13 Changed 3 years ago by Jakub Ś

This is a feature related to bug #9006.

comment:14 Changed 3 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.4.3

We'll use source protection - https://github.com/ckeditor/ckeditor-dev/blob/0c7e0e0/core/htmldataprocessor.js#L859-L866. Not a perfect solution, but definitely the easiest.

comment:15 Changed 3 years ago by Piotrek Koszuliński

I closed #9006 as a duplicate. #9186 should be fixed by patch for this ticket too.

comment:16 Changed 3 years ago by Marek Lewandowski

Owner: set to Marek Lewandowski
Status: confirmedassigned

comment:17 Changed 3 years ago by Marek Lewandowski

Status: assignedreview

Pushed to t/8117 at dev.

Note: meta tags will be stripped by ACF by default. To preserve meta tags add following property to your config:

config.extraAllowedContent = 'meta[itemprop,content]';
Last edited 3 years ago by Piotrek Koszuliński (previous) (diff)

comment:18 Changed 3 years ago by Piotrek Koszuliński

Status: reviewreview_passed

Patch fixes #9186 too.

comment:19 Changed 3 years ago by Piotrek Koszuliński

Resolution: fixed
Status: review_passedclosed

Fixed on master with git:afc35ce.

I'm still analysing whether we should require space after <meta, because I'm a little bit worried that we may protect too much.

comment:20 Changed 3 years ago by Xavier Chantry

Is there any chance to backport a fix to ckeditor 3 or to have a workaround there ?

We found two different settings that work around the problem, but they are not recommended in the documentation:

Note: Changing the default value might introduce unpredictable usability issues
config.autoParagraph = false;
// Not recommended.
config.enterMode = CKEDITOR.ENTER_BR;

comment:21 Changed 3 years ago by Piotrek Koszuliński

We do not backport patches to previous versions. However, you can try. This one should be pretty simple.

comment:22 Changed 3 years ago by Xavier Chantry

It's a bit strange to avoid backporting patches when maintaining a stable version, but it was indeed very easy to apply (even to the minified version) and it works perfectly, thanks a lot !

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy