Commit ef5ecb2f authored by JC Brand's avatar JC Brand

Decouple converse-controlbox and converse-profile

parent edcb8e28
...@@ -363,7 +363,7 @@ converse.plugins.add('converse-chatview', { ...@@ -363,7 +363,7 @@ converse.plugins.add('converse-chatview', {
this.render(); this.render();
this.updateAfterMessagesFetched(); this.updateAfterMessagesFetched();
/** /**
* Triggered once the _converse.ChatBoxView has been initialized * Triggered once the {@link _converse.ChatBoxView} has been initialized
* @event _converse#chatBoxInitialized * @event _converse#chatBoxInitialized
* @type { _converse.ChatBoxView | _converse.HeadlinesBoxView } * @type { _converse.ChatBoxView | _converse.HeadlinesBoxView }
* @example _converse.api.listen.on('chatBoxInitialized', view => { ... }); * @example _converse.api.listen.on('chatBoxInitialized', view => { ... });
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
* @module converse-controlbox * @module converse-controlbox
*/ */
import "converse-chatview"; import "converse-chatview";
import "converse-profile";
import _FormData from "formdata-polyfill"; import _FormData from "formdata-polyfill";
import bootstrap from "bootstrap.native"; import bootstrap from "bootstrap.native";
import converse from "@converse/headless/converse-core"; import converse from "@converse/headless/converse-core";
...@@ -476,16 +475,13 @@ converse.plugins.add('converse-controlbox', { ...@@ -476,16 +475,13 @@ converse.plugins.add('converse-controlbox', {
className: 'controlbox-pane', className: 'controlbox-pane',
initialize () { initialize () {
if (!_converse.XMPPStatusView) { /**
return; * Triggered once the {@link _converse.ControlBoxPane} has been initialized
} * @event _converse#controlBoxPaneInitialized
_converse.xmppstatusview = new _converse.XMPPStatusView({ * @type { _converse.ControlBoxPane }
'model': _converse.xmppstatus * @example _converse.api.listen.on('controlBoxPaneInitialized', view => { ... });
}); */
this.el.insertAdjacentElement( _converse.api.trigger('controlBoxPaneInitialized', this);
'afterBegin',
_converse.xmppstatusview.render().el
);
} }
}); });
......
...@@ -306,6 +306,14 @@ converse.plugins.add('converse-profile', { ...@@ -306,6 +306,14 @@ converse.plugins.add('converse-profile', {
} }
} }
}); });
/******************** Event Handlers ********************/
_converse.api.listen.on('controlBoxPaneInitialized', (view) => {
_converse.xmppstatusview = new _converse.XMPPStatusView({'model': _converse.xmppstatus});
view.el.insertAdjacentElement('afterBegin', _converse.xmppstatusview.render().el);
});
} }
}); });
...@@ -17,6 +17,7 @@ import "converse-muc-views"; // Views related to MUC ...@@ -17,6 +17,7 @@ import "converse-muc-views"; // Views related to MUC
import "converse-notification"; // HTML5 Notifications import "converse-notification"; // HTML5 Notifications
import "converse-omemo"; import "converse-omemo";
import "converse-push"; // XEP-0357 Push Notifications import "converse-push"; // XEP-0357 Push Notifications
import "converse-profile";
import "converse-register"; // XEP-0077 In-band registration import "converse-register"; // XEP-0077 In-band registration
import "converse-roomslist"; // Show currently open chat rooms import "converse-roomslist"; // Show currently open chat rooms
import "converse-rosterview"; import "converse-rosterview";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment