Commit a3cf5e96 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't try to focus tinymce editor until after initialisation (hopefully fixes #519674)


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent c27a1236
......@@ -97,12 +97,12 @@ function pieform_element_wysiwyg_get_headdata() {
global $USER, $_PIEFORM_WYSIWYGS;
if ($USER->get_account_preference('wysiwyg') || defined('PUBLIC')) {
$result = '<script type="text/javascript">'
. "\nvar focusEditor = '$_PIEFORM_WYSIWYGS[0]';"
. "\nPieformManager.connect('onsubmit', null, tinyMCE.triggerSave);"
. "\nPieformManager.connect('onload', null, function() {\n";
foreach ($_PIEFORM_WYSIWYGS as $editor) {
$result .= " tinyMCE.execCommand('mceAddControl', false, '$editor');\n";
}
$result .= " tinyMCE.execCommand('mceFocus', false, '$_PIEFORM_WYSIWYGS[0]');\n";
$result .= "});\nPieformManager.connect('onreply', null, function() {\n";
foreach ($_PIEFORM_WYSIWYGS as $editor) {
$result .= " tinyMCE.execCommand('mceRemoveControl', false, '$editor');\n";
......
......@@ -166,6 +166,13 @@ tinyMCE.init({
directionality: "{$tinymce_langdir}",
content_css : {$content_css},
//document_base_url: {$jswwwroot},
setup: function(ed) {
if (focusEditor && ed.id == focusEditor) {
ed.onInit.add(function(ed) {
ed.focus();
});
}
},
relative_urls: false
});
function custom_urlconvert (u, n, e) {
......
Markdown is supported
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