Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
110d9931
Commit
110d9931
authored
Jan 15, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: handle more asynchronous methods from cropper
parent
aa2c92ce
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
563 additions
and
255 deletions
+563
-255
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
...ateItem/web_page_module/rjs_gadget_document_scanner_js.js
+9
-7
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
...teItem/web_page_module/rjs_gadget_document_scanner_js.xml
+554
-248
No files found.
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
View file @
110d9931
...
...
@@ -22,8 +22,12 @@
if
(
gadget
.
props
.
cropper
)
{
gadget
.
props
.
cropper
.
destroy
();
}
gadget
.
props
.
cropper
=
new
Cropper
(
root
.
querySelector
(
'
.photo
'
),
{
data
:
gadget
.
props
.
preferred_cropped_canvas_data
// creating Cropper is asynchronous
return
new
RSVP
.
Promise
(
function
(
resolve
)
{
gadget
.
props
.
cropper
=
new
Cropper
(
root
.
querySelector
(
'
.photo
'
),
{
data
:
gadget
.
props
.
preferred_cropped_canvas_data
,
ready
:
resolve
});
});
}
...
...
@@ -299,7 +303,7 @@
}
}
}
gadget
.
startStream
();
return
gadget
.
startStream
();
}
if
(
evt
.
target
.
className
.
indexOf
(
"
take-picture-btn
"
)
!==
-
1
)
{
evt
.
preventDefault
();
...
...
@@ -312,7 +316,7 @@
.
push
(
function
()
{
root
.
querySelector
(
"
.camera-input
"
).
style
.
display
=
"
none
"
;
setPageTwo
(
root
);
enableButton
(
root
);
return
enableButton
(
root
);
});
}
if
(
evt
.
target
.
className
.
indexOf
(
"
reset-btn
"
)
!==
-
1
)
{
...
...
@@ -336,9 +340,7 @@
var
canvas
=
gadget
.
props
.
cropper
.
getCroppedCanvas
();
disableButton
(
gadget
.
element
);
return
new
Promise
(
function
(
resolve
)
{
canvas
.
toBlob
(
function
(
blob
)
{
resolve
(
blob
);
},
'
image/jpeg
'
,
0.85
);
canvas
.
toBlob
(
resolve
,
'
image/jpeg
'
,
0.85
);
});
})
.
push
(
function
(
blob
)
{
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
View file @
110d9931
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment