Commit 82c5e644 authored by montefuscolo's avatar montefuscolo

[ENH] add CodeMirror themes dropdown in PluginCode settings

parent 2a760daa
......@@ -806,7 +806,7 @@ $(function() {
.off('plugin_code_ready')
.on('plugin_code_ready', function(args) {
var colors = args.container.find('#param_colors input:first').hide();
var colorsSelector = $('<select />')
var colorsSelector = $('<select class="form-control"/>')
.insertAfter(colors)
.change(function() {
colors.val(colorsSelector.val());
......
......@@ -7,6 +7,22 @@
function wikiplugin_code_info()
{
global $tikipath;
$themes = array();
$themes_folder = rtrim($tikipath, '/') . '/vendor/codemirror/codemirror/theme';
if ( is_dir($themes_folder) ) {
foreach ( scandir($themes_folder) as $file ) {
$match = null;
if ( preg_match('/(.*)(\.css)$/', $file, $match) ) {
$themes[] = array(
'text' => $match[1],
'value' => $match[1]
);
}
}
}
return array(
'name' => tra('Code'),
'documentation' => 'PluginCode',
......@@ -88,8 +104,9 @@ function wikiplugin_code_info()
'theme' => array(
'required' => false,
'name' => tra('Theme'),
'description' => tra('Any supported theme listed at https://codemirror.net/demo/theme.html'),
'since' => '1',
'description' => tra('XAny supported theme listed at https://codemirror.net/demo/theme.html'),
'since' => '17',
'options' => $themes,
'filter' => 'text',
),
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment