@@ -127,30 +127,30 @@ export default {
127
127
responsiveBreakpoint: { type: Number , default: 900 },
128
128
singleRoom: { type: [Boolean , String ], default: false },
129
129
roomsListOpened: { type: [Boolean , String ], default: true },
130
- textMessages: { type: [Object , String ], default: null },
130
+ textMessages: { type: [Object , String ], default : () => ({}) },
131
131
currentUserId: { type: String , default: ' ' },
132
- rooms: { type: [Array , String ], default: null },
132
+ rooms: { type: [Array , String ], default : () => [] },
133
133
roomsOrder: { type: String , default: ' desc' },
134
134
loadingRooms: { type: [Boolean , String ], default: false },
135
135
roomsLoaded: { type: [Boolean , String ], default: false },
136
136
roomId: { type: String , default: null },
137
137
loadFirstRoom: { type: [Boolean , String ], default: true },
138
- messages: { type: [Array , String ], default: null },
138
+ messages: { type: [Array , String ], default : () => [] },
139
139
messagesLoaded: { type: [Boolean , String ], default: false },
140
- roomActions: { type: Array , default : () => [] },
141
- menuActions: { type: Array , default : () => [] },
140
+ roomActions: { type: [ Array , String ] , default : () => [] },
141
+ menuActions: { type: [ Array , String ] , default : () => [] },
142
142
messageActions: {
143
- type: Array ,
143
+ type: [ Array , String ] ,
144
144
default : () => [
145
145
{ name: ' replyMessage' , title: ' Reply' },
146
146
{ name: ' editMessage' , title: ' Edit Message' , onlyMe: true },
147
147
{ name: ' deleteMessage' , title: ' Delete Message' , onlyMe: true },
148
148
{ name: ' selectMessages' , title: ' Select' }
149
149
]
150
150
},
151
- messageSelectionActions: { type: Array , default : () => [] },
151
+ messageSelectionActions: { type: [ Array , String ] , default : () => [] },
152
152
autoScroll: {
153
- type: Object ,
153
+ type: [ Object , String ] ,
154
154
default : () => {
155
155
return {
156
156
send: {
@@ -176,7 +176,7 @@ export default {
176
176
showNewMessagesDivider: { type: [Boolean , String ], default: true },
177
177
showFooter: { type: [Boolean , String ], default: true },
178
178
textFormatting: {
179
- type: Object ,
179
+ type: [ Object , String ] ,
180
180
default : () => ({
181
181
disabled: false ,
182
182
italic: ' _' ,
@@ -188,7 +188,7 @@ export default {
188
188
})
189
189
},
190
190
linkOptions: {
191
- type: Object ,
191
+ type: [ Object , String ] ,
192
192
default : () => ({ disabled: false , target: ' _blank' , rel: null })
193
193
},
194
194
roomInfoEnabled: { type: [Boolean , String ], default: false },
@@ -199,10 +199,10 @@ export default {
199
199
roomMessage: { type: String , default: ' ' },
200
200
scrollDistance: { type: Number , default: 60 },
201
201
acceptedFiles: { type: String , default: ' *' },
202
- templatesText: { type: [Array , String ], default: null },
202
+ templatesText: { type: [Array , String ], default : () => [] },
203
203
mediaPreviewEnabled: { type: [Boolean , String ], default: true },
204
204
usernameOptions: {
205
- type: Object ,
205
+ type: [ Object , String ] ,
206
206
default : () => ({ minUsers: 3 , currentUser: false })
207
207
}
208
208
},
@@ -456,14 +456,10 @@ export default {
456
456
return val === ' true' || val === true
457
457
},
458
458
castArray (val ) {
459
- return ! val ? null : Array .isArray (val) ? val : JSON .parse (val)
459
+ return ! val ? [] : Array .isArray (val) ? val : JSON .parse (val)
460
460
},
461
461
castObject (val ) {
462
- return ! val
463
- ? null
464
- : typeof yourVariable === ' object'
465
- ? val
466
- : JSON .parse (val)
462
+ return ! val ? {} : typeof val === ' object' ? val : JSON .parse (val)
467
463
},
468
464
updateResponsive () {
469
465
this .isMobile = window .innerWidth < Number (this .responsiveBreakpoint )
0 commit comments