I'm trying to use HTML Purifier along Media 2.x inside WYSIWYG + CKEditor 4.3 with MediaElement.js as a video player.

Everything works great without the HTML Purifier filter on my text format. The generated HTML looks something like this :

<div class="mediaelement-video media-element file-default" data-file_info="%7B%22fid%22:%229%22,%22view_mode%22:%22default%22,%22fields%22:%7B%22format%22:%22default%22%7D,%22type%22:%22media%22%7D">
	<video class="mediaelement-formatter-identifier-1385012495-4" controls="controls" src="http://crires.dev/sites/crires/files/stuckkey.mp4" height="385" width="640">&nbsp;</video>
</div>

Am I to understand that I'd have to implement a custom HTML Purifier filter to support the video and audio HTML5 tags along with their attributes ?

Isn't there a way to whitelist these ??

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heddn’s picture

Hi, can you change this into a feature request? There's support for youtube upstream in the library, but that support isn't in the Drupal module. I'll always accept patches.

http://htmlpurifier.org/docs/enduser-youtube.html

PascalAnimateur’s picture

Category: Support request » Feature request
heddn’s picture

Status: Active » Postponed

Postponing until a patch is provided.

silverham’s picture

Title: Support for embedded Media / File entity » Support for HTML Purifier - data attributes.
Project: HTML Purifier » Media CKEditor
Status: Postponed » Active
silverham’s picture

Attached is 2x patches.

First I recommend immediately "support-for-html-purifier-2140645-1.patch" for images, adding data attributes.
(Requires requires at least 7.x-1.0+6-dev of htmlpurifer module.)

Secondly the second "support-for-html-purifier-2140645-2.patch" can be seen as needing further review or not committed as required.

Further reading:

#1321490-27: HTML5 Support?

https://github.com/xemlock/htmlpurifier-html5/blob/master/library/HTMLPurifier/ChildDef/HTML5/Media.php

silverham’s picture

Updated to add _alter() to function comment. to path 1. (so now it's "support-for-html-purifier-2140645-3.patch")