MDL-33041 add base TinyMCE and moodle plugin urls

We should never use ../../../.. to reference core TinyMCE or moodle TinyMCE plugins, this crate problems if we ever decide to create improved loaders.
This commit is contained in:
Petr Škoda
2012-08-11 15:57:38 +02:00
parent 8585624a6c
commit e4907cab85
+12
View File
@@ -106,6 +106,7 @@ class tinymce_texteditor extends texteditor {
'elements' => $elementid,
'relative_urls' => false,
'document_base_url' => $CFG->httpswwwroot,
'moodle_plugin_base' => "$CFG->httpswwwroot/lib/editor/tinymce/plugins/",
'content_css' => $contentcss,
'language' => $lang,
'directionality' => $directionality,
@@ -181,4 +182,15 @@ class tinymce_texteditor extends texteditor {
require_once($CFG->dirroot . '/lib/editor/tinymce/classes/plugin.php');
return editor_tinymce_plugin::get($plugin);
}
/**
* Equivalent to tinyMCE.baseURL value available from JavaScript,
* always use instead of /../ when referencing tinymce core code from moodle plugins!
*
* @return moodle_url url pointing to the root of TinyMCE javascript code.
*/
public function get_tinymce_base_url() {
global $CFG;
return new moodle_url("$CFG->httpswwwroot/lib/editor/tinymce/tiny_mce/$this->version/");
}
}