Merge pull request #1174 from ONLYOFFICE/fix/bugfix

Add oxps format
This commit is contained in:
Julia Radzhabova 2021-09-13 16:59:59 +03:00 committed by GitHub
commit 275ffa752c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 11 deletions

View file

@ -415,7 +415,7 @@
if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') { if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
_config.document.fileType = _config.document.fileType.toLowerCase(); _config.document.fileType = _config.document.fileType.toLowerCase();
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)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott|fb2|xml))$/ 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)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|oxps|docm|dot|dotm|dotx|fodt|ott|fb2|xml))$/
.exec(_config.document.fileType); .exec(_config.document.fileType);
if (!type) { if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it."); window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
@ -427,7 +427,7 @@
} }
} }
var type = /^(?:(pdf|djvu|xps))$/.exec(_config.document.fileType); var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(_config.document.fileType);
if (type && typeof type[1] === 'string') { if (type && typeof type[1] === 'string') {
_config.editorConfig.canUseHistory = false; _config.editorConfig.canUseHistory = false;
} }

View file

@ -130,7 +130,7 @@ DE.ApplicationController = new(function(){
enable = !config.customization || (config.customization.plugins!==false); enable = !config.customization || (config.customization.plugins!==false);
docInfo.asc_putIsEnabledPlugins(!!enable); docInfo.asc_putIsEnabledPlugins(!!enable);
var type = /^(?:(pdf|djvu|xps))$/.exec(docConfig.fileType); var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(docConfig.fileType);
if (type && typeof type[1] === 'string') { if (type && typeof type[1] === 'string') {
permissions.edit = permissions.review = false; permissions.edit = permissions.review = false;
} }

View file

@ -458,7 +458,7 @@ define([
docInfo.asc_putIsEnabledPlugins(!!enable); docInfo.asc_putIsEnabledPlugins(!!enable);
// docInfo.put_Review(this.permissions.review); // docInfo.put_Review(this.permissions.review);
var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType); var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType);
if (type && typeof type[1] === 'string') { if (type && typeof type[1] === 'string') {
this.permissions.edit = this.permissions.review = false; this.permissions.edit = this.permissions.review = false;
} }
@ -521,7 +521,7 @@ define([
} }
this._state.isFromGatewayDownloadAs = true; this._state.isFromGatewayDownloadAs = true;
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType);
if (type && typeof type[1] === 'string') if (type && typeof type[1] === 'string')
this.api.asc_DownloadOrigin(true); this.api.asc_DownloadOrigin(true);
else { else {
@ -1335,7 +1335,7 @@ define([
this.appOptions.canChat = false; this.appOptions.canChat = false;
} }
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType);
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string'); this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string'); this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');

View file

@ -140,7 +140,7 @@ define([
var _file_type = _main.document.fileType, var _file_type = _main.document.fileType,
_format; _format;
if ( !!_file_type ) { if ( !!_file_type ) {
if ( /^pdf|xps|djvu/i.test(_file_type) ) { if ( /^pdf|xps|oxps|djvu/i.test(_file_type) ) {
_main.api.asc_DownloadOrigin(); _main.api.asc_DownloadOrigin();
return; return;
} else { } else {

View file

@ -133,7 +133,7 @@ class MainController extends Component {
enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins !== false); enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins !== false);
docInfo.asc_putIsEnabledPlugins(!!enable); docInfo.asc_putIsEnabledPlugins(!!enable);
const type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType); const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType);
if (type && typeof type[1] === 'string') { if (type && typeof type[1] === 'string') {
this.permissions.edit = this.permissions.review = false; this.permissions.edit = this.permissions.review = false;
} }
@ -675,7 +675,7 @@ class MainController extends Component {
} }
this._state.isFromGatewayDownloadAs = true; this._state.isFromGatewayDownloadAs = true;
const type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType);
if (type && typeof type[1] === 'string') { if (type && typeof type[1] === 'string') {
this.api.asc_DownloadOrigin(true); this.api.asc_DownloadOrigin(true);

View file

@ -124,7 +124,7 @@ export class storeAppOptions {
this.canComments = false; this.canComments = false;
this.trialMode = params.asc_getLicenseMode(); this.trialMode = params.asc_getLicenseMode();
const type = /^(?:(pdf|djvu|xps))$/.exec(document.fileType); const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType);
this.canDownloadOrigin = permissions.download !== false && (type && typeof type[1] === 'string'); this.canDownloadOrigin = permissions.download !== false && (type && typeof type[1] === 'string');
this.canDownload = permissions.download !== false && (!type || typeof type[1] !== 'string'); this.canDownload = permissions.download !== false && (!type || typeof type[1] !== 'string');
this.canReader = (!type || typeof type[1] !== 'string'); this.canReader = (!type || typeof type[1] !== 'string');

View file

@ -98,7 +98,7 @@ export class storeAppOptions {
this.isRestrictedEdit = !this.isEdit && this.canComments; this.isRestrictedEdit = !this.isEdit && this.canComments;
this.trialMode = params.asc_getLicenseMode(); this.trialMode = params.asc_getLicenseMode();
const type = /^(?:(pdf|djvu|xps))$/.exec(document.fileType); const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType);
this.canDownloadOrigin = permissions.download !== false && (type && typeof type[1] === 'string'); this.canDownloadOrigin = permissions.download !== false && (type && typeof type[1] === 'string');
this.canDownload = permissions.download !== false && (!type || typeof type[1] !== 'string'); this.canDownload = permissions.download !== false && (!type || typeof type[1] !== 'string');