0

I'm trying to put a button to change overlayed view to fullscreen, and another one from overlayed to fullscreen without using HTML redirection.

Tried to use converse.api.settings.update but it does not work, looks like it's not rendering the page with view_mode variable updated.

Tried with the next code in a function, and even added this.render(), but not working:

converse.initialize({
  view_mode: 'fullscreen'
});

_converse.api.settings.update({
  view_mode: 'fullscreen'
});
T J
  • 42,762
  • 13
  • 83
  • 138

2 Answers2

0

Check the relevant API documentation.

_converse.api.settings.update isn't used to change a configuration setting. It "allows new configuration settings to be specified, or new default values for existing configuration settings to be specified."

So what you're doing there is simply setting a new default value, which is not the same as changing the value during runtime.

All configuration settings get set on the _converse object, so to change one you can simply assign a new value, for example _converse.view_mode = 'fullscreen';.

This won't have any immediate effect however because Converse doesn't yet support changing the view_mode on the fly.

JC Brand
  • 2,652
  • 18
  • 18
0

Thanks for the answer, but I wanted to "on the fly".

Finally I achieved it "on the fly" but making some tricks and probably wrong stuff, but what I did was to remove all classes in DOM referring to 'converse-overlayed' and later, initialize again the plugin:

converse.initialize({ 
... view_mode: 'fullscreen' 
});

Same for the opposite.

T J
  • 42,762
  • 13
  • 83
  • 138
  • Converse isn't designed in a way so that you can call `converse.initialize` multiple times per session. This is undefined behavior and I'd be quite surprised if everything simply continues working without problems. – JC Brand Jun 19 '19 at 12:20