mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Some changes and additions, still not perfect in IE.
Test it till your eyes and ears start bleeding! git-svn-id: file:///svn/phpbb/trunk@6982 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f885fc36ae
commit
5227d3ce21
1 changed files with 36 additions and 16 deletions
|
@ -32,11 +32,21 @@ function helpline(help)
|
|||
*/
|
||||
function initInsertions()
|
||||
{
|
||||
var textarea = document.forms[form_name].elements[text_name];
|
||||
textarea.focus();
|
||||
var doc;
|
||||
if(document.forms[form_name])
|
||||
{
|
||||
doc = document;
|
||||
}
|
||||
else
|
||||
{
|
||||
doc = opener.document;
|
||||
}
|
||||
var textarea = doc.forms[form_name].elements[text_name];
|
||||
if (is_ie && typeof(baseHeight) != 'number')
|
||||
{
|
||||
baseHeight = document.selection.createRange().duplicate().boundingHeight;
|
||||
textarea.focus();
|
||||
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
|
||||
document.body.focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +58,9 @@ function bbstyle(bbnumber)
|
|||
if (bbnumber != -1)
|
||||
{
|
||||
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
insert_text('[*]');
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
}
|
||||
|
@ -62,6 +74,7 @@ function bbfontstyle(bbopen, bbclose)
|
|||
theSelection = false;
|
||||
|
||||
var textarea = document.forms[form_name].elements[text_name];
|
||||
|
||||
textarea.focus();
|
||||
|
||||
if ((clientVer >= 4) && is_ie && is_win)
|
||||
|
@ -87,7 +100,8 @@ function bbfontstyle(bbopen, bbclose)
|
|||
}
|
||||
|
||||
//The new position for the cursor after adding the bbcode
|
||||
var new_pos = getCaretPosition(textarea).start + bbopen.length;
|
||||
var caret_pos = getCaretPosition(textarea).start;
|
||||
var new_pos = caret_pos + bbopen.length;
|
||||
|
||||
// Open tag
|
||||
insert_text(bbopen + bbclose);
|
||||
|
@ -102,13 +116,14 @@ function bbfontstyle(bbopen, bbclose)
|
|||
// IE
|
||||
else if (document.selection)
|
||||
{
|
||||
|
||||
var range = textarea.createTextRange();
|
||||
range.move("character", new_pos);
|
||||
range.select();
|
||||
storeCaret(document.forms[form_name].elements[text_name]);
|
||||
storeCaret(textarea);
|
||||
}
|
||||
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
textarea.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,7 +137,8 @@ function insert_text(text, spaces, popup)
|
|||
if (!popup)
|
||||
{
|
||||
textarea = document.forms[form_name].elements[text_name];
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
textarea = opener.document.forms[form_name].elements[text_name];
|
||||
}
|
||||
|
@ -152,12 +168,15 @@ function insert_text(text, spaces, popup)
|
|||
caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
textarea.value = textarea.value + text;
|
||||
}
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
if (!popup)
|
||||
{
|
||||
textarea.focus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -352,6 +371,7 @@ function getCaretPosition(txtarea)
|
|||
// dirty and slow IE way
|
||||
else if(document.selection)
|
||||
{
|
||||
|
||||
// get current selection
|
||||
var range = document.selection.createRange();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue