diff options
author | Nils Adermann <naderman@naderman.de> | 2006-05-21 13:22:51 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2006-05-21 13:22:51 +0000 |
commit | 2ddac1037550a12e6a49dd7d78f7884ce584eedc (patch) | |
tree | 98b027accc55318c716ab0852463ed3bdeff0c0d /phpBB | |
parent | 80168f926054db88990fea4f0b5e75b15b26dc38 (diff) | |
download | forums-2ddac1037550a12e6a49dd7d78f7884ce584eedc.tar forums-2ddac1037550a12e6a49dd7d78f7884ce584eedc.tar.gz forums-2ddac1037550a12e6a49dd7d78f7884ce584eedc.tar.bz2 forums-2ddac1037550a12e6a49dd7d78f7884ce584eedc.tar.xz forums-2ddac1037550a12e6a49dd7d78f7884ce584eedc.zip |
- solve duplication of text [Bug #1229]
- fixed [*] BBcode [Bug #1625]
git-svn-id: file:///svn/phpbb/trunk@5956 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/styles/subSilver/template/editor.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/phpBB/styles/subSilver/template/editor.js b/phpBB/styles/subSilver/template/editor.js index 5c7b6e4e29..5ccc210a3c 100644 --- a/phpBB/styles/subSilver/template/editor.js +++ b/phpBB/styles/subSilver/template/editor.js @@ -106,11 +106,15 @@ function bbfontstyle(bbopen, bbclose) { return; } -function insert_text(text) { - if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) { +function insert_text(text) +{ + if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) + { var caretPos = document.forms[form_name].elements[text_name].caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text; - } else { + } + else if (document.forms[form_name].elements[text_name].selectionStart) + { var selStart = document.forms[form_name].elements[text_name].selectionStart; var selEnd = document.forms[form_name].elements[text_name].selectionEnd; @@ -118,6 +122,10 @@ function insert_text(text) { document.forms[form_name].elements[text_name].selectionStart = selStart + text.length; document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length; } + else + { + document.forms[form_name].elements[text_name].value = document.forms[form_name].elements[text_name].value + text; + } } function attach_inline() { @@ -204,12 +212,15 @@ function bbstyle(bbnumber) { return; } + // [*] doesn't have an end tag + noEndTag = (bbtags[bbnumber] == "[*]") + if ((clientVer >= 4) && is_ie && is_win) { theSelection = document.selection.createRange().text; // Get text selection if (theSelection) { // Add tags around selection - document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1]; + document.selection.createRange().text = bbtags[bbnumber] + theSelection + ((!noEndTag) ? bbtags[bbnumber+1] : ''); document.forms[form_name].elements[text_name].focus(); theSelection = ''; return; @@ -217,7 +228,7 @@ function bbstyle(bbnumber) { } else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0)) { - mozWrap(document.forms[form_name].elements[text_name], bbtags[bbnumber], bbtags[bbnumber+1]); + mozWrap(document.forms[form_name].elements[text_name], bbtags[bbnumber], ((!noEndTag) ? bbtags[bbnumber+1] : '')); document.forms[form_name].elements[text_name].focus(); theSelection = ''; return; |