mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-29 08:24:40 +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).ready(function() {
|
||||
const navigatorEl = $('.sci--layout-navigation-navigator');
|
||||
const leftMenuContainerEl = $('.sci--layout--left-menu-container');
|
||||
$(document).on('turbolinks:before-visit.canvas_edit', (e) => {
|
||||
const alertText = $("#update-canvas").attr("data-unsaved-work-text");
|
||||
|
||||
navigatorEl.on('click', 'a', handleAnchorClick);
|
||||
leftMenuContainerEl.on('click', 'a', handleAnchorClick);
|
||||
if (alertText) {
|
||||
// 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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue