diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 135e5875..d829fec7 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -11,7 +11,7 @@ class TfMessageElement extends LitElement { message: {type: Object}, users: {type: Object}, drafts: {type: Object}, - raw: {type: Boolean}, + format: {type: String}, blog_data: {type: String}, expanded: {type: Object}, decrypted: {type: Object}, @@ -27,7 +27,7 @@ class TfMessageElement extends LitElement { this.message = {}; this.users = {}; this.drafts = {}; - this.raw = false; + this.format = 'message'; this.expanded = {}; this.decrypted = undefined; } @@ -255,16 +255,30 @@ class TfMessageElement extends LitElement { content = this.decrypted; } let self = this; - let raw_button = this.raw ? - html` self.raw = false}>` : - html` self.raw = true}>`; + let raw_button; + switch (this.format) { + case 'raw': + if (content?.type == 'post' || content?.type == 'blog') { + raw_button = html` self.format = 'md'}>`; + } else { + raw_button = html` self.format = 'message'}>`; + } + break; + case 'md': + raw_button = html` self.format = 'message'}>`; + break; + default: + raw_button = html` self.format = 'raw'}>`; + break; + } function small_frame(inner) { + let body; return html`
${content.text}
`;
+ break;
+ case 'message':
+ body = unsafeHTML(tfutils.markdown(content.text));
+ break;
+ }
let content_warning = html`