Commit b83f54f8 authored by Dongsheng Cai's avatar Dongsheng Cai Committed by Sam Hemelryk
Browse files

MDL-23930 fixed javascript insert into tinymce

parent f4c23f03
......@@ -3,13 +3,15 @@
* Used when editing a data template
*/
function insert_field_tags(selectlist) {
if (typeof(currEditor) != 'undefined' && currEditor._editMode == 'wysiwyg') {
// HTMLArea-specific
currEditor.insertHTML(selectlist.options[selectlist.selectedIndex].value);
} else {
// For inserting when in HTMLArea code view or for normal textareas
insertAtCursor(currTextarea, selectlist.options[selectlist.selectedIndex].value);
}
var value = selectlist.options[selectlist.selectedIndex].value;
var editorname = 'template';
if (typeof tinyMCE == 'undefined') {
var element = document.getElementsByName(editorname)[0];
// For inserting when in normal textareas
insertAtCursor(element, value);
} else {
tinyMCE.execInstanceCommand(editorname, 'mceInsertContent', false, value);
}
}
/**
......
......@@ -82,13 +82,6 @@ $strdata = get_string('modulenameplural','data');
// For the javascript for inserting template tags: initialise the default textarea to
// 'edit_template' - it is always present in all different possible views.
$editorobj = 'editor_'.md5('template');
$bodytag = 'onload="';
$bodytag .= 'if (typeof('.$editorobj.') != \'undefined\') { currEditor = '.$editorobj.'; } ';
$bodytag .= 'currTextarea = document.getElementById(\'tempform\').template;';
$bodytag .= '" ';
if ($mode == 'singletemplate') {
$PAGE->navbar->add(get_string($mode,'data'));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment