copy option

This commit is contained in:
2024-07-02 10:18:27 +02:00
parent e19e5cdfa1
commit d55fc67fb5
2 changed files with 27 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "magico-pagebuilder",
"version": "0.0.16",
"version": "0.0.17",
"private": true,
"scripts": {
"dev": "vite",

View File

@@ -51,6 +51,16 @@
>Wklej opis <i>Allegro</i></a
>
</li>
<li>
<a @click.prevent="copyClipboard" class="dropdown-item" href="#"
>Kopiuj do schowka</a
>
</li>
<li v-if="pasteAvailable">
<a @click.prevent="pasteClipboard" class="dropdown-item" href="#"
>Wklej ze schowka</a
>
</li>
</ul>
</div>
</div>
@@ -180,6 +190,7 @@ export default {
drag: false,
optionx: '',
comps: [],
pasteAvailable:false,
modalAddSection: false,
modalCopy: false,
pageType: { id: false },
@@ -194,6 +205,9 @@ export default {
if (localStorage.getItem('description_clipboard')) {
this.descriptionAllegro = true
}
if (localStorage.getItem('pagebuilder_clipboard')) {
this.pasteAvailable = true
}
//var trimmed = $("#body_pagebuilder").val().replace((/ |\r\n|\n|\r/gm),"");
var trimmed = this.modelValue //.replace((/{2} |\r\n|\n|\r/gm), "");
try {
@@ -252,6 +266,18 @@ export default {
this.comps.splice(this.comps.indexOf(item), 1)
this.onChange()
},
pasteClipboard:function(){
const item =localStorage.getItem('pagebuilder_clipboard');
if(!item) return;
try{
this.comps = JSON.parse(item)
}catch(e){
alert('Bład wklejenia')
}
},
copyClipboard:function(){
localStorage.setItem('pagebuilder_clipboard', JSON.stringify(this.comps));
},
addSection: function (it) {
this.modalAddSection = false
this.comps.push(JSON.parse(JSON.stringify(it)))