Fix pages.meet post html formatting
This commit is contained in:
parent
4bb004f675
commit
b50bd5621a
|
@ -4,6 +4,7 @@ var env = {
|
|||
dev: '<?php echo DEV ?>' === '<?php echo env() ?>',
|
||||
};
|
||||
var app = {
|
||||
domain: '<?php echo getenv('DOMAIN') ?>',
|
||||
strings: JSON.parse(atob('<?php echo base64_encode(json_encode(strings())) ?>')),
|
||||
pages: {},
|
||||
hashHandlers: [],
|
||||
|
|
|
@ -149,6 +149,7 @@ app.post = {
|
|||
},
|
||||
prepare4html: function(value, tags) {
|
||||
tags = tags || [];
|
||||
value = text2html(value);
|
||||
value = value.replaceAll('</a>', '</a> ')
|
||||
.replaceAll(/\s+/g, ' ');
|
||||
value = value.replaceAll('</p>', '{:br:}{:br:}');
|
||||
|
@ -166,6 +167,8 @@ app.post = {
|
|||
continue;
|
||||
acct = acct.trim().substr(1);
|
||||
href = href.trim();
|
||||
if (acct.endsWith(`@${app.domain}`))
|
||||
acct = acct.replace(`@${app.domain}`, '');
|
||||
const ps = acct.split('@');
|
||||
const link = '<a class="mention" href="'+htmlescape(href)+'">@'+
|
||||
htmlescape(acct) + '</a>';
|
||||
|
|
|
@ -105,6 +105,11 @@ function isVisible(element) {
|
|||
);
|
||||
}
|
||||
|
||||
function text2html(text) {
|
||||
return text.replaceAll('>','>').replaceAll('<','<')
|
||||
.replaceAll('"', '"').replaceAll('&', '&');
|
||||
}
|
||||
|
||||
function html2text(html) {
|
||||
if (html === undefined || html === null)
|
||||
return undefined;
|
||||
|
|
Loading…
Reference in New Issue