field video on paragraphe source
This commit is contained in:
@@ -71,13 +71,21 @@ export default {
|
||||
|
||||
const params = {
|
||||
type: this.data.bundle,
|
||||
nid: [{"value":this.data.nid}],
|
||||
// nid: [{"value":this.data.id}],
|
||||
[this.data.field]: {value: null}
|
||||
};
|
||||
if (this.data.entitytype === 'node') {
|
||||
params.nid = [{"value":this.data.id}];
|
||||
} else {
|
||||
params.id = [{"value":this.data.id}];
|
||||
}
|
||||
|
||||
const configs = {
|
||||
headers: {'X-CSRF-Token': this.csrf_token}
|
||||
};
|
||||
REST.patch(`/node/${this.data.nid}?_format=json`, params, configs)
|
||||
|
||||
let url_base = `/${this.data.entitytype === 'node' ? '' : 'entity/'}${this.data.entitytype}`;
|
||||
REST.patch(`${url_base}/${this.data.id}?_format=json`, params, configs)
|
||||
.then(({ data }) => {
|
||||
console.log(`user REST patch node ${this.data.bundle} ${this.data.field}`, data)
|
||||
// TODO if success update the data in pinia
|
||||
@@ -122,24 +130,24 @@ export default {
|
||||
<template>
|
||||
<div class="editable-image">
|
||||
<!-- with img -->
|
||||
<template v-if="image.length">
|
||||
<template v-if="image">
|
||||
<figure>
|
||||
<img :src="image[0].url" :alt="image[0].alt"/>
|
||||
<figcaption
|
||||
<img :src="image.url" :alt="image.alt"/>
|
||||
<!-- <figcaption
|
||||
:contenteditable="can_update"
|
||||
v-if="image[0].alt || can_update"
|
||||
v-if="image.alt || can_update"
|
||||
>
|
||||
{{ image[0].alt }}
|
||||
</figcaption>
|
||||
{{ image.alt }}
|
||||
</figcaption> -->
|
||||
<ContentEditable
|
||||
tag="figcaption"
|
||||
:value="image[0].alt"
|
||||
:value="image.alt"
|
||||
:contenteditable="can_update"
|
||||
:data="{
|
||||
entitytype: data.entitytype,
|
||||
bundle: data.bundle,
|
||||
nid: data.nid,
|
||||
field: {field_name: data.field, value:'alt', additional_values:{target_id:image[0].id}}
|
||||
id: data.id,
|
||||
field: {field_name: data.field, value:'alt', additional_values:{target_id:image.id}}
|
||||
}" />
|
||||
|
||||
</figure>
|
||||
@@ -149,7 +157,7 @@ export default {
|
||||
</template>
|
||||
<!-- with out img -->
|
||||
<template v-else-if="can_update">
|
||||
<div @click="addImage" class="btn">
|
||||
<div @click="addImage" class="file-btn">
|
||||
<svg-icon type="mdi" :path="mdiImagePlus_path" @click="onDeleteImg" />
|
||||
<!-- <span>ajouter une image</span> -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user