Fixed ImageInputComponent

This commit is contained in:
Noah Lancien 2023-06-12 09:53:07 +02:00
parent 93100c40ac
commit d0797bebc9
2 changed files with 23 additions and 9 deletions

View file

@ -34,7 +34,7 @@
class="d-none"
:name="inTname"
type="text"
:value="inTvalue"
:value="submitIntValue"
>
<input
@click.prevent="chooseAFile"
@ -438,7 +438,7 @@ export default defineComponent({
this.inTheight = Number.parseInt(String(data.height));
this.inTvalue = String(data.value);
if (this.inTvalue.length) {
this.inTvalueFileName = this.inTvalue;
this.inTvalueFileName = this.inTvalue.replace(/^\/|^/, "");
this.inTvalue = this.inTvalue.replace(/^\/|^/, "/");
}
if (data.preview !== undefined) {
@ -459,7 +459,7 @@ export default defineComponent({
this.inTheight = this.height;
this.inTvalue = this.value;
if (this.inTvalue.length) {
this.inTvalueFileName = this.inTvalue;
this.inTvalueFileName = this.inTvalue.replace(/^\/|^/, "");
this.inTvalue = this.inTvalue.replace(/^\/|^/, "/");
}
this.inTpreview = this.preview;
@ -594,6 +594,10 @@ export default defineComponent({
preview: `#Preview${this.inTId}`,
};
},
/** Removes prepended slash */
submitIntValue(): string {
return this.inTvalue.replace(/^\/|^/, "");
},
},
watch: {
inTrotationValue(value) {
@ -630,7 +634,7 @@ export default defineComponent({
container = new DataTransfer();
this.$nextTick(() => {
this.inTvalue = value.replace(/^\/|^/, "/");
this.inTvalueFileName = value;
this.inTvalueFileName = value.replace(/^\/|^/, "");
fetch(this.inTvalue)
.then((response) => {
self.inToriginalFileName = response.url.substring(

View file

@ -1,16 +1,26 @@
import type * as bootstrap from "bootstrap";
/** ! Ignore here because there is no good TS vue mixin implementation at this time */
export default {
data(): {
_tooltips: Array<bootstrap.Tooltip>;
} {
return {
_tooltips: [],
};
},
methods: {
tooltips: [] as Array<bootstrap.Tooltip>,
initTooltips(): void {
if (this.tooltips) {
this.tooltips.forEach((tooltip) => {
initTooltips() {
// @ts-ignore
if (this._tooltips) {
// @ts-ignore
this._tooltips.forEach((tooltip) => {
tooltip.disable();
tooltip.hide();
});
}
this.tooltips = [].slice
// @ts-ignore
this._tooltips = [].slice
.call(document.querySelectorAll("[data-bs-toggle=\"tooltip\"]"))
.map(function (tooltipTriggerEl) {
return new window.bootstrap.Tooltip(tooltipTriggerEl, {