Created
March 28, 2019 09:03
-
-
Save intco/a07490a879548b4930fe0625ae708463 to your computer and use it in GitHub Desktop.
tinyMCE configuration for Contao 4.x - solve [nsbp] problem and set "paste as plain text" as default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Contao; | |
if ($GLOBALS['TL_CONFIG']['useRTE']): | |
?> | |
<script>window.tinymce || document.write('<script src="<?= $this->asset('js/tinymce.min.js', 'contao-components/tinymce4') ?>">\x3C/script>')</script> | |
<script> | |
setTimeout(function() { | |
window.tinymce && tinymce.init({ | |
skin: 'contao', | |
selector: '#<?= $this->selector ?>', | |
language: '<?= Backend::getTinyMceLanguage() ?>', | |
element_format: 'html', | |
document_base_url: '<?= Environment::get('base') ?>', | |
entities: '160,nbsp,60,lt,62,gt,173,shy', | |
branding: false, | |
setup: function(editor) { | |
editor.getElement().removeAttribute('required'); | |
}, | |
init_instance_callback: function(editor) { | |
if (document.activeElement && document.activeElement.id && document.activeElement.id == editor.id) { | |
editor.editorManager.get(editor.id).focus(); | |
} | |
editor.on('focus', function() { Backend.getScrollOffset(); }); | |
}, | |
file_browser_callback: function(field_name, url, type, win) { | |
Backend.openModalBrowser(field_name, url, type, win, '<?= $this->source ?>'); | |
}, | |
file_browser_callback_types: <?= json_encode($this->fileBrowserTypes) ?>, | |
content_css: 'system/themes/<?= Backend::getTheme() ?>/tinymce.css', | |
plugins: 'autosave charmap code fullscreen image importcss link lists paste searchreplace stripnbsp tabfocus table visualblocks visualchars', | |
browser_spellcheck: true, | |
tabfocus_elements: ':prev,:next', | |
importcss_append: true, | |
extended_valid_elements: 'q[cite|class|title],article,section,hgroup,figure,figcaption', | |
menubar: 'edit insert view format table', | |
toolbar: 'link unlink | image | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | code', | |
entity_encoding: 'raw', | |
paste_as_text: true | |
}); | |
}, 0); | |
</script> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment