mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
Fixed handling of html links in HandleRichText::formatText.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5162 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
02a7548de4
commit
27c0535a8a
1 changed files with 6 additions and 9 deletions
|
@ -277,18 +277,17 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
|
||||||
switch(embedInfos.myType) {
|
switch(embedInfos.myType) {
|
||||||
case Ahref:
|
case Ahref:
|
||||||
{
|
{
|
||||||
|
insertedTag = doc.createElement("a");
|
||||||
|
insertedTag.setAttribute("href", embedInfos.myRE.cap(0));
|
||||||
|
insertedTag.appendChild(doc.createTextNode(embedInfos.myRE.cap(0)));
|
||||||
|
|
||||||
RetroShareLink link(embedInfos.myRE.cap(0));
|
RetroShareLink link(embedInfos.myRE.cap(0));
|
||||||
if (link.valid()) {
|
if (link.valid()) {
|
||||||
insertedTag = doc.createElement("a");
|
|
||||||
insertedTag.setAttribute("href", embedInfos.myRE.cap(0));
|
|
||||||
|
|
||||||
QString title = link.title();
|
QString title = link.title();
|
||||||
if (!title.isEmpty()) {
|
if (!title.isEmpty()) {
|
||||||
insertedTag.setAttribute("title", title);
|
insertedTag.setAttribute("title", title);
|
||||||
}
|
}
|
||||||
|
|
||||||
insertedTag.appendChild(doc.createTextNode(embedInfos.myRE.cap(0)));
|
|
||||||
|
|
||||||
if (textDocument && (flag & RSHTML_FORMATTEXT_REPLACE_LINKS)) {
|
if (textDocument && (flag & RSHTML_FORMATTEXT_REPLACE_LINKS)) {
|
||||||
replaceAnchorWithImg(doc, insertedTag, textDocument, link);
|
replaceAnchorWithImg(doc, insertedTag, textDocument, link);
|
||||||
}
|
}
|
||||||
|
@ -304,10 +303,8 @@ void RsHtml::embedHtml(QTextDocument *textDocument, QDomDocument& doc, QDomEleme
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!insertedTag.isNull()) {
|
currentElement.insertBefore(insertedTag, node);
|
||||||
currentElement.insertBefore(insertedTag, node);
|
index++;
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPos = nextPos + embedInfos.myRE.matchedLength();
|
currentPos = nextPos + embedInfos.myRE.matchedLength();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue