Voting starts in March for the Drupal Association Board election.
CKEditor 4.1 includes an Advanced Content Filter. Drupal HEAD is currently using it in default mode, which means CKEditor filters all user entered content (including content pasted from other web pages, Microsoft Word, etc.) to conform to what is allowed by the enabled toolbar buttons and plugins for the text format being used. For example, if in configuring the "Basic HTML" format, the administrator hasn't added any toolbar buttons or plugins that provide
<table> functionality, then upon pasting HTML content from Word, CKEditor will automatically clean up the HTML to not include
<table> and related tags. This is mostly a good thing: to the extent that the configured toolbar matches what is allowed by Drupal's text filters, it helps maintain parity between what the content editor sees in the wysiwyg, and what they'll get when they save the node and view it (i.e., WYS = WYG).
However, there are some situations in which there isn't a perfect match between the configured toolbar and the configured filters. Some examples:
- The Basic HTML format in HEAD allows for the
codetag, but there's no enabled CKEditor button for it. CKEditor has a "source" mode for entering HTML by hand, so you can use that to markup a code snippet with
codetags, save the node, and upon viewing the node, that markup is there, as expected, since the format allows it. However, when re-editing the node, CKEditor applies its default ACF rules and strips out the
codetags, since there's no enabled toolbar button for it.
- Drupal filters can be more fine-grained than CKEditor buttons. For example, you might want a Drupal filter that allows
styleattributes on some tags, but not on others. For WYS to equal WYG, you'd want these rules applied within the editor as well, and relying on CKEditor to figure it out from the enabled buttons is not sufficient.
- You may want the CKEditor interface to be smart about which options it shows in various dialogs. For example, if you have a Drupal filter that strips
targetattributes from links, you probably also want CKEditor hiding that option from its link dialog. CKEditor's ACF allows for setting the
allowedContentconfiguration to what you want, and it will automatically adjust all of its UI options accordingly.
Rather than letting CKEditor guess the
allowedContent from its button/plugin configuration, have Drupal explicitly set
allowedContent to match what the format's text filters allow.
To be able to generate the proper value for that setting, we must know which HTML tags and attributes are allowed by the text format, so this issue is introducing
filter_get_allowed_html_by_format() and an "allowed html callback" for filters of the type
FILTER_TYPE_HTML_RESTRICTOR. (This was originally proposed over at , but back then it was not something you could touch and see; now you can.)
All done; needs reviews!
User interface changes
- Filters of the
FILTER_TYPE_HTML_RESTRICTORtype may now define an "allowed html callback".
- New utility function:
filter_get_allowed_html_by_format(). Allows modules to gain insight about which HTML tags and attributes are allowed by a certain text format.
|#32||ckeditor_acf-1936392-32.patch||41.93 KB||Wim Leers|
PASSED: [[SimpleTest]]: [MySQL] 56,362 pass(es). View
|#32||interdiff-fixes.txt||4.22 KB||Wim Leers|
|#32||interdiff-renaming.txt||16.52 KB||Wim Leers|
|#27||ckeditor_acf-1936392-27.patch||40.53 KB||Wim Leers|
PASSED: [[SimpleTest]]: [MySQL] 56,177 pass(es). View
|#27||interdiff-minor_fixes_26.txt||7.05 KB||Wim Leers|