The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
494 B

  1. const {parse, BOLD} = require("irc-caret-notation")
  2. module.exports = class {
  3. onCreate() {
  4. this.state = {
  5. paragraphs: [],
  6. prev: "",
  7. }
  8. }
  9. onInput(input) {
  10. if (this.state == null) {
  11. return
  12. }
  13. if (input.source != this.state.prev) {
  14. this.state.prev = input.source
  15. this.state.paragraphs = input.source.split("\n").filter(l => l.length > 0).map(l => parse(l, {
  16. "*": (!(input.source.startsWith("(")) ? BOLD : null),
  17. }))
  18. }
  19. }
  20. }