Keep darkmode state in serverside session too. Fix darkmode state in egroupware iframes.

This commit is contained in:
Hadi Nategh
2021-02-24 12:22:27 +01:00
parent 924650827c
commit 2a2f0bf390
11 changed files with 43 additions and 10 deletions

View File

@ -1320,7 +1320,21 @@ var fw_base = (function(){ "use strict"; return Class.extend(
*/
_setDarkMode: function(_state)
{
jQuery('html').attr('data-darkmode', _state);
egw.setSessionItem('api', 'darkmode',_state == '0' ?'0':'1');
let state = _state == '0' ?'0':'1';
jQuery('html').attr('data-darkmode', state);
jQuery('iframe').each((i, frame) =>{
try {
if (frame && frame.contentWindow && frame.contentWindow.jQuery)
{
frame.contentWindow.jQuery('html').attr('data-darkmode', _state == 0?'':'1');
}
}catch(e)
{
}
})
egw.setSessionItem('api', 'darkmode',state);
egw.json('EGroupware\\Api\\Framework\\Ajax::ajax_set_darkmode_flag',[state]).sendRequest();
}
});}).call(this);