Skip to content

Commit

Permalink
Merge branch release/v8.2.0 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
papacarlo committed Oct 17, 2024
2 parents 514ed8c + 0b9706d commit 8b6e1db
Show file tree
Hide file tree
Showing 2,782 changed files with 497,217 additions and 202,577 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ apps/**/main/resources/**/iconsbig*.svg
apps/**/main/resources/**/iconsbig*.less
apps/**/main/resources/**/iconshuge*.png
apps/**/main/resources/**/iconshuge*.less
apps/**/mobile/dist/*.*
apps/**/mobile/hot/*.*
apps/**/mobile/css/*.*


# test documents
Expand Down
18 changes: 18 additions & 0 deletions 3DPARTY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Third-party

* Backbone 1.1.0 ([MIT License](https://github.com/jashkenas/backbone/blob/master/LICENSE))
* es6-promise 4.2.8 ([MIT License](https://github.com/stefanpenner/es6-promise/blob/master/LICENSE))
* i18next 23.4.1 ([MIT License](https://github.com/i18next/i18next/blob/master/LICENSE))
* jQuery 3.5.1 ([MIT License](https://github.com/jquery/jquery/blob/master/LICENSE.txt))
* jQuery.browser v0.0.5 ([MIT](https://github.com/gabceb/jquery-browser-plugin/blob/master/MIT-LICENSE.txt))
* Less.js 4.1.2 ([Apache License 2.0](https://github.com/less/less.js/blob/master/LICENSE))
* perfect-scrollbar v0.4.9 ([MIT License](https://github.com/mdbootstrap/perfect-scrollbar/blob/main/LICENSE))
* RequireJS 2.1.10 ([MIT License](https://github.com/requirejs/requirejs/blob/master/LICENSE))
* RequireJS text 2.0.10 ([MIT License](https://github.com/requirejs/text/blob/master/LICENSE))
* Socket.IO 4.5.3 ([MIT License](https://github.com/socketio/socket.io/blob/main/LICENSE))
* SVGInjector 1.1.3 ([MIT License](https://github.com/iconic/SVGInjector/blob/master/LICENSE))
* Underscore.js 1.8.3 ([MIT License](https://github.com/jashkenas/underscore/blob/master/LICENSE))
* Framework7 8.0.5 ([MIT License](https://github.com/framework7io/framework7/blob/master/LICENSE))
* XRegExp 3.0.0 ([MIT License](https://github.com/slevithan/xregexp/blob/master/LICENSE))
* MobX 6.7.0 ([MIT License](https://github.com/mobxjs/mobx/blob/main/LICENSE))

76 changes: 65 additions & 11 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
logo: {
image: url,
imageDark: url, // logo for dark theme
imageLight: url, // logo for light header
imageEmbedded: url, // deprecated, use image instead
url: http://...,
visible: true // hide logo if visible=false
Expand Down Expand Up @@ -204,6 +205,14 @@
change: false/true // hide/show feature in de/pe/sse
} / false / true // if false/true - use as init value in de/pe. use instead of customization.spellcheck parameter
roles: false/true // hide/show Roles manager, roles settings in right panel and roles in View form button in de
tabStyle: {
mode: 'fill'/'line' // init value, 'fill' by default,
change: true/false // show/hide feature
} / 'fill'/'line' // if string - use as init value
tabBackground: {
mode: 'header'/'toolbar' // init value, 'header' by default
change: true/false // show/hide feature
} / 'header'/'toolbar' // if string - use as init value
},
font: {
name: "Arial",
Expand All @@ -224,7 +233,7 @@
showReviewChanges: false, // must be deprecated. use customization.review.showReviewChanges instead
help: true,
compactHeader: false,
toolbarNoTabs: false,
toolbarNoTabs: false, // must be deprecated. use features.tabStyle.mode='line' && features.tabBackground='toolbar' instead
toolbarHideFileName: false,
reviewDisplay: 'original', // must be deprecated. use customization.review.reviewDisplay instead
spellcheck: true, // must be deprecated. use customization.features.spellcheck instead
Expand All @@ -239,7 +248,10 @@
hideNotes: false // hide or show notes panel on first loading (presentation editor)
uiTheme: 'theme-dark' // set interface theme: id or default-dark/default-light
integrationMode: "embed" // turn off scroll to frame
mobileForceView: true/false (default: true) // turn on/off the 'reader' mode on launch. for mobile document editor only
mobile: {
forceView: true/false (default: true) // turn on/off the 'reader' mode on launch. for mobile document editor only
standardView: true/false (default: false) // open editor in 'Standard view' instead of 'Mobile view'
}
},
coEditing: {
mode: 'fast', // <coauthoring mode>, 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true. 'fast' - default for editor
Expand Down Expand Up @@ -513,20 +525,25 @@

(function() {
var result = /[\?\&]placement=(\w+)&?/.exec(window.location.search);
if (!!result && result.length) {
if (result[1] == 'desktop') {
_config.editorConfig.targetApp = result[1];
// _config.editorConfig.canBackToFolder = false;
if (!_config.editorConfig.customization) _config.editorConfig.customization = {};
_config.editorConfig.customization.about = false;
_config.editorConfig.customization.compactHeader = false;
}
if (!!result && result.length && result[1] == 'desktop' ) {
console.warn('some errors occurred in the desktop app while document opening. please, contact with support team');
}

if (!!window.AscDesktopEditor)
{
_config.editorConfig.targetApp = 'desktop';
// _config.editorConfig.canBackToFolder = false;
if (!_config.editorConfig.customization) _config.editorConfig.customization = {};
_config.editorConfig.customization.about = false;
_config.editorConfig.customization.compactHeader = false;
}
})();

var target = document.getElementById(placeholderId),
iframe;

getShardkey(_config);

if (target && _checkConfigParams()) {
iframe = createIframe(_config);
if (_config.editorConfig.customization && _config.editorConfig.customization.integrationMode==='embed')
Expand Down Expand Up @@ -944,6 +961,17 @@
}
};

function getShardkey(config) {
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length - 1; i >= 0; i--) {
if (scripts[i].src.match(/(.*)api\/documents\/api.js/i)) {
var shardkey = /[\?\&]shardkey=([^&]+)&?/.exec(scripts[i].src);
shardkey && shardkey.length && (config.editorConfig.shardkey = shardkey[1]);
break;
}
}
}

function getBasePath() {
var scripts = document.getElementsByTagName('script'),
match;
Expand Down Expand Up @@ -1024,6 +1052,8 @@
if (type && typeof type[4] === 'string') appType = 'slide';
}
}
if (!(config.editorConfig && config.editorConfig.shardkey && config.document && config.editorConfig.shardkey!==config.document.key))
path = extendAppPath(config, path);
path += appMap[appType];

const path_type = config.type === "mobile" ? "mobile" :
Expand Down Expand Up @@ -1065,9 +1095,11 @@
} else if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded || config.editorConfig.customization.logo.imageDark)) {
(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded) && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded));
config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
} else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
config.editorConfig.customization.logo.imageLight && (params += "&headerlogolight=" + encodeURIComponent(config.editorConfig.customization.logo.imageLight));
} else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark || config.editorConfig.customization.logo.imageLight)) {
config.editorConfig.customization.logo.image && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image));
config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
config.editorConfig.customization.logo.imageLight && (params += "&headerlogolight=" + encodeURIComponent(config.editorConfig.customization.logo.imageLight));
}
}
}
Expand Down Expand Up @@ -1100,6 +1132,13 @@
if (config.editorConfig && config.editorConfig.customization && !!config.editorConfig.customization.compactHeader)
params += "&compact=true";

if (config.editorConfig && config.editorConfig.customization && config.editorConfig.customization.features && config.editorConfig.customization.features.tabBackground) {
if (typeof config.editorConfig.customization.features.tabBackground === 'object') {
params += "&tabBackground=" + (config.editorConfig.customization.features.tabBackground.mode || "header") + (config.editorConfig.customization.features.tabBackground.change!==false ? "-ls" : "");
} else
params += "&tabBackground=" + config.editorConfig.customization.features.tabBackground + "-ls";
}

if (config.editorConfig && config.editorConfig.customization && (config.editorConfig.customization.toolbar===false))
params += "&toolbar=false";

Expand All @@ -1112,6 +1151,9 @@
if (config.document && config.document.fileType)
params += "&fileType=" + config.document.fileType;

if (config.editorConfig && config.editorConfig.shardkey && config.document && config.editorConfig.shardkey!==config.document.key)
params += "&shardkey=" + config.document.key;

if (config.editorConfig) {
var customization = config.editorConfig.customization;
if ( customization && typeof(customization) == 'object' && ( customization.toolbarNoTabs || (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
Expand Down Expand Up @@ -1167,5 +1209,17 @@
return dest;
}

function extendAppPath(config, path) {
if ( !config.isLocalFile ) {
const ver = '/{{PRODUCT_VERSION}}-{{HASH_POSTFIX}}';
if ( ver.lastIndexOf('{{') < 0 && path.indexOf(ver) < 0 ) {
const pos = path.indexOf('/web-apps/app');
if ( pos > 0 )
return [path.slice(0, pos), ver, path.slice(pos)].join('');
}
}
return path;
}

})(window.DocsAPI = window.DocsAPI || {}, window, document);

35 changes: 27 additions & 8 deletions apps/api/wopi/editor-wopi.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ div {
<div id="iframeEditor">
</div>
</div>
<script type="text/javascript" src="../../../web-apps/apps/api/documents/api.js"></script>
<script type="text/javascript" src="../../../web-apps/apps/api/documents/api.js<%- apiQuery %>"></script>
<script type="text/javascript" language="javascript">
var docEditor;
Expand Down Expand Up @@ -223,6 +223,7 @@ div {
var onRequestSaveAs = function (event) {
//SaveAs work via PutRelativeFile server-server request
docEditor.serviceCommand('wopi:saveAsComplete');
};
var onRequestSharingSettings = function (event) {
Expand All @@ -249,6 +250,10 @@ div {
innerAlert(event.data);
};
var onOutdatedVersion = function () {
window.location.reload();
};
var getWopiFileUrl = function(fileInfo, userAuth) {
let url;
if (fileInfo.FileUrl) {
Expand All @@ -262,6 +267,20 @@ div {
return url;
}
var getWopiFolder = function (fileInfo, queryParams) {
if (fileInfo.BreadcrumbFolderName) {
return fileInfo.BreadcrumbFolderName;
}
//connector Nextcloud Office 8.4.5 (SupportsUpdate=undefined, UserCanWrite=true, UserCanNotWriteRelative=false)
if (queryParams.title) {
let titleParts = queryParams.title.split('/');
if (titleParts.length > 1 && titleParts[titleParts.length - 2]) {
return titleParts[titleParts.length - 2];
}
}
return undefined;
}
var connectEditor = function () {
fileInfo = <%- JSON.stringify(fileInfo) %>;
Expand Down Expand Up @@ -289,10 +308,12 @@ div {
fileType = fileInfo.FileExtension ? fileInfo.FileExtension.substr(1) : fileType;
fileType = fileType.toLowerCase();
let customizationClose = !!(fileInfo.ClosePostMessage || fileInfo.CloseUrl);
let customizationSaveAs = fileInfo.SupportsUpdate && !fileInfo.UserCanNotWriteRelative;
//connector Nextcloud Office 8.4.5 (SupportsUpdate=undefined, UserCanWrite=true, UserCanNotWriteRelative=false)
let customizationSaveAs = (fileInfo.SupportsUpdate || fileInfo.UserCanWrite) && !fileInfo.UserCanNotWriteRelative;
let customizationFormSubmit = queryParams.formsubmit === "1";
let permissionsEdit = !fileInfo.ReadOnly && fileInfo.UserCanWrite && !customizationFormSubmit;
let permissionsFillForm = permissionsEdit || customizationFormSubmit;
sessionId = userAuth.userSessionId;
var config = {
"width": "100%",
"height": "100%",
Expand All @@ -316,7 +337,7 @@ div {
"fileType": fileType,
"key": key,
"info": {
"folder": fileInfo.BreadcrumbFolderName
"folder": getWopiFolder(fileInfo, queryParams)
},
"permissions": {
"edit": permissionsEdit,
Expand All @@ -325,9 +346,6 @@ div {
"print": !fileInfo.DisablePrint && !fileInfo.HidePrintOption,
"chat": queryParams.dchat!=="1",
"fillForms": permissionsFillForm
},
"options": {
"WOPISrc": userAuth.wopiSrc
}
},
"editorConfig": {
Expand Down Expand Up @@ -358,7 +376,8 @@ div {
},
"wopi": {
"FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250,
"WOPISrc": userAuth.wopiSrc
"WOPISrc": userAuth.wopiSrc,
"UserSessionId": sessionId
}
},
"events": {
Expand All @@ -367,6 +386,7 @@ div {
'onRequestEditRights': fileInfo.EditModePostMessage || fileInfo.HostEditUrl ? onRequestEditRights : undefined,
'onRequestSaveAs': customizationSaveAs ? onRequestSaveAs : undefined,
"onError": onError,
"onOutdatedVersion": onOutdatedVersion,
"onRequestClose": customizationClose ? onRequestClose : undefined,
"onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined,
"onRequestSharingSettings": fileInfo.FileSharingPostMessage || fileInfo.FileSharingUrl ? onRequestSharingSettings : undefined,
Expand All @@ -379,7 +399,6 @@ div {
if (postMessageOrigin && (typeof postMessageOrigin === 'string') && postMessageOrigin.charAt(postMessageOrigin.length-1)=='/')
postMessageOrigin = postMessageOrigin.substring(0, postMessageOrigin.length - 1);
lang = config.editorConfig.lang;
sessionId = userAuth.userSessionId;
startTime = Date.now();
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
Expand Down
2 changes: 1 addition & 1 deletion apps/common/Analytics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
2 changes: 1 addition & 1 deletion apps/common/Gateway.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
2 changes: 1 addition & 1 deletion apps/common/IrregularStack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
2 changes: 1 addition & 1 deletion apps/common/checkExtendedPDF.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
2 changes: 1 addition & 1 deletion apps/common/embed/lib/controller/modals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
2 changes: 1 addition & 1 deletion apps/common/embed/lib/util/LocalStorage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
Expand Down
Loading

0 comments on commit 8b6e1db

Please sign in to comment.