Merge pull request #1733 from ONLYOFFICE/fix/fix-input-message
Fix/fix input message
This commit is contained in:
commit
936d7d4c50
|
@ -104,7 +104,8 @@
|
||||||
offset : opts.offset,
|
offset : opts.offset,
|
||||||
cls : opts.cls,
|
cls : opts.cls,
|
||||||
html : opts.html,
|
html : opts.html,
|
||||||
hideonclick : opts.hideonclick
|
hideonclick : opts.hideonclick,
|
||||||
|
keepvisible: opts.keepvisible
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opts.hideonclick) {
|
if (opts.hideonclick) {
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
Common.NotificationCenter.on({'layout:changed': function(e){
|
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();
|
me.hide();
|
||||||
}});
|
}});
|
||||||
},
|
},
|
||||||
|
|
|
@ -172,6 +172,9 @@ define([
|
||||||
me.hideCoAuthTips();
|
me.hideCoAuthTips();
|
||||||
me.hideForeignSelectTips();
|
me.hideForeignSelectTips();
|
||||||
me.onDocumentResize();
|
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){
|
'cells:range': function(status){
|
||||||
me.onCellsRange(status);
|
me.onCellsRange(status);
|
||||||
|
@ -1863,6 +1866,8 @@ define([
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
|
} else if (key == Common.UI.Keys.ESC && !this.tooltips.input_msg.isHidden && this.tooltips.input_msg.text) {
|
||||||
|
this.onInputMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2768,6 +2773,26 @@ 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;
|
||||||
|
if (showPoint[1] < pos[1])
|
||||||
|
showPoint[1] = pos[1] + coord.asc_getY() + coord.asc_getHeight() + 5;
|
||||||
|
|
||||||
|
inputTip.ref.getBSTip().$tip.css({
|
||||||
|
top : showPoint[1] + 'px',
|
||||||
|
left: showPoint[0] + 'px',
|
||||||
|
'z-index': 900
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onInputMessage: function(title, message) {
|
onInputMessage: function(title, message) {
|
||||||
var inputtip = this.tooltips.input_msg;
|
var inputtip = this.tooltips.input_msg;
|
||||||
|
|
||||||
|
@ -2794,28 +2819,24 @@ define([
|
||||||
inputtip.ref = new Common.UI.Tooltip({
|
inputtip.ref = new Common.UI.Tooltip({
|
||||||
owner : inputtip.parentEl,
|
owner : inputtip.parentEl,
|
||||||
html : true,
|
html : true,
|
||||||
title : hint
|
title : hint,
|
||||||
|
keepvisible: true
|
||||||
});
|
});
|
||||||
|
|
||||||
inputtip.ref.show([-10000, -10000]);
|
inputtip.ref.show([-10000, -10000]);
|
||||||
|
|
||||||
|
var $tip = inputtip.ref.getBSTip().$tip;
|
||||||
|
$tip.on('click', function () {
|
||||||
|
inputtip.ref.hide();
|
||||||
|
inputtip.ref = undefined;
|
||||||
|
inputtip.text = '';
|
||||||
|
inputtip.isHidden = true;
|
||||||
|
});
|
||||||
|
|
||||||
inputtip.isHidden = false;
|
inputtip.isHidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = [
|
this.changeInputMessagePosition(inputtip);
|
||||||
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
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
if (!inputtip.isHidden && inputtip.ref) {
|
if (!inputtip.isHidden && inputtip.ref) {
|
||||||
inputtip.ref.hide();
|
inputtip.ref.hide();
|
||||||
|
|
Loading…
Reference in a new issue