22 <div class =" sc-message--text" :style =" messageColors" >
33 <template >
44 <div class =" sc-message--toolbox" :style =" {background: messageColors.backgroundColor}" >
5- <button v-if =" showEdition && me && message.id" @click = " edit " :disabled = " isEditing " >
6- <IconBase :color =" isEditing? 'black': messageColors.color" width =" 10" icon-name =" edit" >
5+ <button v-if =" showEdition && me && message.id" :disabled = " isEditing " @click = " edit " >
6+ <IconBase :color =" isEditing ? 'black' : messageColors.color" width =" 10" icon-name =" edit" >
77 <IconEdit />
88 </IconBase >
99 </button >
1010 <div v-if =" showDeletion" >
11- <button v-if =" me && message.id != null && message.id != undefined" @click =" ifelse(showConfirmationDeletion, withConfirm(confirmationDeletionMessage, () => $emit('remove')), () => $emit('remove'))()" >
11+ <button
12+ v-if =" me && message.id != null && message.id != undefined"
13+ @click ="
14+ ifelse(
15+ showConfirmationDeletion,
16+ withConfirm(confirmationDeletionMessage, () => $emit('remove')),
17+ () => $emit('remove')
18+ )()
19+ "
20+ >
1221 <IconBase :color =" messageColors.color" width =" 10" icon-name =" remove" >
1322 <IconCross />
1423 </IconBase >
@@ -38,14 +47,15 @@ import IconEdit from './../components/icons/IconEdit.vue'
3847import IconCross from ' ./../components/icons/IconCross.vue'
3948import escapeGoat from ' escape-goat'
4049import Autolinker from ' autolinker'
41- import store from ' ./../store/'
50+ import store from ' ../store/'
51+
4252const fmt = require (' msgdown' )
4353
4454export default {
45- data () {
46- return {
47- store
48- }
55+ components : {
56+ IconBase,
57+ IconCross,
58+ IconEdit
4959 },
5060 props: {
5161 message: {
@@ -90,12 +100,12 @@ export default {
90100 return this .message .author === ' me'
91101 },
92102 isEditing () {
93- return (store .editMessage && store .editMessage .id ) == this .message .id
103+ return (store .state . editMessage && store .state . editMessage .id ) = == this .message .id
94104 }
95105 },
96106 methods: {
97107 edit () {
98- this . store .editMessage = this .message
108+ store .setState ( ' editMessage' , this .message )
99109 },
100110 ifelse (cond , funcIf , funcElse ) {
101111 return () => {
@@ -107,12 +117,7 @@ export default {
107117 return () => {
108118 if (confirm (msg)) func ()
109119 }
110- },
111- },
112- components: {
113- IconBase,
114- IconCross,
115- IconEdit,
120+ }
116121 }
117122}
118123 </script >
0 commit comments