aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVjacheslav Trushkin <cyberalien@gmail.com>2013-05-20 18:47:25 +0300
committerVjacheslav Trushkin <cyberalien@gmail.com>2013-05-20 18:47:25 +0300
commita1993bc0745db8b904bd8c851b2f410ca0cd42d0 (patch)
tree8c91a7679985d338785dc4a97f69efcbc0009785
parent1e216319a75ef35cf6b905bbb6e257a5f105e62a (diff)
downloadforums-a1993bc0745db8b904bd8c851b2f410ca0cd42d0.tar
forums-a1993bc0745db8b904bd8c851b2f410ca0cd42d0.tar.gz
forums-a1993bc0745db8b904bd8c851b2f410ca0cd42d0.tar.bz2
forums-a1993bc0745db8b904bd8c851b2f410ca0cd42d0.tar.xz
forums-a1993bc0745db8b904bd8c851b2f410ca0cd42d0.zip
[feature/editor-code-tabs] Correctly calculate end tag location
PHPBB3-11557
-rw-r--r--phpBB/styles/prosilver/template/editor.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js
index 9ec8409560..4975c8e5a0 100644
--- a/phpBB/styles/prosilver/template/editor.js
+++ b/phpBB/styles/prosilver/template/editor.js
@@ -441,9 +441,12 @@ function getCaretPosition(txtarea) {
}
if (lastStart == -1) return false;
- for (i = 0; i < endTags.length; i++) {
- index = value.lastIndexOf(endTags[i], start);
- lastEnd = Math.max(lastEnd, index);
+ if (start > 0)
+ {
+ for (i = 0; i < endTags.length; i++) {
+ index = value.lastIndexOf(endTags[i], start - 1);
+ lastEnd = Math.max(lastEnd, index);
+ }
}
return (lastEnd < lastStart);