[desktop] refactoring

This commit is contained in:
Maxim Kadushkin 2022-05-25 16:48:17 +03:00
parent 5afb147034
commit 6fe2adf8fd
6 changed files with 8 additions and 7 deletions

View file

@ -89,7 +89,7 @@ define([
thumbCanvas.width = thumbs[thumbIdx].width; thumbCanvas.width = thumbs[thumbIdx].width;
function CThumbnailLoader() { function CThumbnailLoader() {
this.supportBinaryFormat = (window['AscDesktopEditor'] && !window['AscDesktopEditor']['isSupportBinaryFontsSprite']) ? false : true; this.supportBinaryFormat = !(Common.Controllers.Desktop.isActive() && !Common.Controllers.isFeatureAvailable('isSupportBinaryFontsSprite'));
this.image = null; this.image = null;
this.binaryFormat = null; this.binaryFormat = null;
@ -132,7 +132,6 @@ define([
}; };
this.openBinary = function(arrayBuffer) { this.openBinary = function(arrayBuffer) {
//var t1 = performance.now(); //var t1 = performance.now();
var binaryAlpha = new Uint8Array(arrayBuffer); var binaryAlpha = new Uint8Array(arrayBuffer);

View file

@ -1201,7 +1201,7 @@ define([
Common.Utils.InternalSettings.set("de-settings-showsnaplines", me.api.get_ShowSnapLines()); Common.Utils.InternalSettings.set("de-settings-showsnaplines", me.api.get_ShowSnapLines());
function checkWarns() { function checkWarns() {
if (!window['AscDesktopEditor']) { if (!Common.Controllers.Desktop.isActive()) {
var tips = []; var tips = [];
Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); Common.Utils.isIE9m && tips.push(me.warnBrowserIE9);

View file

@ -368,7 +368,7 @@ define([
isVisible && (lastSeparator = this.miClose.$el.find('+.devider')); isVisible && (lastSeparator = this.miClose.$el.find('+.devider'));
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false;
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide'](); this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();

View file

@ -826,7 +826,7 @@ define([
me.api.asc_ShowNotes(!value); me.api.asc_ShowNotes(!value);
function checkWarns() { function checkWarns() {
if (!window['AscDesktopEditor']) { if (!Common.Controllers.Desktop.isActive()) {
var tips = []; var tips = [];
Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); Common.Utils.isIE9m && tips.push(me.warnBrowserIE9);

View file

@ -369,7 +369,7 @@ define([
isVisible && (lastSeparator = this.miClose.$el.find('+.devider')); isVisible && (lastSeparator = this.miClose.$el.find('+.devider'));
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false;
this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide'](); this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();

View file

@ -833,7 +833,9 @@ define([
}); });
me.slideOnlyControls.push(me.btnInsSlideNum); me.slideOnlyControls.push(me.btnInsSlideNum);
if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsSupportMedia"] && window["AscDesktopEditor"]["IsSupportMedia"]()) { if (Common.Controllers.Desktop.isActive() &&
Common.Controllers.Desktop.isFeatureAvailable("IsSupportMedia") && Common.Controllers.Desktop.call("IsSupportMedia"))
{
me.btnInsAudio = new Common.UI.Button({ me.btnInsAudio = new Common.UI.Button({
id: 'tlbtn-insaudio', id: 'tlbtn-insaudio',
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',