Merge pull request #1290 from MrReSc/master
Codesample plugin setting and translations
This commit is contained in:
commit
5abddff1aa
4 changed files with 42 additions and 14 deletions
|
@ -4,7 +4,8 @@
|
|||
"name": "TinyMCE",
|
||||
"description": "WYSIWYG HTML Editor, mit dem Inhalte einfach formatiert werden können."
|
||||
},
|
||||
"Toolbar top": "Obere Werkzeugleiste",
|
||||
"Toolbar bottom": "Untere Werkzeugleiste",
|
||||
"Mobile toolbar": "Werkzeugleiste auf Mobiles"
|
||||
}
|
||||
"toolbar-top": "Obere Werkzeugleiste",
|
||||
"toolbar-bottom": "Untere Werkzeugleiste",
|
||||
"codesample-languages": "Codesample Programmiersprachen",
|
||||
"codesample-supported-laguages": "Pragrammiersprachen die von Prism unterstützt werden."
|
||||
}
|
|
@ -4,7 +4,8 @@
|
|||
"name": "TinyMCE",
|
||||
"description": "WYSIWYG HTML Editor, mit dem Inhalte einfach formatiert werden können."
|
||||
},
|
||||
"Toolbar top": "Obere Werkzeugleiste",
|
||||
"Toolbar bottom": "Untere Werkzeugleiste",
|
||||
"Mobile toolbar": "Werkzeugleiste auf Mobiles"
|
||||
}
|
||||
"toolbar-top": "Obere Werkzeugleiste",
|
||||
"toolbar-bottom": "Untere Werkzeugleiste",
|
||||
"codesample-languages": "Codesample Programmiersprachen",
|
||||
"codesample-supported-laguages": "Pragrammiersprachen die von Prism unterstützt werden."
|
||||
}
|
|
@ -3,5 +3,9 @@
|
|||
{
|
||||
"name": "TinyMCE",
|
||||
"description": "HTML Editor for formatting content. Recommended for the users who don't want to work with Markdown code."
|
||||
}
|
||||
},
|
||||
"toolbar-top": "Toolbar top",
|
||||
"toolbar-bottom": "Toolbar bottom",
|
||||
"codesample-languages": "Codesample languages",
|
||||
"codesample-supported-laguages": "Programming languages supported by Prism."
|
||||
}
|
|
@ -12,7 +12,8 @@ class pluginTinymce extends Plugin {
|
|||
$this->dbFields = array(
|
||||
'toolbar1'=>'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code',
|
||||
'toolbar2'=>'',
|
||||
'plugins'=>'code autolink image link pagebreak advlist lists textpattern table'
|
||||
'plugins'=>'code autolink image link pagebreak advlist lists textpattern table',
|
||||
'codesampleLanguages'=>'HTML/XML markup|JavaScript javascript|CSS css|PHP php|Ruby ruby|Python python|Java java|C c|C# sharp|C++ cpp'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -20,13 +21,17 @@ class pluginTinymce extends Plugin {
|
|||
{
|
||||
global $L;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$L->get('Toolbar top').'</label>';
|
||||
$html = '<div class="alert alert-primary" role="alert">';
|
||||
$html .= $this->description();
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('toolbar-top').'</label>';
|
||||
$html .= '<input name="toolbar1" id="jstoolbar1" type="text" value="'.$this->getValue('toolbar1').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Toolbar bottom').'</label>';
|
||||
$html .= '<label>'.$L->get('toolbar-bottom').'</label>';
|
||||
$html .= '<input name="toolbar2" id="jstoolbar2" type="text" value="'.$this->getValue('toolbar2').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
|
@ -35,6 +40,14 @@ class pluginTinymce extends Plugin {
|
|||
$html .= '<input name="plugins" id="jsplugins" type="text" value="'.$this->getValue('plugins').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
if (strpos($this->getValue('plugins'), 'codesample') !== false) {
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('codesample-languages').'</label>';
|
||||
$html .= '<input name="codesampleLanguages" id="jsCodesampleLanguages" type="text" value="'.$this->getValue('codesampleLanguages').'">';
|
||||
$html .= '<span class="tip">'.$L->get('codesample-supported-laguages').'</span>';
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
@ -64,6 +77,14 @@ class pluginTinymce extends Plugin {
|
|||
$plugins = $this->getValue('plugins');
|
||||
$version = $this->version();
|
||||
|
||||
if (strpos($this->getValue('plugins'), 'codesample') !== false) {
|
||||
$codesampleLanguages = explode("|", $this->getValue('codesampleLanguages'));
|
||||
foreach($codesampleLanguages AS $codesampleLang) {
|
||||
$values = explode(" ", $codesampleLang);
|
||||
$codesampleConfig .= "{ text: '" . $values[0] . "', value: '" . $values[1] . "' },";
|
||||
}
|
||||
}
|
||||
|
||||
$lang = 'en';
|
||||
if (file_exists($this->phpPath().'tinymce'.DS.'langs'.DS.$L->currentLanguage().'.js')) {
|
||||
$lang = $L->currentLanguage();
|
||||
|
@ -121,7 +142,8 @@ $html = <<<EOF
|
|||
toolbar1: "$toolbar1",
|
||||
toolbar2: "$toolbar2",
|
||||
language: "$lang",
|
||||
content_css: "$content_css"
|
||||
content_css: "$content_css",
|
||||
codesample_languages: [$codesampleConfig],
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue