aboutsummaryrefslogtreecommitdiff
path: root/src/components/image_cropper/image_cropper.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-03-30 12:31:50 +0200
committerHenry Jameson <me@hjkos.com>2019-03-30 12:31:50 +0200
commit9f4a9bff464e43e1c01d621e8c55db6105d327de (patch)
tree3124790d8a00ef148acb199efeac59594879f875 /src/components/image_cropper/image_cropper.js
parente89a62200532a4d61de35d73299c33555aad8bed (diff)
parent0117f6af9f8ae600e613402590de4c9364806967 (diff)
Merge remote-tracking branch 'upstream/develop' into minimal-scopes-mode
* upstream/develop: (173 commits) Fix: Change condition fix typo update store according to retweeted status #433 - update sort by for conversation display replies_count right after reply icon expose replies_count from mastodon api Apparently, MastoAPI gives status in ancestors if you try opening a repeat... make side drawer use gesture service and fix its animations review/remove error hiding errata review #433 - sort conversation for retweets and clean up Revert "Merge branch 'revert-987b5162' into 'develop'" Revert "Merge branch 'mastoapi/friends-tl' into 'develop'" Add await to login action' Remove console log Fix warnings in user profile routing Add tests for gesture service, fix bug with perpendicular directions #255 - clean up autocomplete form #255 - clean up user settings page with self-closing html tags ...
Diffstat (limited to 'src/components/image_cropper/image_cropper.js')
-rw-r--r--src/components/image_cropper/image_cropper.js26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/components/image_cropper/image_cropper.js b/src/components/image_cropper/image_cropper.js
index 990c0370..5ba8f04e 100644
--- a/src/components/image_cropper/image_cropper.js
+++ b/src/components/image_cropper/image_cropper.js
@@ -31,6 +31,9 @@ const ImageCropper = {
saveButtonLabel: {
type: String
},
+ saveWithoutCroppingButtonlabel: {
+ type: String
+ },
cancelButtonLabel: {
type: String
}
@@ -48,6 +51,9 @@ const ImageCropper = {
saveText () {
return this.saveButtonLabel || this.$t('image_cropper.save')
},
+ saveWithoutCroppingText () {
+ return this.saveWithoutCroppingButtonlabel || this.$t('image_cropper.save_without_cropping')
+ },
cancelText () {
return this.cancelButtonLabel || this.$t('image_cropper.cancel')
},
@@ -67,7 +73,19 @@ const ImageCropper = {
submit () {
this.submitting = true
this.avatarUploadError = null
- this.submitHandler(this.cropper, this.filename)
+ this.submitHandler(this.cropper, this.file)
+ .then(() => this.destroy())
+ .catch((err) => {
+ this.submitError = err
+ })
+ .finally(() => {
+ this.submitting = false
+ })
+ },
+ submitWithoutCropping () {
+ this.submitting = true
+ this.avatarUploadError = null
+ this.submitHandler(false, this.dataUrl)
.then(() => this.destroy())
.catch((err) => {
this.submitError = err
@@ -88,14 +106,14 @@ const ImageCropper = {
readFile () {
const fileInput = this.$refs.input
if (fileInput.files != null && fileInput.files[0] != null) {
+ this.file = fileInput.files[0]
let reader = new window.FileReader()
reader.onload = (e) => {
this.dataUrl = e.target.result
this.$emit('open')
}
- reader.readAsDataURL(fileInput.files[0])
- this.filename = fileInput.files[0].name || 'unknown'
- this.$emit('changed', fileInput.files[0], reader)
+ reader.readAsDataURL(this.file)
+ this.$emit('changed', this.file, reader)
}
},
clearError () {