logs-content: Replaced old post rendering with actual irc caret notation parsing.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const {parse, BOLD} = require("irc-caret-notation")
|
||||
|
||||
module.exports = class {
|
||||
onCreate() {
|
||||
this.state = {
|
||||
paragraphs: [],
|
||||
prev: "",
|
||||
}
|
||||
}
|
||||
|
||||
onInput(input) {
|
||||
if (this.state == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (input.source != this.state.prev) {
|
||||
this.state.prev = input.source
|
||||
this.state.paragraphs = input.source.split("\n").filter(l => l.length > 0).map(l => parse(l, {
|
||||
"*": (!(input.source.startsWith("(")) ? BOLD : null),
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class=["irc-caret-notation", input.class]>
|
||||
<p for(p in state.paragraphs)>
|
||||
<span for(chunk in p) class=chunk.cssClasses("icn-")>${chunk.text}</span>
|
||||
</p>
|
||||
</div>
|
||||
Reference in New Issue
Block a user