diff --git a/apps/common/main/lib/component/Tooltip.js b/apps/common/main/lib/component/Tooltip.js index 71e36dd4c..c9af406cf 100644 --- a/apps/common/main/lib/component/Tooltip.js +++ b/apps/common/main/lib/component/Tooltip.js @@ -120,8 +120,8 @@ this.getBSTip().show(at); }, - hide: function() { - this.getBSTip().hide(); + hide: function(callback) { + this.getBSTip().hide(callback); }, setTitle: function(title) { diff --git a/apps/common/main/resources/less/tooltip.less b/apps/common/main/resources/less/tooltip.less index d2ae02886..728459182 100644 --- a/apps/common/main/resources/less/tooltip.less +++ b/apps/common/main/resources/less/tooltip.less @@ -50,3 +50,7 @@ word-wrap: break-word; max-width: 300px; } + +.link-tooltip .tooltip-inner { + max-width: 500px; +} \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index a77014f83..6a7508131 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -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); }, diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 7cd5aef47..47d1b05d5 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -327,7 +327,8 @@ define([ toolTip: new Common.UI.Tooltip({ owner: this, html: true, - title: '
Press Ctrl and click link' + title: '
Press Ctrl and click link', + 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,42 +443,63 @@ define([ } if (moveData) { - var showPoint, ToolTip; + var showPoint, ToolTip, + type = moveData.get_Type(); - if (moveData.get_Type()==1) { // 1 - hyperlink - var hyperProps = moveData.get_Hyperlink(); - 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 + '
' + me.txtPressLink + ''); - screenTip.tipLength = ToolTip.length; - screenTip.strTip = ToolTip; - recalc = true; - } - - showPoint = [moveData.get_X(), moveData.get_Y()]; - showPoint[1] += (me._XY[1]-15); - showPoint[0] += (me._XY[0]+5); - - if (!screenTip.isVisible || recalc) { - screenTip.isVisible = true; - screenTip.toolTip.show([-10000, -10000]); - } - - if ( recalc ) { - 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 ) - showPoint[0] = me._BodyWidth - screenTip.tipWidth; - screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'}); + 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; + screenTip.isHidden = false; + + ToolTip = Common.Utils.String.htmlEncode(ToolTip); + + if (screenTip.tipType !== type || screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) { + screenTip.toolTip.setTitle((type==1) ? (ToolTip + '
' + me.txtPressLink + '') : ToolTip); + screenTip.tipLength = ToolTip.length; + screenTip.strTip = ToolTip; + screenTip.tipType = type; + recalc = true; + } + + showPoint = [moveData.get_X(), moveData.get_Y()]; + showPoint[1] += (me._XY[1]-15); + showPoint[0] += (me._XY[0]+5); + + if (!screenTip.isVisible || recalc) { + screenTip.isVisible = true; + screenTip.toolTip.show([-10000, -10000]); + } + + if ( recalc ) { + screenTip.tipHeight = screenTip.toolTip.getBSTip().$tip.height(); + screenTip.tipWidth = screenTip.toolTip.getBSTip().$tip.width(); + } + + recalc = false; + if (showPoint[0] + screenTip.tipWidth > me._BodyWidth ) { + showPoint[0] = me._BodyWidth - screenTip.tipWidth; + 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 diff --git a/apps/documenteditor/main/app/view/NoteSettingsDialog.js b/apps/documenteditor/main/app/view/NoteSettingsDialog.js index ab2049642..518239fb8 100644 --- a/apps/documenteditor/main/app/view/NoteSettingsDialog.js +++ b/apps/documenteditor/main/app/view/NoteSettingsDialog.js @@ -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) {