From 3886559e8331f59c9633a0ec9c915b1e1e84db12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dr=C3=B6scher?= Date: Thu, 7 Dec 2006 17:05:52 +0000 Subject: [PATCH] #5822 Thanks to TerraFrost for this fix! :) git-svn-id: file:///svn/phpbb/trunk@6726 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subSilver/template/editor.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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;