![JC Brand](/assets/img/avatar_default.png)
- new config option `singleton`. - new plugin `converse-uniview` - removed `converse-embedded`. - various CSS changes, to properly render an embedded full app - don't re-open cached and non-autojoined chats in singleton mode The goal here is to extend the `embedded` `view_mode` so that the full app can also be embedded, not just a single MUC or private chat. To do this, we'll need to differentiate between multi and singleton chat apps. * A singleton chat app contains only a single chat. * A multi-chat app can contain zero or more chats So we introduce a new config option, `singleton`, which when used with `view_mode` set to `embedded` will determine whether a single chat or the full app is embedded. Similarly, in `overlayed`, `fullscreen` and `mobile` view modes, `singleton` set to true will allow only one chat within the parameters of that view mode. We're appropriating the word `singleton` and introducing the concepts of `uniview` and `multiview` (see a785ca8) to cover what was previously meant with `singleton`. updates #1297
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
// Converse.js (A browser based XMPP chat client)
|
|
// https://conversejs.org
|
|
//
|
|
// Copyright (c) JC Brand <jc@opkode.com>
|
|
// Licensed under the Mozilla Public License (MPLv2)
|
|
//
|
|
|
|
import "@converse/headless/converse-muc";
|
|
import "converse-chatview";
|
|
import "converse-controlbox";
|
|
import "converse-singleton";
|
|
import converse from "@converse/headless/converse-core";
|
|
import tpl_brand_heading from "templates/inverse_brand_heading.html";
|
|
|
|
const { Strophe, _ } = converse.env;
|
|
|
|
|
|
converse.plugins.add('converse-fullscreen', {
|
|
|
|
enabled (_converse) {
|
|
return _converse.isUniView();
|
|
},
|
|
|
|
overrides: {
|
|
// overrides mentioned here will be picked up by converse.js's
|
|
// plugin architecture they will replace existing methods on the
|
|
// relevant objects or classes.
|
|
//
|
|
// new functions which don't exist yet can also be added.
|
|
|
|
ControlBoxView: {
|
|
createBrandHeadingHTML() {
|
|
const { _converse } = this.__super__;
|
|
return tpl_brand_heading({
|
|
'version_name': _converse.VERSION_NAME
|
|
});
|
|
},
|
|
|
|
insertBrandHeading () {
|
|
const { _converse } = this.__super__;
|
|
const el = _converse.root.getElementById('converse-login-panel');
|
|
el.parentNode.insertAdjacentHTML(
|
|
'afterbegin',
|
|
this.createBrandHeadingHTML()
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
initialize () {
|
|
this._converse.api.settings.update({
|
|
chatview_avatar_height: 50,
|
|
chatview_avatar_width: 50,
|
|
hide_open_bookmarks: true,
|
|
show_controlbox_by_default: true,
|
|
sticky_controlbox: true
|
|
});
|
|
}
|
|
});
|