mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 15:16:16 +02:00
[ticket/8996] Correctly apply BBCodes in IE6-9 when applying with accesskey
PHPBB3-8996
This commit is contained in:
parent
86f8851c40
commit
219bdbaf70
@ -86,14 +86,10 @@ function bbfontstyle(bbopen, bbclose)
|
||||
if ((clientVer >= 4) && is_ie && is_win)
|
||||
{
|
||||
// Get text selection
|
||||
theSelection = document.selection.createRange().text;
|
||||
|
||||
if (theSelection)
|
||||
textarea = document.forms[form_name].elements[text_name];
|
||||
if (textarea.createTextRange && textarea.caretPos)
|
||||
{
|
||||
// Add tags around selection
|
||||
document.selection.createRange().text = bbopen + theSelection + bbclose;
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
theSelection = '';
|
||||
textarea.caretPos.text = bbopen + textarea.caretPos.text + bbclose;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -347,7 +343,15 @@ function mozWrap(txtarea, open, close)
|
||||
*/
|
||||
function storeCaret(textEl)
|
||||
{
|
||||
if (textEl.createTextRange)
|
||||
var keyCode = false;
|
||||
if (is_ie)
|
||||
{
|
||||
keyCode = (event.keyCode) ? event.keyCode : event.charCode;
|
||||
}
|
||||
|
||||
// Did the user press Shift (16), Ctrl (17) or Alt (18)?
|
||||
// If so, we do not update the caretPos, so BBCodes can still be applied correctly.
|
||||
if ((!is_ie || (keyCode != 16 && keyCode != 17 && keyCode != 18)) && (textEl.createTextRange))
|
||||
{
|
||||
textEl.caretPos = document.selection.createRange().duplicate();
|
||||
}
|
||||
@ -425,7 +429,7 @@ function getCaretPosition(txtarea)
|
||||
var caretPos = new caretPosition();
|
||||
|
||||
// simple Gecko/Opera way
|
||||
if(txtarea.selectionStart || txtarea.selectionStart == 0)
|
||||
if(!is_ie && (txtarea.selectionStart || txtarea.selectionStart == 0))
|
||||
{
|
||||
caretPos.start = txtarea.selectionStart;
|
||||
caretPos.end = txtarea.selectionEnd;
|
||||
|
Loading…
x
Reference in New Issue
Block a user