diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-05-20 18:47:25 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-05-20 18:47:25 +0300 |
commit | a1993bc0745db8b904bd8c851b2f410ca0cd42d0 (patch) | |
tree | 8c91a7679985d338785dc4a97f69efcbc0009785 | |
parent | 1e216319a75ef35cf6b905bbb6e257a5f105e62a (diff) | |
download | forums-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.js | 9 |
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); |