From 8f97dc8d78e085cd8a3c41cf6cbd93e06a54d1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Fri, 24 Nov 2006 19:38:48 +0000 Subject: [PATCH] Blah ... git-svn-id: file:///svn/phpbb/trunk@6652 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/editor.js | 14 +++++++------- phpBB/styles/subSilver/template/editor.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 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; diff --git a/phpBB/styles/subSilver/template/editor.js b/phpBB/styles/subSilver/template/editor.js index 50f34d37d8..0e5f9d12f2 100644 --- a/phpBB/styles/subSilver/template/editor.js +++ b/phpBB/styles/subSilver/template/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;