|
@@ -1,30 +1,27 @@
|
|
import 'plugins/chatview/heading.js';
|
|
import 'plugins/chatview/heading.js';
|
|
import 'plugins/chatview/bottom-panel.js';
|
|
import 'plugins/chatview/bottom-panel.js';
|
|
-import { render } from 'lit';
|
|
|
|
import BaseChatView from 'shared/chat/baseview.js';
|
|
import BaseChatView from 'shared/chat/baseview.js';
|
|
import tpl_chat from './templates/chat.js';
|
|
import tpl_chat from './templates/chat.js';
|
|
import { __ } from 'i18n';
|
|
import { __ } from 'i18n';
|
|
import { _converse, api } from '@converse/headless/core';
|
|
import { _converse, api } from '@converse/headless/core';
|
|
|
|
|
|
/**
|
|
/**
|
|
- * The View of an open/ongoing chat conversation.
|
|
|
|
|
|
+ * The view of an open/ongoing chat conversation.
|
|
* @class
|
|
* @class
|
|
* @namespace _converse.ChatBoxView
|
|
* @namespace _converse.ChatBoxView
|
|
* @memberOf _converse
|
|
* @memberOf _converse
|
|
*/
|
|
*/
|
|
export default class ChatView extends BaseChatView {
|
|
export default class ChatView extends BaseChatView {
|
|
length = 200
|
|
length = 200
|
|
- className = 'chatbox hidden'
|
|
|
|
|
|
|
|
- async initialize () {
|
|
|
|
- const jid = this.getAttribute('jid');
|
|
|
|
- _converse.chatboxviews.add(jid, this);
|
|
|
|
- this.model = _converse.chatboxes.get(jid);
|
|
|
|
|
|
+ async connectedCallback () {
|
|
|
|
+ super.connectedCallback();
|
|
|
|
+ _converse.chatboxviews.add(this.jid, this);
|
|
|
|
+ this.model = _converse.chatboxes.get(this.jid);
|
|
this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
|
|
this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
|
|
this.listenTo(this.model, 'change:hidden', () => !this.model.get('hidden') && this.afterShown());
|
|
this.listenTo(this.model, 'change:hidden', () => !this.model.get('hidden') && this.afterShown());
|
|
- this.listenTo(this.model, 'change:show_help_messages', this.render);
|
|
|
|
|
|
+ this.listenTo(this.model, 'change:show_help_messages', this.requestUpdate);
|
|
this.listenTo(this.model, 'change:status', this.onStatusMessageChanged);
|
|
this.listenTo(this.model, 'change:status', this.onStatusMessageChanged);
|
|
- this.render();
|
|
|
|
|
|
|
|
await this.model.messages.fetched;
|
|
await this.model.messages.fetched;
|
|
!this.model.get('hidden') && this.afterShown()
|
|
!this.model.get('hidden') && this.afterShown()
|
|
@@ -37,7 +34,7 @@ export default class ChatView extends BaseChatView {
|
|
api.trigger('chatBoxViewInitialized', this);
|
|
api.trigger('chatBoxViewInitialized', this);
|
|
}
|
|
}
|
|
|
|
|
|
- toHTML () {
|
|
|
|
|
|
+ render () {
|
|
return tpl_chat(Object.assign({
|
|
return tpl_chat(Object.assign({
|
|
'model': this.model,
|
|
'model': this.model,
|
|
'help_messages': this.getHelpMessages(),
|
|
'help_messages': this.getHelpMessages(),
|
|
@@ -54,10 +51,9 @@ export default class ChatView extends BaseChatView {
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
- showControlBox () {
|
|
|
|
|
|
+ showControlBox () { // eslint-disable-line class-methods-use-this
|
|
// Used in mobile view, to navigate back to the controlbox
|
|
// Used in mobile view, to navigate back to the controlbox
|
|
_converse.chatboxviews.get('controlbox')?.show();
|
|
_converse.chatboxviews.get('controlbox')?.show();
|
|
- this.hide();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|