Commit 546b47ac authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix failure of mceFocus command in FF


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 7b8f1ec1
......@@ -97,12 +97,13 @@ function pieform_element_wysiwyg_get_headdata() {
global $USER, $_PIEFORM_WYSIWYGS;
if ($USER->get_account_preference('wysiwyg') || defined('PUBLIC')) {
$result = '<script type="text/javascript">'
. "\nvar editor_to_focus;"
. "\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 .= " $('{$editor}').focus = function() {\n";
$result .= " callLater(0.0001, function(){ tinyMCE.execCommand('mceFocus', false, '$editor'); });\n";
$result .= " editor_to_focus = '$editor';\n";
$result .= " };\n";
}
$result .= "});\nPieformManager.connect('onreply', null, function() {\n";
......
......@@ -167,7 +167,14 @@ tinyMCE.init({
content_css : {$content_css},
//document_base_url: {$jswwwroot},
remove_script_host: false,
relative_urls: false
relative_urls: false,
setup: function(ed) {
ed.onInit.add(function(ed) {
if (editor_to_focus && typeof(editor_to_focus) == 'string' && ed.editorId == editor_to_focus) {
ed.focus();
}
});
}
});
function custom_urlconvert (u, n, e) {
// Don't convert the url on the skype status buttons.
......
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