| 92 | } |
| 93 | |
| 94 | onClickSaveButton (e) { |
| 95 | this.treema.endExistingEdits() |
| 96 | for (const key in this.treema.data) { |
| 97 | const value = this.treema.data[key] |
| 98 | this.chat.set(key, value) |
| 99 | } |
| 100 | |
| 101 | // Store chat.message.originalText iff the current text is different than the original |
| 102 | const message = this.chat.get('message') |
| 103 | if ((message.text !== this.originalMessageText) && (message.originalText !== this.originalMessageText)) { |
| 104 | message.originalText = this.originalMessageText |
| 105 | this.chat.set('message', message) |
| 106 | } |
| 107 | |
| 108 | this.chat.updateI18NCoverage() |
| 109 | |
| 110 | const res = this.chat.save() |
| 111 | |
| 112 | res.error((collection, response, options) => { |
| 113 | return console.error(response) |
| 114 | }) |
| 115 | |
| 116 | return res.success(() => { |
| 117 | const url = `/editor/chat/${this.chat.get('slug') || this.chat.id}` |
| 118 | return document.location.href = url |
| 119 | }) |
| 120 | } |
| 121 | |
| 122 | confirmDeletion () { |
| 123 | const renderData = { |