Tinymce n
This commit is contained in:
parent
4b2ea853b8
commit
dd06fb5a8a
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
class pluginsimpleMDE extends Plugin {
|
class pluginsimpleMDE extends Plugin {
|
||||||
|
|
||||||
private $loadWhenController = array(
|
private $loadOnController = array(
|
||||||
'new-post',
|
|
||||||
'new-page',
|
'new-page',
|
||||||
'edit-post',
|
|
||||||
'edit-page'
|
'edit-page'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -54,13 +52,9 @@ class pluginsimpleMDE extends Plugin {
|
||||||
|
|
||||||
public function adminHead()
|
public function adminHead()
|
||||||
{
|
{
|
||||||
global $layout;
|
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
// Load CSS and JS only on Controllers in array.
|
|
||||||
if(in_array($layout['controller'], $this->loadWhenController))
|
|
||||||
{
|
|
||||||
// Path plugin.
|
// Path plugin.
|
||||||
$pluginPath = $this->htmlPath();
|
$pluginPath = $this->htmlPath();
|
||||||
|
|
||||||
|
@ -81,30 +75,22 @@ class pluginsimpleMDE extends Plugin {
|
||||||
.CodeMirror, .CodeMirror-scroll { min-height: 400px !important; border-radius: 0 !important; }
|
.CodeMirror, .CodeMirror-scroll { min-height: 400px !important; border-radius: 0 !important; }
|
||||||
</style>';
|
</style>';
|
||||||
|
|
||||||
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminBodyEnd()
|
public function adminBodyEnd()
|
||||||
{
|
{
|
||||||
global $layout;
|
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
|
||||||
global $Language;
|
|
||||||
|
|
||||||
$html = '';
|
|
||||||
|
|
||||||
// Load CSS and JS only on Controllers in array.
|
|
||||||
if(in_array($layout['controller'], $this->loadWhenController))
|
|
||||||
{
|
|
||||||
// Autosave
|
// Autosave
|
||||||
global $_Page, $_Post;
|
global $Page;
|
||||||
$autosaveID = $layout['controller'];
|
global $Language;
|
||||||
|
$autosaveID = $GLOBALS['ADMIN_CONTROLLER'];
|
||||||
$autosaveEnable = $this->getDbField('autosave')?'true':'false';
|
$autosaveEnable = $this->getDbField('autosave')?'true':'false';
|
||||||
if(isset($_Page)) {
|
if (!empty($Page)) {
|
||||||
$autosaveID = $_Page->key();
|
$autosaveID = $Page->key();
|
||||||
}
|
|
||||||
if(isset($_Post)) {
|
|
||||||
$autosaveID = $_Post->key();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spell Checker
|
// Spell Checker
|
||||||
|
@ -148,8 +134,9 @@ class pluginsimpleMDE extends Plugin {
|
||||||
});';
|
});';
|
||||||
|
|
||||||
$html .= '}); </script>';
|
$html .= '}); </script>';
|
||||||
}
|
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,43 +2,14 @@
|
||||||
|
|
||||||
class pluginTinymce extends Plugin {
|
class pluginTinymce extends Plugin {
|
||||||
|
|
||||||
private $loadWhenController = array(
|
private $loadOnController = array(
|
||||||
'new-post',
|
|
||||||
'new-page',
|
'new-page',
|
||||||
'edit-post',
|
|
||||||
'edit-page'
|
'edit-page'
|
||||||
);
|
);
|
||||||
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
$this->dbFields = array(
|
|
||||||
'plugins'=>'autoresize, fullscreen, pagebreak, link, textcolor, code, image, paste',
|
|
||||||
'toolbar'=>'bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist | styleselect | link forecolor backcolor removeformat image | pagebreak code fullscreen'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function form()
|
|
||||||
{
|
|
||||||
global $Language;
|
|
||||||
|
|
||||||
$html = '<div>';
|
|
||||||
$html .= '<label>Tinymce plugins</label>';
|
|
||||||
$html .= '<input name="plugins" id="jsplugins" type="text" value="'.$this->getDbField('plugins').'">';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<label>Tinymce toolbar</label>';
|
|
||||||
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getDbField('toolbar').'">';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function adminHead()
|
public function adminHead()
|
||||||
{
|
{
|
||||||
global $layout;
|
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
|
||||||
|
|
||||||
if (in_array($layout['controller'], $this->loadWhenController)) {
|
|
||||||
return '<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>';
|
return '<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -46,10 +17,37 @@ class pluginTinymce extends Plugin {
|
||||||
|
|
||||||
public function adminBodyEnd()
|
public function adminBodyEnd()
|
||||||
{
|
{
|
||||||
global $layout;
|
global $Language;
|
||||||
|
|
||||||
if (in_array($layout['controller'], $this->loadWhenController)) {
|
if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
|
||||||
return '<script>tinymce.init({ selector:"textarea" });</script>';
|
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>';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue