Change config parameter documentType: it must take one of the values word/cell/slide (deprecate text/spreadsheet/presentation values).

This commit is contained in:
Julia Radzhabova 2020-09-11 16:34:29 +03:00 committed by Maxim Kadushkin
parent 0fea919d9c
commit da273fd8f8
4 changed files with 22 additions and 13 deletions

View file

@ -14,7 +14,7 @@
type: 'desktop or mobile',
width: '100% by default',
height: '100% by default',
documentType: 'text' | 'spreadsheet' | 'presentation',
documentType: 'word' | 'cell' | 'slide',// deprecate 'text' | 'spreadsheet' | 'presentation',
document: {
title: 'document title',
url: 'document url'
@ -163,7 +163,7 @@
type: 'embedded',
width: '100% by default',
height: '100% by default',
documentType: 'text' | 'spreadsheet' | 'presentation',
documentType: 'word' | 'cell' | 'slide',// deprecate 'text' | 'spreadsheet' | 'presentation',
document: {
title: 'document title',
url: 'document url',
@ -334,9 +334,15 @@
'text': 'docx',
'text-pdf': 'pdf',
'spreadsheet': 'xlsx',
'presentation': 'pptx'
'presentation': 'pptx',
'word': 'docx',
'cell': 'xlsx',
'slide': 'pptx'
}, app;
if (_config.documentType=='text' || _config.documentType=='spreadsheet' ||_config.documentType=='presentation')
console.warn("The \"documentType\" parameter for the config object must take one of the values word/cell/slide.");
if (typeof _config.documentType === 'string' && _config.documentType != '') {
app = appMap[_config.documentType.toLowerCase()];
if (!app) {
@ -355,9 +361,9 @@
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
return false;
} else if (typeof _config.documentType !== 'string' || _config.documentType == ''){
if (typeof type[1] === 'string') _config.documentType = 'spreadsheet'; else
if (typeof type[2] === 'string') _config.documentType = 'presentation'; else
if (typeof type[3] === 'string') _config.documentType = 'text';
if (typeof type[1] === 'string') _config.documentType = 'cell'; else
if (typeof type[2] === 'string') _config.documentType = 'slide'; else
if (typeof type[3] === 'string') _config.documentType = 'word';
}
}
@ -737,9 +743,12 @@
'text': 'documenteditor',
'text-pdf': 'documenteditor',
'spreadsheet': 'spreadsheeteditor',
'presentation': 'presentationeditor'
'presentation': 'presentationeditor',
'word': 'documenteditor',
'cell': 'spreadsheeteditor',
'slide': 'presentationeditor'
},
app = appMap['text'];
app = appMap['word'];
if (typeof config.documentType === 'string') {
app = appMap[config.documentType.toLowerCase()];
@ -748,8 +757,8 @@
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/
.exec(config.document.fileType);
if (type) {
if (typeof type[1] === 'string') app = appMap['spreadsheet']; else
if (typeof type[2] === 'string') app = appMap['presentation'];
if (typeof type[1] === 'string') app = appMap['cell']; else
if (typeof type[2] === 'string') app = appMap['slide'];
}
}

View file

@ -53,7 +53,7 @@
type: urlParams['type'],
width: '100%',
height: '100%',
documentType: urlParams['doctype'] || 'text',
documentType: urlParams['doctype'] || 'word',
document: doc,
editorConfig: cfg,
events: {

View file

@ -59,7 +59,7 @@ define([
externalEditor = new DocsAPI.DocEditor('id-diagram-editor-placeholder', {
width : '100%',
height : '100%',
documentType: 'spreadsheet',
documentType: 'cell',
document : {
url : '_chart_',
permissions : {

View file

@ -58,7 +58,7 @@ define([
externalEditor = new DocsAPI.DocEditor('id-merge-editor-placeholder', {
width : '100%',
height : '100%',
documentType: 'spreadsheet',
documentType: 'cell',
document : {
url : '_chart_',
permissions : {