tooltips no longer display after associated element disappears

This commit is contained in:
zuzanna-maria 2024-02-06 21:07:49 +00:00
parent e4cd6ebe92
commit c35abb4443
6 changed files with 40 additions and 6 deletions

View File

@ -113,6 +113,8 @@ define([
window.focus();
window.print();
framework.feedback('PRINT_CODE');
UI.clearTooltipsDelay();
});
framework._.toolbar.$drawer.append($printButton);
};

View File

@ -1112,6 +1112,14 @@ define([
});
};
UI.clearTooltipsDelay = function () {
$.when(new Promise(res =>
setTimeout(res, 500)))
.then(() => {
UI.clearTooltips();
});
};
var delay = typeof(AppConfig.tooltipDelay) === "number" ? AppConfig.tooltipDelay : 500;
$.extend(true, Tippy.defaults, {
placement: 'bottom',

View File

@ -591,7 +591,9 @@ define([
title: Messages.exportButtonTitle,
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.exportButton));
button.click(common.prepareFeedback(type));
button.click(function() {common.prepareFeedback(type);
UI.clearTooltipsDelay();
});
if (callback) {
button.click(callback);
}
@ -648,6 +650,7 @@ define([
.click(common.prepareFeedback(type))
.click(function () {
handler();
UI.clearTooltipsDelay();
});
//}
break;
@ -681,7 +684,9 @@ define([
if (callback) { callback(); }
});
if (data.accept) { $input.attr('accept', data.accept); }
button.click(function () { $input.click(); });
button.click(function () { $input.click();
UI.clearTooltipsDelay();
});
break;
case 'copy':
button = $('<button>', {
@ -691,6 +696,7 @@ define([
.click(common.prepareFeedback(type))
.click(function () {
sframeChan.query('EV_MAKE_A_COPY');
UI.clearTooltipsDelay();
});
break;
case 'importtemplate':
@ -704,6 +710,7 @@ define([
.click(function () {
if (callback) { return void callback(); }
UIElements.openTemplatePicker(common, true);
UI.clearTooltipsDelay();
});
break;
case 'template':
@ -754,6 +761,7 @@ define([
});
};
UI.prompt(Messages.saveTemplatePrompt, title, todo);
UI.clearTooltipsDelay();
});
}
break;
@ -841,6 +849,7 @@ define([
.click(common.prepareFeedback(type))
.on('click', function () {
common.getHistory(data.histConfig);
UI.clearTooltipsDelay();
});
}
break;
@ -897,6 +906,7 @@ define([
}
UIElements.updateTags(common, null);
});
UI.clearTooltipsDelay();
});
break;
case 'toggle':
@ -948,6 +958,8 @@ define([
}
sframeChan.event('EV_PROPERTIES_OPEN');
UI.clearTooltipsDelay();
});
break;
case 'save': // OnlyOffice save
@ -956,7 +968,10 @@ define([
title: Messages.settings_save,
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'})
.text(Messages.settings_save))
.click(common.prepareFeedback(type));
.click(function() {
common.prepareFeedback(type);
UI.clearTooltipsDelay();
});
if (callback) { button.click(callback); }
break;
case 'newpad':
@ -968,6 +983,8 @@ define([
.click(common.prepareFeedback(type))
.click(function () {
common.createNewPadModal();
UI.clearTooltipsDelay();
});
break;
case 'snapshots':
@ -977,11 +994,12 @@ define([
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.snapshots_button));
button
.click(common.prepareFeedback(type))
.click(function () {
.click(function() {
if (typeof(data.load) !== "function" || typeof(data.make) !== "function") {
return;
}
UIElements.openSnapshotsModal(common, data.load, data.make, data.remove);
UI.clearTooltipsDelay();
});
break;
default:
@ -1304,6 +1322,7 @@ define([
});
$toolbarButton.click(function () {
common.openUnsafeURL(href);
UI.clearTooltipsDelay();
});
common.getAttribute(['hideHelp', type], function (err, val) {

View File

@ -512,10 +512,12 @@ define([
h('i.fa.fa-check'),
h('span', Messages.history_restore)
]);
var close = h('button', { title: Messages.history_closeTitle }, [
var close = h('button',
{ title: Messages.history_closeTitle }, [
h('i.fa.fa-times'),
h('span', Messages.history_close)
]);
]
);
var actions = h('div.cp-toolbar-history-actions', [
h('span.cp-history-actions-first', [
snapshot,
@ -651,6 +653,7 @@ define([
states = [];
onClose();
closeUI();
UI.clearTooltipsDelay();
});
$(restore).click(function () {
var restorePrompt = config.drive ? Messages.history_restoreDrivePrompt

View File

@ -631,6 +631,7 @@ define([
*/
editor.execCommand('print');
framework.feedback('PRINT_PAD');
UI.clearTooltipsDelay();
});
framework._.toolbar.$drawer.append($printButton);
};

View File

@ -129,6 +129,7 @@ define([
window.focus();
window.print();
framework.feedback('PRINT_SLIDES');
UI.clearTooltipsDelay();
});
framework._.toolbar.$drawer.append($printButton);
};