Skip to content

Commit

Permalink
CKEditor font list is configurable - refs BT#16686
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien Ducoulombier committed Apr 15, 2020
1 parent 018de86 commit 9895e1a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main/inc/lib/javascript/ckeditor/config_js.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,21 @@
$template->assign('enter_mode', $enterMode);
}

$fontNames = [];
foreach (api_get_configuration_sub_value('ck_editor_font_names/names', [
'Arial' => 'Arial, Helvetica, sans-serif',
'Comic Sans MS' => 'Comic Sans MS, cursive',
'Courier New' => 'Courier New, Courier, monospace',
'Georgia' => 'Georgia, serif',
'Lucida Sans Unicode' => 'Lucida Sans Unicode, Lucida Grande, sans-serif',
'Tahoma' => 'Tahoma, Geneva, sans-serif',
'Times New Roman' => 'Times New Roman, Times, serif',
'Trebuchet MS' => 'Trebuchet MS, Helvetica, sans-serif',
'Verdana' => 'Verdana, Geneva, sans-serif',
]) as $label => $value) {
$fontNames[] = "$label/$value";
}
$template->assign('font_names', join(';', $fontNames));

header('Content-type: application/x-javascript');
$template->display($template->get_template('javascript/editor/ckeditor/config_js.tpl'));
15 changes: 15 additions & 0 deletions main/install/configuration.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,21 @@
'fields' => ['duree_en_min'],
];*/

// CKEditor font names
/*$_configuration['ck_editor_font_names'] = [
'names' => [
'Arial' => 'Arial, Helvetica, sans-serif',
'Comic Sans MS' => 'Comic Sans MS, cursive',
'Courier New' => 'Courier New, Courier, monospace',
'Georgia' => 'Georgia, serif',
'Lucida Sans Unicode' => 'Lucida Sans Unicode, Lucida Grande, sans-serif',
'Tahoma' => 'Tahoma, Geneva, sans-serif',
'Times New Roman' => 'Times New Roman, Times, serif',
'Trebuchet MS' => 'Trebuchet MS, Helvetica, sans-serif',
'Verdana' => 'Verdana, Geneva, sans-serif',
]
];*/

// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ CKEDITOR.editorConfig = function (config) {
config.language_list = ['{{ language_list }}'];

config.qMarkersRollsUrl = '{{ _p.web_ajax }}exercise.ajax.php?a=get_quiz_embeddable';

config.font_names = "{{ font_names }}";
};

// Sets default target to "_blank" in link plugin
Expand Down

1 comment on commit 9895e1a

@ywarnier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.