In trying to integrate the TinyMCE After the Deadline plugin (http://www.afterthedeadline.com/download.slp?platform=TinyMCE) with the Drupal TinyMCE module, I ran into an issue whereby tinymce.module converting TinyMCE setting boolean values contained within PHP strings to normal boolean values on the JavaScript side when outputting the JS code for tinyMCE.init() affects the behavior of the plugin.
Within the function _tinymce_plugins() in plugin_reg.php of the Drupal TinyMCE module code, I added this line:
$plugins['AtD']['atd_ignore_enable'] = array('true');
Around line 127 of tinymce.module in the Drupal TinyMCE module code is this block:
$settings = array();
foreach ($init as $k => $v) {
$v = is_array($v) ? implode(',', $v) : $v;
// Don't wrap the JS init in quotes for boolean values or functions.
if (strtolower($v) != 'true' && strtolower($v) != 'false' && $v[0] != '{') {
$v = '"'. $v .'"';
}
$settings[] = $k .' : '. $v;
}
$tinymce_settings = implode(",\n ", $settings);
This conversion to JS strings causes "true" to become true and true to become "1" on the JS side when the PHP code outputs tinyMCE.init(). As a result, values resulting from all of the above type conversions fail the equality test on line 724 of editor_plugin.js in the TinyMCE After the Deadline plugin.
if (this.editor.getParam("atd_ignore_enable", "false") == "true")
This appears to be the only case of boolean values contained within strings in editor_plugin.js. However, none of the plugins bundled with the Drupal TinyMCE module appear to depend on this behavior with the default plugin_reg.php configuration. Is there a particular reason this conversion is done? It seems more logical to simply have true be true and "true" be "true" when going from PHP to JS. Attached is a patch that implements this change.
| Comment | File | Size | Author |
|---|---|---|---|
| tinymce.module.diff | 496 bytes | elazar |
Comments
Comment #1
nicoloye commented