[Desktop] refactoring

This commit is contained in:
Maxim Kadushkin 2022-12-19 23:48:45 +03:00
parent 57749f4fe1
commit b823c308db

View file

@ -278,23 +278,14 @@ define([
});
}
return {
init: function (opts) {
_.extend(config, opts);
if ( config.isDesktopApp ) {
const me = this;
let is_win_xp = nativevars && nativevars.os === 'winxp';
Common.UI.Themes.setAvailable(!is_win_xp);
Common.NotificationCenter.on('app:ready', function (opts) {
const _onAppReady = function (opts) {
_.extend(config, opts);
!!native && native.execCommand('doc:onready', '');
$('.toolbar').addClass('editor-native-color');
});
}
Common.NotificationCenter.on('document:ready', function () {
const _onDocumentReady = function () {
if ( config.isEdit ) {
function get_locked_message (t) {
switch (t) {
@ -337,11 +328,11 @@ define([
});
}
_checkHelpAvailable.call(me);
_checkHelpAvailable.call(this);
}
}
});
Common.NotificationCenter.on('app:face', function (mode) {
const _onHidePreloader = function (mode) {
features.viewmode = !mode.isEdit;
features.crypted = mode.isCrypted;
native.execCommand('webapps:features', JSON.stringify(features));
@ -426,9 +417,20 @@ define([
// $('#box-document-title .hedset')[native.features.singlewindow ? 'hide' : 'show']();
!!titlebuttons.home && titlebuttons.home.btn.setVisible(native.features.singlewindow);
}
});
}
return {
init: function (opts) {
_.extend(config, opts);
if ( config.isDesktopApp ) {
let is_win_xp = nativevars && nativevars.os === 'winxp';
Common.UI.Themes.setAvailable(!is_win_xp);
Common.NotificationCenter.on({
'app:ready': _onAppReady,
'document:ready': _onDocumentReady.bind(this),
'app:face': _onHidePreloader.bind(this),
'modal:show': _onModalDialog.bind(this, 'open'),
'modal:close': _onModalDialog.bind(this, 'close'),
'modal:hide': _onModalDialog.bind(this, 'hide'),