From dba683c323867a8aefcc3caa2ab5ffab2f6100fd Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 26 Mar 2024 14:07:28 +0100 Subject: [PATCH] Fix feedback --- www/code/inner.js | 1 - www/common/common-interface.js | 6 +---- www/common/common-ui-elements.js | 43 ++++---------------------------- 3 files changed, 6 insertions(+), 44 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index 67bacaab3..670e2097a 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -114,7 +114,6 @@ define([ window.print(); framework.feedback('PRINT_CODE'); UI.clearTooltipsDelay(); - }); var $print = UIElements.getEntryFromButton($printButton); framework._.toolbar.$drawer.append($print); diff --git a/www/common/common-interface.js b/www/common/common-interface.js index c8cea3126..e34037d30 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -1113,11 +1113,7 @@ define([ }; UI.clearTooltipsDelay = function () { - $.when(new Promise(res => - setTimeout(res, 500))) - .then(() => { - UI.clearTooltips(); - }); + setTimeout(UI.clearTooltips, 500); }; var delay = typeof(AppConfig.tooltipDelay) === "number" ? AppConfig.tooltipDelay : 500; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 685df97f2..81ec19b57 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -616,9 +616,9 @@ define([ title: Messages.exportButtonTitle, }).append($('', {'class': 'cp-toolbar-drawer-element'}).text(Messages.exportButton)); - button.click(function() {common.prepareFeedback(type); - UI.clearTooltipsDelay(); - }); + button + .click(common.prepareFeedback(type)) + .click(UI.clearTooltipsDelay); if (callback) { button.click(callback); } @@ -628,38 +628,6 @@ define([ 'class': 'fa fa-upload cp-toolbar-icon-import', title: Messages.importButtonTitle, }).append($('', {'class': 'cp-toolbar-drawer-element'}).text(Messages.importButton)); - /*if (data.types) { - // New import button in the toolbar - var importFunction = { - template: function () { - UIElements.openTemplatePicker(common, true); - }, - file: function (cb) { - importContent('text/plain', function (content, file) { - cb(content, file); - }, {accept: data ? data.accept : undefined}) - } - }; - var toImport = []; - Object.keys(data.types).forEach(function (importType) { - if (!importFunction[importType] || !data.types[importType]) { return; } - var option = h('button', importType); - $(option).click(function () { - importFunction[importType](data.types[importType]); - }); - toImport.push(options); - }); - - button.click(common.prepareFeedback(type)); - - if (toImport.length === 1) { - button.click(function () { $(toImport[0]).click(); }); - } else { - Cryptpad.alert(h('p.cp-import-container', toImport)); - } - } - else if (callback) {*/ - // Old import button, used in settings var importer = importContent((data && data.binary) ? 'application/octet-stream' : 'text/plain', callback, { accept: data ? data.accept : undefined, binary: data ? data.binary : undefined @@ -709,7 +677,8 @@ 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; @@ -984,7 +953,6 @@ define([ sframeChan.event('EV_PROPERTIES_OPEN'); UI.clearTooltipsDelay(); - }); break; case 'save': // OnlyOffice save @@ -1009,7 +977,6 @@ define([ .click(function () { common.createNewPadModal(); UI.clearTooltipsDelay(); - }); break; case 'snapshots':