Commit c5d39aff 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 5affcb78
...@@ -587,19 +587,21 @@ ...@@ -587,19 +587,21 @@
.onEvent("click", function (evt) { .onEvent("click", function (evt) {
// Only handle click on BUTTON and IMG element // Only handle click on BUTTON and IMG element
if (evt.target.tagName !== 'BUTTON' && evt.target.tagName !== 'IMG') {
return;
}
var gadget = this, var gadget = this,
tag_name = evt.target.tagName,
state_dict; 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 // Disable any button. It must be managed by this gadget
evt.preventDefault(); evt.preventDefault();
// If user clicks on same image twice, // If user clicks on same image twice,
// we don't need to disable everything again if parent is already disabled // we don't need to disable everything again if parent is already disabled
if (evt.target.tagName === 'BUTTON' || ( if (tag_name === 'BUTTON' || (
evt.target.tagName === 'IMG' && !evt.target.parentElement.disabled)) { tag_name === 'IMG' && !evt.target.parentElement.disabled)) {
gadget.element.querySelectorAll('button').forEach(function (elt) { gadget.element.querySelectorAll('button').forEach(function (elt) {
elt.disabled = true; elt.disabled = true;
}); });
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>981.64220.2230.18329</string> </value> <value> <string>981.65259.1875.5819</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1582242994.7</float> <float>1582305668.63</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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