Andrius Pratusis fc3c4e5bc9
Add files via upload
TinyMCE plugin edit. Added Print and Media embed. We can add video iframes with an editor now. Just add iframe source to embed field.
2018-02-25 10:43:47 +02:00

62 lines
1.6 KiB
PHP

<?php
class pluginTinymce extends Plugin {
private $loadOnController = array(
'new-content',
'edit-content'
);
public function adminHead()
{
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
return '<script src="'.$this->htmlPath().'tinymce/tinymce.min.js"></script>';
}
return false;
}
public function adminBodyEnd()
{
global $Language;
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
return '<script>
function editorAddImage(filename) {
tinymce.activeEditor.insertContent("<img src=\""+filename+"\" alt=\"'.$Language->get('Image description').'\">" + "\n");
}
tinymce.init({
selector: "#jscontent",
theme: "modern",
skin: "bludit",
min_height: 500,
max_height: 1000,
element_format : "html",
entity_encoding : "raw",
schema: "html5",
statusbar: false,
menubar:false,
branding: false,
browser_spellcheck: true,
pagebreak_separator: "'.PAGE_BREAK.'",
paste_as_text: true,
document_base_url: "'.DOMAIN_UPLOADS.'",
plugins: [
"autosave",
"searchreplace autolink directionality",
"visualblocks visualchars",
"fullscreen image link media template",
"codesample table hr pagebreak",
"advlist lists textcolor wordcount",
"contextmenu colorpicker textpattern",
"emoticons", "print"
],
toolbar: "restoredraft | formatselect | bold italic strikethrough forecolor backcolor | link | emoticons | print |alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat media table | pagebreak code fullscreen"
});
</script>';
}
return false;
}
}