diff options
author | Dominik Dröscher <dhn2@users.sourceforge.net> | 2006-11-24 19:38:48 +0000 |
---|---|---|
committer | Dominik Dröscher <dhn2@users.sourceforge.net> | 2006-11-24 19:38:48 +0000 |
commit | 8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6 (patch) | |
tree | 2685986181cd15a12b51eabdddd96b884d96e2f7 /phpBB/adm/style/editor.js | |
parent | 2d31d53289fe4232b43e84a6d5968aa531be8a72 (diff) | |
download | forums-8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6.tar forums-8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6.tar.gz forums-8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6.tar.bz2 forums-8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6.tar.xz forums-8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6.zip |
Blah ...
git-svn-id: file:///svn/phpbb/trunk@6652 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/adm/style/editor.js')
-rw-r--r-- | phpBB/adm/style/editor.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 50f34d37d8..0e5f9d12f2 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -85,10 +85,9 @@ function bbstyle(bbnumber) function bbfontstyle(bbopen, bbclose) { theSelection = false; - document.forms[form_name].elements[text_name].focus(); - + var textarea = document.forms[form_name].elements[text_name]; - var new_pos = getCaretPosition(textarea).start + bbopen.length; + textarea.focus(); if ((clientVer >= 4) && is_ie && is_win) { @@ -112,12 +111,13 @@ function bbfontstyle(bbopen, bbclose) return; } + //The new position for the cursor after adding the bbcode + var new_pos = getCaretPosition(textarea).start + bbopen.length; + // Open tag insert_text(bbopen + bbclose); // Center the cursor when we don't have a selection - - // IE & Opera if (document.selection) { @@ -373,13 +373,13 @@ function getCaretPosition(txtarea) sel.text = dummy; //find dummy chraracter again - len = (dul.text.indexOf(c)); + len = (dul.text.indexOf(dummy)); sel.moveStart('character',-1); sel.text = ""; if (len == -1) { - len = 0; + len = txtarea.value.length; } caretPos.start = len; |