[SSE] Hint Manager: add hint to list item in statusbar to open context menu

This commit is contained in:
JuliaSvinareva 2021-07-05 20:17:04 +03:00
parent 147bffff21
commit 40933fc590
4 changed files with 32 additions and 3 deletions

View file

@ -82,7 +82,7 @@ Common.UI.HintManager = new(function() {
if (_currentHints.length > 0) {
_hintVisible = true;
_currentHints.forEach(function(item) {
item.show()
item.show();
});
} else
_hintVisible = false;
@ -161,7 +161,7 @@ Common.UI.HintManager = new(function() {
var index = 0;
visibleItems.forEach(function (item) {
var el = $(item);
if (usedLetters.indexOf(index) !== -1) {
while (usedLetters.indexOf(index) !== -1) {
index++;
}
var title = el.attr('data-hint-title');
@ -178,6 +178,12 @@ Common.UI.HintManager = new(function() {
_getControls();
_currentControls.forEach(function(item, index) {
if (!item.hasClass('disabled') && !item.parent().hasClass('disabled') && !item.attr('disabled')) {
if (window.SSE && item.parent().prop('id') === 'statusbar_bottom') {
var $statusbar = item.parent();
if (item.offset().left > $statusbar.offset().left + $statusbar.width()) {
return;
}
}
var hint = $('<div style="" class="hint-div">' + item.attr('data-hint-title') + '</div>');
var direction = item.attr('data-hint-direction');
// exceptions
@ -306,7 +312,10 @@ Common.UI.HintManager = new(function() {
}
if (curr) {
var tag = curr.prop("tagName").toLowerCase();
if (tag === 'input' || tag === 'textarea') {
if (window.SSE && curr.parent().prop('id') === 'statusbar_bottom') {
curr.contextmenu();
_hideHints();
} else if (tag === 'input' || tag === 'textarea') {
curr.trigger(jQuery.Event('click', {which: 1}));
curr.focus();
_hideHints();

View file

@ -671,6 +671,21 @@ define([
}
return false;
},
addDataHint: function (index) { //Hint Manager
var oldHintTab = this.$bar.find('[data-hint]');
if (oldHintTab.length > 0) {
oldHintTab.removeAttr('data-hint');
oldHintTab.removeAttr('data-hint-direction');
oldHintTab.removeAttr('data-hint-offset');
oldHintTab.removeAttr('data-hint-title');
}
var newHintTab = this.tabs[index].$el;
newHintTab.attr('data-hint', '0');
newHintTab.attr('data-hint-direction', 'top');
newHintTab.attr('data-hint-offset', 'medium');
newHintTab.attr('data-hint-title', 'M');
}
});
});

View file

@ -1,4 +1,5 @@
.hint-div {
display: none;
position: absolute;
z-index: @zindex-navbar + 3;
width: auto;

View file

@ -591,6 +591,8 @@ define([
if (!this.tabbar.isTabVisible(sindex))
this.tabbar.setTabVisible(sindex);
this.tabbar.addDataHint(sindex);
this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || me.api.isCellEdited);
$('#status-label-zoom').text(Common.Utils.String.format(this.zoomText, Math.floor((this.api.asc_getZoom() +.005)*100)));
@ -669,6 +671,8 @@ define([
this.tabbar.setTabVisible(index);
}
this.tabbar.addDataHint(index);
this.fireEvent('sheet:changed', [this, tab.sheetindex]);
this.fireEvent('sheet:updateColors', [true]);