Refactoring show external message.
[SSE] Show tip when link is copies
This commit is contained in:
parent
75d6ab646f
commit
a86fe8a7f6
|
@ -109,8 +109,12 @@
|
|||
});
|
||||
|
||||
if (opts.hideonclick) {
|
||||
var me = this;
|
||||
var tip = this.$element.data('bs.tooltip');
|
||||
if (tip) tip.tip().on('click', function() {tip.hide();});
|
||||
if (tip) tip.tip().on('click', function() {
|
||||
tip.hide();
|
||||
me.trigger('tooltip:hideonclick', this);
|
||||
});
|
||||
}
|
||||
|
||||
this.$element.on('shown.bs.tooltip', _.bind(this.onTipShown, this));
|
||||
|
|
|
@ -613,7 +613,8 @@ define([
|
|||
this.view.turnChanges(state, global);
|
||||
if (userId && this.userCollection) {
|
||||
var rec = this.userCollection.findOriginalUser(userId);
|
||||
rec && this.showTips(Common.Utils.String.format(globalFlag ? this.textOnGlobal : this.textOffGlobal, AscCommon.UserInfoParser.getParsedName(rec.get('username'))));
|
||||
rec && Common.NotificationCenter.trigger('showmessage', {msg: Common.Utils.String.format(globalFlag ? this.textOnGlobal : this.textOffGlobal, AscCommon.UserInfoParser.getParsedName(rec.get('username')))},
|
||||
{timeout: 5000, hideCloseTip: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -903,41 +904,6 @@ define([
|
|||
me.appConfig.reviewHoverMode = val;
|
||||
},
|
||||
|
||||
showTips: function(strings) {
|
||||
var me = this;
|
||||
if (!strings.length) return;
|
||||
if (typeof(strings)!='object') strings = [strings];
|
||||
|
||||
function showNextTip() {
|
||||
var str_tip = strings.shift();
|
||||
if (str_tip) {
|
||||
me.tooltip.setTitle(str_tip);
|
||||
me.tooltip.show();
|
||||
me.tipTimeout = setTimeout(function () {
|
||||
me.tooltip.hide();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.tooltip) {
|
||||
this.tooltip = new Common.UI.Tooltip({
|
||||
owner: this.getApplication().getController('Toolbar').getView(),
|
||||
hideonclick: true,
|
||||
placement: 'bottom',
|
||||
cls: 'main-info',
|
||||
offset: 30
|
||||
});
|
||||
this.tooltip.on('tooltip:hide', function(cmp){
|
||||
if (cmp==me.tooltip) {
|
||||
clearTimeout(me.tipTimeout);
|
||||
setTimeout(showNextTip, 300);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
showNextTip();
|
||||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
this.view && this.view.turnSpelling( Common.localStorage.getBool(this.view.appPrefix + "settings-spellcheck", true) );
|
||||
this.view && this.view.turnCoAuthMode( Common.localStorage.getBool(this.view.appPrefix + "settings-coauthmode", true) );
|
||||
|
|
|
@ -1752,10 +1752,10 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onExternalMessage: function(msg) {
|
||||
onExternalMessage: function(msg, options) {
|
||||
if (msg && msg.msg) {
|
||||
msg.msg = (msg.msg).toString();
|
||||
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]);
|
||||
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)], options);
|
||||
|
||||
Common.component.Analytics.trackEvent('External Error');
|
||||
}
|
||||
|
@ -2043,17 +2043,30 @@ define([
|
|||
this._state.isDisconnected = true;
|
||||
},
|
||||
|
||||
showTips: function(strings) {
|
||||
showTips: function(strings, options) {
|
||||
var me = this;
|
||||
if (!strings.length) return;
|
||||
if (typeof(strings)!='object') strings = [strings];
|
||||
|
||||
function closeTip(cmp){
|
||||
me.tipTimeout && clearTimeout(me.tipTimeout);
|
||||
setTimeout(showNextTip, 300);
|
||||
}
|
||||
|
||||
function showNextTip() {
|
||||
var str_tip = strings.shift();
|
||||
if (str_tip) {
|
||||
if (!(options && options.hideCloseTip))
|
||||
str_tip += '\n' + me.textCloseTip;
|
||||
tooltip.setTitle(str_tip);
|
||||
tooltip.show();
|
||||
me.tooltip.setTitle(str_tip);
|
||||
me.tooltip.show();
|
||||
me.tipTimeout && clearTimeout(me.tipTimeout);
|
||||
if (options && options.timeout) {
|
||||
me.tipTimeout = setTimeout(function () {
|
||||
me.tooltip.hide();
|
||||
closeTip();
|
||||
}, options.timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2065,13 +2078,9 @@ define([
|
|||
cls: 'main-info',
|
||||
offset: 30
|
||||
});
|
||||
this.tooltip.on('tooltip:hideonclick',closeTip);
|
||||
}
|
||||
|
||||
var tooltip = this.tooltip;
|
||||
tooltip.on('tooltip:hide', function(){
|
||||
setTimeout(showNextTip, 300);
|
||||
});
|
||||
|
||||
showNextTip();
|
||||
},
|
||||
|
||||
|
|
|
@ -1667,7 +1667,7 @@ define([
|
|||
}
|
||||
|
||||
var tooltip = this.tooltip;
|
||||
tooltip.on('tooltip:hide', function(){
|
||||
tooltip.on('tooltip:hideonclick', function(){
|
||||
setTimeout(showNextTip, 300);
|
||||
});
|
||||
|
||||
|
|
|
@ -1179,7 +1179,7 @@ define([
|
|||
var me = this;
|
||||
navigator.clipboard && navigator.clipboard.writeText(url)
|
||||
.then(function() {
|
||||
console.log('OK');
|
||||
Common.NotificationCenter.trigger('showmessage', {msg: me.txtCopySuccess}, {timeout: 3000, hideCloseTip: true});
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err);
|
||||
|
@ -4382,7 +4382,8 @@ define([
|
|||
txtAllTableHint: 'Returns the entire contents of the table or specified table columns including column headers, data and total rows',
|
||||
txtDataTableHint: 'Returns the data cells of the table or specified table columns',
|
||||
txtHeadersTableHint: 'Returns the column headers for the table or specified table columns',
|
||||
txtTotalsTableHint: 'Returns the total rows for the table or specified table columns'
|
||||
txtTotalsTableHint: 'Returns the total rows for the table or specified table columns',
|
||||
txtCopySuccess: 'Link copied to the clipboard'
|
||||
|
||||
}, SSE.Controllers.DocumentHolder || {}));
|
||||
});
|
|
@ -1523,10 +1523,10 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onExternalMessage: function(msg) {
|
||||
onExternalMessage: function(msg, options) {
|
||||
if (msg && msg.msg) {
|
||||
msg.msg = (msg.msg).toString();
|
||||
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]);
|
||||
this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)], options);
|
||||
|
||||
Common.component.Analytics.trackEvent('External Error');
|
||||
}
|
||||
|
@ -2009,17 +2009,30 @@ define([
|
|||
this._state.isDisconnected = true;
|
||||
},
|
||||
|
||||
showTips: function(strings) {
|
||||
showTips: function(strings, options) {
|
||||
var me = this;
|
||||
if (!strings.length) return;
|
||||
if (typeof(strings)!='object') strings = [strings];
|
||||
|
||||
function closeTip(cmp){
|
||||
me.tipTimeout && clearTimeout(me.tipTimeout);
|
||||
setTimeout(showNextTip, 300);
|
||||
}
|
||||
|
||||
function showNextTip() {
|
||||
var str_tip = strings.shift();
|
||||
if (str_tip) {
|
||||
if (!(options && options.hideCloseTip))
|
||||
str_tip += '\n' + me.textCloseTip;
|
||||
tooltip.setTitle(str_tip);
|
||||
tooltip.show();
|
||||
me.tooltip.setTitle(str_tip);
|
||||
me.tooltip.show();
|
||||
me.tipTimeout && clearTimeout(me.tipTimeout);
|
||||
if (options && options.timeout) {
|
||||
me.tipTimeout = setTimeout(function () {
|
||||
me.tooltip.hide();
|
||||
closeTip();
|
||||
}, options.timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2031,13 +2044,9 @@ define([
|
|||
cls: 'main-info',
|
||||
offset: 30
|
||||
});
|
||||
this.tooltip.on('tooltip:hideonclick',closeTip);
|
||||
}
|
||||
|
||||
var tooltip = this.tooltip;
|
||||
tooltip.on('tooltip:hide', function(){
|
||||
setTimeout(showNextTip, 300);
|
||||
});
|
||||
|
||||
showNextTip();
|
||||
},
|
||||
|
||||
|
|
|
@ -645,6 +645,7 @@
|
|||
"SSE.Controllers.DocumentHolder.txtUseTextImport": "Use text import wizard",
|
||||
"SSE.Controllers.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?",
|
||||
"SSE.Controllers.DocumentHolder.txtWidth": "Width",
|
||||
"SSE.Controllers.DocumentHolder.txtCopySuccess": "Link copied to the clipboard",
|
||||
"SSE.Controllers.FormulaDialog.sCategoryAll": "All",
|
||||
"SSE.Controllers.FormulaDialog.sCategoryCube": "Cube",
|
||||
"SSE.Controllers.FormulaDialog.sCategoryDatabase": "Database",
|
||||
|
@ -2051,6 +2052,7 @@
|
|||
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
||||
"SSE.Views.DocumentHolder.txtWidth": "Width",
|
||||
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
||||
"SSE.Views.DocumentHolder.txtGetLink": "Get link to this range",
|
||||
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
|
||||
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
|
||||
"SSE.Views.FieldSettingsDialog.textReport": "Report Form",
|
||||
|
|
Loading…
Reference in a new issue