Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Jan 31, 2025
1 parent 0be01dd commit 43af739
Showing 2 changed files with 9 additions and 18 deletions.
18 changes: 7 additions & 11 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
type: 'desktop or mobile or embedded',
width: '100% by default',
height: '100% by default',
documentType: 'word' | 'cell' | 'slide' | 'pdf' | 'diagram' ,// deprecate 'text' | 'spreadsheet' | 'presentation',
documentType: 'word' | 'cell' | 'slide' | 'pdf' ,// deprecate 'text' | 'spreadsheet' | 'presentation',
token: <string> encrypted signature
document: {
title: 'document title',
@@ -474,12 +474,11 @@
'word': 'docx',
'cell': 'xlsx',
'slide': 'pptx',
'pdf': 'pdf',
'diagram': 'vsdx'
'pdf': 'pdf'
}, 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/pdf/diagram.");
console.warn("The \"documentType\" parameter for the config object must take one of the values word/cell/slide/pdf.");

if (typeof _config.documentType === 'string' && _config.documentType != '') {
app = appMap[_config.documentType.toLowerCase()];
@@ -493,7 +492,7 @@

if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
_config.document.fileType = _config.document.fileType.toLowerCase();
var type = /^(?:(xls|xlsx|ods|csv|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|sxc|et|ett|numbers)|(pps|ppsx|ppt|pptx|odp|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|sxi|dps|dpt|key)|(pdf|djvu|xps|oxps)|(doc|docx|odt|gdoc|txt|rtf|mht|htm|html|mhtml|epub|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf|sxw|stw|wps|wpt|pages|hwp|hwpx)|(vsdx|vssx|vstx|vsdm|vssm|vstm))$/
var type = /^(?:(xls|xlsx|ods|csv|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|sxc|et|ett|numbers)|(pps|ppsx|ppt|pptx|odp|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|sxi|dps|dpt|key)|(pdf|djvu|xps|oxps)|(doc|docx|odt|gdoc|txt|rtf|mht|htm|html|mhtml|epub|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf|sxw|stw|wps|wpt|pages|hwp|hwpx))$/
.exec(_config.document.fileType);
if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
@@ -502,8 +501,7 @@
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 = 'pdf'; else
if (typeof type[4] === 'string') _config.documentType = 'word'; else
if (typeof type[5] === 'string') _config.documentType = 'diagram';
if (typeof type[4] === 'string') _config.documentType = 'word';
}
}

@@ -1065,7 +1063,6 @@
'cell': 'spreadsheeteditor',
'slide': 'presentationeditor',
'pdf': 'pdfeditor',
'diagram': 'visioeditor',
'common': 'common'
},
appType = 'word',
@@ -1074,7 +1071,7 @@
isForm = false;
if (config.document) {
if (typeof config.document.fileType === 'string')
type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|numbers)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|key)|(oform|docxf)|(vsdx|vssx|vstx|vsdm|vssm|vstm))$/
type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb|numbers)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp|key)|(oform|docxf))$/
.exec(config.document.fileType);

if (config.document.permissions)
@@ -1097,8 +1094,7 @@
appType = config.documentType.toLowerCase();
else {
if (type && typeof type[3] === 'string') appType = 'cell'; else
if (type && typeof type[4] === 'string') appType = 'slide'; else
if (type && typeof type[6] === 'string') appType = 'diagram';
if (type && typeof type[4] === 'string') appType = 'slide';
}
}
if (!(config.editorConfig && config.editorConfig.shardkey && config.document && config.editorConfig.shardkey!==config.document.key))
9 changes: 2 additions & 7 deletions build/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -669,8 +669,7 @@ module.exports = function(grunt) {
},
cmd: function() {
const editor = packageFile.name == 'presentationeditor' ? 'slide' :
packageFile.name == 'spreadsheeteditor' ? 'cell' :
packageFile.name == 'visioeditor' ? 'visio' : 'word';
packageFile.name == 'spreadsheeteditor' ? 'cell' : 'word';
return `npm run deploy-${editor}`;

// const addon_path = `${packageFile.mobile.js.reactjs && !!packageFile.mobile.js.reactjs.features ? `ADDON_ENV=${packageFile.mobile.js.reactjs.features}` : ''}`;
@@ -843,7 +842,6 @@ module.exports = function(grunt) {
doRegisterInitializeAppTask('spreadsheeteditor', 'SpreadsheetEditor', 'spreadsheeteditor.json');
doRegisterInitializeAppTask('presentationeditor', 'PresentationEditor', 'presentationeditor.json');
doRegisterInitializeAppTask('pdfeditor', 'PDFEditor', 'pdfeditor.json');
doRegisterInitializeAppTask('visioeditor', 'VisioEditor', 'visioeditor.json');

doRegisterInitializeAppTask('testdocumenteditor', 'TestDocumentEditor', 'testdocumenteditor.json');
doRegisterInitializeAppTask('testpresentationeditor', 'TestPresentationEditor', 'testpresentationeditor.json');
@@ -865,15 +863,13 @@ module.exports = function(grunt) {
grunt.registerTask('deploy-spreadsheeteditor-component', ['init-build-spreadsheeteditor', 'deploy-app']);
grunt.registerTask('deploy-presentationeditor-component', ['init-build-presentationeditor', 'deploy-app']);
grunt.registerTask('deploy-pdfeditor-component', ['init-build-pdfeditor', 'deploy-app']);
grunt.registerTask('deploy-visioeditor-component', ['init-build-visioeditor', 'deploy-app']);
// This task is called from the Makefile, don't delete it.
grunt.registerTask('deploy-documents-component', ['deploy-common-component']);

grunt.registerTask('deploy-documenteditor', ['deploy-common-component', 'deploy-documenteditor-component']);
grunt.registerTask('deploy-spreadsheeteditor', ['deploy-common-component', 'deploy-spreadsheeteditor-component']);
grunt.registerTask('deploy-presentationeditor', ['deploy-common-component', 'deploy-presentationeditor-component']);
grunt.registerTask('deploy-pdfeditor', ['deploy-common-component', 'deploy-pdfeditor-component']);
grunt.registerTask('deploy-visioeditor', ['deploy-common-component', 'deploy-visioeditor-component']);

grunt.registerTask('deploy-testdocumenteditor', ['init-build-testdocumenteditor', 'deploy-app']);
grunt.registerTask('deploy-testpresentationeditor', ['init-build-testpresentationeditor', 'deploy-app']);
@@ -883,6 +879,5 @@ module.exports = function(grunt) {
'deploy-documenteditor-component',
'deploy-spreadsheeteditor-component',
'deploy-presentationeditor-component',
'deploy-pdfeditor-component',
'deploy-visioeditor-component']);
'deploy-pdfeditor-component']);
};

0 comments on commit 43af739

Please sign in to comment.