Hi,
I’m coding a plugin to generate alt text from OpenAI API.
From the image page, I create a button which when clicked fills the “alt” name field.
I already created the button, connect the API on click, get the correct response…
But I can’t fint the correct way to select the “alt” named field and chage its value.
Here is the code I use :
panel.plugin("my/altTextGenerator", {
fields: {
altgenerator: {
props: {
label: String,
},
template: '<k-button data-has-text="true" class="generator" :class="status" @click="generate_alt()">{{ label }}</k-button>',
methods: {
async generate_alt() {
// Function to generate alt text with OpenAI
// ..............
$alt = 'Generated value'; // That value has to be stored on <input name="alt">
}
}
}
}
});
I think it’s a Vue.js problem, bu I never use it.
Thanks for your help.