Add api event onRequestCreateNew for creating files
This commit is contained in:
parent
6e8bdc5e6b
commit
5f03cfae8a
|
@ -215,6 +215,7 @@
|
|||
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
|
||||
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
|
||||
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
|
||||
_config.editorConfig.canRequestCreateNew = _config.events && !!_config.events.onRequestCreateNew;
|
||||
_config.frameEditorId = placeholderId;
|
||||
_config.parentOrigin = window.location.origin;
|
||||
|
||||
|
|
|
@ -322,6 +322,10 @@ if (Common === undefined) {
|
|||
_postMessage({event:'onRequestSharingSettings'});
|
||||
},
|
||||
|
||||
requestCreateNew: function () {
|
||||
_postMessage({event:'onRequestCreateNew'});
|
||||
},
|
||||
|
||||
on: function(event, handler){
|
||||
var localHandler = function(event, data){
|
||||
handler.call(me, data)
|
||||
|
|
|
@ -503,8 +503,12 @@ define([
|
|||
|
||||
onCreateNew: function(menu, type) {
|
||||
if ( !Common.Controllers.Desktop.process('create:new') ) {
|
||||
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
|
||||
if (newDocumentPage) newDocumentPage.focus();
|
||||
if (this.mode.canRequestCreateNew)
|
||||
Common.Gateway.requestCreateNew();
|
||||
else {
|
||||
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
|
||||
if (newDocumentPage) newDocumentPage.focus();
|
||||
}
|
||||
}
|
||||
|
||||
if (menu) {
|
||||
|
|
|
@ -337,11 +337,12 @@ define([
|
|||
this.editorConfig.user =
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
this.appOptions.templates = this.editorConfig.templates;
|
||||
this.appOptions.recent = this.editorConfig.recent;
|
||||
this.appOptions.createUrl = this.editorConfig.createUrl;
|
||||
this.appOptions.canRequestCreateNew = this.editorConfig.canRequestCreateNew;
|
||||
this.appOptions.lang = this.editorConfig.lang;
|
||||
this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : '';
|
||||
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
|
||||
|
|
|
@ -339,8 +339,12 @@ define([
|
|||
|
||||
onCreateNew: function(menu, type) {
|
||||
if ( !Common.Controllers.Desktop.process('create:new') ) {
|
||||
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
|
||||
if (newDocumentPage) newDocumentPage.focus();
|
||||
if (this.mode.canRequestCreateNew)
|
||||
Common.Gateway.requestCreateNew();
|
||||
else {
|
||||
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
|
||||
if (newDocumentPage) newDocumentPage.focus();
|
||||
}
|
||||
}
|
||||
if (menu) {
|
||||
menu.hide();
|
||||
|
|
|
@ -302,11 +302,12 @@ define([
|
|||
this.editorConfig.user =
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, this.textAnonymous);
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
this.appOptions.templates = this.editorConfig.templates;
|
||||
this.appOptions.recent = this.editorConfig.recent;
|
||||
this.appOptions.createUrl = this.editorConfig.createUrl;
|
||||
this.appOptions.canRequestCreateNew = this.editorConfig.canRequestCreateNew;
|
||||
this.appOptions.lang = this.editorConfig.lang;
|
||||
this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : '';
|
||||
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
|
||||
|
|
|
@ -431,8 +431,12 @@ define([
|
|||
|
||||
onCreateNew: function(menu, type) {
|
||||
if ( !Common.Controllers.Desktop.process('create:new') ) {
|
||||
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
|
||||
if (newDocumentPage) newDocumentPage.focus();
|
||||
if (this.mode.canRequestCreateNew)
|
||||
Common.Gateway.requestCreateNew();
|
||||
else {
|
||||
var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank");
|
||||
if (newDocumentPage) newDocumentPage.focus();
|
||||
}
|
||||
}
|
||||
if (menu) {
|
||||
menu.hide();
|
||||
|
|
|
@ -325,11 +325,12 @@ define([
|
|||
this.editorConfig.user =
|
||||
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
|
||||
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
|
||||
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canCreateNew = this.editorConfig.canRequestCreateNew || !_.isEmpty(this.editorConfig.createUrl);
|
||||
this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
|
||||
this.appOptions.templates = this.editorConfig.templates;
|
||||
this.appOptions.recent = this.editorConfig.recent;
|
||||
this.appOptions.createUrl = this.editorConfig.createUrl;
|
||||
this.appOptions.canRequestCreateNew = this.editorConfig.canRequestCreateNew;
|
||||
this.appOptions.lang = this.editorConfig.lang;
|
||||
this.appOptions.location = (typeof (this.editorConfig.location) == 'string') ? this.editorConfig.location.toLowerCase() : '';
|
||||
this.appOptions.region = (typeof (this.editorConfig.region) == 'string') ? this.editorConfig.region.toLowerCase() : this.editorConfig.region;
|
||||
|
|
Loading…
Reference in a new issue