diff --git a/marko/components/modal/component.js b/marko/components/modal/component.js
index a94ddcb..39a30ba 100644
--- a/marko/components/modal/component.js
+++ b/marko/components/modal/component.js
@@ -47,6 +47,9 @@ module.exports = class {
if (this.input.enabled) {
window.removeEventListener("keydown", this.onPress)
}
+
+ this.mounted = false
+ this.opened = false
}
/**
diff --git a/marko/page/story-content/components/chapter-meta/component.js b/marko/page/story-content/components/chapter-meta/component.js
index 0a423c9..212a0f7 100644
--- a/marko/page/story-content/components/chapter-meta/component.js
+++ b/marko/page/story-content/components/chapter-meta/component.js
@@ -50,6 +50,13 @@ module.exports = class {
break
}
+
+ case "title": {
+ this.state.color = "color-primary"
+ this.state.text = value
+
+ break
+ }
default: {
this.state.color = "color-menu"
diff --git a/marko/page/story-content/components/chapter-meta/index.marko b/marko/page/story-content/components/chapter-meta/index.marko
index 9165ff5..f554de8 100644
--- a/marko/page/story-content/components/chapter-meta/index.marko
+++ b/marko/page/story-content/components/chapter-meta/index.marko
@@ -9,6 +9,10 @@
${input.character.author}
+
+
(Unknown Character)
+ ${input.ukAuthor}
+
\ No newline at end of file
diff --git a/marko/page/story-content/components/chapter/component.js b/marko/page/story-content/components/chapter/component.js
index 05929a8..924e20a 100644
--- a/marko/page/story-content/components/chapter/component.js
+++ b/marko/page/story-content/components/chapter/component.js
@@ -8,9 +8,37 @@ module.exports = class {
Message: "Message",
Chat: "Chat Message",
},
+ selectedComment: null,
}
}
+ onOpenComment(comment, modal) {
+ this.state.selectedComment = comment
+ this.state.modal = modal
+ }
+
+ addComment(comment) {
+ this.updateChapter({
+ comments: this.input.chapter.comments.concat(comment),
+ })
+ }
+
+ editComment(comment) {
+ const comments = this.input.chapter.comments.slice()
+ const index = comments.findIndex(c => c.id === comment.id)
+ if (index != -1) {
+ comments[index] = comment
+ } else {
+ comments.push(comment)
+ }
+
+ this.updateChapter({comments})
+ }
+
+ removeComment(comment) {
+ this.updateChapter({comments: this.input.chapter.comments.filter(c => c.id !== comment.id)})
+ }
+
updateChapter(data) {
this.emit("edit", data)
}
diff --git a/marko/page/story-content/components/chapter/index.marko b/marko/page/story-content/components/chapter/index.marko
index 3b7465d..304e7ad 100644
--- a/marko/page/story-content/components/chapter/index.marko
+++ b/marko/page/story-content/components/chapter/index.marko
@@ -25,6 +25,7 @@
locked=input.chapter.commentsLocked
mode=input.chapter.commentMode
user=input.user
+ on-open("onOpenComment", comment)
/>
@@ -32,6 +33,8 @@
+
+
\ No newline at end of file
diff --git a/marko/page/story-content/components/comment/index.marko b/marko/page/story-content/components/comment/index.marko
index 2cbbe5b..6419aa2 100644
--- a/marko/page/story-content/components/comment/index.marko
+++ b/marko/page/story-content/components/comment/index.marko
@@ -5,10 +5,10 @@ import moment from "moment"
@@ -34,7 +34,14 @@ import moment from "moment"
-
${input.comment.characterName}
+
+ ${input.comment.characterName}
+
+
+
(Unknown Character)
+ ${input.comment.author}
+
+
@@ -51,10 +58,10 @@ import moment from "moment"
@@ -91,14 +98,14 @@ import moment from "moment"