Recent Topics

1 Oct 05, 2005 12:42    

Hello.

I've found out a possible bug in
'blogs/plugins/toolbars/_quicktags.toolbar.php' file (in 0.9.1b and 0.9.0.12 too)

In line 302:


cursorPos += b2evoButtons[i].tagStart.length + edButtons[i].tagEnd.length;


but there's no 'edButtons' object defined (a typo?). So you get a "edButtons not defined" JavaScript error when accesing with Mozilla/Firefox browser (this is a code to focus cursor after inserting code when using Mozilla browsers) and cursor isn't focused on the textarea (as supposed).

I changed it to insert 'b2evoButtons':


cursorPos += b2evoButtons[i].tagStart.length + b2evoButtons[i].tagEnd.length;


and it works with Mozilla/Firefox:
- no JavaScript error
- cursor is focused on the textarea

Hope this helps the project.

2 Oct 07, 2005 16:03

Hi.

I've been checking the original Alex King's 'Quicktags' libraries
(http://www.alexking.org/index.php?content=software/javascript/content.php)
and noticed there were 2 missing lines in '_quicktags.toolbar.php':


var scrollTop = myField.scrollTop;


myField.scrollTop = scrollTop;

This was the reason the cursor wasn't focused at the bottom of the textearea. If you insert them, it works.

This is the modified piece of code:


 //MOZILLA/NETSCAPE support
                        else if (myField.selectionStart || myField.selectionStart == '0') {
                                var startPos = myField.selectionStart;
                                var endPos = myField.selectionEnd;
                                var cursorPos = endPos;
                                var scrollTop = myField.scrollTop;
                                if (startPos != endPos) {
                                        myField.value = myField.value.substring(0, startPos) + b2evoButtons[i].tagStart + myField.value.substring(startPos, endPos) + b2evoButtons[i].tagEnd + myField.value.substring(endPos, myField.value.length);
                                        cursorPos += b2evoButtons[i].tagStart.length + b2evoButtons[i].tagEnd.length;
                                }
                                else {
                                        if (!b2evoCheckOpenTags(i) || b2evoButtons[i].tagEnd == '') {
                                                myField.value = myField.value.substring(0, startPos) + b2evoButtons[i].tagStart + myField.value.substring(endPos, myField.value.length);
                                                b2evoAddTag(i);
                                                cursorPos = startPos + b2evoButtons[i].tagStart.length;
                                        }
                                        else {
                                                myField.value = myField.value.substring(0, startPos) + b2evoButtons[i].tagEnd + myField.value.substring(endPos, myField.value.length);
                                                b2evoRemoveTag(i);
                                                cursorPos = startPos + b2evoButtons[i].tagEnd.length;
                                        }
                                }
                                myField.focus();
                                myField.selectionStart = cursorPos;
                                myField.selectionEnd = cursorPos;
                                myField.scrollTop = scrollTop;
                        }


Form is loading...