bludit/bl-plugins/tinymce/plugin.php

63 lines
1.7 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-10-02 22:42:18 +02:00
'new-content',
'edit-content'
2017-08-03 23:28:32 +02:00
);
public function adminHead()
{
2017-08-06 00:52:00 +02:00
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
2017-10-10 00:43:33 +02:00
return '<script src="'.$this->htmlPath().'tinymce/tinymce.min.js"></script>';
2017-08-03 23:28:32 +02:00
}
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",
2017-10-10 00:43:33 +02:00
theme: "modern",
skin: "bludit",
min_height: 500,
max_height: 1000,
2017-08-06 00:52:00 +02:00
element_format : "html",
entity_encoding : "raw",
schema: "html5",
statusbar: false,
menubar:false,
2018-02-16 19:41:06 +01:00
remove_script_host: false,
2017-08-06 00:52:00 +02:00
branding: false,
browser_spellcheck: true,
pagebreak_separator: "'.PAGE_BREAK.'",
paste_as_text: true,
document_base_url: "'.DOMAIN_UPLOADS.'",
plugins: [
"autosave, code",
"searchreplace autolink directionality",
"visualblocks visualchars",
"fullscreen image link media template",
"codesample table hr pagebreak",
"advlist lists textcolor wordcount",
"contextmenu colorpicker textpattern"
2017-08-06 00:52:00 +02:00
],
toolbar1: "restoredraft | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | outdent indent | removeformat image | pagebreak code",
toolbar2: "formatselect | table | numlist bullist | fullscreen"
2017-08-06 00:52:00 +02:00
});
</script>';
2017-08-03 23:28:32 +02:00
}
return false;
}
}