From c6edf940286438a54d6c914358703aa0c054ad8b Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 24 Jan 2022 21:17:01 +0300 Subject: [PATCH] [SSE] Fix bug 53571 --- apps/common/main/lib/component/Tooltip.js | 3 +- apps/common/main/lib/util/Tip.js | 2 +- .../main/app/controller/DocumentHolder.js | 40 +++++++++++-------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/apps/common/main/lib/component/Tooltip.js b/apps/common/main/lib/component/Tooltip.js index df02ca406..83d8f9c84 100644 --- a/apps/common/main/lib/component/Tooltip.js +++ b/apps/common/main/lib/component/Tooltip.js @@ -104,7 +104,8 @@ offset : opts.offset, cls : opts.cls, html : opts.html, - hideonclick : opts.hideonclick + hideonclick : opts.hideonclick, + keepvisible: opts.keepvisible }); if (opts.hideonclick) { diff --git a/apps/common/main/lib/util/Tip.js b/apps/common/main/lib/util/Tip.js index b0521586d..4a9574c24 100644 --- a/apps/common/main/lib/util/Tip.js +++ b/apps/common/main/lib/util/Tip.js @@ -109,7 +109,7 @@ var me = this; Common.NotificationCenter.on({'layout:changed': function(e){ - if (!me.options.hideonclick && me.tip().is(':visible')) + if (!me.options.keepvisible && !me.options.hideonclick && me.tip().is(':visible')) me.hide(); }}); }, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index ff6f867fe..ea6890b19 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -172,6 +172,9 @@ define([ me.hideCoAuthTips(); me.hideForeignSelectTips(); me.onDocumentResize(); + if (me.api && !me.tooltips.input_msg.isHidden && me.tooltips.input_msg.text) { + me.changeInputMessagePosition(me.tooltips.input_msg); + } }, 'cells:range': function(status){ me.onCellsRange(status); @@ -2674,6 +2677,24 @@ define([ } }, + changeInputMessagePosition: function (inputTip) { + var pos = [ + this.documentHolder.cmpEl.offset().left - $(window).scrollLeft(), + this.documentHolder.cmpEl.offset().top - $(window).scrollTop() + ], + coord = this.api.asc_getActiveCellCoord(), + showPoint = [coord.asc_getX() + pos[0] - 3, coord.asc_getY() + pos[1] - inputTip.ref.getBSTip().$tip.height() - 5]; + var tipwidth = inputTip.ref.getBSTip().$tip.width(); + if (showPoint[0] + tipwidth > this.tooltips.coauth.bodyWidth ) + showPoint[0] = this.tooltips.coauth.bodyWidth - tipwidth; + + inputTip.ref.getBSTip().$tip.css({ + top : showPoint[1] + 'px', + left: showPoint[0] + 'px', + 'z-index': 900 + }); + }, + onInputMessage: function(title, message) { var inputtip = this.tooltips.input_msg; @@ -2700,28 +2721,15 @@ define([ inputtip.ref = new Common.UI.Tooltip({ owner : inputtip.parentEl, html : true, - title : hint + title : hint, + keepvisible: true }); inputtip.ref.show([-10000, -10000]); inputtip.isHidden = false; } - var pos = [ - this.documentHolder.cmpEl.offset().left - $(window).scrollLeft(), - this.documentHolder.cmpEl.offset().top - $(window).scrollTop() - ], - coord = this.api.asc_getActiveCellCoord(), - showPoint = [coord.asc_getX() + pos[0] - 3, coord.asc_getY() + pos[1] - inputtip.ref.getBSTip().$tip.height() - 5]; - var tipwidth = inputtip.ref.getBSTip().$tip.width(); - if (showPoint[0] + tipwidth > this.tooltips.coauth.bodyWidth ) - showPoint[0] = this.tooltips.coauth.bodyWidth - tipwidth; - - inputtip.ref.getBSTip().$tip.css({ - top : showPoint[1] + 'px', - left: showPoint[0] + 'px', - 'z-index': 900 - }); + this.changeInputMessagePosition(inputtip); } else { if (!inputtip.isHidden && inputtip.ref) { inputtip.ref.hide();