bludit/bl-plugins/tinymce/plugin.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2017-08-03 23:28:32 +02:00
<?php
class pluginTinymce extends Plugin {
2017-08-06 00:52:00 +02:00
private $loadOnController = array(
2017-08-03 23:28:32 +02:00
'new-page',
'edit-page'
);
public function adminHead()
{
2017-08-06 00:52:00 +02:00
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
2017-08-03 23:28:32 +02:00
return '<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>';
}
return false;
}
public function adminBodyEnd()
{
2017-08-06 00:52:00 +02:00
global $Language;
2017-08-03 23:28:32 +02:00
2017-08-06 00:52:00 +02:00
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",
element_format : "html",
entity_encoding : "raw",
schema: "html5",
statusbar: false,
menubar:false,
branding: false,
browser_spellcheck: true,
autoresize_bottom_margin: "50",
pagebreak_separator: "'.PAGE_BREAK.'",
paste_as_text: true,
document_base_url: "'.DOMAIN_UPLOADS.'",
plugins: [
"autoresize advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste code pagebreak"
],
toolbar: "bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist | styleselect | link forecolor backcolor removeformat image | pagebreak code fullscreen"
});
</script>';
2017-08-03 23:28:32 +02:00
}
return false;
}
}