allegro copy descritpion
This commit is contained in:
@@ -46,6 +46,17 @@
|
|||||||
>Zapisz jako szablon</a
|
>Zapisz jako szablon</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="descriptionAllegro">
|
||||||
|
<a
|
||||||
|
@click.prevent="
|
||||||
|
pasteAllegro
|
||||||
|
"
|
||||||
|
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
>Wklej opis <i>Allegro</i></a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -199,6 +210,11 @@ export default {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
descriptionAllegro: function(){
|
||||||
|
return localStorage.getItem('description_clipboard')
|
||||||
|
}
|
||||||
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
if (this.name) this.namex = this.name
|
if (this.name) this.namex = this.name
|
||||||
else this.namxe = 'body'
|
else this.namxe = 'body'
|
||||||
@@ -248,6 +264,42 @@ export default {
|
|||||||
this.pageType.body = this.pageType.source
|
this.pageType.body = this.pageType.source
|
||||||
this.changeBody()
|
this.changeBody()
|
||||||
},
|
},
|
||||||
|
pasteAllegro: function(){
|
||||||
|
let sections = this.descriptionAllegro;
|
||||||
|
try {
|
||||||
|
sections = JSON.parse(sections);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof SyntaxError) {
|
||||||
|
sections = [{ name: 'Tekst', cols: [{ type: 'text', value: sections, size: 12 }] }];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pagebuilder = sections.map(item => {
|
||||||
|
const columns = [];
|
||||||
|
|
||||||
|
if (item.cols && Array.isArray(item.cols)) {
|
||||||
|
item.cols.forEach(col => {
|
||||||
|
const column = {
|
||||||
|
name: 'col-md-' + col.size,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
name: (col.type === 'img' ? 'core_section_image' : 'core_section_textarea'),
|
||||||
|
text: col.value,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
if (col.type === 'img' && col.figcaption) {
|
||||||
|
column.items[0]['figcaption'] = col.figcaption;
|
||||||
|
}
|
||||||
|
columns.push(column);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { columns };
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.comps = pagebuilder;
|
||||||
|
},
|
||||||
changeBody() {
|
changeBody() {
|
||||||
var t = this
|
var t = this
|
||||||
var value = this.pageType.body
|
var value = this.pageType.body
|
||||||
|
|||||||
Reference in New Issue
Block a user