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