I'd really like to be able to limit the HTML block elements that can be chosen (p, h1-h6, div, blockquote etc.) for some of my clients to prevent them from misusing these options (see http://bugs.modx.com/browse/TINYMCE-77, too - I'm not sure if the project is still maintained in that issue tracker).
To accomplish this, I modified the following files:
/core/components/tinymce/tinymce.class.php
public function setProperties(array $properties = array()) {
$browserAction = $this->_getBrowserAction();
$this->properties = array_merge(array(
[...]
// This line has been changed:
'theme_advanced_blockformats' => $this->modx->getOption('tiny.blockformats',null,'p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address'),
[...]
),$properties);
/* now do user/context/system setting overrides - these must override properties */
$this->properties = array_merge($this->properties,array(
[...]
// This line has been added:
'theme_advanced_blockformats' => $this->modx->getOption('tiny.blockformats',$this->properties,'p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address'),
[...]
));
}
/assets/components/tinymce/tinymce.panel.js
Tiny.Editor = function(config) {
config = config || {};
config.tinyConfig = config.tinyConfig || Tiny.config;
config.tinyConfig = config.tinyConfig || {};
Ext.applyIf(config.tinyConfig,{
setup: (function(ed) {
ed.onInit.add(this.onLoad);
ed.onKeyUp.add(this.onChange);
}).createDelegate(this)
,apply_source_formatting: true
[...]
// This line has been changed:
,theme_advanced_blockformats: MODx.config['tiny.blockformats']
[...]
});
// These lines have been added:
$_lang['setting_tiny.blockformats'] = 'HTML block elements';
$_lang['setting_tiny.blockformats_desc'] = 'A comma separated list of HTML block elements. Possible values are: p, h1, h2, h3, h4, h5, h6, div, blockquote, code, pre, address.';
I'd really like to be able to limit the HTML block elements that can be chosen (p, h1-h6, div, blockquote etc.) for some of my clients to prevent them from misusing these options (see http://bugs.modx.com/browse/TINYMCE-77, too - I'm not sure if the project is still maintained in that issue tracker).
To accomplish this, I modified the following files:
/core/components/tinymce/tinymce.class.php
/assets/components/tinymce/tinymce.panel.js
/core/components/tinymce/lexicon/en/default.inc.php
/core/components/tinymce/lexicon/de/default.inc.php
This has to be done for the other languages, too, of course. ;)
Finally I added the system setting for this to the system_settings database table:
Database entry in tablesystem_settings
I'd be happy if this could be taken over into the official TinyMCE package. ;)