mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-14741: use the default html editor, as chosen in the admin settings
This commit is contained in:
parent
c7b4be096a
commit
b26be9a9cd
@ -61,9 +61,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
|
||||
|
||||
function toHtml(){
|
||||
if ($this->_canUseHtmlEditor && !$this->_flagFrozen){
|
||||
ob_start();
|
||||
use_html_editor($this->getName(), '', $this->getAttribute('id'));
|
||||
$script=ob_get_clean();
|
||||
global $htmlEditorObject;
|
||||
$script = $htmlEditorObject->activateEditor($this->getName(), $this->getAttribute('id'));
|
||||
} else {
|
||||
$script='';
|
||||
}
|
||||
@ -96,4 +95,4 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
|
||||
return $html . $this->_getPersistantData();
|
||||
} //end func getFrozenHtml
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -6131,6 +6131,33 @@ function ini_get_bool($ini_get_arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of available HTML editors
|
||||
*/
|
||||
function get_available_html_editors() {
|
||||
global $CFG;
|
||||
static $editors = null;
|
||||
|
||||
if ($editors != null) {
|
||||
return $editors;
|
||||
}
|
||||
|
||||
$editors = array();
|
||||
|
||||
$dir = opendir($CFG->libdir .'/editor');
|
||||
while (($file = readdir($dir)) !== false) {
|
||||
if ($file != '.' and $file != '..') {
|
||||
$path_file = $CFG->libdir ."/editor/{$file}";
|
||||
if (is_dir($path_file) and file_exists($path_file .'.js.php')) {
|
||||
$editors[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
return $editors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the HTML editor is enabled.
|
||||
*
|
||||
|
@ -2557,11 +2557,18 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
|
||||
|
||||
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
|
||||
|
||||
require_once($CFG->libdir .'/editor/htmlEditor.class.php');
|
||||
global $htmlEditorObject;
|
||||
$htmlEditorObject = new htmlEditor();
|
||||
$htmlEditor = $htmlEditorObject->configure();
|
||||
|
||||
ob_start();
|
||||
include($CFG->header);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$output = str_replace('</head>', "\n\n$htmlEditor\n\n</head>", $output);
|
||||
|
||||
// container debugging info
|
||||
$THEME->open_header_containers = open_containers();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user