mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-21 23:12:40 +00:00
fix(mail): correctly render mail when searching
This commit is contained in:
1 parent
d7232618e6
commit
0cb21f8fb9
2 files changed
+14
-8
No files matched your search
@@ -497,7 +497,7 @@
|
|||||||
&& ("UIxMailPartHTMLViewer" == parts[i].type
|
&& ("UIxMailPartHTMLViewer" == parts[i].type
|
||||||
|| "UIxMailPartTextViewer" == parts[i].type)) {
|
|| "UIxMailPartTextViewer" == parts[i].type)) {
|
||||||
// Content
|
// Content
|
||||||
parts[i].content = this.highlightSearchTerms(parts[i].content, false);
|
parts[i].content = this.highlightSearchTerms(parts[i].content, false, true);
|
||||||
// Title
|
// Title
|
||||||
this.subject = this.getHighlightSubject();
|
this.subject = this.getHighlightSubject();
|
||||||
// From
|
// From
|
||||||
@@ -518,14 +518,20 @@
|
|||||||
* @desc Returns the data with highlight search
|
* @desc Returns the data with highlight search
|
||||||
* @returns the data with highlighted search terms
|
* @returns the data with highlighted search terms
|
||||||
*/
|
*/
|
||||||
Message.prototype.highlightSearchTerms = function (data, encodeEntities) {
|
Message.prototype.highlightSearchTerms = function (data, encodeEntities, isHtml) {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
if (this.$mailbox.getHighlightWords()
|
if (this.$mailbox.getHighlightWords()
|
||||||
&& this.$mailbox.getHighlightWords().length > 0
|
&& this.$mailbox.getHighlightWords().length > 0
|
||||||
&& data
|
&& data
|
||||||
&& -1 === data.indexOf("data-markjs")) {
|
&& -1 === data.indexOf("data-markjs")) {
|
||||||
var dom = document.createElement("DIV");
|
var dom = document.createElement("DIV");
|
||||||
dom.textContent = encodeEntities ? data.encodeEntities() : data;
|
if(isHtml){
|
||||||
|
dom.innerHTML = encodeEntities ? data.encodeEntities() : data;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
dom.textContent = encodeEntities ? data.encodeEntities() : data;
|
||||||
|
}
|
||||||
|
|
||||||
var markInstance = new Mark(dom);
|
var markInstance = new Mark(dom);
|
||||||
markInstance.mark(this.$mailbox.getHighlightWords());
|
markInstance.mark(this.$mailbox.getHighlightWords());
|
||||||
data = dom.innerHTML;
|
data = dom.innerHTML;
|
||||||
@@ -545,7 +551,7 @@
|
|||||||
* @returns the subject with highlighted search terms
|
* @returns the subject with highlighted search terms
|
||||||
*/
|
*/
|
||||||
Message.prototype.getHighlightSubject = function () {
|
Message.prototype.getHighlightSubject = function () {
|
||||||
return this.highlightSearchTerms(this.subject, false);
|
return this.highlightSearchTerms(this.subject, false, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -557,8 +563,8 @@
|
|||||||
Message.prototype.getHighlightFrom = function () {
|
Message.prototype.getHighlightFrom = function () {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
for (i = 0; i < this.from.length; i++) {
|
for (i = 0; i < this.from.length; i++) {
|
||||||
this.from[i].fullHighlighted = this.highlightSearchTerms(this.from[i].full, false);
|
this.from[i].fullHighlighted = this.highlightSearchTerms(this.from[i].full, false, false);
|
||||||
this.from[i].nameHighlighted = this.highlightSearchTerms(this.from[i].name, false);
|
this.from[i].nameHighlighted = this.highlightSearchTerms(this.from[i].name, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.from;
|
return this.from;
|
||||||
|
|||||||
@@ -197,9 +197,9 @@
|
|||||||
|
|
||||||
// Sender or recipient when in Sent or Draft mailbox
|
// Sender or recipient when in Sent or Draft mailbox
|
||||||
if ($ctrl.MailboxService.selectedFolder.isSentFolder || $ctrl.MailboxService.selectedFolder.isDraftsFolder)
|
if ($ctrl.MailboxService.selectedFolder.isSentFolder || $ctrl.MailboxService.selectedFolder.isDraftsFolder)
|
||||||
$ctrl.senderElement.innerHTML = $ctrl.message.highlightSearchTerms($ctrl.message.$shortAddress('to', Preferences.defaults.SOGoMailDisplayFullEmail), true);
|
$ctrl.senderElement.innerHTML = $ctrl.message.highlightSearchTerms($ctrl.message.$shortAddress('to', Preferences.defaults.SOGoMailDisplayFullEmail), true, false);
|
||||||
else
|
else
|
||||||
$ctrl.senderElement.innerHTML = $ctrl.message.highlightSearchTerms($ctrl.message.$shortAddress('from', Preferences.defaults.SOGoMailDisplayFullEmail), true);
|
$ctrl.senderElement.innerHTML = $ctrl.message.highlightSearchTerms($ctrl.message.$shortAddress('from', Preferences.defaults.SOGoMailDisplayFullEmail), true, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user