Skip to content

Commit

Permalink
Merge branch 'release/v8.1.0' into feature/close-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Feb 22, 2024
2 parents 14c33df + 3740ba4 commit 2ad950f
Show file tree
Hide file tree
Showing 322 changed files with 3,185 additions and 2,099 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "CodeQL"

on:
push:
branches:
- 'master'
- 'hotfix/**'
- 'release/**'
paths-ignore:
- '**/README.md'
- '**/LICENSE'
- '.github/**'

schedule:
- cron: '0 0 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript-typescript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
15 changes: 10 additions & 5 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
image: url,
imageDark: url, // logo for dark theme
imageEmbedded: url, // deprecated, use image instead
url: http://...
url: http://...,
visible: true // hide logo if visible=false
},
customer: {
name: 'SuperPuper',
Expand Down Expand Up @@ -162,11 +163,13 @@
save: false/true // save button
} / false / true,
home: {
mailmerge: false/true // mail merge button
mailmerge: false/true // mail merge button // deprecated, button is moved to collaboration tab. use toolbar->collaboration->mailmerge instead
},
layout: false / true, // layout tab
references: false / true, // de references tab
collaboration: false / true // collaboration tab
collaboration: {
mailmerge: false/true // mail merge button in de
} / false / true, // collaboration tab
draw: false / true // draw tab
protect: false / true, // protect tab
plugins: false / true // plugins tab
Expand Down Expand Up @@ -209,7 +212,7 @@
compactToolbar: false,
leftMenu: true, // must be deprecated. use layout.leftMenu instead
rightMenu: true, // must be deprecated. use layout.rightMenu instead
hideRightMenu: false, // hide or show right panel on first loading
hideRightMenu: true, // hide or show right panel on first loading !! default value changed in 8.1
toolbar: true, // must be deprecated. use layout.toolbar instead
statusBar: true, // must be deprecated. use layout.statusBar instead
autosave: true,
Expand Down Expand Up @@ -1018,7 +1021,9 @@
params += "&logo=" + encodeURIComponent(config.editorConfig.customization.loaderLogo);
}
if ( config.editorConfig.customization.logo ) {
if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded))
if (config.editorConfig.customization.logo.visible===false) {
params += "&headerlogo=";
} else if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded))
params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded);
else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
config.editorConfig.customization.logo.image && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image));
Expand Down
7 changes: 6 additions & 1 deletion apps/api/wopi/editor-wopi.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ div {
window.open(fileInfo.HostEditUrl, "_blank");
};
var onRequestSaveAs = function (event) {
//SaveAs work via PutRelativeFile server-server request
};
var onRequestSharingSettings = function (event) {
if (fileInfo.FileSharingPostMessage)
_postMessage('UI_Sharing', {});
Expand Down Expand Up @@ -324,7 +328,8 @@ div {
"events": {
"onAppReady": onAppReady,
"onDocumentStateChange": fileInfo.EditNotificationPostMessage ? onDocumentStateChange : undefined,
'onRequestEditRights': fileInfo.EditModePostMessage || (fileInfo.HostEditUrl && !fileInfo.UserCanNotWriteRelative) ? onRequestEditRights : undefined,
'onRequestEditRights': fileInfo.EditModePostMessage || fileInfo.HostEditUrl ? onRequestEditRights : undefined,
'onRequestSaveAs': fileInfo.SupportsUpdate && !fileInfo.UserCanNotWriteRelative ? onRequestSaveAs : undefined,
"onError": onError,
"onRequestClose": fileInfo.ClosePostMessage || fileInfo.CloseUrl ? onRequestClose : undefined,
"onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined,
Expand Down
2 changes: 1 addition & 1 deletion apps/common/checkExtendedPDF.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function downloadPartialy(url, limit, postData, callback) {
var xhr = new XMLHttpRequest();
//value of responseText always has the current content received from the server, even if it's incomplete
// xhr.responseType = "json"; it raises an IE error. bug 66160
xhr.overrideMimeType('text/xml; charset=iso-8859-1');
xhr.overrideMimeType('text/plain; charset=iso-8859-1');
xhr.onreadystatechange = function () {
if (callbackCalled) {
return;
Expand Down
7 changes: 4 additions & 3 deletions apps/common/main/lib/component/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,11 @@ define([
if (/svgicon/.test(this.iconCls)) {
var icon = /svgicon\s(\S+)/.exec(this.iconCls);
svgIcon.attr('xlink:href', icon && icon.length > 1 ? '#' + icon[1] : '');
} else if (svgIcon.length) {
var icon = /btn-[^\s]+/.exec(this.iconCls);
svgIcon.attr('href', icon ? '#' + icon[0]: '');
} else {
if (svgIcon.length) {
var icon = /btn-[^\s]+/.exec(this.iconCls);
svgIcon.attr('href', icon ? '#' + icon[0]: '');
}
btnIconEl.removeClass(oldCls);
btnIconEl.addClass(cls || '');
if (this.options.scaling === false) {
Expand Down
116 changes: 80 additions & 36 deletions apps/common/main/lib/component/ComboDataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ define([
this.openButton.menu.setInnerMenu([{menu: this.menuPicker, index: 0}]);
}

// Handle resize
setInterval(_.bind(this.checkSize, this), 500);

if (this.options.el) {
this.render();
}
Expand Down Expand Up @@ -200,6 +197,8 @@ define([
});
}

me.autoWidth && me.cmpEl.addClass('auto-width');

me.fieldPicker.on('item:select', _.bind(me.onFieldPickerSelect, me));
me.menuPicker.on('item:select', _.bind(me.onMenuPickerSelect, me));
me.fieldPicker.on('item:click', _.bind(me.onFieldPickerClick, me));
Expand All @@ -211,9 +210,10 @@ define([
me.menuPicker.el.addEventListener('contextmenu', _.bind(me.onPickerComboContextMenu, me), false);

Common.NotificationCenter.on('more:toggle', _.bind(this.onMoreToggle, this));

Common.NotificationCenter.on('tab:active', _.bind(this.onTabActive, this));
Common.NotificationCenter.on('window:resize', _.bind(this.startCheckSize, this));
me.checkSize();
me.onResize();

me.rendered = true;

me.trigger('render:after', me);
Expand All @@ -227,17 +227,40 @@ define([

onMoreToggle: function(btn, state) {
if(state) {
this.checkSize();
this.startCheckSize();
}
},

onTabActive: function() {
this.startCheckSize();
},

startCheckSize: function() {
if (!this.cmpEl || !this.cmpEl.is(':visible')) return;

var me = this;
me.checkSize();
if (!me._timer_id) {
me._needCheckSize = 0;
me._timer_id = setInterval(function() {
if (me._needCheckSize++ < 10)
me.checkSize();
else {
clearInterval(me._timer_id);
delete me._timer_id;
}
}, 500);
} else
me._needCheckSize = 0;
},

checkSize: function() {
if (this.cmpEl && this.cmpEl.is(':visible')) {
if(this.autoWidth && this.menuPicker.store.length > 0) {
var wrapWidth = this.$el.width();
if(wrapWidth != this.wrapWidth || this.needFillComboView){
this.wrapWidth = wrapWidth;
this.autoChangeWidth();
wrapWidth = this.autoChangeWidth();
wrapWidth && (this.wrapWidth = wrapWidth);

var picker = this.menuPicker;
var record = picker.getSelectedRec();
Expand All @@ -248,7 +271,6 @@ define([
var me = this,
width = this.cmpEl.width(),
height = this.cmpEl.height();

if (width < this.minWidth) return;

if (this.rootWidth != width || this.rootHeight != height) {
Expand Down Expand Up @@ -290,32 +312,13 @@ define([

autoChangeWidth: function() {
if(this.menuPicker.dataViewItems[0]){
var wrapEl = this.$el;
var wrapWidth = wrapEl.width();

var itemEl = this.menuPicker.dataViewItems[0].$el;
var itemWidth = this.itemWidth + parseFloat(itemEl.css('padding-left')) + parseFloat(itemEl.css('padding-right')) + 2 * parseFloat(itemEl.css('border-width'));
var itemMargins = parseFloat(itemEl.css('margin-left')) + parseFloat(itemEl.css('margin-right'));

var fieldPickerEl = this.fieldPicker.$el;
var fieldPickerPadding = parseFloat(fieldPickerEl.css(Common.UI.isRTL() ? 'padding-left' : 'padding-right'));
var fieldPickerBorder = parseFloat(fieldPickerEl.css('border-width'));
var dataviewPaddings = parseFloat(this.fieldPicker.$el.find('.dataview').css('padding-left')) + parseFloat(this.fieldPicker.$el.find('.dataview').css('padding-right'));

var cmbDataViewEl = this.cmpEl;
var cmbDataViewPaddings = parseFloat(cmbDataViewEl.css('padding-left')) + parseFloat(cmbDataViewEl.css('padding-right'));

var itemsCount = Math.floor((wrapWidth - fieldPickerPadding - dataviewPaddings - 2 * fieldPickerBorder - cmbDataViewPaddings) / (itemWidth + itemMargins));
if(itemsCount > this.store.length)
itemsCount = this.store.length;

var widthCalc = Math.ceil((itemsCount * (itemWidth + itemMargins) + fieldPickerPadding + dataviewPaddings + 2 * fieldPickerBorder + cmbDataViewPaddings) * 10) / 10;

var maxWidth = parseFloat(cmbDataViewEl.css('max-width'));
if(widthCalc > maxWidth)
widthCalc = maxWidth;

cmbDataViewEl.css('width', widthCalc);
var wrapEl = this.$el,
widthCalc = this.checkAutoWidth(wrapEl, wrapEl.width()),
cmbDataViewEl = this.cmpEl;
if (widthCalc) {
cmbDataViewEl.css('width', widthCalc);
wrapEl.css('width', (widthCalc + parseFloat(wrapEl.css('padding-left')) + parseFloat(wrapEl.css('padding-right'))) + 'px');
}

if(this.initAutoWidth) {
this.initAutoWidth = false;
Expand All @@ -324,9 +327,50 @@ define([
cmbDataViewEl.css('bottom', '50%');
cmbDataViewEl.css('margin', 'auto 0');
}

return widthCalc;
}
},


checkAutoWidth: function(el, width) {
var $menuPicker = el.find('.menu-picker'),
$fieldPicker = el.find('.field-picker').closest('.view'),
cmbDataViewEl = el.find('.combo-dataview');
if ($menuPicker && $menuPicker.length>0) {
var itemEl = $menuPicker.find('.item'),
storeLength = itemEl.length,
fieldItemEl = $fieldPicker.find('.item');
if (itemEl.length>0) {
itemEl = $(itemEl[0]);
var itemWidth = itemEl.width();
if (itemWidth<1) {
itemWidth = fieldItemEl.length>0 ? $(fieldItemEl[0]).width() : 0;
}
if (itemWidth<1) return;

itemWidth += parseFloat(itemEl.css('padding-left')) + parseFloat(itemEl.css('padding-right')) + 2 * parseFloat(itemEl.css('border-width'));
var itemMargins = parseFloat(itemEl.css('margin-left')) + parseFloat(itemEl.css('margin-right'));

var fieldPickerPadding = parseFloat($fieldPicker.css(Common.UI.isRTL() ? 'padding-left' : 'padding-right'));
var fieldPickerBorder = parseFloat($fieldPicker.css('border-width'));
var dataView = $fieldPicker.find('.dataview');
var dataviewPaddings = parseFloat(dataView.css('padding-left')) + parseFloat(dataView.css('padding-right'));

var cmbDataViewPaddings = parseFloat(cmbDataViewEl.css('padding-left')) + parseFloat(cmbDataViewEl.css('padding-right'));
var itemsCount = Math.floor((width - fieldPickerPadding - dataviewPaddings - 2 * fieldPickerBorder - cmbDataViewPaddings) / (itemWidth + itemMargins));
if(itemsCount > storeLength)
itemsCount = storeLength;

var widthCalc = Math.ceil((itemsCount * (itemWidth + itemMargins) + fieldPickerPadding + dataviewPaddings + 2 * fieldPickerBorder + cmbDataViewPaddings) * 10) / 10;
var maxWidth = parseFloat(cmbDataViewEl.css('max-width'));
if(widthCalc > maxWidth)
widthCalc = maxWidth;

return widthCalc;
}
}
},

onBeforeShowMenu: function(e) {
var me = this;

Expand Down
Loading

0 comments on commit 2ad950f

Please sign in to comment.