// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
/**
* TinyMCE helper javascript functions.
*
* @package editor_tinymce
* @copyright 2010 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
M.editor_tinymce = M.editor_tinymce || {};
M.editor_tinymce.editor_options = M.editor_tinymce.options || {};
M.editor_tinymce.filepicker_options = M.editor_tinymce.filepicker_options || {};
M.editor_tinymce.initialised = false;
M.editor_tinymce.init_editor = function(Y, editorid, options) {
if (!M.editor_tinymce.initialised) {
// Load all language strings for all plugins - we do not use standard TinyMCE lang pack loading!
tinymce.ScriptLoader.add(M.cfg.wwwroot + '/lib/editor/tinymce/all_strings.php?elanguage=' + options.language + '&rev=' + options.langrev);
// Monkey patch for MDL-35284 - this hack ignores empty toolbars.
tinymce.ui.Toolbar.prototype.oldRenderHTML = tinymce.ui.Toolbar.prototype.renderHTML;
tinymce.ui.Toolbar.prototype.renderHTML = function() {
if (this.controls.length == 0) {
return;
}
return tinymce.ui.Toolbar.prototype.oldRenderHTML.call(this);
};
M.editor_tinymce.initialised = true;
M.util.js_pending('editors');
options.oninit = "M.editor_tinymce.init_callback";
}
M.editor_tinymce.editor_options[editorid] = options;
// Load necessary Moodle plugins into editor.
if (options.moodle_init_plugins) {
var extraplugins = options.moodle_init_plugins.split(',');
for (var i=0; i