diff --git a/package.json b/package.json index e2840021..192eca10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ptn-ninja", - "version": "3.4.21", + "version": "3.4.22", "description": "An editor and viewer for Portable Tak Notation", "productName": "PTN Ninja", "author": "Craig Laparo ", diff --git a/src/Game/comments.js b/src/Game/comments.js index bcc60333..cd302570 100644 --- a/src/Game/comments.js +++ b/src/Game/comments.js @@ -49,12 +49,19 @@ export default class GameComments { addComments(type, messages) { const isEvaluation = /^[?!'"]+$/; + const isReplacement = /^!r(\d+):/; for (const plyID in messages) { messages[plyID].forEach((message) => { if (isEvaluation.test(message)) { this._setEvaluation(plyID, message); } else { - this._addComment(type, message, plyID); + if (isReplacement.test(message)) { + let index = message.match(isReplacement)[1]; + message = message.substring(index.length + 3); + this._replaceComment(type, plyID, index, message); + } else { + this._addComment(type, message, plyID); + } } }); } @@ -64,11 +71,18 @@ export default class GameComments { this.board.updatePositionOutput(); } - editComment(type, plyID, index, message) { + _replaceComment(type, plyID, index, message) { if (this[type][plyID] && this[type][plyID][index]) { this[type][plyID][index].message = message; - this._updatePTN(true); this.board.dirtyComment(type, plyID); + return true; + } + return false; + } + + editComment(type, plyID, index, message) { + if (this._replaceComment(type, plyID, index, message)) { + this._updatePTN(true); this.board.updateCommentsOutput(); return this[type][plyID][index]; } diff --git a/src/components/board/Board.vue b/src/components/board/Board.vue index 91fb8a0c..0f3ddfbb 100644 --- a/src/components/board/Board.vue +++ b/src/components/board/Board.vue @@ -221,7 +221,7 @@ export default { return this.$store.state.game.ptn; }, evaluation() { - if (this.$store.state.game.evaluation) { + if (this.$store.state.game.evaluation !== null) { return this.$store.state.game.evaluation; } else if (this.position.boardPly) { return this.$store.state.game.comments.evaluations[ diff --git a/src/components/board/CurrentMove.vue b/src/components/board/CurrentMove.vue index 01add7c7..36d84eac 100644 --- a/src/components/board/CurrentMove.vue +++ b/src/components/board/CurrentMove.vue @@ -1,13 +1,11 @@