Fix "editor.css" inclusion when using style menu. BT#14221

- "style" parameter removed, now editor.css is only included when
the ckeditor is in fullpage and it's controlled by FormValidator.
pull/2495/head
jmontoyaa 8 years ago
parent 7c1d4e87bb
commit 725a60245a
  1. 3
      main/admin/settings.lib.php
  2. 3
      main/document/create_document.php
  3. 1
      main/exercise/exercise_show.php
  4. 2
      main/inc/introductionSection.inc.php
  5. 11
      main/inc/lib/formvalidator/FormValidator.class.php
  6. 3
      main/inc/lib/javascript/ckeditor/config_js.php
  7. 11
      main/inc/lib/template.lib.php
  8. 4
      main/template/default/javascript/editor/ckeditor/config_js.tpl
  9. 3
      main/template/default/javascript/editor/elfinder_standalone.tpl

@ -1124,8 +1124,7 @@ function addEditTemplate()
get_lang('Text'),
true,
true,
['ToolbarSet' => 'Documents', 'Width' => '100%', 'Height' => '400'],
true
['ToolbarSet' => 'Documents', 'Width' => '100%', 'Height' => '400']
);
// Setting the form elements: the form to upload an image to be used with the template.

@ -326,8 +326,7 @@ $form->addHtmlEditor(
get_lang('Content'),
true,
true,
$editorConfig,
true
$editorConfig
);
// Comment-field

@ -91,7 +91,6 @@ $is_allowedToEdit = api_is_allowed_to_edit(null, true) ||
api_is_session_admin() ||
api_is_drh() ||
api_is_student_boss();
if (!empty($sessionId) && !$is_allowedToEdit) {
if (api_is_course_session_coach(
$currentUserId,

@ -59,7 +59,7 @@ $config = [
'Height' => '300',
];
$form->addHtmlEditor('intro_content', null, false, false, $config, true);
$form->addHtmlEditor('intro_content', null, false, false, $config);
$form->addButtonSave(get_lang('SaveIntroText'), 'intro_cmdUpdate');
/* INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) */

@ -925,15 +925,13 @@ EOT;
* @param bool $required (optional) Is the form-element required (default=true)
* @param bool $fullPage (optional) When it is true, the editor loads completed html code for a full page
* @param array $config (optional) Configuration settings for the online editor
* @param bool $style
*/
public function addHtmlEditor(
$name,
$label,
$required = true,
$fullPage = false,
$config = [],
$style = false
$config = []
) {
$attributes = [];
$attributes['rows'] = isset($config['rows']) ? $config['rows'] : 15;
@ -949,12 +947,11 @@ EOT;
/** @var HtmlEditor $element */
$element = $this->getElement($name);
if ($style) {
$config['style'] = true;
}
$config['style'] = false;
if ($fullPage) {
$config['fullPage'] = true;
// Adds editor.css in ckEditor
$config['style'] = true;
}
if ($element->editor) {

@ -4,13 +4,12 @@
require_once __DIR__.'/../../../global.inc.php';
$moreButtonsInMaximizedMode = false;
if (api_get_setting('more_buttons_maximized_mode') === 'true') {
$moreButtonsInMaximizedMode = true;
}
$template = new Template();
$template->setCSSEditor();
$template->setStyleMenuInCkEditor();
$template->assign('moreButtonsInMaximizedMode', $moreButtonsInMaximizedMode);
$courseId = api_get_course_int_id();
$courseCondition = '';

@ -626,14 +626,19 @@ class Template
}
}
public function setCSSEditor()
/**
* Sets the "styles" menu in ckEditor
*
* Reads css/themes/xxx/editor.css if exists and shows it in the menu, otherwise it
* will take the default web/editor.css file
*/
public function setStyleMenuInCkEditor()
{
$cssEditor = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'editor.css');
if (is_file(api_get_path(SYS_CSS_PATH).$this->themeDir.'editor.css')) {
$cssEditor = api_get_path(WEB_CSS_PATH).$this->themeDir.'editor.css';
}
$this->assign('cssEditor', $cssEditor);
$this->assign('css_editor', $cssEditor);
}
/**

@ -96,7 +96,6 @@ CKEDITOR.editorConfig = function (config) {
}
];
{% if moreButtonsInMaximizedMode %}
config.toolbar = 'minToolbar';
config.smallToolbar = 'minToolbar';
@ -109,7 +108,8 @@ CKEDITOR.editorConfig = function (config) {
// Allows to use "class" attribute inside divs and spans.
config.allowedContent = true;
config.contentsCss = '{{ cssEditor }}';
// Option to set the "styles" menu
config.contentsCss = '{{ css_editor }}';
config.customConfig = '{{ _p.web_main ~ 'inc/lib/javascript/ckeditor/config_js.php'}}';
};

@ -30,6 +30,3 @@
});
</script>
<div id="elfinder"></div>

Loading…
Cancel
Save