Skip to content

Commit

Permalink
Merge branch 'release/v8.2.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Sep 26, 2024
2 parents addaa2b + fae7147 commit 8e48a42
Show file tree
Hide file tree
Showing 529 changed files with 95,028 additions and 72,618 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
34 changes: 32 additions & 2 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@
} / 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: 'tab'/'line' // init value, 'tab' by default,
mode: 'fill'/'line' // init value, 'fill' by default,
change: true/false // show/hide feature
} / 'tab'/'line' // if string - use as init value
} / 'fill'/'line' // if string - use as init value
tabBackground: {
mode: 'header'/'toolbar' // init value, 'header' by default
change: true/false // show/hide feature
Expand Down Expand Up @@ -542,6 +542,8 @@
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 @@ -959,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 @@ -1039,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 @@ -1136,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 @@ -1191,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);

22 changes: 19 additions & 3 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 Down Expand Up @@ -262,6 +263,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,7 +304,8 @@ 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;
Expand Down Expand Up @@ -317,7 +333,7 @@ div {
"fileType": fileType,
"key": key,
"info": {
"folder": fileInfo.BreadcrumbFolderName
"folder": getWopiFolder(fileInfo, queryParams)
},
"permissions": {
"edit": permissionsEdit,
Expand Down
95 changes: 93 additions & 2 deletions apps/common/embed/lib/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,95 @@
check = function(regex){
return regex.test(userAgent);
},
isMac = check(/macintosh|mac os x/);
version = function (is, regex) {
var m;
return (is && (m = regex.exec(userAgent))) ? parseFloat(m[1]) : 0;
},
isOpera = check(/opera/),
isIE = !isOpera && (check(/msie/) || check(/trident/) || check(/edge/)),
isChrome = !isIE && check(/\bchrome\b/),
chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/),
isMac = check(/macintosh|mac os x/),
zoom = 1,
checkSize = function () {
var scale = {};
if (!!window.AscCommon && !!window.AscCommon.checkDeviceScale) {
scale = window.AscCommon.checkDeviceScale();
AscCommon.correctApplicationScale(scale);
scale.correct && (zoom = scale.zoom);
}
},
isOffsetUsedZoom = function() {
if (isChrome && 128 <= chromeVersion)
return (zoom === 1) ? false : true;
return false;
},
getBoundingClientRect = function(element) {
let rect = element.getBoundingClientRect();
if (!isOffsetUsedZoom())
return rect;

let koef = zoom;
let newRect = {}
if (rect.x!==undefined) newRect.x = rect.x * koef;
if (rect.y!==undefined) newRect.y = rect.y * koef;
if (rect.width!==undefined) newRect.width = rect.width * koef;
if (rect.height!==undefined) newRect.height = rect.height * koef;

if (rect.left!==undefined) newRect.left = rect.left * koef;
if (rect.top!==undefined) newRect.top = rect.top * koef;
if (rect.right!==undefined) newRect.right = rect.right * koef;
if (rect.bottom!==undefined) newRect.bottom = rect.bottom * koef;
return newRect;
},
getOffset = function($element) {
let pos = $element.offset();
if (!isOffsetUsedZoom())
return pos;
return {left: pos.left * zoom, top: pos.top * zoom};
},
setOffset = function($element, options) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
position = $element.css("position"),
props = {};

if ( position === "static" ) {
$element[0].style.position = "relative";
}

curOffset = getOffset($element);
curCSSTop = $element.css("top");
curCSSLeft = $element.css("left");
calculatePosition = ( position === "absolute" || position === "fixed" ) &&
( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;

if ( calculatePosition ) {
curPosition = getPosition($element);
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}

if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
$element.css( props );
},
getPosition = function($element) {
let pos = $element.position();
if (!isOffsetUsedZoom())
return pos;
return {left: pos.left * zoom, top: pos.top * zoom};
};
if (!isIE) {
checkSize();
$(window).on('resize', checkSize);
}
return {
openLink: function(url) {
if (url) {
Expand Down Expand Up @@ -105,7 +193,10 @@
}
}
},

getBoundingClientRect: getBoundingClientRect,
getOffset: getOffset,
setOffset: setOffset,
getPosition: getPosition,
isMac : isMac
};
})();
Expand Down
1 change: 1 addition & 0 deletions apps/common/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
var params = getUrlParams(),
postfix = params["indexPostfix"] || '',
embed = params["type"]==='embedded';
params.skipScaling = true;
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
</script>
Expand Down
1 change: 1 addition & 0 deletions apps/common/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
var params = getUrlParams(),
postfix = params["indexPostfix"] || '',
embed = params["type"]==='embedded';
params.skipScaling = true;
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
</script>
Expand Down
2 changes: 1 addition & 1 deletion apps/common/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Common.Locale = new(function() {
} else _requireLang();

const _isCurrentRtl = function () {
return currentLang && (/^(ar)$/i.test(currentLang));
return currentLang && (/^(ar|he)$/i.test(currentLang));
};

return {
Expand Down
2 changes: 2 additions & 0 deletions apps/common/main/lib/component/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ define([
me.btnPrev = new Common.UI.Button({
parentEl: me.cmpEl.find('#prev-arrow'),
cls: '',
scaling: false,
iconCls: 'arrow-prev img-commonctrl'
});
me.btnPrev.on('click', _.bind(me.onClickPrev, me));

me.btnNext = new Common.UI.Button({
parentEl: me.cmpEl.find('#next-arrow'),
cls: '',
scaling: false,
iconCls: 'arrow-next img-commonctrl'
});
me.btnNext.on('click', _.bind(me.onClickNext, me));
Expand Down
48 changes: 30 additions & 18 deletions apps/common/main/lib/component/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ define([
displayField: 'displayValue',
valueField : 'value',
search : false,
searchFields: ['displayValue'], // Property name from the item to be searched by
placeHolder : '',
scrollAlwaysVisible: false,
takeFocusOnClose: false,
Expand Down Expand Up @@ -128,6 +129,7 @@ define([
this.valueField = me.options.valueField;
this.placeHolder = me.options.placeHolder;
this.search = me.options.search;
this.searchFields = me.options.searchFields;
this.scrollAlwaysVisible = me.options.scrollAlwaysVisible;
this.focusWhenNoSelection = (me.options.focusWhenNoSelection!==false);
this.restoreMenuHeight = me.options.restoreMenuHeight;
Expand Down Expand Up @@ -357,7 +359,7 @@ define([
$selected = $list.find('> li.selected');

if ($selected.length) {
var itemTop = $selected.position().top,
var itemTop = Common.Utils.getPosition($selected).top,
itemHeight = $selected.outerHeight(),
listHeight = $list.outerHeight();

Expand Down Expand Up @@ -486,26 +488,36 @@ define([
},

selectCandidate: function() {
var index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
var me = this,
index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
isFirstCharsEqual = re.test(this.store.at(index).get(this.displayField)),
isFirstCharsEqual = this.searchFields.some(function(field) {
return re.test(me.store.at(index).get(field));
}),
itemCandidate, idxCandidate;

for (var i=0; i<this.store.length; i++) {
var item = this.store.at(i);
if (re.test(item.get(this.displayField))) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
if(!isFirstCharsEqual)
break;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
break;
var item = this.store.at(i),
isBreak = false;
this.searchFields.forEach(function(fieldName) {
if (item.get(fieldName) && re.test(item.get(fieldName))) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
if(!isFirstCharsEqual) {
isBreak = true;
return;
}
}
if (me._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
isBreak = true;
return;
}
}
}
});
if(isBreak) break;
}

if (itemCandidate) {
Expand All @@ -514,7 +526,7 @@ define([
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var $list = $(this.el).find('ul');
var itemTop = item.position().top,
var itemTop = Common.Utils.getPosition(item).top,
itemHeight = item.outerHeight(),
listHeight = $list.outerHeight();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
Expand Down Expand Up @@ -843,4 +855,4 @@ define([
this.cmpEl && this.cmpEl.find('.form-control').focus();
}
}, Common.UI.ComboBoxCustom || {}));
});
});
2 changes: 1 addition & 1 deletion apps/common/main/lib/component/ComboBoxFonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ define([
itemNode.addClass('selected');
itemNode.find('a').attr('aria-checked', true);

var itemTop = itemNode.position().top,
var itemTop = Common.Utils.getPosition(itemNode).top,
menuTop = menuEl.scrollTop();

if (itemTop != 0)
Expand Down
Loading

0 comments on commit 8e48a42

Please sign in to comment.