fix sanitarization fiendica
This commit is contained in:
parent
0e9bff10f6
commit
b2cad5fd8a
|
@ -27,7 +27,9 @@ export class DatabindedTextComponent implements OnInit {
|
||||||
|
|
||||||
this.processedText = '';
|
this.processedText = '';
|
||||||
|
|
||||||
value = value.replace('@<span class="">', '<span class="">'); //Friendica sanitarization
|
do {
|
||||||
|
value = value.replace('@<span class="">', '<span class="">'); //Friendica sanitarization
|
||||||
|
} while (value.includes('@<span class="">'));
|
||||||
|
|
||||||
let linksSections = value.split('<a ');
|
let linksSections = value.split('<a ');
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@ export class DatabindedTextComponent implements OnInit {
|
||||||
let extractedAccountAndNext: string[];
|
let extractedAccountAndNext: string[];
|
||||||
let extractedAccountName: string;
|
let extractedAccountName: string;
|
||||||
|
|
||||||
if(section.includes('<span class="mention">')){ //Friendica
|
if (section.includes('<span class="mention">')) { //Friendica
|
||||||
extractedAccountAndNext = section.split('</a>');
|
extractedAccountAndNext = section.split('</a>');
|
||||||
extractedAccountName = extractedAccountAndNext[0].split('<span class="mention">')[1].split('</span>')[0];
|
extractedAccountName = extractedAccountAndNext[0].split('<span class="mention">')[1].split('</span>')[0];
|
||||||
} else if (!section.includes('@<span>')) { //GNU social
|
} else if (!section.includes('@<span>')) { //GNU social
|
||||||
|
@ -101,11 +103,11 @@ export class DatabindedTextComponent implements OnInit {
|
||||||
let classname = this.getClassNameForAccount(extractedAccount);
|
let classname = this.getClassNameForAccount(extractedAccount);
|
||||||
this.processedText += `<a href class="${classname}" title="${extractedAccount}">@${extractedAccountName}</a>`;
|
this.processedText += `<a href class="${classname}" title="${extractedAccount}">@${extractedAccountName}</a>`;
|
||||||
|
|
||||||
if (extractedAccountAndNext[1])
|
if (extractedAccountAndNext[1])
|
||||||
this.processedText += extractedAccountAndNext[1];
|
this.processedText += extractedAccountAndNext[1];
|
||||||
|
|
||||||
//GNU Social clean up
|
//GNU Social clean up
|
||||||
if(this.processedText.includes('@<a'))
|
if (this.processedText.includes('@<a'))
|
||||||
this.processedText = this.processedText.replace('@<a', '<a');
|
this.processedText = this.processedText.replace('@<a', '<a');
|
||||||
|
|
||||||
this.accounts.push(extractedAccount);
|
this.accounts.push(extractedAccount);
|
||||||
|
@ -180,10 +182,10 @@ export class DatabindedTextComponent implements OnInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.renderer.listen(el, 'mouseup', (event) => {
|
this.renderer.listen(el, 'mouseup', (event) => {
|
||||||
if(event.which === 2){
|
if (event.which === 2) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
|
||||||
window.open(link, '_blank');
|
window.open(link, '_blank');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue