[DE] Add parameter review.hoverMode to customization: show review changes balloons as tooltips (on mouse move)

This commit is contained in:
Julia Radzhabova 2021-08-04 15:43:54 +03:00
parent 7dfb96f914
commit 2954b9ded5
3 changed files with 24 additions and 4 deletions

View file

@ -136,7 +136,8 @@
label: string (default: "Guest") // postfix for user name
},
review: {
hideReviewDisplay: false // hide button Review mode
hideReviewDisplay: false, // hide button Review mode
hoverMode: false // true - show review balloons on mouse move, not on click on text
},
chat: true,
comments: true,

View file

@ -181,7 +181,7 @@ define([
onApiShowChange: function (sdkchange) {
if (this.getPopover()) {
if (sdkchange && sdkchange.length>0) {
if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0) {
var i = 0,
changes = this.readSDKChange(sdkchange),
posX = sdkchange[0].get_X(),
@ -844,6 +844,14 @@ define([
me.view.btnCommentRemove && me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true));
me.view.btnCommentResolve && me.view.btnCommentResolve.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true));
}
var val = Common.localStorage.getItem(me.view.appPrefix + "settings-review-hover-mode");
if (val === null) {
val = me.appConfig.customization && me.appConfig.customization.review ? !!me.appConfig.customization.review.hoverMode : false;
} else
val = !!parseInt(val);
Common.Utils.InternalSettings.set(me.view.appPrefix + "settings-review-hover-mode", val);
me.appConfig.reviewHoverMode = val;
},
showTips: function(strings) {

View file

@ -491,7 +491,8 @@ define([
var showPoint, ToolTip,
type = moveData.get_Type();
if (type==Asc.c_oAscMouseMoveDataTypes.Hyperlink || type==Asc.c_oAscMouseMoveDataTypes.Footnote || type==Asc.c_oAscMouseMoveDataTypes.Form) { // 1 - hyperlink, 3 - footnote
if (type==Asc.c_oAscMouseMoveDataTypes.Hyperlink || type==Asc.c_oAscMouseMoveDataTypes.Footnote || type==Asc.c_oAscMouseMoveDataTypes.Form ||
type==Asc.c_oAscMouseMoveDataTypes.Review && me.mode.reviewHoverMode) {
if (isTooltipHiding) {
mouseMoveData = moveData;
return;
@ -511,12 +512,22 @@ define([
ToolTip = moveData.get_FormHelpText();
if (ToolTip.length>1000)
ToolTip = ToolTip.substr(0, 1000) + '...';
} else if (type==Asc.c_oAscMouseMoveDataTypes.Review) {
var changes = DE.getController("Common.Controllers.ReviewChanges").readSDKChange(moveData.asc_getChanges());
if (changes && changes.length>0)
changes = changes[0];
if (changes) {
ToolTip = '<b>'+ Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(changes.get('username'))) +' </b>';
ToolTip += '<span style="font-size:10px; opacity: 0.7;">'+ changes.get('date') +'</span><br>';
ToolTip += changes.get('changetext');
}
}
var recalc = false;
screenTip.isHidden = false;
ToolTip = Common.Utils.String.htmlEncode(ToolTip);
if (type!==Asc.c_oAscMouseMoveDataTypes.Review)
ToolTip = Common.Utils.String.htmlEncode(ToolTip);
if (screenTip.tipType !== type || screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) {
screenTip.toolTip.setTitle((type==Asc.c_oAscMouseMoveDataTypes.Hyperlink) ? (ToolTip + '<br><b>' + me.txtPressLink + '</b>') : ToolTip);