2020-12-04 23:12:09 +01:00
|
|
|
/**
|
|
|
|
* @copyright 2020, the Converse.js contributors
|
|
|
|
* @license Mozilla Public License (MPLv2)
|
|
|
|
*/
|
|
|
|
import '../chatboxviews/index.js';
|
2021-09-17 12:17:43 +02:00
|
|
|
import 'plugins/modal/index.js';
|
2021-02-22 20:20:19 +01:00
|
|
|
import 'shared/chat/chat-content.js';
|
2021-03-12 09:58:17 +01:00
|
|
|
import 'shared/chat/help-messages.js';
|
2021-02-22 20:20:19 +01:00
|
|
|
import 'shared/chat/toolbar.js';
|
2021-06-14 15:44:50 +02:00
|
|
|
import ChatView from './chat.js';
|
2021-02-22 20:20:19 +01:00
|
|
|
import { _converse, api, converse } from '@converse/headless/core';
|
2021-06-15 09:26:06 +02:00
|
|
|
import { clearHistory } from './utils.js';
|
2020-12-04 23:12:09 +01:00
|
|
|
|
2021-04-29 15:18:17 +02:00
|
|
|
import './styles/index.scss';
|
2021-03-19 11:43:16 +01:00
|
|
|
|
2020-12-04 23:12:09 +01:00
|
|
|
const { Strophe } = converse.env;
|
|
|
|
|
|
|
|
|
|
|
|
converse.plugins.add('converse-chatview', {
|
|
|
|
/* Plugin dependencies are other plugins which might be
|
|
|
|
* overridden or relied upon, and therefore need to be loaded before
|
|
|
|
* this plugin.
|
|
|
|
*
|
|
|
|
* If the setting "strict_plugin_dependencies" is set to true,
|
|
|
|
* an error will be raised if the plugin is not found. By default it's
|
|
|
|
* false, which means these plugins are only loaded opportunistically.
|
|
|
|
*
|
|
|
|
* NB: These plugins need to have already been loaded via require.js.
|
|
|
|
*/
|
|
|
|
dependencies: ['converse-chatboxviews', 'converse-chat', 'converse-disco', 'converse-modal'],
|
|
|
|
|
|
|
|
initialize () {
|
|
|
|
/* The initialize function gets called as soon as the plugin is
|
|
|
|
* loaded by converse.js's plugin machinery.
|
|
|
|
*/
|
|
|
|
api.settings.extend({
|
2021-09-09 16:20:33 +02:00
|
|
|
'allowed_audio_domains': null,
|
|
|
|
'allowed_image_domains': null,
|
|
|
|
'allowed_video_domains': null,
|
2020-12-04 23:12:09 +01:00
|
|
|
'auto_focus': true,
|
|
|
|
'debounced_content_rendering': true,
|
|
|
|
'filter_url_query_params': null,
|
|
|
|
'image_urls_regex': null,
|
|
|
|
'message_limit': 0,
|
|
|
|
'muc_hats': ['xep317'],
|
2021-09-09 16:20:33 +02:00
|
|
|
'render_media': true,
|
2020-12-04 23:12:09 +01:00
|
|
|
'show_message_avatar': true,
|
|
|
|
'show_retraction_warning': true,
|
|
|
|
'show_send_button': true,
|
|
|
|
'show_toolbar': true,
|
|
|
|
'time_format': 'HH:mm',
|
|
|
|
'use_system_emojis': true,
|
|
|
|
'visible_toolbar_buttons': {
|
|
|
|
'call': false,
|
|
|
|
'clear': true,
|
|
|
|
'emoji': true,
|
|
|
|
'spoiler': true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-14 15:44:50 +02:00
|
|
|
_converse.ChatBoxView = ChatView;
|
2020-12-04 23:12:09 +01:00
|
|
|
|
|
|
|
api.listen.on('connected', () => api.disco.own.features.add(Strophe.NS.SPOILER));
|
2021-06-15 09:26:06 +02:00
|
|
|
api.listen.on('chatBoxClosed', (model) => clearHistory(model.get('jid')));
|
2020-12-04 23:12:09 +01:00
|
|
|
}
|
|
|
|
});
|