From ad9beca9db53524ffbeac3bab9879d6c8f59ca3b Mon Sep 17 00:00:00 2001 From: OVSharova Date: Wed, 2 Mar 2022 17:30:09 +0300 Subject: [PATCH] Advancet Settings without button Apply --- .../main/app/controller/LeftMenu.js | 4 +-- apps/documenteditor/main/app/view/FileMenu.js | 5 +++- .../main/app/view/FileMenuPanels.js | 30 +++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 9eccb802c..78b980781 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -432,7 +432,7 @@ define([ this.isFromFileDownloadAs = false; }, - applySettings: function(menu) { + applySettings: function(menu, showmenu) { var value; value = Common.localStorage.getBool("de-settings-inputmode"); @@ -501,7 +501,7 @@ define([ this.api.put_ShowSnapLines(Common.Utils.InternalSettings.get("de-settings-showsnaplines")); - menu.hide(); + (!showmenu) && menu.hide(); }, onCreateNew: function(menu, type) { diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 041fb9795..71cb9eedb 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -69,7 +69,10 @@ define([ this.fireEvent('item:click', [this, item.options.action, !!panel]); if (panel) { - this.$el.find('.content-box:visible').hide(); + if(this.active == 'opts') + this.panels[this.active].hide(); + else + this.$el.find('.content-box:visible').hide(); this.active = item.options.action; panel.show(); } diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index f8929c1ce..bf15c73c4 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -339,21 +339,21 @@ define([ '
', '', '', - '', + /*'', '', '', - '', + '',*/ '', '
', - ''*/ ].join('')), initialize: function(options) { @@ -636,17 +636,17 @@ define([ dataHintDirection: 'left', dataHintOffset: 'small' }); - - $markup.find('.btn.primary').each(function(index, el){ + this.menu.on('menu:hide', _.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.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.trApply = $markup.find('.fms-btn-apply'); this.$el = $(node).html($markup); @@ -673,13 +673,17 @@ define([ this.updateSettings(); this.updateScroller(); }, + hide: function (){ + Common.UI.BaseView.prototype.hide.call(this,arguments); + this.applySettings(); + }, updateScroller: function() { if (this.scroller) { Common.UI.Menu.Manager.hideAll(); - var scrolled = this.$el.height()< this.pnlTable.parent().height() + 25 + this.pnlApply.height(); - this.pnlApply.toggleClass('hidden', !scrolled); - this.trApply.toggleClass('hidden', scrolled); + var scrolled = this.$el.height()< this.pnlTable.parent().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()); @@ -841,7 +845,7 @@ define([ Common.localStorage.save(); if (this.menu) { - this.menu.fireEvent('settings:apply', [this.menu]); + this.menu.fireEvent('settings:apply', [this.menu, true]); if (this._oldUnits !== this.cmbUnit.getValue()) Common.NotificationCenter.trigger('settings:unitschanged', this);