mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-10 13:59:56 +08:00
Merge pull request #7581 from aignatov-bio/ai-sci-10724-fix-click-away-for-canvas
Fix canvas click away [SCI-10724]
This commit is contained in:
commit
9a4f6f7136
1 changed files with 13 additions and 6 deletions
|
@ -570,13 +570,20 @@ function handleAnchorClick(event) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// listen to clicks on links in navigator and leftMenuContainer
|
$(document).on('turbolinks:before-visit.canvas_edit', (e) => {
|
||||||
$(document).ready(function() {
|
const alertText = $("#update-canvas").attr("data-unsaved-work-text");
|
||||||
const navigatorEl = $('.sci--layout-navigation-navigator');
|
|
||||||
const leftMenuContainerEl = $('.sci--layout--left-menu-container');
|
|
||||||
|
|
||||||
navigatorEl.on('click', 'a', handleAnchorClick);
|
if (alertText) {
|
||||||
leftMenuContainerEl.on('click', 'a', handleAnchorClick);
|
// eslint-disable-next-line no-alert
|
||||||
|
if (confirm(alertText)) {
|
||||||
|
$(document).off('turbolinks:before-visit.canvas_edit');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$(document).off('turbolinks:before-visit.canvas_edit');
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
function bindEditModeCloseWindow() {
|
function bindEditModeCloseWindow() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue