2019-02-07 00:05:59 -08:00
|
|
|
<template>
|
|
|
|
<div class="image-cropper">
|
2019-02-08 18:59:33 -08:00
|
|
|
<div v-if="dataUrl">
|
|
|
|
<div class="image-cropper-image-container">
|
2019-07-05 00:17:44 -07:00
|
|
|
<img
|
|
|
|
ref="img"
|
|
|
|
:src="dataUrl"
|
|
|
|
alt=""
|
|
|
|
@load.stop="createCropper"
|
|
|
|
>
|
2019-02-07 00:05:59 -08:00
|
|
|
</div>
|
2019-02-08 18:59:33 -08:00
|
|
|
<div class="image-cropper-buttons-wrapper">
|
2019-07-05 00:17:44 -07:00
|
|
|
<button
|
|
|
|
class="btn"
|
|
|
|
type="button"
|
|
|
|
:disabled="submitting"
|
|
|
|
@click="submit()"
|
|
|
|
v-text="saveText"
|
|
|
|
/>
|
|
|
|
<button
|
|
|
|
class="btn"
|
|
|
|
type="button"
|
|
|
|
:disabled="submitting"
|
|
|
|
@click="destroy"
|
|
|
|
v-text="cancelText"
|
|
|
|
/>
|
|
|
|
<button
|
|
|
|
class="btn"
|
|
|
|
type="button"
|
|
|
|
:disabled="submitting"
|
|
|
|
@click="submit(false)"
|
|
|
|
v-text="saveWithoutCroppingText"
|
|
|
|
/>
|
2020-10-20 14:01:28 -07:00
|
|
|
<FAIcon
|
2019-07-05 00:17:44 -07:00
|
|
|
v-if="submitting"
|
2020-10-20 14:01:28 -07:00
|
|
|
spin
|
|
|
|
icon="circle-notch"
|
2019-07-05 00:17:44 -07:00
|
|
|
/>
|
2019-02-07 00:05:59 -08:00
|
|
|
</div>
|
2019-07-05 00:17:44 -07:00
|
|
|
<div
|
|
|
|
v-if="submitError"
|
|
|
|
class="alert error"
|
|
|
|
>
|
|
|
|
{{ submitErrorMsg }}
|
2020-10-20 11:18:23 -07:00
|
|
|
<FAIcon
|
2020-10-20 14:31:16 -07:00
|
|
|
class="button-icon"
|
|
|
|
icon="times"
|
2019-07-05 00:17:44 -07:00
|
|
|
@click="clearError"
|
|
|
|
/>
|
2019-02-08 18:59:33 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-07-05 00:17:44 -07:00
|
|
|
<input
|
|
|
|
ref="input"
|
|
|
|
type="file"
|
|
|
|
class="image-cropper-img-input"
|
|
|
|
:accept="mimes"
|
|
|
|
>
|
2019-02-07 00:05:59 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./image_cropper.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.image-cropper {
|
|
|
|
&-img-input {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-image-container {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
img {
|
|
|
|
display: block;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-08 18:59:33 -08:00
|
|
|
&-buttons-wrapper {
|
2019-03-18 18:19:42 -07:00
|
|
|
margin-top: 10px;
|
|
|
|
|
|
|
|
button {
|
|
|
|
margin-top: 5px;
|
|
|
|
}
|
2019-02-07 00:05:59 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|