[all] opened 'create new' option for desktop app

This commit is contained in:
Maxim Kadushkin 2019-07-16 16:30:37 +03:00
parent 13fe6a52ff
commit 511888dc4e
8 changed files with 21 additions and 12 deletions

View file

@ -125,6 +125,12 @@ define([
if ( opts == 'preloader:hide' ) { if ( opts == 'preloader:hide' ) {
app.execCommand('editor:onready', ''); app.execCommand('editor:onready', '');
return true; return true;
} else
if ( opts == 'create:new' ) {
if (config.createUrl == 'desktop://create.new') {
app.LocalFileCreate(!!window.SSE ? 2 : !!window.PE ? 1 : 0);
return true;
}
} }
} }

View file

@ -436,8 +436,10 @@ define([
}, },
onCreateNew: function(menu, type) { onCreateNew: function(menu, type) {
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); if ( !Common.Controllers.Desktop.process('create:new') ) {
if (newDocumentPage) newDocumentPage.focus(); var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
if (newDocumentPage) newDocumentPage.focus();
}
if (menu) { if (menu) {
menu.hide(); menu.hide();

View file

@ -329,7 +329,7 @@ define([
this.editorConfig.user = this.editorConfig.user =
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp; this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
this.appOptions.templates = this.editorConfig.templates; this.appOptions.templates = this.editorConfig.templates;
this.appOptions.recent = this.editorConfig.recent; this.appOptions.recent = this.editorConfig.recent;

View file

@ -327,8 +327,10 @@ define([
}, },
onCreateNew: function(menu, type) { onCreateNew: function(menu, type) {
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); if ( !Common.Controllers.Desktop.process('create:new') ) {
if (newDocumentPage) newDocumentPage.focus(); var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
if (newDocumentPage) newDocumentPage.focus();
}
if (menu) { if (menu) {
menu.hide(); menu.hide();
} }

View file

@ -299,7 +299,7 @@ define([
this.editorConfig.user = this.editorConfig.user =
this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, this.textAnonymous);
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp; this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
this.appOptions.templates = this.editorConfig.templates; this.appOptions.templates = this.editorConfig.templates;
this.appOptions.recent = this.editorConfig.recent; this.appOptions.recent = this.editorConfig.recent;

View file

@ -292,9 +292,6 @@ define([
} }
} }
if (this.mode.isDesktopApp && this.mode.isOffline)
this.$el.find('#fm-btn-create, #fm-btn-back, #fm-btn-create+.devider').hide();
if (this.mode.canProtect) { if (this.mode.canProtect) {
this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
this.panels['protect'].setMode(this.mode); this.panels['protect'].setMode(this.mode);

View file

@ -385,8 +385,10 @@ define([
}, },
onCreateNew: function(menu, type) { onCreateNew: function(menu, type) {
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); if ( !Common.Controllers.Desktop.process('create:new') ) {
if (newDocumentPage) newDocumentPage.focus(); var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
if (newDocumentPage) newDocumentPage.focus();
}
if (menu) { if (menu) {
menu.hide(); menu.hide();
} }

View file

@ -301,7 +301,7 @@ define([
this.editorConfig.user = this.editorConfig.user =
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp; this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
this.appOptions.templates = this.editorConfig.templates; this.appOptions.templates = this.editorConfig.templates;
this.appOptions.recent = this.editorConfig.recent; this.appOptions.recent = this.editorConfig.recent;