[all] extend options on desktop app launch

This commit is contained in:
Maxim Kadushkin 2021-05-12 16:41:59 +03:00
parent cd21ce2283
commit f900a3480b
5 changed files with 12 additions and 9 deletions

View file

@ -48,7 +48,7 @@ define([
uithemes: true uithemes: true
}; };
var native = window.AscDesktopEditor; var native = window.native || window.AscDesktopEditor;
!!native && native.execCommand('webapps:features', JSON.stringify(features)); !!native && native.execCommand('webapps:features', JSON.stringify(features));
var Desktop = function () { var Desktop = function () {

View file

@ -253,8 +253,8 @@ define([
return themes_map[this.currentThemeId()].type == 'dark'; return themes_map[this.currentThemeId()].type == 'dark';
}, },
setTheme: function (id) { setTheme: function (id, force) {
if ( !!themes_map[id] ) { if ( (currentThemeId != id || force) && !!themes_map[id] ) {
var classname = document.body.className.replace(/theme-\w+\s?/, ''); var classname = document.body.className.replace(/theme-\w+\s?/, '');
document.body.className = classname; document.body.className = classname;

View file

@ -212,11 +212,12 @@
window.parentOrigin = params["parentOrigin"]; window.parentOrigin = params["parentOrigin"];
if ( window.AscDesktopEditor ) { if ( window.AscDesktopEditor ) {
window.desktop = window.AscDesktopEditor; window.native = window.AscDesktopEditor;
window.on_native_message = function (cmd, param) { window.on_native_message = function (cmd, param) {
!window.native_message_cmd && (window.native_message_cmd = []); !window.native_message_cmd && (window.native_message_cmd = []);
window.native_message_cmd[cmd] = param; window.native_message_cmd[cmd] = param;
} }
window.native.execCommand('webapps:entry', '');
} }
</script> </script>
@ -229,7 +230,7 @@
<div id="viewport"></div> <div id="viewport"></div>
<script> <script>
if ( window.desktop ) { if ( window.native ) {
var logo = document.getElementsByClassName('loading-logo'); var logo = document.getElementsByClassName('loading-logo');
if ( !!logo && logo.length ) { if ( !!logo && logo.length ) {
logo[0].setAttribute('style','display:none;'); logo[0].setAttribute('style','display:none;');

View file

@ -259,11 +259,12 @@
} }
if ( window.AscDesktopEditor ) { if ( window.AscDesktopEditor ) {
window.desktop = window.AscDesktopEditor; window.native = window.AscDesktopEditor;
window.on_native_message = function (cmd, param) { window.on_native_message = function (cmd, param) {
!window.native_message_cmd && (window.native_message_cmd = []); !window.native_message_cmd && (window.native_message_cmd = []);
window.native_message_cmd[cmd] = param; window.native_message_cmd[cmd] = param;
} }
window.native.execCommand('webapps:entry', '');
} }
</script> </script>
@ -287,7 +288,7 @@
<div id="viewport"></div> <div id="viewport"></div>
<script> <script>
if ( window.desktop ) { if ( window.native ) {
var logo = document.getElementsByClassName('loading-logo'); var logo = document.getElementsByClassName('loading-logo');
if ( !!logo && logo.length ) { if ( !!logo && logo.length ) {
logo[0].setAttribute('style','display:none;'); logo[0].setAttribute('style','display:none;');

View file

@ -254,11 +254,12 @@
window.parentOrigin = params["parentOrigin"]; window.parentOrigin = params["parentOrigin"];
if ( window.AscDesktopEditor ) { if ( window.AscDesktopEditor ) {
window.desktop = window.AscDesktopEditor; window.native = window.AscDesktopEditor;
window.on_native_message = function (cmd, param) { window.on_native_message = function (cmd, param) {
!window.native_message_cmd && (window.native_message_cmd = []); !window.native_message_cmd && (window.native_message_cmd = []);
window.native_message_cmd[cmd] = param; window.native_message_cmd[cmd] = param;
} }
window.native.execCommand('webapps:entry', '');
} }
</script> </script>
@ -287,7 +288,7 @@
<div id="viewport"></div> <div id="viewport"></div>
<script> <script>
if ( window.desktop ) { if ( window.native ) {
var logo = document.getElementsByClassName('loading-logo'); var logo = document.getElementsByClassName('loading-logo');
if ( !!logo && logo.length ) { if ( !!logo && logo.length ) {
logo[0].setAttribute('style','display:none;'); logo[0].setAttribute('style','display:none;');