[DE] Show footnote tooltip. Debug applying note settings.

Fix fast mousemove from one footnote/hyperlink to another.
This commit is contained in:
Julia Radzhabova 2016-12-26 17:07:50 +03:00
parent e93ec60426
commit 96dba54f6d
5 changed files with 78 additions and 58 deletions

View file

@ -120,8 +120,8 @@
this.getBSTip().show(at);
},
hide: function() {
this.getBSTip().hide();
hide: function(callback) {
this.getBSTip().hide(callback);
},
setTitle: function(title) {

View file

@ -50,3 +50,7 @@
word-wrap: break-word;
max-width: 300px;
}
.link-tooltip .tooltip-inner {
max-width: 500px;
}

View file

@ -2013,12 +2013,9 @@ define([
api: me.api,
handler: function(result, settings) {
if (settings) {
if (result == 'insert') {
me.api.asc_SetFootnoteProps(settings.props);
me.api.asc_SetFootnoteProps(settings.props, settings.applyToAll);
if (result == 'insert')
me.api.asc_AddFootnote(settings.custom);
} else if (result == 'apply') {
me.api.asc_SetFootnoteProps(settings.props);
}
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},

View file

@ -327,7 +327,8 @@ define([
toolTip: new Common.UI.Tooltip({
owner: this,
html: true,
title: '<br><b>Press Ctrl and click link</b>'
title: '<br><b>Press Ctrl and click link</b>',
cls: 'link-tooltip'
// style: 'word-wrap: break-word;'
}),
strTip: '',
@ -335,7 +336,6 @@ define([
isVisible: false
};
/** coauthoring begin **/
var userTooltip = true;
@ -401,7 +401,6 @@ define([
};
var onMouseMoveStart = function() {
screenTip.isHidden = true;
/** coauthoring begin **/
if (me.usertips.length>0) {
@ -418,10 +417,18 @@ define([
/** coauthoring end **/
};
var mouseMoveData = null,
isTooltipHiding = false;
var onMouseMoveEnd = function() {
if (screenTip.isHidden && screenTip.isVisible) {
screenTip.isVisible = false;
screenTip.toolTip.hide();
isTooltipHiding = true;
screenTip.toolTip.hide(function(){
isTooltipHiding = false;
if (mouseMoveData) onMouseMove(mouseMoveData);
mouseMoveData = null;
});
}
};
@ -436,21 +443,35 @@ define([
}
if (moveData) {
var showPoint, ToolTip;
var showPoint, ToolTip,
type = moveData.get_Type();
if (moveData.get_Type()==1) { // 1 - hyperlink
if (type==1 || type==3) { // 1 - hyperlink, 3 - footnote
if (isTooltipHiding) {
mouseMoveData = moveData;
return;
}
if (type==1) {
var hyperProps = moveData.get_Hyperlink();
if (!hyperProps) return;
ToolTip = (_.isEmpty(hyperProps.get_ToolTip())) ? hyperProps.get_Value() : hyperProps.get_ToolTip();
} else {
ToolTip = moveData.get_FootnoteText();
if (ToolTip.length>1000)
ToolTip = ToolTip.substr(0, 1000) + '...';
}
var recalc = false;
if (hyperProps) {
screenTip.isHidden = false;
ToolTip = (_.isEmpty(hyperProps.get_ToolTip())) ? hyperProps.get_Value() : hyperProps.get_ToolTip();
ToolTip = Common.Utils.String.htmlEncode(ToolTip);
if (screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) {
screenTip.toolTip.setTitle(ToolTip + '<br><b>' + me.txtPressLink + '</b>');
if (screenTip.tipType !== type || screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) {
screenTip.toolTip.setTitle((type==1) ? (ToolTip + '<br><b>' + me.txtPressLink + '</b>') : ToolTip);
screenTip.tipLength = ToolTip.length;
screenTip.strTip = ToolTip;
screenTip.tipType = type;
recalc = true;
}
@ -467,11 +488,18 @@ define([
screenTip.tipHeight = screenTip.toolTip.getBSTip().$tip.height();
screenTip.tipWidth = screenTip.toolTip.getBSTip().$tip.width();
}
showPoint[1] -= screenTip.tipHeight;
if (showPoint[0] + screenTip.tipWidth > me._BodyWidth )
recalc = false;
if (showPoint[0] + screenTip.tipWidth > me._BodyWidth ) {
showPoint[0] = me._BodyWidth - screenTip.tipWidth;
screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'});
recalc = true;
}
if (showPoint[1] - screenTip.tipHeight < 0) {
showPoint[1] = (recalc) ? showPoint[1]+30 : 0;
} else
showPoint[1] -= screenTip.tipHeight;
screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'});
}
/** coauthoring begin **/
else if (moveData.get_Type()==2 && me.mode.isEdit) { // 2 - locked object

View file

@ -216,11 +216,11 @@ define([
menuStyle: 'min-width: 150px;',
editable: false,
data: [
{ displayValue: this.textDocument, value: Asc.section_footnote_RestartContinuous },
{ displayValue: this.textSection, value: Asc.section_footnote_RestartEachSect }
{ displayValue: this.textDocument, value: 1 },
{ displayValue: this.textSection, value: 0 }
]
});
this.cmbApply.setValue(Asc.section_footnote_RestartContinuous);
this.cmbApply.setValue(1);
this.btnApply = new Common.UI.Button({
el: $('#note-settings-btn-apply')
@ -251,11 +251,6 @@ define([
val = props.get_NumRestart();
this.cmbNumbering.setValue(val);
/*
val = props.get_ApplyTo();
this.cmbApply.setValue(val);
*/
}
},
@ -270,13 +265,9 @@ define([
val = this.cmbFormat.getValue();
props.put_NumFormat(val);
props.put_NumStart(this.spnStart.getNumberValue());
} else {
// props.set_Custom(val);
}
// props.put_ApplyTo(this.cmbApply.getValue());
return {props: props, custom: _.isEmpty(val) ? undefined : val};
return {props: props, applyToAll: (this.cmbApply.getValue()==1), custom: _.isEmpty(val) ? undefined : val};
},
onDlgBtnClick: function(event) {