Commit 3b1c707d authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: Fix issue when clicking you in the main image

When you access an image (after clicking on a thumbnail) and then click on the main image field (cropper area), you get an "Error : Unhandled button".
parent ab8c95cb
......@@ -587,19 +587,21 @@
.onEvent("click", function (evt) {
// Only handle click on BUTTON and IMG element
if (evt.target.tagName !== 'BUTTON' && evt.target.tagName !== 'IMG') {
return;
}
var gadget = this,
tag_name = evt.target.tagName,
state_dict;
if (tag_name !== 'BUTTON' &&
(tag_name !== 'IMG' || evt.target.className.indexOf("show-img") === -1)) {
return;
}
// Disable any button. It must be managed by this gadget
evt.preventDefault();
// If user clicks on same image twice,
// we don't need to disable everything again if parent is already disabled
if (evt.target.tagName === 'BUTTON' || (
evt.target.tagName === 'IMG' && !evt.target.parentElement.disabled)) {
if (tag_name === 'BUTTON' || (
tag_name === 'IMG' && !evt.target.parentElement.disabled)) {
gadget.element.querySelectorAll('button').forEach(function (elt) {
elt.disabled = true;
});
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>981.64220.2230.18329</string> </value>
<value> <string>981.65259.1875.5819</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1582242994.7</float>
<float>1582305668.63</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment