mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 05:48:51 +00:00
- solve duplication of text [Bug #1229]
- fixed [*] BBcode [Bug #1625] git-svn-id: file:///svn/phpbb/trunk@5956 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
80168f9260
commit
2ddac10375
1 changed files with 16 additions and 5 deletions
|
@ -106,11 +106,15 @@ function bbfontstyle(bbopen, bbclose) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert_text(text) {
|
function insert_text(text)
|
||||||
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
|
{
|
||||||
|
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;
|
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;
|
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 selStart = document.forms[form_name].elements[text_name].selectionStart;
|
||||||
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
|
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].selectionStart = selStart + text.length;
|
||||||
document.forms[form_name].elements[text_name].selectionEnd = selEnd + 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() {
|
function attach_inline() {
|
||||||
|
@ -204,12 +212,15 @@ function bbstyle(bbnumber) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [*] doesn't have an end tag
|
||||||
|
noEndTag = (bbtags[bbnumber] == "[*]")
|
||||||
|
|
||||||
if ((clientVer >= 4) && is_ie && is_win)
|
if ((clientVer >= 4) && is_ie && is_win)
|
||||||
{
|
{
|
||||||
theSelection = document.selection.createRange().text; // Get text selection
|
theSelection = document.selection.createRange().text; // Get text selection
|
||||||
if (theSelection) {
|
if (theSelection) {
|
||||||
// Add tags around selection
|
// 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();
|
document.forms[form_name].elements[text_name].focus();
|
||||||
theSelection = '';
|
theSelection = '';
|
||||||
return;
|
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))
|
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();
|
document.forms[form_name].elements[text_name].focus();
|
||||||
theSelection = '';
|
theSelection = '';
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue