Convert Converse.js to container

Is it possible to configure Converse.js to display it in custom containers divinstead of adding them to the body of the page?

+4
source share
1 answer

Yes, you can do this by writing a converse.js plugin in which you override the insertIntoPage method ChatBoxView.

Refer to the plugin documentation above. In short, it would look something like this:

// The following line registers your plugin.
converse_api.plugins.add('myplugin', {

    overrides: {
        // If you want to override some function or a Backbone model or
        // view defined inside converse, then you do that under this
        // "overrides" namespace.    
        ChatBoxView: {
            insertIntoPage: function (type, status_message, jid) {
                // XXX Your custom code comes here.
                // The standard code looks as follows:
                this.$el.insertAfter(converse.chatboxviews.get("controlbox).$el);
                return this;
            }
        },
    }

UPDATE: with the latest version instead converse.js method override _equElement , instead insertIntoPage.

+2

Source: https://habr.com/ru/post/1606563/


All Articles