aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Dröscher <dhn2@users.sourceforge.net>2006-12-07 17:05:52 +0000
committerDominik Dröscher <dhn2@users.sourceforge.net>2006-12-07 17:05:52 +0000
commit3886559e8331f59c9633a0ec9c915b1e1e84db12 (patch)
treec3d7a4f52a7c059dd3f8d8078b36056c1260f08a
parent7f3114364df5bf425c65d0e6da655ed67741f69c (diff)
downloadforums-3886559e8331f59c9633a0ec9c915b1e1e84db12.tar
forums-3886559e8331f59c9633a0ec9c915b1e1e84db12.tar.gz
forums-3886559e8331f59c9633a0ec9c915b1e1e84db12.tar.bz2
forums-3886559e8331f59c9633a0ec9c915b1e1e84db12.tar.xz
forums-3886559e8331f59c9633a0ec9c915b1e1e84db12.zip
#5822 Thanks to TerraFrost for this fix! :)
git-svn-id: file:///svn/phpbb/trunk@6726 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/styles/subSilver/template/editor.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/styles/subSilver/template/editor.js b/phpBB/styles/subSilver/template/editor.js
index 54e7e61f3a..c6542aac89 100644
--- a/phpBB/styles/subSilver/template/editor.js
+++ b/phpBB/styles/subSilver/template/editor.js
@@ -18,6 +18,9 @@ var is_nav = ((clientPC.indexOf('mozilla') != -1) && (clientPC.indexOf('spoofer'
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
var is_mac = (clientPC.indexOf('mac') != -1);
+var baseHeight;
+window.onload = initInsertions;
+
/**
* Shows the help messages in the helpline window
*/
@@ -64,6 +67,19 @@ function arraypop(thearray)
return retval;
}
+/**
+* Fix a bug involving the TextRange object. From
+* http://www.frostjedi.com/terra/scripts/demo/caretBug.html
+*/
+function initInsertions()
+{
+ document.post.message.focus();
+ if (is_ie && typeof(baseHeight) != 'number')
+ {
+ baseHeight = document.selection.createRange().duplicate().boundingHeight;
+ }
+}
+
/**
* bbstyle
@@ -168,6 +184,11 @@ function insert_text(text, spaces, popup)
else if (textarea.createTextRange && textarea.caretPos)
{
+ if (baseHeight != textarea.caretPos.boundingHeight)
+ {
+ textarea.focus();
+ storeCaret(textarea);
+ }
var caret_pos = textarea.caretPos;
caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;