From 26752c4c5cceba44081e12d30d955e33927c7ff2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 18 Nov 2020 00:38:48 +0300 Subject: [PATCH 1/2] Fix Bug 47479 --- apps/common/main/lib/component/ComboBox.js | 3 +++ apps/common/main/resources/less/combobox.less | 5 ++++ .../main/app/view/FileMenuPanels.js | 25 ++++++++++++----- .../main/app/view/FileMenuPanels.js | 25 ++++++++++++----- .../main/app/view/FileMenuPanels.js | 27 ++++++++++++++----- 5 files changed, 66 insertions(+), 19 deletions(-) diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 78a7b0a22..c50a88aff 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -302,6 +302,9 @@ define([ if ($list.hasClass('menu-absolute')) { var offset = this.cmpEl.offset(); $list.css({left: offset.left, top: offset.top + this.cmpEl.outerHeight() + 2}); + } else if ($list.hasClass('menu-aligned')) { + var offset = this.cmpEl.offset(); + $list.toggleClass('show-top', offset.top + this.cmpEl.outerHeight() + $list.outerHeight() > Common.Utils.innerHeight()); } }, diff --git a/apps/common/main/resources/less/combobox.less b/apps/common/main/resources/less/combobox.less index cc3cb36b8..31a7f0601 100644 --- a/apps/common/main/resources/less/combobox.less +++ b/apps/common/main/resources/less/combobox.less @@ -130,6 +130,11 @@ .dropdown-menu.menu-absolute { position: fixed; } + + .dropdown-menu.show-top { + top: auto; + bottom: 100%; + } } .open > .combobox.combo-dataview-menu { diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 8bd418ea4..1e91ff1f0 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -262,13 +262,17 @@ define([ '
', '
', '','', + '', + '', + '', + '', '', '', - '
', + '' @@ -425,6 +429,7 @@ define([ el : $markup.findById('#fms-cmb-macros'), style : 'width: 160px;', editable : false, + menuCls : 'menu-aligned', cls : 'input-group-nr', data : [ { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc }, @@ -446,13 +451,16 @@ define([ }); this.btnAutoCorrect.on('click', _.bind(this.autoCorrect, this)); - this.btnApply = new Common.UI.Button({ - el: $markup.findById('#fms-btn-apply') + $markup.find('.btn.primary').each(function(index, el){ + (new Common.UI.Button({ + el: $(el) + })).on('click', _.bind(me.applySettings, me)); }); - this.btnApply.on('click', this.applySettings.bind(this)); - this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings'); + this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply'); + this.pnlTable = this.pnlSettings.find('table'); + this.trApply = $markup.find('.fms-btn-apply'); this.$el = $(node).html($markup); @@ -482,6 +490,11 @@ define([ updateScroller: function() { if (this.scroller) { + Common.UI.Menu.Manager.hideAll(); + var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height(); + this.pnlApply.toggleClass('hidden', !scrolled); + this.trApply.toggleClass('hidden', scrolled); + this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible'); this.scroller.update(); this.pnlSettings.toggleClass('bordered', this.scroller.isVisible()); } diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index aa802e4ec..315fb36ea 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -236,13 +236,17 @@ define([ '
', '
', '','', + '', + '', + '', + '', '', '
', - '
', + '' @@ -368,6 +372,7 @@ define([ el : $markup.findById('#fms-cmb-macros'), style : 'width: 160px;', editable : false, + menuCls : 'menu-aligned', cls : 'input-group-nr', data : [ { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc }, @@ -389,13 +394,16 @@ define([ }); this.btnAutoCorrect.on('click', _.bind(this.autoCorrect, this)); - this.btnApply = new Common.UI.Button({ - el: $markup.findById('#fms-btn-apply') + $markup.find('.btn.primary').each(function(index, el){ + (new Common.UI.Button({ + el: $(el) + })).on('click', _.bind(me.applySettings, me)); }); - this.btnApply.on('click', _.bind(this.applySettings, this)); - this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings'); + this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply'); + this.pnlTable = this.pnlSettings.find('table'); + this.trApply = $markup.find('.fms-btn-apply'); this.$el = $(node).html($markup); @@ -425,6 +433,11 @@ define([ updateScroller: function() { if (this.scroller) { + Common.UI.Menu.Manager.hideAll(); + var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height(); + this.pnlApply.toggleClass('hidden', !scrolled); + this.trApply.toggleClass('hidden', scrolled); + this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible'); this.scroller.update(); this.pnlSettings.toggleClass('bordered', this.scroller.isVisible()); } diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 4a58c46b0..9bbae242d 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -737,13 +737,17 @@ define([ '
', '
', '','', + '', + '', + '', + '', '', '
', - '
', + '', @@ -977,6 +981,7 @@ define([ el : $markup.findById('#fms-cmb-macros'), style : 'width: 160px;', editable : false, + menuCls : 'menu-aligned', cls : 'input-group-nr', data : [ { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc }, @@ -992,13 +997,16 @@ define([ el: $markup.findById('#fms-chb-paste-settings'), labelText: this.strPasteButton }); - - this.btnApply = new Common.UI.Button({ - el: $markup.findById('#fms-btn-apply') - }); - this.btnApply.on('click', _.bind(this.applySettings, this)); + $markup.find('.btn.primary').each(function(index, el){ + (new Common.UI.Button({ + el: $(el) + })).on('click', _.bind(me.applySettings, me)); + }); this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings'); + this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply'); + this.pnlTable = this.pnlSettings.find('table'); + this.trApply = $markup.find('.fms-btn-apply'); this.$el = $(node).html($markup); @@ -1032,6 +1040,11 @@ define([ updateScroller: function() { if (this.scroller) { + Common.UI.Menu.Manager.hideAll(); + var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height(); + this.pnlApply.toggleClass('hidden', !scrolled); + this.trApply.toggleClass('hidden', scrolled); + this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible'); this.scroller.update(); this.pnlSettings.toggleClass('bordered', this.scroller.isVisible()); } From efebf7b09045db3f7cebea5079d5f879122d8b4f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 18 Nov 2020 00:52:01 +0300 Subject: [PATCH 2/2] [DE] Revert changes for Bug 47515 --- .../main/app/controller/Links.js | 5 +-- .../main/app/view/CrossReferenceDialog.js | 34 ++++++------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 8ab4e9693..661e67e2e 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -82,8 +82,7 @@ define([ onLaunch: function () { this._state = { prcontrolsdisable:undefined, - in_object: false, - in_header: false + in_object: false }; Common.Gateway.on('setactionlink', function (url) { console.log('url with actions: ' + url); @@ -155,7 +154,6 @@ define([ } this._state.prcontrolsdisable = paragraph_locked || header_locked; this._state.in_object = in_image || in_table || in_equation; - this._state.in_header = in_header; var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null, control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false, @@ -463,7 +461,6 @@ define([ me.dlgCrossRefDialog = new DE.Views.CrossReferenceDialog({ api: me.api, crossRefProps: me.crossRefProps, - inHeader: me._state.in_header, handler: function (result, settings) { if (result != 'ok') Common.NotificationCenter.trigger('edit:complete', me.toolbar); diff --git a/apps/documenteditor/main/app/view/CrossReferenceDialog.js b/apps/documenteditor/main/app/view/CrossReferenceDialog.js index d20963f1e..54f46b750 100644 --- a/apps/documenteditor/main/app/view/CrossReferenceDialog.js +++ b/apps/documenteditor/main/app/view/CrossReferenceDialog.js @@ -101,7 +101,6 @@ define([ this.api = options.api; this.options.tpl = _.template(this.template)(this.options); this._locked = false; - this.inHeader = options.inHeader || false; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -203,29 +202,12 @@ define([ this._setDefaults(); var me = this; - var onApiFocusObject = function(selectedObjects) { - var i = -1, - in_header = false; - while (++i < selectedObjects.length) { - if (selectedObjects[i].get_ObjectType() === Asc.c_oAscTypeSelectElement.Header) { - in_header = true; - break; - } - } - if (me.inHeader !== in_header) { - me.inHeader = in_header; - var rec = me.cmbReference.getSelectedRecord(); - me.refreshReferenceTypes(me.cmbType.getSelectedRecord(), rec && (!me.inHeader || rec.value !== Asc.c_oAscDocumentRefenceToType.AboveBelow) ? rec.value : undefined); - } - }; var onApiEndCalculate = function() { var rec = me.cmbType.getSelectedRecord(); rec && me.refreshReferences(rec.value); }; - this.api.asc_registerCallback('asc_onFocusObject', onApiFocusObject); this.api.asc_registerCallback('asc_onEndCalculate', onApiEndCalculate); this.on('close', function(obj){ - me.api.asc_unregisterCallback('asc_onFocusObject', onApiFocusObject); me.api.asc_unregisterCallback('asc_onEndCalculate', onApiEndCalculate); }); }, @@ -313,7 +295,8 @@ define([ { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textCaption }, { value: Asc.c_oAscDocumentRefenceToType.OnlyLabelAndNumber, displayValue: this.textLabelNum }, { value: Asc.c_oAscDocumentRefenceToType.OnlyCaptionText, displayValue: this.textOnlyCaption }, - { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum } + { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } ]; } else { type = record.value; @@ -324,7 +307,8 @@ define([ { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum }, { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo }, { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull }, - { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textText } + { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textText }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } ]; str = this.textWhichPara; break; @@ -334,7 +318,8 @@ define([ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textHeadingNum }, { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textHeadingNumNo }, - { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textHeadingNumFull } + { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textHeadingNumFull }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } ]; str = this.textWhichHeading; break; @@ -344,7 +329,8 @@ define([ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum }, { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo }, - { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull } + { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow } ]; str = this.textWhichBookmark; break; @@ -352,6 +338,7 @@ define([ arr = [ { value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textNoteNum }, { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }, { value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textNoteNumForm } ]; str = this.textWhichNote; @@ -360,14 +347,13 @@ define([ arr = [ { value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textEndNoteNum }, { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum }, + { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }, { value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textEndNoteNumForm } ]; str = this.textWhichEndnote; break; } } - if (!this.inHeader) - arr.push({ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }); this.cmbReference.setData(arr); var rec = this.cmbReference.store.findWhere({value: currentRef});