PHP-Code:
<?php
if ($GLOBALS['TL_CONFIG']['useRTE']):
?>
<script>window.tinymce || document.write('<script src="<?php echo TL_ASSETS_URL; ?>assets/tinymce4/tinymce.gzip.js">\x3C/script>')</script>
<script>
window.tinymce && tinymce.init({
skin: 'contao',
selector: '#<?php echo $selector; ?>',
language: '<?php echo Backend::getTinyMceLanguage(); ?>',
element_format: 'html',
document_base_url: '<?php echo Environment::get('base'); ?>',
entities: '160,nbsp,60,lt,62,gt,173,shy',
setup: function(editor) {
editor.getElement().removeAttribute('required');
},
init_instance_callback: function(editor) {
editor.on('focus', function(){ Backend.getScrollOffset(); });
},
file_browser_callback: function(field_name, url, type, win) {
Backend.openModalBrowser(field_name, url, type, win);
},
templates: [
<?php echo Backend::getTinyTemplates(); ?>
],
plugins: 'autosave charmap code fullscreen image importcss link lists paste searchreplace tabfocus template visualblocks',
browser_spellcheck: true,
tabfocus_elements: ':prev,:next',
extended_valid_elements: 'q[cite|class|title],article,section,hgroup,figure,figcaption',
menubar: 'file edit insert view',
paste_as_text: true, // activate 'paste as text' in menu bar
toolbar: 'formatselect | styleselect | removeformat | bold italic | link unlink | bullist numlist outdent indent | undo redo | code',
content_css: '<?php echo TL_PATH; ?>/system/themes/tinymce.css,<?php echo TL_PATH . '/' . Config::get('uploadPath'); ?>/css/tinymce.css?' + new Date().getTime(),
importcss_selector_converter: function(selector) {
if(selector.charAt(0) == '.') {
return {title: selector.substr(1), inline: 'span', selector: '*', classes: selector.substr(1)};
}
},
importcss_append: true,
keep_styles: false,
style_formats: [
{title: 'Inline', items: [
{title: 'Underline', icon: 'underline', format: 'underline'},
{title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough'},
{title: 'Superscript', icon: 'superscript', format: 'superscript'},
{title: 'Subscript', icon: 'subscript', format: 'subscript'},
{title: 'Code', icon: 'code', format: 'code'}
]},
{title: 'Alignment', items: [
{title: 'Left', icon: 'alignleft', format: 'alignleft'},
{title: 'Center', icon: 'aligncenter', format: 'aligncenter'},
{title: 'Right', icon: 'alignright', format: 'alignright'},
{title: 'Justify', icon: 'alignjustify', format: 'alignjustify'}
]}
],
block_formats:
'H1=h1;' +
'H2=h2;' +
'H3=h3;' +
'H4=h4;' +
'H5=h5;' +
'H6=h6;' +
'Paragraph=p;' +
'Blockquote=blockquote;' +
'DIV=div;' +
'PRE=pre;',
convert_urls: false
});
</script>
<?php endif; ?>
Und hier mal wieder die Einbindung, damit alle Felder, welche die tinyMCE.php benutzen, jetzt die tinyCustom.php benutzen. Code kommt in die system/config/dcaconfig.php
Lesezeichen