Compare commits
95 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d0d56a452 | |||
| eeb3c92778 | |||
| da0a1b006d | |||
| c2c67c15a7 | |||
| 0386355405 | |||
| b54a2c41ce | |||
| 60add34529 | |||
| 96becf4747 | |||
| d0d74e8e99 | |||
| 12914907bd | |||
| 74b50624fc | |||
| 43927991b6 | |||
| 3fe033c073 | |||
| a1615ed2cc | |||
| f73e173294 | |||
| 09beabe34f | |||
| 9c52316499 | |||
| 5ed33697ee | |||
| 32e098322c | |||
| a75ac0921d | |||
| 08d26e5621 | |||
| 45628eb596 | |||
| d55fc67fb5 | |||
| e19e5cdfa1 | |||
| 24eae8c4fe | |||
| 0951c2a4ea | |||
| 883dd6da91 | |||
| 4008ebbbcc | |||
| 2ffa793e84 | |||
| c1c6f46255 | |||
| dbb2f02049 | |||
| e80f2b3def | |||
| 8d2d0c6d77 | |||
| c5fb9f5080 | |||
| e750930057 | |||
| de80d14c64 | |||
| 6d9857ab59 | |||
| c7d4125d2c | |||
| 63fa2b9134 | |||
| 9fe3b379a8 | |||
| 6f9e2f0eac | |||
| ab402a32f1 | |||
| 008b54431d | |||
| e81fd95970 | |||
| ab4fdbad85 | |||
| 7d7df8ff99 | |||
| d1d1eaa55d | |||
| cf875dc704 | |||
| 5ba7df5b62 | |||
| c5b4c18d2f | |||
| 8785aae615 | |||
| f309bc3863 | |||
| 7e31c9d34e | |||
|
|
92ce5c02c2 | ||
|
|
ff9b0f4357 | ||
|
|
baf9dfb0b2 | ||
|
|
54719ea98c | ||
| a0d55eb5a1 | |||
| 656808255a | |||
| eb9b2c06a6 | |||
| cd3a57c12f | |||
| 0148c0f3a0 | |||
|
|
8af2815bb6 | ||
|
|
a7f04d90c4 | ||
|
|
5554c4a9fd | ||
| 2801ee9691 | |||
| ae877784ee | |||
| 5277849312 | |||
| 7d4cc6ee70 | |||
|
|
ec02fe865e | ||
| 23bcaebc0c | |||
| 3b832a26bf | |||
| 134b73af29 | |||
| d2f1a6a10d | |||
| b7ead79e41 | |||
| e975407fc6 | |||
| 4d974ac81c | |||
| 2bcbb0f5a9 | |||
| 5eded33414 | |||
| 1055263eaa | |||
| 436d2dc3b9 | |||
| 0c25909b49 | |||
| 4d262ace68 | |||
| 3ce6d6a9ec | |||
| 95465a5b7d | |||
| a2e74d2c85 | |||
| 56c6f27c77 | |||
| b9ec183258 | |||
| 9352dd3633 | |||
| d0834b1511 | |||
| 7cf101a5c9 | |||
| 57930b1c50 | |||
| 5fd3d9c9ba | |||
| 40052aeb9b | |||
| a769bd9b64 |
27
.gitignore
vendored
27
.gitignore
vendored
@@ -1,26 +1,21 @@
|
|||||||
# Logs
|
.DS_Store
|
||||||
logs
|
node_modules
|
||||||
*.log
|
/dist
|
||||||
|
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
node_modules
|
|
||||||
.DS_Store
|
|
||||||
dist
|
|
||||||
dist-ssr
|
|
||||||
coverage
|
|
||||||
*.local
|
|
||||||
|
|
||||||
/cypress/videos/
|
|
||||||
/cypress/screenshots/
|
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
|
||||||
!.vscode/extensions.json
|
|
||||||
.idea
|
.idea
|
||||||
|
.vscode
|
||||||
*.suo
|
*.suo
|
||||||
*.ntvs*
|
*.ntvs*
|
||||||
*.njsproj
|
*.njsproj
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "magico-pagebuilder",
|
"name": "magico-pagebuilder",
|
||||||
"version": "0.0.0",
|
"version": "0.0.33",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -10,13 +10,15 @@
|
|||||||
"format": "prettier --write src/"
|
"format": "prettier --write src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.3.4",
|
|
||||||
"@popperjs/core": "^2.11.7",
|
"@popperjs/core": "^2.11.7",
|
||||||
"@tinymce/tinymce-vue": "^4",
|
"@tinymce/tinymce-vue": "^4",
|
||||||
"bootstrap": "^5.3.1",
|
"bootstrap": "5.2",
|
||||||
|
"bootstrap-icons": "^1.10.5",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"magico-section": "../magico-section",
|
"magico-section": "https://serwer.magico.pl/gitrepos/public/magico-section.git",
|
||||||
"tinymce": "^6.0.3",
|
"tinymce": "^6.0.3",
|
||||||
|
"vue": "^3.3.4",
|
||||||
|
"vue-i18n": "9",
|
||||||
"vuedraggable": "^4.1.0"
|
"vuedraggable": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
26
src/App.vue
26
src/App.vue
@@ -1,24 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app" class="container">
|
<div id="app" class="container">
|
||||||
<img alt="Vue logo" style="width:100px" src="./assets/logo.png">
|
<img alt="Vue logo" style="width: 100px" src="./assets/logo.png" />
|
||||||
<h2>Pagebuilder Magico</h2>
|
<h2>Pagebuilder Magico</h2>
|
||||||
<MagicoPagebuilder v-model="data" />
|
<MagicoPagebuilder v-model="data" />
|
||||||
|
|
||||||
<div class="bg-dark text-light mt-4 p-2">{{data}}</div>
|
<div class="bg-dark text-light mt-4 p-2">{{ data }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { useSections } from './components/registerSections'
|
||||||
|
import axios from 'axios'
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {},
|
||||||
|
data: function () {
|
||||||
},
|
|
||||||
data: function(){
|
|
||||||
return {
|
return {
|
||||||
data:'[{"label":"1 kolumna ","name":"col_1","columns":[{"name":"col-md-12","items":[{"name":"core_section_textarea","text":""},{"name":"core_section_text","text":""}]}]}]'
|
data: '[{"label":"1 kolumna ","name":"col_1","columns":[{"name":"col-md-12","items":[{"name":"core_section_textarea","text":""},{"name":"core_section_text","text":""}]}]}]'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
const { register: sectionRegister } = useSections()
|
||||||
|
let vm = this
|
||||||
|
this.$pagebuilder.axios = axios.create({
|
||||||
|
headers: { Authorization: 'Bearer 40660b963460d453d903be5d5091e0c94a3254ce' }
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$pagebuilder.axios.get('https://cms.magico.pro/api/v1/section').then((response) => {
|
||||||
|
sectionRegister(vm.$pagebuilder, response.data.data)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@import './base.css';
|
@import './base.css';
|
||||||
|
@import 'bootstrap-icons/font/bootstrap-icons.css';
|
||||||
#app {
|
#app {
|
||||||
min-width: 1980px;
|
min-width: 1980px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|||||||
111
src/components/AIModal.vue
Normal file
111
src/components/AIModal.vue
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<MagicoModal v-model="modal" title="Generuj AI">
|
||||||
|
<div class="p-1">
|
||||||
|
<h5>O czym chcesz napisać?</h5>
|
||||||
|
<textarea
|
||||||
|
class="form-control mb-3"
|
||||||
|
rows="5"
|
||||||
|
v-model="text"
|
||||||
|
placeholder="Napisz krótki opis, aby AI mogło wygenerować treść."
|
||||||
|
></textarea>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Ilość znaków</label>
|
||||||
|
<select v-model="count" class="form-select">
|
||||||
|
<option value="500">500</option>
|
||||||
|
<option value="1000">1000</option>
|
||||||
|
<option value="2000">2000</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<button :disabled="loader" @click="generate" class="btn btn-primary">
|
||||||
|
<span class="spinner-border spinner-border-sm me-2" v-if="loader"></span>
|
||||||
|
Generuj
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</MagicoModal>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
const modal = ref(true)
|
||||||
|
import axios from 'axios';
|
||||||
|
import MagicoModal from './MagicoModal.vue'
|
||||||
|
// import axios from '@/api/sync-axios'
|
||||||
|
const props = defineProps({
|
||||||
|
product: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
modelValue: {
|
||||||
|
type: Object,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
lang: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
type: Function,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const text = ref('')
|
||||||
|
const offer = ref({})
|
||||||
|
const loader = ref(false)
|
||||||
|
onMounted(() => {
|
||||||
|
offer.value = props.modelValue
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(newValue) => {
|
||||||
|
offer.value = newValue
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
const count = ref(500)
|
||||||
|
const emit = defineEmits(['offerGenerated', 'update:modelValue'])
|
||||||
|
function generate() {
|
||||||
|
const prompt = `Twoim zadaniem jest stworzenie opisu.
|
||||||
|
Do "content" wstaw tekst w formacie HTML, jako akapity dla edytora WYSIWYG na podstawie dostarczonej treści na maksymalnie ${count.value} znaków.
|
||||||
|
Odpowiedź wygeneruj w języku określanym przez kod kraju: pl.
|
||||||
|
Wynik zwróć jako czysty JSON bez dodatkowego formatowania, bez używania \`\`\`json i \`\`\`, bez używania \`\`\`html i \`\`\`:
|
||||||
|
{
|
||||||
|
"content": ""
|
||||||
|
}`
|
||||||
|
const query = `${text.value}`
|
||||||
|
loader.value = true
|
||||||
|
axios
|
||||||
|
.post(
|
||||||
|
'https://ai.magico.pro/api/v1/message',
|
||||||
|
{ prompt, query },
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Bearer ' + localStorage.getItem('access_token')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
loader.value = false
|
||||||
|
modal.value = false // Close the modal after generation
|
||||||
|
// Handle the response, e.g., display the generated content
|
||||||
|
const jsonText = response.data.data.choices[0].message.content
|
||||||
|
const jsonData = JSON.parse(jsonText)
|
||||||
|
console.log('Generated Offer Data:', jsonData)
|
||||||
|
emit('update:modelValue', offer.value)
|
||||||
|
props.callback(jsonData)
|
||||||
|
// Assuming you want to do something with the generated data
|
||||||
|
// modal.value = false; // Close the modal after generation
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Błąd podczas generowania oferty:', error)
|
||||||
|
alert('Wystąpił błąd podczas generowania oferty.')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function setFeatureValue(featureName, value) {
|
||||||
|
const feature = offer.value.features.find((f) => f.feature_name === featureName)
|
||||||
|
if (feature) {
|
||||||
|
feature.feature_value = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
108
src/components/AosSelect.vue
Normal file
108
src/components/AosSelect.vue
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<template>
|
||||||
|
<div class="form form-group mb-3">
|
||||||
|
<label class="form-label">Wybierz animację</label>
|
||||||
|
<select v-model="selectedAnimation" @change="changeSelect" class="form-select">
|
||||||
|
<option value="">Brak animacji</option>
|
||||||
|
<option v-for="item in animations" :key="item.value" :value="item.value">
|
||||||
|
{{ item.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div class="mt-2">
|
||||||
|
<label class="form-label">Opóźnienie animacji (ms)</label>
|
||||||
|
<input type="number" v-model="aosDelay" @input="changeSelect" class="form-control" min="0" step="50" placeholder="np. 200" />
|
||||||
|
</div>
|
||||||
|
<!-- <small class="form-text text-muted" v-if="selectedAnimation">
|
||||||
|
Wybrana animacja: {{ getCompiledAttribute() }}
|
||||||
|
</small> -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch, onMounted } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:value', 'aos-changed']);
|
||||||
|
|
||||||
|
const selectedAnimation = ref('');
|
||||||
|
const aosDelay = ref('');
|
||||||
|
const animations = [
|
||||||
|
{ value: 'fade', name: 'Zanikanie' },
|
||||||
|
{ value: 'fade-up', name: 'Zanikanie w górę' },
|
||||||
|
{ value: 'fade-down', name: 'Zanikanie w dół' },
|
||||||
|
{ value: 'fade-left', name: 'Zanikanie w lewo' },
|
||||||
|
{ value: 'fade-right', name: 'Zanikanie w prawo' },
|
||||||
|
{ value: 'fade-up-right', name: 'Zanikanie w górę i prawo' },
|
||||||
|
{ value: 'fade-up-left', name: 'Zanikanie w górę i lewo' },
|
||||||
|
{ value: 'fade-down-right', name: 'Zanikanie w dół i prawo' },
|
||||||
|
{ value: 'fade-down-left', name: 'Zanikanie w dół i lewo' },
|
||||||
|
{ value: 'flip-up', name: 'Obrót w górę' },
|
||||||
|
{ value: 'flip-down', name: 'Obrót w dół' },
|
||||||
|
{ value: 'flip-left', name: 'Obrót w lewo' },
|
||||||
|
{ value: 'flip-right', name: 'Obrót w prawo' },
|
||||||
|
{ value: 'slide-up', name: 'Przesunięcie w górę' },
|
||||||
|
{ value: 'slide-down', name: 'Przesunięcie w dół' },
|
||||||
|
{ value: 'slide-left', name: 'Przesunięcie w lewo' },
|
||||||
|
{ value: 'slide-right', name: 'Przesunięcie w prawo' },
|
||||||
|
{ value: 'zoom-in', name: 'Powiększenie' },
|
||||||
|
{ value: 'zoom-in-up', name: 'Powiększenie w górę' },
|
||||||
|
{ value: 'zoom-in-down', name: 'Powiększenie w dół' },
|
||||||
|
{ value: 'zoom-in-left', name: 'Powiększenie w lewo' },
|
||||||
|
{ value: 'zoom-in-right', name: 'Powiększenie w prawo' },
|
||||||
|
{ value: 'zoom-out', name: 'Pomniejszenie' },
|
||||||
|
{ value: 'zoom-out-up', name: 'Pomniejszenie w górę' },
|
||||||
|
{ value: 'zoom-out-down', name: 'Pomniejszenie w dół' },
|
||||||
|
{ value: 'zoom-out-left', name: 'Pomniejszenie w lewo' },
|
||||||
|
{ value: 'zoom-out-right', name: 'Pomniejszenie w prawo' }
|
||||||
|
];
|
||||||
|
|
||||||
|
function decompileAosAttribute(val) {
|
||||||
|
if (val) {
|
||||||
|
const aosMatch = val.match(/data-aos="([^"]+)"/);
|
||||||
|
const delayMatch = val.match(/data-aos-delay="(\d+)"/);
|
||||||
|
if (aosMatch) {
|
||||||
|
selectedAnimation.value = aosMatch[1];
|
||||||
|
} else {
|
||||||
|
selectedAnimation.value = val;
|
||||||
|
}
|
||||||
|
if (delayMatch) {
|
||||||
|
aosDelay.value = delayMatch[1];
|
||||||
|
} else {
|
||||||
|
aosDelay.value = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedAnimation.value = '';
|
||||||
|
aosDelay.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCompiledAttribute() {
|
||||||
|
let attr = '';
|
||||||
|
if (selectedAnimation.value) {
|
||||||
|
attr += `data-aos="${selectedAnimation.value}"`;
|
||||||
|
if (aosDelay.value) {
|
||||||
|
attr += ` data-aos-delay="${aosDelay.value}"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeSelect() {
|
||||||
|
const compiledAttribute = getCompiledAttribute();
|
||||||
|
emit('update:modelValue', compiledAttribute);
|
||||||
|
emit('aos-changed', compiledAttribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
decompileAosAttribute(props.modelValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(() => props.modelValue, (newVal) => {
|
||||||
|
decompileAosAttribute(newVal);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -17,6 +17,12 @@
|
|||||||
v-if="item.svg"
|
v-if="item.svg"
|
||||||
v-html="item.svg"
|
v-html="item.svg"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
|
<img
|
||||||
|
style="width: 100%"
|
||||||
|
v-else-if="item.image"
|
||||||
|
:src="item.image"
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
v-else
|
v-else
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@@ -69,7 +75,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,30 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div :id="id" class="modal" data-bs-focus="false" tabindex="-1">
|
||||||
:id="id"
|
<div class="modal-dialog" :class="class_other" >
|
||||||
class="modal"
|
<div class="modal-content" v-if="modelValue">
|
||||||
>
|
<div v-if="title" class="modal-header">
|
||||||
<div
|
<h4 class="modal-title" v-html="title" />
|
||||||
class="modal-dialog"
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
|
||||||
:class="class_other"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
v-if="modal"
|
|
||||||
class="modal-content"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
v-if="title"
|
|
||||||
class="modal-header"
|
|
||||||
>
|
|
||||||
<h4
|
|
||||||
class="modal-title"
|
|
||||||
v-html="title"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn-close"
|
|
||||||
data-bs-dismiss="modal"
|
|
||||||
aria-label="Close"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<slot />
|
<slot />
|
||||||
@@ -35,50 +15,54 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Modal } from "bootstrap";
|
import { Modal } from 'bootstrap'
|
||||||
import { onMounted, onBeforeUnmount, ref, watch } from "vue";
|
import { onMounted, onBeforeUnmount, ref, watch } from 'vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ["modelValue", "title", "class_other"],
|
props: ['modelValue', 'title', 'class_other'],
|
||||||
|
emits: ['change', 'update:modelValue', 'hide'],
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const id = "modal" + Math.round(Math.random() * 100000);
|
const id = 'modalpgb' + Math.round(Math.random() * 100000)
|
||||||
const modal = ref(null);
|
const modal = ref(null)
|
||||||
|
|
||||||
const triggerModal = (value, emitEvent = true) => {
|
const triggerModal = (value, emitEvent = true) => {
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
modal.value.show();
|
modal.value.show()
|
||||||
} else {
|
} else {
|
||||||
modal.value.hide();
|
modal.value.hide()
|
||||||
if (emitEvent) {
|
if (emitEvent) {
|
||||||
emit("hide");
|
emit('hide')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit("update:modelValue", value);
|
emit('update:modelValue', value)
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.body.append(document.getElementById(id));
|
document.body.append(document.getElementById(id))
|
||||||
modal.value = new Modal(document.getElementById(id));
|
modal.value = new Modal(document.getElementById(id))
|
||||||
document.getElementById(id).addEventListener("hidden.bs.modal", function () {
|
document.getElementById(id).addEventListener('hidden.bs.modal', function () {
|
||||||
triggerModal(false);
|
triggerModal(false)
|
||||||
});
|
})
|
||||||
triggerModal(props.modelValue, false);
|
triggerModal(props.modelValue, false)
|
||||||
});
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
document.getElementById(id).remove();
|
modal.value.hide()
|
||||||
});
|
setTimeout(function () {
|
||||||
|
document.getElementById(id).remove()
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
() => {
|
() => {
|
||||||
triggerModal(props.modelValue);
|
triggerModal(props.modelValue)
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
|
||||||
return { id, modal };
|
return { id, modal }
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -14,26 +14,55 @@
|
|||||||
<span class="material-icons-outlined">fullscreen</span>
|
<span class="material-icons-outlined">fullscreen</span>
|
||||||
</button>
|
</button>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<div class="dropdown">
|
||||||
@click.prevent="
|
<button
|
||||||
modalLoad = !modalLoad;
|
class="btn btn-outline-secondary dropdown-toggle"
|
||||||
pageType = { name: null };
|
type="button"
|
||||||
"
|
data-bs-toggle="dropdown"
|
||||||
title="Wczytaj szablon do schowka"
|
aria-expanded="false"
|
||||||
class="btn btn-outline-primary btn-icon-sm"
|
>
|
||||||
>
|
{{ t('pagebuilder.template') }}
|
||||||
<span class="material-icons-outlined">find_replace</span>
|
</button>
|
||||||
</button>
|
<ul class="dropdown-menu">
|
||||||
<button
|
<li>
|
||||||
@click.prevent="
|
<a
|
||||||
modalSave = !modalSave;
|
@click.prevent="
|
||||||
pageType = { name: null };
|
modalLoad = !modalLoad;
|
||||||
"
|
pageType = { name: null }
|
||||||
title="Zapisz szablon do schowka"
|
"
|
||||||
class="btn btn-outline-success btn-icon-sm"
|
class="dropdown-item"
|
||||||
>
|
href="#"
|
||||||
<span class="material-icons-outlined">save</span>
|
>{{ t('pagebuilder.import_template') }}</a
|
||||||
</button>
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
@click.prevent="
|
||||||
|
modalSave = !modalSave;
|
||||||
|
pageType = { name: null }
|
||||||
|
"
|
||||||
|
class="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
>{{ t('pagebuilder.save_template') }}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li v-if="descriptionAllegro">
|
||||||
|
<a @click.prevent="pasteAllegro" class="dropdown-item" href="#"
|
||||||
|
>Wklej opis <i>Allegro</i></a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a @click.prevent="copyClipboard" class="dropdown-item" href="#">{{
|
||||||
|
t('pagebuilder.copy_template')
|
||||||
|
}}</a>
|
||||||
|
</li>
|
||||||
|
<li v-if="pasteAvailable">
|
||||||
|
<a @click.prevent="pasteClipboard" class="dropdown-item" href="#">{{
|
||||||
|
t('pagebuilder.paste_template')
|
||||||
|
}}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <button v-if="showcopy" class="btn btn-outline-secondary mr-1" @click.prevent="modalCopy = !modalCopy;">Kopiuj
|
<!-- <button v-if="showcopy" class="btn btn-outline-secondary mr-1" @click.prevent="modalCopy = !modalCopy;">Kopiuj
|
||||||
@@ -47,12 +76,15 @@
|
|||||||
item-key="d"
|
item-key="d"
|
||||||
@end="
|
@end="
|
||||||
drag = false;
|
drag = false;
|
||||||
onChange();
|
onChange()
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<template #item="{ element }">
|
<template #item="{ element, index }">
|
||||||
<PagebuilderSection
|
<PagebuilderSection
|
||||||
:value="element"
|
:value="element"
|
||||||
|
:key="'g' + index"
|
||||||
|
:id="'g' + index"
|
||||||
|
:keyIndex="'g' + index"
|
||||||
v-on:deleteSection="deleteSection"
|
v-on:deleteSection="deleteSection"
|
||||||
v-on:copy="copySection"
|
v-on:copy="copySection"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
@@ -62,15 +94,11 @@
|
|||||||
</draggable>
|
</draggable>
|
||||||
|
|
||||||
<b-modal
|
<b-modal
|
||||||
class_other="modal-xl"
|
v-model="modalSave"
|
||||||
v-model.value="modalSave"
|
|
||||||
title="Zapisz szablon do schowka"
|
title="Zapisz szablon do schowka"
|
||||||
v-on:onClose="modalSave = false"
|
v-on:onClose="modalSave = false"
|
||||||
>
|
>
|
||||||
<PagebuilderTemplateSave
|
<PagebuilderTemplateSave v-model.value="pageType" :szablon="modelValue">
|
||||||
v-model.value="pageType"
|
|
||||||
:szablon="value"
|
|
||||||
>
|
|
||||||
</PagebuilderTemplateSave>
|
</PagebuilderTemplateSave>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
@@ -79,37 +107,29 @@
|
|||||||
class="btn btn-success mr-1"
|
class="btn btn-success mr-1"
|
||||||
:disabled="!pageType.name"
|
:disabled="!pageType.name"
|
||||||
>
|
>
|
||||||
Zapisz do schowka
|
{{ t('pagebuilder.copy_template') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
|
|
||||||
<b-modal
|
<b-modal
|
||||||
class_other="modal-xl"
|
v-model="modalLoad"
|
||||||
v-model.value="modalLoad"
|
|
||||||
title="Wczytaj szablon ze schowka"
|
title="Wczytaj szablon ze schowka"
|
||||||
v-on:onClose="modalLoad = false"
|
v-on:onClose="modalLoad = false"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<PagebuilderTemplateLoad
|
<PagebuilderTemplateLoad
|
||||||
v-model.value="pageType"
|
v-model="pageType"
|
||||||
@input="modalLoadClick"
|
v-if="modalLoad"
|
||||||
|
@update:modelValue="modalLoadClick"
|
||||||
></PagebuilderTemplateLoad>
|
></PagebuilderTemplateLoad>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
|
|
||||||
<b-modal
|
<b-modal v-model="modalCopy" v-on:onClose="modalCopy = false">
|
||||||
class_other="modal-xl"
|
<PagebuilderTemplateLoad v-model="pageType"></PagebuilderTemplateLoad>
|
||||||
v-model.value="modalCopy"
|
|
||||||
v-on:onClose="modalCopy = false"
|
|
||||||
>
|
|
||||||
<PagebuilderTemplateLoad v-model.value="pageType"></PagebuilderTemplateLoad>
|
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button class="btn btn-primary mr-1" :disabled="!pageType.id" @click.prevent="changeBody">
|
||||||
class="btn btn-primary mr-1"
|
|
||||||
:disabled="!pageType.id"
|
|
||||||
@click.prevent="changeBody"
|
|
||||||
>
|
|
||||||
Skopiuj układ i treść
|
Skopiuj układ i treść
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,8 +137,8 @@
|
|||||||
|
|
||||||
<b-modal
|
<b-modal
|
||||||
class_other="modal-xl"
|
class_other="modal-xl"
|
||||||
v-model.value="modalAddSection"
|
v-model="modalAddSection"
|
||||||
title=" Dodaj sekcję"
|
:title="t('pagebuilder.add_section')"
|
||||||
v-on:onClose="modalAddSection = false"
|
v-on:onClose="modalAddSection = false"
|
||||||
hide-footer
|
hide-footer
|
||||||
>
|
>
|
||||||
@@ -132,10 +152,10 @@
|
|||||||
class="btn btn-block btn-primary mt-4"
|
class="btn btn-block btn-primary mt-4"
|
||||||
@click.prevent="
|
@click.prevent="
|
||||||
modalAddSection = !modalAddSection;
|
modalAddSection = !modalAddSection;
|
||||||
optionx = false;
|
optionx = false
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
Dodaj sekcję
|
{{ t('pagebuilder.add_section') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -143,136 +163,220 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import draggable from "vuedraggable";
|
import draggable from 'vuedraggable'
|
||||||
import grid from "./grid.js";
|
import grid from './grid.js'
|
||||||
import MagicoModal from "./MagicoModal.vue";
|
import MagicoModal from './MagicoModal.vue'
|
||||||
import PagebuilderSection from "./PagebuilderSection.vue";
|
import PagebuilderSection from './PagebuilderSection.vue'
|
||||||
import DropdownSectionGrid from "./DropdownSectionGrid.vue";
|
import DropdownSectionGrid from './DropdownSectionGrid.vue'
|
||||||
import PagebuilderTemplateSave from "./PagebuilderTemplateSave.vue";
|
import PagebuilderTemplateSave from './PagebuilderTemplateSave.vue'
|
||||||
import PagebuilderTemplateLoad from "./PagebuilderTemplateLoad.vue";
|
import PagebuilderTemplateLoad from './PagebuilderTemplateLoad.vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MagicoPagebuilder",
|
name: 'MagicoPagebuilder',
|
||||||
emits: ["update:modelValue"],
|
emits: ['update:modelValue', 'change'],
|
||||||
components: {
|
components: {
|
||||||
"b-modal": MagicoModal,
|
'b-modal': MagicoModal,
|
||||||
PagebuilderSection,
|
PagebuilderSection,
|
||||||
draggable,
|
draggable,
|
||||||
DropdownSectionGrid,
|
DropdownSectionGrid,
|
||||||
PagebuilderTemplateSave,
|
PagebuilderTemplateSave,
|
||||||
PagebuilderTemplateLoad,
|
PagebuilderTemplateLoad
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
grid: grid,
|
grid: grid,
|
||||||
namex: "body", //podmieniane przez name
|
namex: 'body', //podmieniane przez name
|
||||||
drag: false,
|
drag: false,
|
||||||
optionx: "",
|
optionx: '',
|
||||||
comps: [],
|
comps: [],
|
||||||
|
pasteAvailable: false,
|
||||||
modalAddSection: false,
|
modalAddSection: false,
|
||||||
modalCopy: false,
|
modalCopy: false,
|
||||||
pageType: { id: false },
|
pageType: { id: false },
|
||||||
modalSave: false,
|
modalSave: false,
|
||||||
modalLoad: false,
|
modalLoad: false,
|
||||||
};
|
descriptionAllegro: false,
|
||||||
},
|
ownUpdate: false
|
||||||
props: ["name", "modelValue", "showcopy", "lang"],
|
|
||||||
mounted: function () {
|
|
||||||
//var trimmed = $("#body_pagebuilder").val().replace((/ |\r\n|\n|\r/gm),"");
|
|
||||||
var trimmed = this.modelValue; //.replace((/{2} |\r\n|\n|\r/gm), "");
|
|
||||||
try {
|
|
||||||
this.comps = JSON.parse(trimmed);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn(e);
|
|
||||||
this.comps = [
|
|
||||||
{
|
|
||||||
label: "1 kolumna ",
|
|
||||||
name: "col_1",
|
|
||||||
columns: [{ name: "col-md-12", items: [{ name: "core_section_textarea" }] }],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
props: ['name', 'modelValue', 'showcopy', 'lang'],
|
||||||
|
setup() {
|
||||||
|
const { t } = useI18n()
|
||||||
|
return { t }
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
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 {
|
||||||
|
this.comps = JSON.parse(trimmed)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e)
|
||||||
|
this.comps = [
|
||||||
|
{
|
||||||
|
label: '1 kolumna ',
|
||||||
|
name: 'col_1',
|
||||||
|
columns: [{ name: 'col-md-12', items: [{ name: 'core_section_textarea' }] }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
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'
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// whenever question changes, this function will run
|
// whenever question changes, this function will run
|
||||||
comps: function (newQuestion) {
|
comps: function (newQuestion) {
|
||||||
console.log("nq", newQuestion);
|
console.log('nq', newQuestion)
|
||||||
},
|
},
|
||||||
|
modelValue: function () {
|
||||||
|
if (this.ownUpdate) {
|
||||||
|
this.ownUpdate = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.comps = JSON.parse(this.modelValue)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e)
|
||||||
|
this.comps = [
|
||||||
|
{
|
||||||
|
label: '1 kolumna ',
|
||||||
|
name: 'col_1',
|
||||||
|
columns: [{ name: 'col-md-12', items: [{ name: 'core_section_textarea' }] }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onChange: function () {
|
onChange: function () {
|
||||||
this.$emit("update:modelValue", JSON.stringify(this.comps));
|
this.ownUpdate = true
|
||||||
this.$emit("change");
|
this.$emit('update:modelValue', JSON.stringify(this.comps))
|
||||||
|
this.$emit('change')
|
||||||
},
|
},
|
||||||
copySection: function (item) {
|
copySection: function (item) {
|
||||||
this.comps.push(JSON.parse(JSON.stringify(item)));
|
this.comps.push(JSON.parse(JSON.stringify(item)))
|
||||||
this.onChange();
|
this.onChange()
|
||||||
},
|
},
|
||||||
deleteSection: function (item) {
|
deleteSection: function (item) {
|
||||||
this.comps.splice(this.comps.indexOf(item), 1);
|
this.comps.splice(this.comps.indexOf(item), 1)
|
||||||
this.onChange();
|
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) {
|
addSection: function (it) {
|
||||||
this.modalAddSection = false;
|
this.modalAddSection = false
|
||||||
this.comps.push(JSON.parse(JSON.stringify(it)));
|
this.comps.push(JSON.parse(JSON.stringify(it)))
|
||||||
this.onChange();
|
this.onChange()
|
||||||
},
|
},
|
||||||
modalSaveSave: function () {
|
modalSaveSave: function () {
|
||||||
console.log(this.pageType);
|
console.log(this.pageType)
|
||||||
var data = {
|
var data = {
|
||||||
id: this.pageType.id,
|
id: this.pageType.id,
|
||||||
name: this.pageType.name,
|
name: this.pageType.name,
|
||||||
source: this.modelValue,
|
source: this.modelValue,
|
||||||
description: this.pageType.description,
|
description: this.pageType.description
|
||||||
};
|
}
|
||||||
if (this.$pagebuilder.axios) {
|
if (this.$pagebuilder.axios) {
|
||||||
this.$pagebuilder.axios.post("api/v1/pagebuilder/template", data).then(() => {
|
this.$pagebuilder.axios.post('api/v1/pagebuilder/template', data).then(() => {
|
||||||
this.pageType = {};
|
this.pageType = {}
|
||||||
this.modalSave = false;
|
this.modalSave = false
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
console.error("NO AXIOS INSTACE PROVIDED TO PAGEBUILDER");
|
console.error('NO AXIOS INSTACE PROVIDED TO PAGEBUILDER')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modalLoadClick: function () {
|
modalLoadClick: function () {
|
||||||
this.pageType.body = this.pageType.source;
|
this.pageType.body = this.pageType.source
|
||||||
this.changeBody();
|
this.changeBody()
|
||||||
|
},
|
||||||
|
pasteAllegro: function () {
|
||||||
|
let sections = localStorage.getItem('description_clipboard')
|
||||||
|
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 = {
|
||||||
|
type: 'container',
|
||||||
|
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, label: '', name: '', type: 'container' }
|
||||||
|
})
|
||||||
|
|
||||||
|
this.comps = pagebuilder
|
||||||
|
this.onChange()
|
||||||
},
|
},
|
||||||
changeBody() {
|
changeBody() {
|
||||||
var t = this;
|
var t = this
|
||||||
var value = this.pageType.body;
|
var value = this.pageType.body
|
||||||
var trimmed = value;
|
var trimmed = value
|
||||||
try {
|
try {
|
||||||
//this.comps.forEach((item)=>{
|
//this.comps.forEach((item)=>{
|
||||||
// this.deleteSection(item);
|
// this.deleteSection(item);
|
||||||
//})
|
//})
|
||||||
this.comps = [];
|
this.comps = []
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
t.comps = JSON.parse(trimmed);
|
t.comps = JSON.parse(trimmed)
|
||||||
t.onChange();
|
t.onChange()
|
||||||
}, 300);
|
}, 300)
|
||||||
//this.comps =JSON.parse(trimmed);
|
//this.comps =JSON.parse(trimmed);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.comps = [
|
this.comps = [
|
||||||
{
|
{
|
||||||
label: "1 kolumna ",
|
label: '1 kolumna ',
|
||||||
name: "col_1",
|
name: 'col_1',
|
||||||
columns: [{ name: "col-md-12", items: [{ name: "core_section_textarea" }] }],
|
columns: [{ name: 'col-md-12', items: [{ name: 'core_section_textarea' }] }]
|
||||||
},
|
}
|
||||||
];
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
this.modalCopy = false;
|
this.modalCopy = false
|
||||||
this.modalSave = false;
|
this.modalSave = false
|
||||||
this.modalLoad = false;
|
this.modalLoad = false
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
|||||||
@@ -1,36 +1,40 @@
|
|||||||
import MagicoPagebuilder from "./MagicoPagebuilder.vue";
|
import MagicoPagebuilder from './MagicoPagebuilder.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install: (app) => {
|
install: (app) => {
|
||||||
app.component("MagicoPagebuilder", MagicoPagebuilder);
|
app.component('MagicoPagebuilder', MagicoPagebuilder)
|
||||||
|
|
||||||
console.log(app);
|
console.log(app)
|
||||||
app.config.globalProperties.$pagebuilder = {
|
app.config.globalProperties.$pagebuilder = {
|
||||||
items: {
|
items: {
|
||||||
core_section_text: {
|
core_section_text: {
|
||||||
label: "Pole nagłowek",
|
label: 'Pole nagłowek',
|
||||||
svg_off: "",
|
svg_off: ''
|
||||||
},
|
},
|
||||||
core_section_textarea: {
|
core_section_textarea: {
|
||||||
label: "Pole tekstowe",
|
label: 'Pole tekstowe',
|
||||||
svg_off: "",
|
svg_off: ''
|
||||||
},
|
},
|
||||||
core_section_html: {
|
core_section_html: {
|
||||||
label: "Pole HTML",
|
label: 'Pole HTML',
|
||||||
svg_off: "",
|
svg_off: ''
|
||||||
},
|
},
|
||||||
core_section_image: {
|
core_section_image: {
|
||||||
label: "Obrazek",
|
label: 'Obrazek',
|
||||||
svg_off: "",
|
svg_off: ''
|
||||||
},
|
},
|
||||||
|
core_section_video: {
|
||||||
|
label: 'Wideo',
|
||||||
|
svg_off: ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
axios: null,
|
axios: null,
|
||||||
registerPlugin(name, item, component) {
|
registerPlugin(name, item, component) {
|
||||||
this.items[name] = item;
|
this.items[name] = item
|
||||||
if(component){
|
if (component) {
|
||||||
app.component(name, component);
|
app.component(name, component)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div style="min-height: 100px" class="pagebuilder-column" :class="value.name">
|
||||||
style="min-height: 100px"
|
<h6 v-if="value.user_label">{{ value.user_label }}</h6>
|
||||||
class="pagebuilder-column"
|
|
||||||
:class="value.name"
|
|
||||||
>
|
|
||||||
<b-modal
|
<b-modal
|
||||||
v-model.value="modalAddBox"
|
v-model="modalAddBox"
|
||||||
class_other="modal-xl"
|
class_other="modal-xl"
|
||||||
v-on:onClose="modalAddBox = false"
|
v-on:onClose="modalAddBox = false"
|
||||||
title="Dodaj widżet"
|
title="Dodaj widżet"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<DropdownSectionSection @choose="clickAdd"> </DropdownSectionSection>
|
<DropdownSectionSection v-if="modalAddBox" @choose="clickAdd"> </DropdownSectionSection>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
|
|
||||||
@@ -22,21 +19,18 @@
|
|||||||
v-on:onClose="modalColumnsSettings = false"
|
v-on:onClose="modalColumnsSettings = false"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div class="from-group">
|
<div class="from-group mb-3">
|
||||||
<label>Klasa kolumny</label>
|
<label class="form-label">Nazwa kolumny</label>
|
||||||
<input
|
<input @input="onChange" v-model="value.user_label" type="text" class="form-control" />
|
||||||
@input="onChange"
|
|
||||||
v-model="value.class"
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="from-group mb-3">
|
||||||
|
<label class="form-label">Klasa kolumny</label>
|
||||||
|
<input @input="onChange" v-model="value.class" type="text" class="form-control" />
|
||||||
|
</div>
|
||||||
|
<AosSelect v-model="value.attribute" @aos-changed="onChange" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="mt-4">
|
||||||
<button
|
<button @click="modalColumnsSettings = false" class="btn btn-outline-secondary">
|
||||||
@click="modalColumnsSettings = false"
|
|
||||||
class="btn btn-outline-secondary"
|
|
||||||
>
|
|
||||||
Zapisz i zamknij
|
Zapisz i zamknij
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,10 +38,11 @@
|
|||||||
<draggable
|
<draggable
|
||||||
:options="{ handle: '.box-move' }"
|
:options="{ handle: '.box-move' }"
|
||||||
v-model="value.items"
|
v-model="value.items"
|
||||||
|
itemKey="name"
|
||||||
@start="drag = true"
|
@start="drag = true"
|
||||||
@end="
|
@end="
|
||||||
drag = false;
|
drag = false;
|
||||||
onChange();
|
onChange()
|
||||||
"
|
"
|
||||||
group="people"
|
group="people"
|
||||||
>
|
>
|
||||||
@@ -55,7 +50,8 @@
|
|||||||
<div class="pb_section table-bordered p-2 pl-3 pr-3 mb-3 rounded">
|
<div class="pb_section table-bordered p-2 pl-3 pr-3 mb-3 rounded">
|
||||||
<component
|
<component
|
||||||
@itemRemoved="removeItem"
|
@itemRemoved="removeItem"
|
||||||
:key="index"
|
:key="keyIndex+contentId + element.name+index"
|
||||||
|
:id="keyIndex+contentId + element.name+index"
|
||||||
v-bind:is="element.name"
|
v-bind:is="element.name"
|
||||||
v-bind:value="element"
|
v-bind:value="element"
|
||||||
v-model="value.items[index]"
|
v-model="value.items[index]"
|
||||||
@@ -95,53 +91,70 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import draggable from "vuedraggable";
|
import draggable from 'vuedraggable'
|
||||||
import MagicoModal from "./MagicoModal.vue";
|
import MagicoModal from './MagicoModal.vue'
|
||||||
import SectionText from "./plugin/SectionText.vue";
|
import SectionText from './plugin/SectionText.vue'
|
||||||
import SectionTextarea from "./plugin/SectionTextarea.vue";
|
import SectionTextarea from './plugin/SectionTextarea.vue'
|
||||||
import SectionHtml from "./plugin/SectionHtml.vue";
|
import SectionVideo from './plugin/SectionVideo.vue'
|
||||||
import SectionImage from "./plugin/SectionImage.vue";
|
|
||||||
|
|
||||||
import DropdownSectionSection from "./DropdownSectionSection.vue";
|
import SectionHtml from './plugin/SectionHtml.vue'
|
||||||
|
import SectionImage from './plugin/SectionImage.vue'
|
||||||
|
|
||||||
|
import DropdownSectionSection from './DropdownSectionSection.vue'
|
||||||
|
import AosSelect from './AosSelect.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: function () {
|
data: function () {
|
||||||
return { opcja: "", modalAddBox: false, drag: false, modalColumnsSettings: false };
|
|
||||||
|
return {
|
||||||
|
opcja: '',
|
||||||
|
modalAddBox: false,
|
||||||
|
drag: false,
|
||||||
|
|
||||||
|
modalColumnsSettings: false,
|
||||||
|
contentId: 'cnt' + Math.round(Math.random() * 1000)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
props: { value: Object },
|
props: { value: Object, keyIndex: String },
|
||||||
emits: ["update:modelValue"],
|
emits: ['update:modelValue','change'],
|
||||||
components: {
|
components: {
|
||||||
draggable,
|
draggable,
|
||||||
"b-modal": MagicoModal,
|
'b-modal': MagicoModal,
|
||||||
core_section_textarea: SectionTextarea,
|
core_section_textarea: SectionTextarea,
|
||||||
core_section_text: SectionText,
|
core_section_text: SectionText,
|
||||||
core_section_html: SectionHtml,
|
core_section_html: SectionHtml,
|
||||||
core_section_image: SectionImage,
|
core_section_image: SectionImage,
|
||||||
|
core_section_video: SectionVideo,
|
||||||
DropdownSectionSection,
|
DropdownSectionSection,
|
||||||
|
AosSelect
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onChange: function () {
|
onChange: function () {
|
||||||
this.$emit("change");
|
this.$emit('change')
|
||||||
},
|
},
|
||||||
rand: function () {
|
rand: function () {
|
||||||
return "component" + Math.random() * 100;
|
return 'c' + Math.round(Math.random() * 1000)
|
||||||
},
|
},
|
||||||
removeItem(item) {
|
removeItem(item) {
|
||||||
this.value.items.indexOf(item);
|
this.value.items.indexOf(item)
|
||||||
this.value.items.splice(this.value.items.indexOf(item), 1);
|
this.value.items.splice(this.value.items.indexOf(item), 1)
|
||||||
|
|
||||||
this.onChange();
|
this.onChange()
|
||||||
},
|
},
|
||||||
clickAdd: function (item) {
|
clickAdd: function (item) {
|
||||||
console.log(item);
|
console.log(item)
|
||||||
this.modalAddBox = false;
|
const sectionobj = this.$pagebuilder.items[item]
|
||||||
var a = { name: item, open: true };
|
console.log('addedd', sectionobj)
|
||||||
this.value.items.push(a);
|
this.modalAddBox = false
|
||||||
this.onChange();
|
var a = { name: item, open: true }
|
||||||
},
|
if (sectionobj.section_id) {
|
||||||
},
|
a.section_id = sectionobj.section_id
|
||||||
};
|
}
|
||||||
|
this.value.items.push(a)
|
||||||
|
this.onChange()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.pagebuilder-column-hover {
|
.pagebuilder-column-hover {
|
||||||
|
|||||||
@@ -1,105 +1,87 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row pb-3 mb-3 position-relative border-bottom pb_outer_section pr-5">
|
<div class="row pb-3 mb-3 position-relative border-bottom pb_outer_section pr-5">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
|
<h5 class="mt-4" v-if="value.title">{{ value.title }}</h5>
|
||||||
<div class="row p-0 mt-3 me-2">
|
<div class="row p-0 mt-3 me-2">
|
||||||
<PagebuilderContent
|
<PagebuilderContent class="col-sm-12" v-for="(column, index) in value.columns" :value="column"
|
||||||
class="col-sm-12"
|
:key="keyIndex + 's' + index" :id="keyIndex + 's' + index" :keyIndex="keyIndex + 's' + index"
|
||||||
v-for="(column, index) in value.columns"
|
@change="onChange"></PagebuilderContent>
|
||||||
:value="column"
|
|
||||||
:key="index"
|
|
||||||
@change="onChange"
|
|
||||||
></PagebuilderContent>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div class="pb_section_options position-absolute" style="top: 12px; right: 14px; width: 20px">
|
||||||
class="pb_section_options position-absolute"
|
<a href="#" title="Przenieś sekcje" class="box-settings-icon box-move"><i
|
||||||
style="top: 12px; right: 14px; width: 20px"
|
class="material-icons-outlined">sort</i></a>
|
||||||
>
|
<a href="#" title="Duplikuj sekcje" @click.prevent="copySection"
|
||||||
<a
|
class="box-settings-icon box-copy text-warning"><i class="material-icons-outlined">file_copy</i></a>
|
||||||
href="#"
|
<a href="#" title="Ustawienia sekcji" @click.prevent="toggleSettings"
|
||||||
title="Przenieś sekcje"
|
class="box-settings-icon box-settings text-secondary"><i class="material-icons-outlined">settings</i></a>
|
||||||
class="box-settings-icon box-move"
|
<a href="#" title="Usuń sekcje" @click.prevent="deleteSection" class="box-settings-icon box-delete text-danger"><i
|
||||||
><i class="material-icons-outlined">sort</i></a
|
class="material-icons-outlined">delete</i></a>
|
||||||
>
|
<b-modal v-model="show_settings" :title="t('pagebuilder.section_settings')" @onClose="ustawieniaSave()">
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
title="Duplikuj sekcje"
|
|
||||||
@click.prevent="copySection"
|
|
||||||
class="box-settings-icon box-copy text-warning"
|
|
||||||
><i class="material-icons-outlined">file_copy</i></a
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
title="Ustawienia sekcji"
|
|
||||||
@click.prevent="toggleSettings"
|
|
||||||
class="box-settings-icon box-settings text-secondary"
|
|
||||||
><i class="material-icons-outlined">settings</i></a
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
title="Usuń sekcje"
|
|
||||||
@click.prevent="deleteSection"
|
|
||||||
class="box-settings-icon box-delete text-danger"
|
|
||||||
><i class="material-icons-outlined">delete</i></a
|
|
||||||
>
|
|
||||||
<b-modal
|
|
||||||
v-model="show_settings"
|
|
||||||
title="Ustawienia sekcji"
|
|
||||||
@onClose="ustawieniaSave()"
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div class="form-group mb-3">
|
||||||
<div class="form-group mb-2">
|
<label class="w-100 col-form-label"> {{ t('pagebuilder.section_type') }} </label>
|
||||||
<label class="w-100 col-form-label"> Klasa sekcji </label>
|
<div class="row">
|
||||||
<input
|
<div class="col-6">
|
||||||
type="text"
|
<button class="btn w-100" @click="setType('container')"
|
||||||
class="form-control"
|
:class="type == 'container' ? 'btn-primary' : 'btn-outline-primary'">
|
||||||
v-model="value.class"
|
{{ t('pagebuilder.container') }}
|
||||||
/>
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<button class="btn w-100" @click="setType('full')"
|
||||||
|
:class="type == 'full' ? 'btn-primary' : 'btn-outline-primary'">
|
||||||
|
{{ t('pagebuilder.full_width') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-2">
|
</div>
|
||||||
<label>Margines górny</label>
|
|
||||||
<div class="input-group mb-3">
|
<div>
|
||||||
<input
|
|
||||||
type="number"
|
<div class="form-group mb-3">
|
||||||
class="form-control"
|
<label class="w-100 col-form-label">Tytuł sekcji</label>
|
||||||
v-model="value.margin_top"
|
<input type="text" class="form-control" v-model="value.title">
|
||||||
/>
|
</div>
|
||||||
|
<div class="form-group mb-3 ml-4">
|
||||||
|
<input type="checkbox" id="dropdown" class="form-check-input me-1" v-model="value.dropdown">
|
||||||
|
<label for="dropdown" class="form-check-label">Sekcja rozwijana</label>
|
||||||
|
</div>
|
||||||
|
<div v-if="value.dropdown" class="form-group mb-3 ml-4">
|
||||||
|
<input type="checkbox" id="dropdown_default_open" class="form-check-input me-1"
|
||||||
|
v-model="value.dropdown_default_open">
|
||||||
|
<label for="dropdown_default_open" class="form-check-label">Domyślnie rozwinięta</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="w-100 col-form-label"> Klasa sekcji </label>
|
||||||
|
<input type="text" class="form-control" v-model="value.class" />
|
||||||
|
</div>
|
||||||
|
<AosSelect v-model="value.attribute" />
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="form-label">Margines górny</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="number" class="form-control" v-model="value.margin_top" />
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span
|
<span class="input-group-text" id="basic-addon1">px</span>
|
||||||
class="input-group-text"
|
|
||||||
id="basic-addon1"
|
|
||||||
>px</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-2">
|
<div class="form-group mb-3">
|
||||||
<label>Margines dolny</label>
|
<label class="form-label">Margines dolny</label>
|
||||||
<div class="input-group mb-3">
|
<div class="input-group">
|
||||||
<input
|
<input type="number" class="form-control" v-model="value.margin_bottom" />
|
||||||
type="number"
|
|
||||||
class="form-control"
|
|
||||||
v-model="value.margin_bottom"
|
|
||||||
/>
|
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span
|
<span class="input-group-text" id="basic-addon1">px</span>
|
||||||
class="input-group-text"
|
|
||||||
id="basic-addon1"
|
|
||||||
>px</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button class="btn btn-outline-secondary" @click.prevent="ustawieniaSave">
|
||||||
class="btn btn-outline-secondary"
|
{{ t('pagebuilder.save') }}
|
||||||
@click.prevent="ustawieniaSave"
|
|
||||||
>
|
|
||||||
Zapisz
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
@@ -107,45 +89,59 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import grid from "./grid.js";
|
import { useI18n } from 'vue-i18n'
|
||||||
import MagicoModal from "./MagicoModal.vue";
|
import grid from './grid.js'
|
||||||
import PagebuilderContent from "./PagebuilderContent.vue";
|
import MagicoModal from './MagicoModal.vue'
|
||||||
|
import PagebuilderContent from './PagebuilderContent.vue'
|
||||||
|
import AosSelect from './AosSelect.vue'
|
||||||
export default {
|
export default {
|
||||||
props: { value: Object },
|
props: { value: Object, keyIndex: String },
|
||||||
emits: ["update:modelValue", "copy", "deleteSection"],
|
emits: ['update:modelValue', 'copy', 'deleteSection', 'change'],
|
||||||
components: {
|
components: {
|
||||||
"b-modal": MagicoModal,
|
'b-modal': MagicoModal,
|
||||||
PagebuilderContent,
|
PagebuilderContent,
|
||||||
|
AosSelect
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return { items: grid, value2: "", show_settings: false };
|
return { items: grid, value2: '', show_settings: false, type: '' }
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
const { t } = useI18n()
|
||||||
|
return { t }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeSelect: function () {
|
changeSelect: function () {
|
||||||
this.onChange();
|
this.onChange()
|
||||||
},
|
},
|
||||||
onChange: function () {
|
onChange: function () {
|
||||||
this.$emit("change");
|
this.$emit('change')
|
||||||
},
|
},
|
||||||
deleteSection: function () {
|
deleteSection: function () {
|
||||||
this.$emit("deleteSection", this.value);
|
this.$emit('deleteSection', this.value)
|
||||||
},
|
},
|
||||||
copySection: function () {
|
copySection: function () {
|
||||||
this.$emit("copy", this.value);
|
this.$emit('copy', this.value)
|
||||||
},
|
},
|
||||||
toggleSettings: function () {
|
toggleSettings: function () {
|
||||||
this.show_settings = !this.show_settings;
|
this.show_settings = !this.show_settings
|
||||||
},
|
},
|
||||||
ustawieniaSave: function () {
|
ustawieniaSave: function () {
|
||||||
this.show_settings = false;
|
this.show_settings = false
|
||||||
this.onChange();
|
this.onChange()
|
||||||
},
|
},
|
||||||
rand: function (index) {
|
rand: function (index) {
|
||||||
return "column" + index + Math.random() * 100;
|
return 'column' + index + Math.random() * 100
|
||||||
},
|
},
|
||||||
|
setType: function (type) {
|
||||||
|
this.type = type
|
||||||
|
this.value.type = type
|
||||||
|
this.onChange()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {},
|
mounted: function () {
|
||||||
};
|
this.type = this.value.type
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
#pagebuilder {
|
#pagebuilder {
|
||||||
@@ -155,7 +151,7 @@ export default {
|
|||||||
.pb_section {
|
.pb_section {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
||||||
> div {
|
>div {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,6 +164,7 @@ export default {
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-icons-outlined {
|
.material-icons-outlined {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="form form-group">
|
<div class="form form-group">
|
||||||
<div class="ms-3">
|
<div class="ms-3">
|
||||||
<div class="mb-3" v-for="item, ii in items" :key="ii" :value="item">{{ item.name }} <button
|
<div class="mb-3 w-100" v-for="item, ii in items" :key="ii" :value="item"> <button
|
||||||
class="btn btn-outline-primary" @click="itemselected = item; changeSelect()">Wczytaj</button>
|
class="btn btn-outline-secondary w-100" @click="itemselected = item; changeSelect()">Wczytaj {{ item.name }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-show="items.length == 0"><i>Brak zapisanych szablonów</i></div>
|
<div v-show="items.length == 0"><i>Brak zapisanych szablonów</i></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
created() {
|
mounted() {
|
||||||
this.getPost();
|
this.getPost();
|
||||||
},
|
},
|
||||||
|
emits: ['update:modelValue','change'],
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
items: [],
|
items: [],
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export default {
|
|||||||
id: 0,
|
id: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
emits: ['update:modelValue','change'],
|
||||||
methods: {
|
methods: {
|
||||||
change() {
|
change() {
|
||||||
this.$emit("update:modelValue", {
|
this.$emit("update:modelValue", {
|
||||||
|
|||||||
@@ -1,117 +1,129 @@
|
|||||||
export default {
|
export default {
|
||||||
col_1: {
|
col_1: {
|
||||||
label: "1 kolumna ",
|
label: '1 kolumna ',
|
||||||
name: "col_1",
|
name: 'col_1',
|
||||||
class: "",
|
type: 'container',
|
||||||
columns: [{ name: "col-md-12", items: [] }],
|
class: '',
|
||||||
|
columns: [{ name: 'col-md-12', items: [], class: '', attribute: '' }]
|
||||||
},
|
},
|
||||||
col_2: {
|
col_2: {
|
||||||
label: "2 kolumny po 6 ",
|
label: '2 kolumny po 6 ',
|
||||||
name: "col_2",
|
name: 'col_2',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-6", items: [] },
|
{ name: 'col-md-6', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-6", items: [] },
|
{ name: 'col-md-6', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_4_8: {
|
col_4_8: {
|
||||||
label: "2 kolumny 2 i 8 ",
|
label: '2 kolumny 2 i 8 ',
|
||||||
name: "col_4_8",
|
name: 'col_4_8',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-4", items: [] },
|
{ name: 'col-md-4', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-8", items: [] },
|
{ name: 'col-md-8', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_8_4: {
|
col_8_4: {
|
||||||
label: "2 kolkumny 8 i 2 ",
|
label: '2 kolkumny 8 i 2 ',
|
||||||
name: "col_8_4",
|
name: 'col_8_4',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-8", items: [] },
|
{ name: 'col-md-8', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-4", items: [] },
|
{ name: 'col-md-4', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_2_10: {
|
col_2_10: {
|
||||||
label: "2 kolumny 2 i 10 ",
|
label: '2 kolumny 2 i 10 ',
|
||||||
name: "col_2_10",
|
name: 'col_2_10',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-10", items: [] },
|
{ name: 'col-md-10', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_10_2: {
|
col_10_2: {
|
||||||
label: "2 kolkumny 10 i 2 ",
|
label: '2 kolkumny 10 i 2 ',
|
||||||
name: "col_10_2",
|
name: 'col_10_2',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-10", items: [] },
|
{ name: 'col-md-10', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_3: {
|
col_3: {
|
||||||
label: "3 kolumny po 4 ",
|
label: '3 kolumny po 4 ',
|
||||||
name: "col_3",
|
name: 'col_3',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-4", items: [] },
|
{ name: 'col-md-4', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-4", items: [] },
|
{ name: 'col-md-4', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-4", items: [] },
|
{ name: 'col-md-4', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_3_6_3: {
|
col_3_6_3: {
|
||||||
label: "3 kolumny: 3 ,6, 3 ",
|
label: '3 kolumny: 3 ,6, 3 ',
|
||||||
name: "col_3_6_3",
|
name: 'col_3_6_3',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-6", items: [] },
|
{ name: 'col-md-6', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_6_3_3: {
|
col_6_3_3: {
|
||||||
label: "3 kolumny: 6,3,3 ",
|
label: '3 kolumny: 6,3,3 ',
|
||||||
name: "col_6_3_3",
|
name: 'col_6_3_3',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-6", items: [] },
|
{ name: 'col-md-6', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_3_3_6: {
|
col_3_3_6: {
|
||||||
label: "3 kolumny: 3,3,6 ",
|
label: '3 kolumny: 3,3,6 ',
|
||||||
name: "col_3_3_6",
|
name: 'col_3_3_6',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-6", items: [] },
|
{ name: 'col-md-6', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_4: {
|
col_4: {
|
||||||
label: "4 kolumny po 3 ",
|
label: '4 kolumny po 3 ',
|
||||||
name: "col_4",
|
name: 'col_4',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-3", items: [] },
|
{ name: 'col-md-3', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
col_6: {
|
col_6: {
|
||||||
label: "6 kolumn po 2 ",
|
label: '6 kolumn po 2 ',
|
||||||
name: "col_6",
|
name: 'col_6',
|
||||||
class: "",
|
type: 'container',
|
||||||
|
class: '',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' },
|
||||||
{ name: "col-md-2", items: [] },
|
{ name: 'col-md-2', items: [], class: '', attribute: '' }
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,200 +1,228 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="row m-0 p-0 align-items-center">
|
<div class="row m-0 p-0 align-items-center">
|
||||||
|
<div class="col-sm-12 col-md-6 p-0">
|
||||||
<div class="col-sm-12 col-md-6 p-0">
|
<span class="material-icons-outlined box-move me-2" style="cursor: move">open_with</span
|
||||||
<span class="material-icons-outlined box-move me-2" style="cursor:move;">open_with</span><span
|
><span class="font-weight-bold text-primary">{{ langs.label }}</span>
|
||||||
class="font-weight-bold text-primary">{{ langs.label }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-12 col-md-6 p-0 text-end">
|
|
||||||
<a href="#" @click.prevent="modalOpen" title="Edytuj" class="text-primary me-2"><i
|
|
||||||
class="material-icons-outlined">create</i></a>
|
|
||||||
<a href="#" title="Usuń" @click.prevent="removeItem()" class="text-danger"><i
|
|
||||||
class="material-icons-outlined">delete</i></a>
|
|
||||||
</div>
|
|
||||||
<b-modal v-model="modalBox" v-on:close="onCloseModal" :title="langs.label">
|
|
||||||
<div>
|
|
||||||
<div class="p-0 m-0">
|
|
||||||
<div class="form-group ">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.label }}</label>
|
|
||||||
<div class="input-group mb-3">
|
|
||||||
<input class="form-control" type="text" v-model="text" />
|
|
||||||
<button @click="chooseImage" class="btn btn-outline-secondary" type="button" id="button-addon2">Wybierz</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group ">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.title }}</label>
|
|
||||||
<input class="form-control" type="text" v-model="title" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group ">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.alt }}</label>
|
|
||||||
<input class="form-control" type="text" v-model="alt" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group ">
|
|
||||||
<label class="w-100 col-form-label">Legenda obrazka</label>
|
|
||||||
<input class="form-control" type="text" v-model="figcaption" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group ">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.scaling }}</label>
|
|
||||||
<select v-model="scale" class="form-select">
|
|
||||||
<option v-for="item, ii in scales" :key="ii" :value="item.key">{{ item.modelValue }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.href }}</label>
|
|
||||||
<input class="form-control" type="text" v-model="href" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<fieldset class="mt-3" v-show="scale == 'tak'">
|
|
||||||
<legend>{{ langs.proportions }}</legend>
|
|
||||||
Brak możliwości skalowania obrazków z zewnętrznego serwera.
|
|
||||||
<div class="form-group"><label class="w-100 col-form-label">{{ langs.width
|
|
||||||
}}</label><input class="form-control" v-model="width"></div>
|
|
||||||
<div class="form-group"><label class="w-100 col-form-label">{{ langs.height
|
|
||||||
}}</label><input class="form-control" v-model="height"></div>
|
|
||||||
<div class="form-group"><label class="w-100 col-form-label">{{ langs.ratio
|
|
||||||
}}</label><select class="form-select" v-model="ratio">
|
|
||||||
<option v-for="item, ri in ratios" :key="ri">{{ item }}</option>
|
|
||||||
</select></div>
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<img v-if="text" :src="text" style="max-width: 100%;" class="my-2">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="text-center mt-4"><button class="btn btn-outline-secondary mr-1"
|
|
||||||
@click.prevent="onCloseModal">{{
|
|
||||||
langs.saveclose
|
|
||||||
}}</button></div>
|
|
||||||
</b-modal>
|
|
||||||
|
|
||||||
<div v-if="text">
|
|
||||||
<img :src="text" style="width:100px;" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 col-md-6 p-0 text-end">
|
||||||
|
<a href="#" @click.prevent="modalOpen" title="Edytuj" class="text-primary me-2"
|
||||||
|
><i class="material-icons-outlined">create</i></a
|
||||||
|
>
|
||||||
|
<a href="#" title="Usuń" @click.prevent="removeItem()" class="text-danger"
|
||||||
|
><i class="material-icons-outlined">delete</i></a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<b-modal v-model="modalBox" v-on:close="onCloseModal" :title="langs.label">
|
||||||
|
<div>
|
||||||
|
<div class="p-0 m-0">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.label }}</label>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<input class="form-control" type="text" v-model="text" />
|
||||||
|
<button
|
||||||
|
@click="chooseImage"
|
||||||
|
class="btn btn-outline-secondary"
|
||||||
|
type="button"
|
||||||
|
id="button-addon2"
|
||||||
|
>
|
||||||
|
Wybierz
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.title }}</label>
|
||||||
|
<input class="form-control" type="text" v-model="title" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.alt }}</label>
|
||||||
|
<input class="form-control" type="text" v-model="alt" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">Legenda obrazka</label>
|
||||||
|
<input class="form-control" type="text" v-model="figcaption" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.scaling }}</label>
|
||||||
|
<select v-model="scale" class="form-select">
|
||||||
|
<option v-for="(item, ii) in scales" :key="ii" :value="item.key">
|
||||||
|
{{ item.modelValue }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.href }}</label>
|
||||||
|
<input class="form-control" type="text" v-model="href" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<fieldset class="mt-3" v-show="scale == 'tak'">
|
||||||
|
<legend>{{ langs.proportions }}</legend>
|
||||||
|
Brak możliwości skalowania obrazków z zewnętrznego serwera.
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.width }}</label
|
||||||
|
><input class="form-control" v-model="width" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.height }}</label
|
||||||
|
><input class="form-control" v-model="height" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ langs.ratio }}</label
|
||||||
|
><select class="form-select" v-model="ratio">
|
||||||
|
<option v-for="(item, ri) in ratios" :key="ri">{{ item }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">Używaj lightbox</label>
|
||||||
|
|
||||||
|
<select v-model="img_lightbox" class="form-select">
|
||||||
|
<option :value="false">NIE</option>
|
||||||
|
<option :value="true">TAK</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<img v-if="text" :src="text" style="max-width: 100%; max-height: 30vh; width: 100%;object-fit:contain;" class="my-2" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<button class="btn btn-outline-secondary mr-1" @click.prevent="onCloseModal">
|
||||||
|
{{ langs.saveclose }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</b-modal>
|
||||||
|
|
||||||
|
<div v-if="text">
|
||||||
|
<img :src="text" style="width: 100px" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import MagicoModal from './../MagicoModal.vue'
|
import MagicoModal from './../MagicoModal.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object,
|
modelValue: Object
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
langs: {
|
langs: {
|
||||||
saveclose: "Zapisz",
|
saveclose: 'Zapisz',
|
||||||
label: "Obrazek",
|
label: 'Obrazek',
|
||||||
close: "Zamknij",
|
close: 'Zamknij',
|
||||||
removefile: "<?=lang('pagebuilder_core_section_image_removefile')?>",
|
removefile: "<?=lang('pagebuilder_core_section_image_removefile')?>",
|
||||||
fileupload: "<?=lang('pagebuilder_core_section_image_fileupload')?>",
|
fileupload: "<?=lang('pagebuilder_core_section_image_fileupload')?>",
|
||||||
scaling: "Skalowanie",
|
scaling: 'Skalowanie',
|
||||||
scalingyes: "Tak",
|
scalingyes: 'Tak',
|
||||||
scalingno: "Nie",
|
scalingno: 'Nie',
|
||||||
proportions: "Proporcje",
|
proportions: 'Proporcje',
|
||||||
height: "Wysokość",
|
height: 'Wysokość',
|
||||||
width: "Szerokość",
|
width: 'Szerokość',
|
||||||
ratio: "Radio",
|
ratio: 'Radio',
|
||||||
href: "Adres URL",
|
href: 'Adres URL',
|
||||||
alt: "Tekst alternatywny",
|
alt: 'Tekst alternatywny',
|
||||||
title: "Tytuł",
|
title: 'Tytuł'
|
||||||
},
|
},
|
||||||
modalBox: false,
|
modalBox: false,
|
||||||
items: [],
|
items: [],
|
||||||
text: '',
|
text: '',
|
||||||
name: '',
|
name: '',
|
||||||
alt: '',
|
alt: '',
|
||||||
href: '',
|
href: '',
|
||||||
title: '',
|
title: '',
|
||||||
width: 1800,
|
width: 1800,
|
||||||
height: 600,
|
height: 600,
|
||||||
ratio: 'crop',
|
ratio: 'crop',
|
||||||
figcaption: '',
|
figcaption: '',
|
||||||
ratios: ['crop', 'auto', 'width', 'height'],
|
img_lightbox: true,
|
||||||
scales: [{
|
ratios: ['crop', 'auto', 'width', 'height'],
|
||||||
"key": "nie",
|
scales: [
|
||||||
"value": "Nie"
|
{
|
||||||
}, {
|
key: 'nie',
|
||||||
"key": "tak",
|
value: 'Nie'
|
||||||
"value": "Tak"
|
},
|
||||||
}],
|
{
|
||||||
scale: "Nie"
|
key: 'tak',
|
||||||
|
value: 'Tak'
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
scale: 'Nie'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
console.log('mount image', this.modelValue)
|
||||||
|
this.alt = this.modelValue && this.modelValue.alt ? this.modelValue.alt : this.alt
|
||||||
|
this.title = this.modelValue && this.modelValue.title ? this.modelValue.title : this.title
|
||||||
|
this.name = this.modelValue && this.modelValue.name ? this.modelValue.name : this.name
|
||||||
|
this.text = this.modelValue && this.modelValue.text ? this.modelValue.text : this.text
|
||||||
|
this.width = this.modelValue && this.modelValue.width ? this.modelValue.width : this.width
|
||||||
|
this.height = this.modelValue && this.modelValue.height ? this.modelValue.height : this.height
|
||||||
|
this.ratio = this.modelValue && this.modelValue.ratio ? this.modelValue.ratio : this.ratio
|
||||||
|
this.scale = this.modelValue && this.modelValue.scale ? this.modelValue.scale : this.scale
|
||||||
|
this.href = this.modelValue && this.modelValue.href ? this.modelValue.href : this.href
|
||||||
|
this.figcaption =
|
||||||
|
this.modelValue && this.modelValue.figcaption ? this.modelValue.figcaption : this.figcaption
|
||||||
|
this.img_lightbox =
|
||||||
|
this.modelValue && this.modelValue.img_lightbox
|
||||||
|
? this.modelValue.img_lightbox
|
||||||
|
: this.img_lightbox
|
||||||
|
if (this.modelValue.open) this.modalBox = true
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'b-modal': MagicoModal
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
removeItem: function () {
|
||||||
|
this.$emit('itemRemoved', this.modelValue)
|
||||||
},
|
},
|
||||||
mounted: function () {
|
chooseImage: function () {
|
||||||
console.log('mount image', this.modelValue);
|
if (this.$filechooser) {
|
||||||
this.alt = (this.modelValue && this.modelValue.alt) ? this.modelValue.alt : this.alt;
|
let vm = this
|
||||||
this.title = (this.modelValue && this.modelValue.title) ? this.modelValue.title : this.title;
|
this.$filechooser.open({
|
||||||
this.name = (this.modelValue && this.modelValue.name) ? this.modelValue.name : this.name;
|
chooseCallback: function (ev) {
|
||||||
this.text = (this.modelValue && this.modelValue.text) ? this.modelValue.text : this.text;
|
vm.text = ev.publicUrl
|
||||||
this.width = (this.modelValue && this.modelValue.width) ? this.modelValue.width : this.width;
|
}
|
||||||
this.height = (this.modelValue && this.modelValue.height) ? this.modelValue.height : this.height;
|
})
|
||||||
this.ratio = (this.modelValue && this.modelValue.ratio) ? this.modelValue.ratio : this.ratio;
|
} else {
|
||||||
this.scale = (this.modelValue && this.modelValue.scale) ? this.modelValue.scale : this.scale;
|
alert('No FileChooser implemented')
|
||||||
this.href = (this.modelValue && this.modelValue.href) ? this.modelValue.href : this.href;
|
}
|
||||||
this.figcaption = (this.modelValue && this.modelValue.figcaption) ? this.modelValue.figcaption : this.figcaption;
|
|
||||||
|
|
||||||
if (this.modelValue.open) this.modalBox = true;
|
|
||||||
},
|
},
|
||||||
components: {
|
onCloseModal: function () {
|
||||||
'b-modal': MagicoModal,
|
this.modalBox = false
|
||||||
|
this.$emit('update:modelValue', {
|
||||||
|
name: this.name,
|
||||||
|
text: this.text,
|
||||||
|
height: this.height,
|
||||||
|
width: this.width,
|
||||||
|
ratio: this.ratio,
|
||||||
|
scale: this.scale,
|
||||||
|
alt: this.alt,
|
||||||
|
href: this.href,
|
||||||
|
title: this.title,
|
||||||
|
figcaption: this.figcaption,
|
||||||
|
img_lightbox: this.img_lightbox
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
setText: function (item) {
|
||||||
removeItem: function () {
|
this.text = 'files/images/' + item
|
||||||
this.$emit('itemRemoved', this.modelValue);
|
this.$emit('update:modelValue', {
|
||||||
},
|
name: this.name,
|
||||||
chooseImage: function () {
|
text: this.text,
|
||||||
if (this.$filechooser) {
|
height: this.height,
|
||||||
let vm = this;
|
width: this.width,
|
||||||
this.$filechooser.open({
|
ratio: this.ratio,
|
||||||
chooseCallback: function (ev) {
|
scale: this.scale,
|
||||||
vm.text = ev.publicUrl
|
alt: this.alt,
|
||||||
}
|
href: this.href,
|
||||||
})
|
title: this.title,
|
||||||
}else{
|
figcaption: this.figcaption,
|
||||||
alert('No FileChooser implemented')
|
img_lightbox: this.img_lightbox
|
||||||
}
|
})
|
||||||
},
|
|
||||||
onCloseModal: function () {
|
|
||||||
this.modalBox = false;
|
|
||||||
this.$emit('update:modelValue', {
|
|
||||||
name: this.name,
|
|
||||||
text: this.text,
|
|
||||||
height: this.height,
|
|
||||||
width: this.width,
|
|
||||||
ratio: this.ratio,
|
|
||||||
scale: this.scale,
|
|
||||||
alt: this.alt,
|
|
||||||
href: this.href,
|
|
||||||
title: this.title,
|
|
||||||
figcaption: this.figcaption,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
setText: function (item) {
|
|
||||||
this.text = 'files/images/' + item;
|
|
||||||
this.$emit('update:modelValue', {
|
|
||||||
name: this.name,
|
|
||||||
text: this.text,
|
|
||||||
height: this.height,
|
|
||||||
width: this.width,
|
|
||||||
ratio: this.ratio,
|
|
||||||
scale: this.scale,
|
|
||||||
alt: this.alt,
|
|
||||||
href: this.href,
|
|
||||||
title: this.title,
|
|
||||||
figcaption: this.figcaption,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
modalOpen: function () {
|
|
||||||
this.modalBox = !this.modalBox;
|
|
||||||
//this.getItems();
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
modalOpen: function () {
|
||||||
};
|
this.modalBox = !this.modalBox
|
||||||
|
//this.getItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,124 +1,149 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row m-0 p-0 align-items-center">
|
<div class="row m-0 p-0 align-items-center">
|
||||||
<div class="col-sm-12 col-md-6 p-0 mb-0">
|
<div class="col-sm-12 col-md-6 p-0 mb-0">
|
||||||
<span class="material-icons-outlined me-1 box-move" style="cursor:move;">open_with</span><span
|
<span class="material-icons-outlined me-1 box-move" style="cursor: move">open_with</span
|
||||||
class="font-weight-bold text-primary">{{ langs.label }}</span>
|
><span class="font-weight-bold text-primary">{{ t('pagebuilder.widget_text') }}</span>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-12 col-md-6 p-0 text-end">
|
|
||||||
<a href="#" @click.prevent="modalBox = !modalBox" title="Edytuj" class="text-primary me-2"><i
|
|
||||||
class="material-icons-outlined">create</i></a>
|
|
||||||
<a href="#" title="Usuń" @click.prevent="removeItem()" class="text-danger"><i
|
|
||||||
class="material-icons-outlined">delete</i></a>
|
|
||||||
</div>
|
|
||||||
<div class="ms-2">
|
|
||||||
<strong class="font-weight-bold">{{ langs.type }}:</strong> {{ h_type }},
|
|
||||||
<strong class="font-weight-bold">{{ langs.content }}:</strong> {{ (text) ? text : ' ' }}
|
|
||||||
</div>
|
|
||||||
<b-modal v-model="modalBox" :title="langs.label" @close="onCloseModal">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.content }}</label>
|
|
||||||
<input class="form-control" type="text" v-model="text" />
|
|
||||||
</div>
|
|
||||||
<div class="form-grou mb-2">
|
|
||||||
<label class="w-100 col-form-label">{{ langs.type }}</label>
|
|
||||||
<select class="form-select" v-model="h_type">
|
|
||||||
<option value="">{{ langs.typeplaintext }}</option>
|
|
||||||
<option value="h1">{{ langs.typeheader }} 1</option>
|
|
||||||
<option value="h2">{{ langs.typeheader }} 2</option>
|
|
||||||
<option value="h3">{{ langs.typeheader }} 3</option>
|
|
||||||
<option value="h4">{{ langs.typeheader }} 4</option>
|
|
||||||
<option value="h5">{{ langs.typeheader }} 5</option>
|
|
||||||
<option value="h6">{{ langs.typeheader }} 6</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="w-100 col-form-label">Wyrównanie</label>
|
|
||||||
<div class="">
|
|
||||||
<button v-tooltip title="Wyrównanie do lewej" @click="align = 'left'" class="btn btn-icon-sm "
|
|
||||||
:class="align == 'left' ? 'btn-primary' : 'btn-outline-primary'">
|
|
||||||
<span class="material-icons-outlined">format_align_left</span>
|
|
||||||
</button>
|
|
||||||
<button v-tooltip title="Wyrównanie do środka" @click="align = 'center'" class="btn btn-icon-sm "
|
|
||||||
:class="align == 'center' ? 'btn-primary' : 'btn-outline-primary'">
|
|
||||||
<span class="material-icons-outlined">format_align_center</span>
|
|
||||||
</button>
|
|
||||||
<button v-tooltip title="Wyrównanie do prawej" @click="align = 'right'" class="btn btn-icon-sm "
|
|
||||||
:class="align == 'right' ? 'btn-primary' : 'btn-outline-primary'">
|
|
||||||
<span class="material-icons-outlined">format_align_right</span>
|
|
||||||
</button>
|
|
||||||
<button v-tooltip title="Justowanie" @click="align = 'justify'" class="btn btn-icon-sm "
|
|
||||||
:class="align == 'justify' ? 'btn-primary' : 'btn-outline-primary'">
|
|
||||||
<span class="material-icons-outlined">format_align_justify</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-center"><button class="btn btn-outline-secondary me-1" @click.prevent="onCloseModal">{{
|
|
||||||
langs.saveclose
|
|
||||||
}}</button></div>
|
|
||||||
</b-modal>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 col-md-6 p-0 text-end">
|
||||||
|
<a href="#" @click.prevent="modalBox = !modalBox" title="Edytuj" class="text-primary me-2"
|
||||||
|
><i class="material-icons-outlined">create</i></a
|
||||||
|
>
|
||||||
|
<a href="#" title="Usuń" @click.prevent="removeItem()" class="text-danger"
|
||||||
|
><i class="material-icons-outlined">delete</i></a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="ms-2">
|
||||||
|
<strong class="font-weight-bold">{{ t('pagebuilder.type') }}:</strong> {{ h_type }},
|
||||||
|
<strong class="font-weight-bold">{{ t('pagebuilder.content') }}:</strong> {{ text ? text : ' ' }}
|
||||||
|
</div>
|
||||||
|
<b-modal v-model="modalBox" :title="t('pagebuilder.widget_text')" @close="onCloseModal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ t('pagebuilder.content') }}</label>
|
||||||
|
<input class="form-control" type="text" v-model="text" />
|
||||||
|
</div>
|
||||||
|
<div class="form-grou mb-2">
|
||||||
|
<label class="w-100 col-form-label">{{ t('pagebuilder.type') }}</label>
|
||||||
|
<select class="form-select" v-model="h_type">
|
||||||
|
<option value="">{{ langs.typeplaintext }}</option>
|
||||||
|
<option value="h1">{{ langs.typeheader }} 1</option>
|
||||||
|
<option value="h2">{{ langs.typeheader }} 2</option>
|
||||||
|
<option value="h3">{{ langs.typeheader }} 3</option>
|
||||||
|
<option value="h4">{{ langs.typeheader }} 4</option>
|
||||||
|
<option value="h5">{{ langs.typeheader }} 5</option>
|
||||||
|
<option value="h6">{{ langs.typeheader }} 6</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{ t('pagebuilder.align') }}</label>
|
||||||
|
<div class="">
|
||||||
|
<button
|
||||||
|
vx-tooltip
|
||||||
|
title="Wyrównanie do lewej"
|
||||||
|
@click="align = 'left'"
|
||||||
|
class="btn btn-icon-sm"
|
||||||
|
:class="align == 'left' ? 'btn-primary' : 'btn-outline-primary'"
|
||||||
|
>
|
||||||
|
<span class="material-icons-outlined">format_align_left</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
vx-tooltip
|
||||||
|
title="Wyrównanie do środka"
|
||||||
|
@click="align = 'center'"
|
||||||
|
class="btn btn-icon-sm"
|
||||||
|
:class="align == 'center' ? 'btn-primary' : 'btn-outline-primary'"
|
||||||
|
>
|
||||||
|
<span class="material-icons-outlined">format_align_center</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
vx-tooltip
|
||||||
|
title="Wyrównanie do prawej"
|
||||||
|
@click="align = 'right'"
|
||||||
|
class="btn btn-icon-sm"
|
||||||
|
:class="align == 'right' ? 'btn-primary' : 'btn-outline-primary'"
|
||||||
|
>
|
||||||
|
<span class="material-icons-outlined">format_align_right</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
vx-tooltip
|
||||||
|
title="Justowanie"
|
||||||
|
@click="align = 'justify'"
|
||||||
|
class="btn btn-icon-sm"
|
||||||
|
:class="align == 'justify' ? 'btn-primary' : 'btn-outline-primary'"
|
||||||
|
>
|
||||||
|
<span class="material-icons-outlined">format_align_justify</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<button class="btn btn-outline-secondary me-1" @click.prevent="onCloseModal">
|
||||||
|
{{ langs.saveclose }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</b-modal>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
import MagicoModal from './../MagicoModal.vue'
|
import MagicoModal from './../MagicoModal.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
'b-modal': MagicoModal,
|
'b-modal': MagicoModal
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object
|
modelValue: Object
|
||||||
},
|
},
|
||||||
emits:['update:modelValue'],
|
setup() {
|
||||||
data: function () {
|
const { t } = useI18n()
|
||||||
return {
|
return { t }
|
||||||
langs: {
|
},
|
||||||
label: "Tekst",
|
emits: ['update:modelValue'],
|
||||||
close: "Zaknij",
|
data: function () {
|
||||||
content: "Treść",
|
return {
|
||||||
type: "Typ",
|
langs: {
|
||||||
typeplaintext: "Tekst",
|
label: 'Tekst',
|
||||||
typeheader: "Nagłowek",
|
close: 'Zaknij',
|
||||||
saveclose: "Zapisz"
|
content: 'Treść',
|
||||||
},
|
type: 'Typ',
|
||||||
modalBox: false,
|
typeplaintext: 'Tekst',
|
||||||
text: '',
|
typeheader: 'Nagłowek',
|
||||||
name: '',
|
saveclose: 'Zapisz'
|
||||||
h_type: '',
|
},
|
||||||
align: 'left',
|
modalBox: false,
|
||||||
}
|
text: '',
|
||||||
},
|
name: '',
|
||||||
mounted: function () {
|
h_type: '',
|
||||||
this.name = (this.modelValue && this.modelValue.name) ? this.modelValue.name : this.name;
|
align: 'left'
|
||||||
this.text = (this.modelValue && this.modelValue.text) ? this.modelValue.text : this.text;
|
|
||||||
this.h_type = (this.modelValue && this.modelValue.h_type) ? this.modelValue.h_type : this.h_type;
|
|
||||||
this.align = (this.modelValue && this.modelValue.align) ? this.modelValue.align : this.align;
|
|
||||||
if (this.modelValue.open) this.modalBox = true;
|
|
||||||
console.log('mounted text');
|
|
||||||
this.$emit('update:modelValue', this.modelValue);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
removeItem: function () {
|
|
||||||
this.$emit('itemRemoved', this.modelValue);
|
|
||||||
},
|
|
||||||
onCloseModal: function () {
|
|
||||||
this.modalBox = false;
|
|
||||||
this.$emit('update:modelValue', {
|
|
||||||
name: this.name,
|
|
||||||
text: this.text,
|
|
||||||
h_type: this.h_type,
|
|
||||||
align: this.align,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
destroy() {
|
|
||||||
this.modalBox = false;
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
this.name = this.modelValue && this.modelValue.name ? this.modelValue.name : this.name
|
||||||
|
this.text = this.modelValue && this.modelValue.text ? this.modelValue.text : this.text
|
||||||
|
this.h_type = this.modelValue && this.modelValue.h_type ? this.modelValue.h_type : this.h_type
|
||||||
|
this.align = this.modelValue && this.modelValue.align ? this.modelValue.align : this.align
|
||||||
|
if (this.modelValue.open) this.modalBox = true
|
||||||
|
console.log('mounted text')
|
||||||
|
this.$emit('update:modelValue', this.modelValue)
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
removeItem: function () {
|
||||||
|
this.$emit('itemRemoved', this.modelValue)
|
||||||
|
},
|
||||||
|
onCloseModal: function () {
|
||||||
|
this.modalBox = false
|
||||||
|
this.$emit('update:modelValue', {
|
||||||
|
name: this.name,
|
||||||
|
text: this.text,
|
||||||
|
h_type: this.h_type,
|
||||||
|
align: this.align
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroy() {
|
||||||
|
this.modalBox = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,107 +1,155 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row m-0 p-0 align-items-center">
|
<div class="row m-0 p-0 align-items-center">
|
||||||
<div class="col-sm-12 col-md-6 p-0">
|
<div class="col-sm-12 col-md-6 p-0">
|
||||||
<span class="material-icons-outlined box-move me-2" style="cursor:move;">open_with</span><span
|
<span class="material-icons-outlined box-move me-2" style="cursor: move">open_with</span
|
||||||
class="font-weight-bold text-primary">{{ langs.label }}</span>
|
><span class="font-weight-bold text-primary">{{ t('pagebuilder.widget_textarea') }}</span>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-12 col-md-6 p-0 text-end">
|
|
||||||
<a href="#" @click.prevent="modalBox = !modalBox" title="Edytuj" class="text-primary me-2"><i
|
|
||||||
class="material-icons-outlined">create</i></a>
|
|
||||||
<b-modal no-enforce-focus class_other="modal-xl" v-model="modalBox" :title="langs.label"
|
|
||||||
v-on:hide="onCloseModal">
|
|
||||||
<div class="mb-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<editor api-key="no-api-key" rows="12" class="form-control" v-model="text" :init="vtinymce" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex"><button class="btn btn-outline-secondary m-auto" @click.prevent="onCloseModal">{{
|
|
||||||
langs.saveclose
|
|
||||||
}}</button></div>
|
|
||||||
</b-modal>
|
|
||||||
<a href="#" title="Usuń" @click.prevent="removeItem()" class="text-danger"><i
|
|
||||||
class="material-icons-outlined">delete</i></a>
|
|
||||||
</div>
|
|
||||||
<div class="ms-4" style="color: #a9a9a9" v-html="ctext"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 col-md-6 p-0 text-end">
|
||||||
|
<a href="#" @click.prevent="openModal" title="Edytuj" class="text-primary me-2"
|
||||||
|
><i class="material-icons-outlined">create</i></a
|
||||||
|
>
|
||||||
|
<b-modal
|
||||||
|
no-enforce-focus
|
||||||
|
class_other="modal-xl"
|
||||||
|
v-model="modalBox"
|
||||||
|
:title="t('pagebuilder.widget_textarea')"
|
||||||
|
v-on:hide="onCloseModal"
|
||||||
|
>
|
||||||
|
<div style="min-height: 400px">
|
||||||
|
<div class="mb-4" v-if="delayModal">
|
||||||
|
<div class="form-group">
|
||||||
|
<editor
|
||||||
|
api-key="no-api-key"
|
||||||
|
rows="12"
|
||||||
|
class="form-control"
|
||||||
|
v-model="text"
|
||||||
|
:init="{ ...vtinymce, language: locale }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex">
|
||||||
|
<button class="btn btn-outline-secondary m-auto" @click.prevent="onCloseModal">
|
||||||
|
{{ t('pagebuilder.save') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</b-modal>
|
||||||
|
<a href="#" title="Usuń" @click.prevent="removeItem()" class="text-danger"
|
||||||
|
><i class="material-icons-outlined">delete</i></a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="ms-4" style="color: #a9a9a9" v-html="ctext"></div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import MagicoModal from './../MagicoModal.vue'
|
import MagicoModal from './../MagicoModal.vue'
|
||||||
import tinymceConfig from '../tinymce/config.js'
|
import tinymceConfig from '../tinymce/config.js'
|
||||||
|
|
||||||
import Editor from '@tinymce/tinymce-vue'
|
import Editor from '@tinymce/tinymce-vue'
|
||||||
|
import { nextTick } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
export default {
|
export default {
|
||||||
emits:['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
components: {
|
components: {
|
||||||
'b-modal': MagicoModal,
|
'b-modal': MagicoModal,
|
||||||
|
|
||||||
'editor': Editor // <- To jest TINYMCE
|
editor: Editor // <- To jest TINYMCE
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object
|
modelValue: Object
|
||||||
},
|
},
|
||||||
mounted: function () {
|
setup() {
|
||||||
this.name = (this.modelValue && this.modelValue.name) ? this.modelValue.name : this.name;
|
const { t, locale } = useI18n()
|
||||||
this.text = (this.modelValue && this.modelValue.text) ? this.modelValue.text : this.text;
|
return { t, locale }
|
||||||
if (this.modelValue.open) this.modalBox = true;
|
},
|
||||||
console.log('mounted textarea');
|
mounted: function () {
|
||||||
this.$emit('update:modelValue', this.modelValue);
|
let vm = this
|
||||||
|
this.name = this.modelValue && this.modelValue.name ? this.modelValue.name : this.name
|
||||||
|
this.text = this.modelValue && this.modelValue.text ? this.modelValue.text : this.text
|
||||||
|
if (this.modelValue.open) {
|
||||||
|
this.modalBox = true
|
||||||
|
setTimeout(function () {
|
||||||
|
vm.delayModal = true
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
console.log('mounted textarea')
|
||||||
|
this.$emit('update:modelValue', this.modelValue)
|
||||||
|
},
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
langs: {
|
||||||
|
saveclose: 'Zapisz',
|
||||||
|
label: 'Pole tekstowe',
|
||||||
|
close: 'Zamknij'
|
||||||
|
},
|
||||||
|
height: window.innerHeight - window.innerHeight / 4,
|
||||||
|
modalBox: false,
|
||||||
|
delayModal: false,
|
||||||
|
editor: null,
|
||||||
|
text: '',
|
||||||
|
name: 'core_section_textarea',
|
||||||
|
vtinymce: Object.assign(tinymceConfig, {
|
||||||
|
|
||||||
},
|
file_picker_callback: (callback) => {
|
||||||
data: function () {
|
if (this.$filechooser) {
|
||||||
return {
|
this.$filechooser.open({
|
||||||
langs: {
|
chooseCallback: function (ev) {
|
||||||
saveclose: "Zapisz",
|
console.log('filePathChosed', ev)
|
||||||
label: "Pole tekstowe",
|
callback(ev.publicUrl)
|
||||||
close: "Zamknij"
|
}
|
||||||
},
|
|
||||||
height: window.innerHeight - window.innerHeight / 4,
|
|
||||||
modalBox: false,
|
|
||||||
text: '',
|
|
||||||
name: 'core_section_textarea',
|
|
||||||
vtinymce: Object.assign(tinymceConfig, {
|
|
||||||
file_picker_callback: (callback) => {
|
|
||||||
if (this.$filechooser) {
|
|
||||||
this.$filechooser.open({
|
|
||||||
chooseCallback: function (ev) {
|
|
||||||
console.log('filePathChosed', ev)
|
|
||||||
callback(ev.publicUrl);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
modalBox: function () {
|
|
||||||
if (this.modalBox) {
|
|
||||||
document.addEventListener('focusin', (e) => {
|
|
||||||
if (e.target.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root") !== null) {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.log('focus');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
ctext: function () {
|
|
||||||
return this.modelValue.text ? this.modelValue.text.replace(/<(?:.|\n)*?>/gm, '') : '';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
removeItem: function () {
|
|
||||||
this.$emit('itemRemoved', this.modelValue);
|
|
||||||
},
|
|
||||||
onCloseModal: function () {
|
|
||||||
this.modalBox = false;
|
|
||||||
this.$emit('update:modelValue', {
|
|
||||||
name: this.name,
|
|
||||||
text: this.text,
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
modalBox: function () {
|
||||||
|
if (this.modalBox) {
|
||||||
|
document.addEventListener('focusin', (e) => {
|
||||||
|
if (
|
||||||
|
e.target.closest('.tox-tinymce-aux, .moxman-window, .tam-assetmanager-root') !== null
|
||||||
|
) {
|
||||||
|
e.stopImmediatePropagation()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log('focus')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
ctext: function () {
|
||||||
|
return this.modelValue.text ? this.modelValue.text.replace(/<(?:.|\n)*?>/gm, '') : ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openModal: function () {
|
||||||
|
let vm = this
|
||||||
|
this.modalBox = true
|
||||||
|
setTimeout(function () {
|
||||||
|
vm.delayModal = true
|
||||||
|
}, 200)
|
||||||
|
// nextTick(() => {
|
||||||
|
// vm.delayModal = true
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
|
removeItem: function () {
|
||||||
|
this.$emit('itemRemoved', this.modelValue)
|
||||||
|
},
|
||||||
|
onCloseModal: function () {
|
||||||
|
setTimeout(
|
||||||
|
function () {
|
||||||
|
this.modalBox = false
|
||||||
|
this.delayModal = false
|
||||||
|
this.$emit('update:modelValue', {
|
||||||
|
name: this.name,
|
||||||
|
text: this.text
|
||||||
|
})
|
||||||
|
}.bind(this),
|
||||||
|
200
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
211
src/components/plugin/SectionVideo.vue
Normal file
211
src/components/plugin/SectionVideo.vue
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
<template>
|
||||||
|
<div class="row m-0 p-0 align-items-center">
|
||||||
|
<div class="col-sm-12 col-md-6 p-0">
|
||||||
|
<span class="material-icons-outlined box-move me-2 my-1" style="cursor: move">open_with</span>
|
||||||
|
<span class="font-weight-bold text-primary">{{
|
||||||
|
t('pagebuilder.core_section_video')
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 col-md-6 p-0 text-end">
|
||||||
|
<a href="#" @click.prevent="toggleModal" title="Edytuj" class="text-primary me-2 my-1">
|
||||||
|
<i class="material-icons-outlined">create</i>
|
||||||
|
</a>
|
||||||
|
<MagicoModal
|
||||||
|
v-model="modalBox"
|
||||||
|
v-on:close="onCloseModal"
|
||||||
|
size="xl"
|
||||||
|
:title="t('pagebuilder.core_section_video')"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
@click.prevent="changeView('youtube')"
|
||||||
|
:class="type == 'youtube' ? 'btn-secondary' : 'btn-outline-secondary'"
|
||||||
|
class="btn me-1 my-1"
|
||||||
|
>
|
||||||
|
Youtube
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click.prevent="changeView('vimeo')"
|
||||||
|
:class="type == 'vimeo' ? 'btn-secondary' : 'btn-outline-secondary'"
|
||||||
|
class="btn me-1 my-1"
|
||||||
|
>
|
||||||
|
Vimeo
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click.prevent="changeView('file')"
|
||||||
|
:class="type == 'file' ? 'btn-secondary' : 'btn-outline-secondary'"
|
||||||
|
class="btn me-1 my-1"
|
||||||
|
>
|
||||||
|
{{ t('pagebuilder.core_section_video_file') }}
|
||||||
|
</button>
|
||||||
|
<div v-if="type === 'youtube'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{
|
||||||
|
t('pagebuilder.core_section_video_ytlink')
|
||||||
|
}}</label>
|
||||||
|
<input
|
||||||
|
@change="generateYouTubeEmbedCode"
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
v-model="link"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{
|
||||||
|
t('pagebuilder.core_section_video_ytcode')
|
||||||
|
}}</label>
|
||||||
|
<textarea class="form-control" v-model="text"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="type === 'vimeo'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{
|
||||||
|
t('pagebuilder.core_section_video_vimeocode')
|
||||||
|
}}</label>
|
||||||
|
<textarea class="form-control" v-model="text"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="type === 'file'">
|
||||||
|
<!-- <div>
|
||||||
|
<button
|
||||||
|
class="btn btn-outline-secondary me-1 my-1"
|
||||||
|
v-for="item in items"
|
||||||
|
:key="item"
|
||||||
|
@click.prevent="setText(item)"
|
||||||
|
@dblclick="deleteItem(item)"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div> -->
|
||||||
|
<div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="w-100 col-form-label">{{
|
||||||
|
t('pagebuilder.core_section_video_title')
|
||||||
|
}}</label>
|
||||||
|
<input class="form-control" type="text" v-model="text" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-end mt-4">
|
||||||
|
<button class="btn btn-outline-secondary me-1 my-1" @click.prevent="onCloseModal">
|
||||||
|
{{ t('pagebuilder.save') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</MagicoModal>
|
||||||
|
<a href="#" title="Usuń" @click.prevent="removeItem" class="text-danger">
|
||||||
|
<i class="material-icons-outlined">delete</i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong class="font-weight-bold">{{ t('pagebuilder.core_section_video_title') }}:</strong>
|
||||||
|
{{ text || ' ' }}<br />
|
||||||
|
<strong class="font-weight-bold">{{ t('pagebuilder.core_section_video_type') }}:</strong>
|
||||||
|
{{ type }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import axios from 'axios'
|
||||||
|
import MagicoModal from '../MagicoModal.vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
export default {
|
||||||
|
name: 'CoreSectionVideo',
|
||||||
|
components: {
|
||||||
|
MagicoModal
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
modelValue: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const modalBox = ref(false)
|
||||||
|
const items = ref([])
|
||||||
|
const type = ref('file')
|
||||||
|
const text = ref('')
|
||||||
|
const link = ref('')
|
||||||
|
const name = ref('')
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(newValue) => {
|
||||||
|
name.value = newValue?.name || ''
|
||||||
|
text.value = newValue?.text || ''
|
||||||
|
type.value = newValue?.type || 'file'
|
||||||
|
if (newValue?.open) modalBox.value = true
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
const toggleModal = () => {
|
||||||
|
modalBox.value = !modalBox.value
|
||||||
|
getItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
const onCloseModal = () => {
|
||||||
|
modalBox.value = false
|
||||||
|
emit('update:modelValue', { name: name.value, text: text.value, type: type.value })
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeView = (viewType) => {
|
||||||
|
type.value = viewType
|
||||||
|
}
|
||||||
|
|
||||||
|
const setText = (item) => {
|
||||||
|
type.value = 'file'
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteItem = (item) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateYouTubeEmbedCode = () => {
|
||||||
|
const urlParams = new URLSearchParams(new URL(link.value).search)
|
||||||
|
const videoId = urlParams.get('v')
|
||||||
|
text.value = videoId
|
||||||
|
? `<iframe width="560" height="315" src="https://www.youtube.com/embed/${videoId}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`
|
||||||
|
: t('Nieprawidłowy link do YouTube.')
|
||||||
|
}
|
||||||
|
|
||||||
|
const getItems = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const finishUpload = (e) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeItem = () => {
|
||||||
|
emit('itemRemoved', props.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
t,
|
||||||
|
modalBox,
|
||||||
|
items,
|
||||||
|
type,
|
||||||
|
text,
|
||||||
|
link,
|
||||||
|
name,
|
||||||
|
toggleModal,
|
||||||
|
onCloseModal,
|
||||||
|
changeView,
|
||||||
|
setText,
|
||||||
|
deleteItem,
|
||||||
|
generateYouTubeEmbedCode,
|
||||||
|
getItems,
|
||||||
|
finishUpload,
|
||||||
|
removeItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,16 +1,20 @@
|
|||||||
import PagebuilderSectionPlugin from "../../../magico-section/src/components/PagebuilderSectionPlugin.vue";
|
import PagebuilderSectionPlugin from 'magico-section/src/components/PagebuilderSectionPlugin.vue'
|
||||||
|
|
||||||
export function useSections() {
|
export function useSections() {
|
||||||
console.log('DUPA',PagebuilderSectionPlugin);
|
function register(vm, sections) {
|
||||||
function register(vm) {
|
console.log('sections', sections, vm)
|
||||||
vm.registerPlugin(
|
sections.forEach((item) => {
|
||||||
"SectionX1",
|
vm.registerPlugin(
|
||||||
{
|
'Sections' + item.site_section_id,
|
||||||
label: "Sekcja 1",
|
{
|
||||||
svg_off: ``,
|
label: item.title,
|
||||||
},
|
svg_off: ``,
|
||||||
PagebuilderSectionPlugin
|
section_id: item.section_id,
|
||||||
);
|
image: item.image
|
||||||
|
},
|
||||||
|
PagebuilderSectionPlugin
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return { register };
|
return { register }
|
||||||
}
|
}
|
||||||
|
|||||||
54
src/components/tinymce/ai.js
Normal file
54
src/components/tinymce/ai.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
export function addAI(editor) {
|
||||||
|
editor.ui.registry.addButton('ai_button', {
|
||||||
|
text: 'Wygeneruj treść AI',
|
||||||
|
onAction: async function () {
|
||||||
|
open({
|
||||||
|
callback: (data) => {
|
||||||
|
editor.setContent(data.content || '<p>Brak treści</p>')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// const count = 1000
|
||||||
|
// const lang = 'pl'
|
||||||
|
// const prompt = `Twoim zadaniem jest stworzenie nowego wpisu na stronę www na podstawie dostarczonej treści strony.
|
||||||
|
// Do "content" wstaw tekst w formacie HTML, jako akapity dla edytora WYSIWYG na podstawie dostarczonej treści na maksymalnie ${count} znaków.
|
||||||
|
// Metatagi wygeneruj na podstawie wygenerowanej przez ciebie treści.
|
||||||
|
// Odpowiedź wygeneruj w języku określanym przez kod kraju: "${lang}".
|
||||||
|
// Wynik zwróć jako czysty JSON bez dodatkowego formatowania, bez używania \`\`\`json i \`\`\`, bez używania \`\`\`html i \`\`\`:
|
||||||
|
// {
|
||||||
|
// "title": "",
|
||||||
|
// "page_title": "",
|
||||||
|
// "meta_description": "",
|
||||||
|
// "meta_keywords": "",
|
||||||
|
// "og_title": "",
|
||||||
|
// "og_description": "",
|
||||||
|
// "content": ""
|
||||||
|
// }`
|
||||||
|
|
||||||
|
// // Tu możesz wysłać zapytanie do swojego endpointa lub OpenAI
|
||||||
|
// const response = await fetch('/api/generate', {
|
||||||
|
// method: 'POST',
|
||||||
|
// headers: { 'Content-Type': 'application/json' },
|
||||||
|
// body: JSON.stringify({ prompt })
|
||||||
|
// })
|
||||||
|
|
||||||
|
// const data = await response.json()
|
||||||
|
// editor.setContent(data.content || '<p>Brak treści</p>')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
import { createApp, h } from 'vue'
|
||||||
|
import AIModal from '../AIModal.vue'
|
||||||
|
|
||||||
|
export function open(props = {}) {
|
||||||
|
const app = createApp({
|
||||||
|
render: () => h(AIModal, props)
|
||||||
|
})
|
||||||
|
|
||||||
|
const mountNode = document.createElement('div')
|
||||||
|
document.body.appendChild(mountNode)
|
||||||
|
app.mount(mountNode)
|
||||||
|
|
||||||
|
return app
|
||||||
|
}
|
||||||
@@ -1,118 +1,168 @@
|
|||||||
|
import { addAI } from './ai'
|
||||||
export default {
|
export default {
|
||||||
autoresize_max_height: window.innerHeight - window.innerHeight / 4,
|
autoresize_max_height: window.innerHeight - window.innerHeight / 4,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
selector: "textarea.wysiwyg",
|
selector: 'textarea.wysiwyg',
|
||||||
language: "pl",
|
language: 'pl',
|
||||||
language_url: 'https://cdn.magico.pl/tinymce/langs/pl.js',
|
language_url: 'https://cdn.magico.pl/tinymce/langs/pl.js',
|
||||||
forced_root_block: "p",
|
forced_root_block: 'p',
|
||||||
entity_encoding: 'named',
|
entity_encoding: 'named',
|
||||||
entities: '160,nbsp,38,amp,60,lt,62,gt',
|
entities: '160,nbsp,38,amp,60,lt,62,gt',
|
||||||
valid_elements: '*[*]',
|
valid_elements: '*[*]',
|
||||||
document_base_url: window.location,
|
document_base_url: window.location,
|
||||||
relative_urls: false,
|
relative_urls: false,
|
||||||
browser_spellcheck: true,
|
browser_spellcheck: true,
|
||||||
autoresize_bottom_margin: 10,
|
autoresize_bottom_margin: 10,
|
||||||
autoresize_min_height: 90,
|
autoresize_min_height: 90,
|
||||||
image_caption: true,
|
image_caption: true,
|
||||||
image_description: true,
|
image_description: true,
|
||||||
image_title: true,
|
image_title: true,
|
||||||
promotion: false,
|
promotion: false,
|
||||||
visualblocks_default_state: true,
|
visualblocks_default_state: true,
|
||||||
visualchars_default_state: false,
|
visualchars_default_state: false,
|
||||||
formats: {
|
setup(editor) {
|
||||||
mainparagraph: {
|
addAI(editor)
|
||||||
inline: 'span',
|
},
|
||||||
styles: {
|
formats: {
|
||||||
fontSize: '18px'
|
mainparagraph: {
|
||||||
},
|
inline: 'span',
|
||||||
classes: 'main_paragraph'
|
styles: {
|
||||||
},
|
fontSize: '18px'
|
||||||
firstlink: {
|
},
|
||||||
inline: 'span',
|
classes: 'main_paragraph'
|
||||||
styles: {
|
|
||||||
fontSize: '16px'
|
|
||||||
},
|
|
||||||
classes: 'default_button_span black'
|
|
||||||
},
|
|
||||||
secondlink: {
|
|
||||||
inline: 'span',
|
|
||||||
styles: {
|
|
||||||
fontSize: '16px'
|
|
||||||
},
|
|
||||||
classes: 'default_button_span'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
style_formats: [{
|
firstlink: {
|
||||||
title: 'Headers',
|
inline: 'span',
|
||||||
items: [{
|
styles: {
|
||||||
title: 'h1',
|
fontSize: '16px'
|
||||||
block: 'h1'
|
},
|
||||||
}, {
|
classes: 'default_button_span black'
|
||||||
title: 'h2',
|
},
|
||||||
block: 'h2'
|
secondlink: {
|
||||||
}, {
|
inline: 'span',
|
||||||
title: 'h3',
|
styles: {
|
||||||
block: 'h3'
|
fontSize: '16px'
|
||||||
}, {
|
},
|
||||||
title: 'h4',
|
classes: 'default_button_span'
|
||||||
block: 'h4'
|
}
|
||||||
}, {
|
},
|
||||||
title: 'h5',
|
style_formats: [
|
||||||
block: 'h5'
|
{
|
||||||
}, {
|
title: 'Headers',
|
||||||
title: 'h6',
|
items: [
|
||||||
block: 'h6'
|
{
|
||||||
}]
|
title: 'h1',
|
||||||
}, {
|
block: 'h1'
|
||||||
title: 'Blocks',
|
},
|
||||||
items: [{
|
{
|
||||||
title: 'Główny akapit',
|
title: 'h2',
|
||||||
format: 'mainparagraph'
|
block: 'h2'
|
||||||
}, {
|
},
|
||||||
title: 'LinkURL - 1',
|
{
|
||||||
format: 'firstlink'
|
title: 'h3',
|
||||||
}, {
|
block: 'h3'
|
||||||
title: 'LinkURL - 2',
|
},
|
||||||
format: 'secondlink'
|
{
|
||||||
}, {
|
title: 'h4',
|
||||||
title: 'p',
|
block: 'h4'
|
||||||
block: 'p'
|
},
|
||||||
}, {
|
{
|
||||||
title: 'div',
|
title: 'h5',
|
||||||
block: 'div'
|
block: 'h5'
|
||||||
}, {
|
},
|
||||||
title: 'pre',
|
{
|
||||||
block: 'pre'
|
title: 'h6',
|
||||||
}]
|
block: 'h6'
|
||||||
}, {
|
}
|
||||||
title: 'Containers',
|
]
|
||||||
items: [{
|
},
|
||||||
title: 'section',
|
{
|
||||||
block: 'section',
|
title: 'Blocks',
|
||||||
wrapper: true,
|
items: [
|
||||||
merge_siblings: false
|
{
|
||||||
|
title: 'Główny akapit',
|
||||||
|
format: 'mainparagraph'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'LinkURL - 1',
|
||||||
|
format: 'firstlink'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'LinkURL - 2',
|
||||||
|
format: 'secondlink'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'p',
|
||||||
|
block: 'p'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'div',
|
||||||
|
block: 'div'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'pre',
|
||||||
|
block: 'pre'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Containers',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
title: 'section',
|
||||||
|
block: 'section',
|
||||||
|
wrapper: true,
|
||||||
|
merge_siblings: false
|
||||||
},
|
},
|
||||||
//{ title: 'article', block: 'article', wrapper: true, merge_siblings: false },
|
//{ title: 'article', block: 'article', wrapper: true, merge_siblings: false },
|
||||||
{
|
{
|
||||||
title: 'blockquote',
|
title: 'blockquote',
|
||||||
block: 'blockquote',
|
block: 'blockquote',
|
||||||
wrapper: true
|
wrapper: true
|
||||||
},
|
}
|
||||||
//{ title: 'hgroup', block: 'hgroup', wrapper: true },
|
//{ title: 'hgroup', block: 'hgroup', wrapper: true },
|
||||||
//{ title: 'aside', block: 'aside', wrapper: true },
|
//{ title: 'aside', block: 'aside', wrapper: true },
|
||||||
//{ title: 'figure', block: 'figure', wrapper: true }
|
//{ title: 'figure', block: 'figure', wrapper: true }
|
||||||
]
|
]
|
||||||
}],
|
}
|
||||||
paste_word_valid_elements: "table,tr,td,th,b,strong,i,em,h1,h2, strong",
|
],
|
||||||
valid_styles: {
|
paste_word_valid_elements: 'table,tr,td,th,b,link,strong,i,em,h1,h2, strong',
|
||||||
'*': 'display, margin, float, margin-left, margin-right, margin-top, margin-bottom, padding-left, padding-right, padding-top, padding-bottom, text-decoration, border,font-size,color,background,background-color,line-height,text-align,list-style-type, border-radius',
|
valid_styles: {
|
||||||
|
'*': 'display, margin, float, margin-left, margin-right, margin-top, margin-bottom, padding-left, padding-right, padding-top, padding-bottom, text-decoration, border,font-size,color,background,background-color,line-height,text-align,list-style-type, border-radius'
|
||||||
|
},
|
||||||
|
plugins: ['autoresize', 'link', 'image', 'media', 'lists', 'nonbreaking'],
|
||||||
|
removed_menuitems: 'newdocument',
|
||||||
|
toolbarxx:
|
||||||
|
'undo redo | bold italic | bullist numlist outdent indent | alignleft aligncenter alignright alignjustify | link image forecolor backcolor | ai_button',
|
||||||
|
toolbar1:
|
||||||
|
'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | link image | media | forecolor backcolor ai_button',
|
||||||
|
toolbar2: '',
|
||||||
|
menubar: true,
|
||||||
|
menu: {
|
||||||
|
|
||||||
|
edit: {
|
||||||
|
title: 'Edit',
|
||||||
|
items: 'undo redo | cut copy paste pastetext | selectall | searchreplace'
|
||||||
},
|
},
|
||||||
plugins: ['autoresize'],
|
view: {
|
||||||
removed_menuitems: 'newdocument',
|
title: 'View',
|
||||||
toolbarxx: "undo redo | bold italic | bullist numlist outdent indent | alignleft aligncenter alignright alignjustify | link image forecolor backcolor",
|
items:
|
||||||
toolbar1: 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | media | forecolor backcolor',
|
' visualaid visualchars visualblocks'
|
||||||
toolbar2: '',
|
},
|
||||||
menubar: true,
|
insert: {
|
||||||
|
title: 'Insert',
|
||||||
|
items:
|
||||||
|
'image link media | hr nonbreaking'
|
||||||
|
},
|
||||||
|
format: {
|
||||||
|
title: 'Format',
|
||||||
|
items:
|
||||||
|
'bold italic underline strikethrough superscript subscript codeformat | forecolor backcolor | language | removeformat'
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
title: 'Table',
|
||||||
|
items: 'inserttable | cell row column | advtablesort | tableprops deletetable'
|
||||||
|
},
|
||||||
|
help: { title: 'Help', items: 'help' }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
26
src/locale/en.js
Normal file
26
src/locale/en.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
export default {
|
||||||
|
widget_textarea: 'Text area',
|
||||||
|
close: 'Close',
|
||||||
|
save: 'Save',
|
||||||
|
align: 'Alignment',
|
||||||
|
type: 'Type',
|
||||||
|
content: 'Content',
|
||||||
|
widget_text: 'Content',
|
||||||
|
add_section: 'Add section',
|
||||||
|
template: 'Templates',
|
||||||
|
import_template: 'Load template',
|
||||||
|
save_template: 'Save template',
|
||||||
|
copy_template: 'Save to clipboard',
|
||||||
|
paste_template: 'Paste from clipboard',
|
||||||
|
section_type: 'Section type',
|
||||||
|
container: 'Container',
|
||||||
|
full_width: '100% width',
|
||||||
|
section_settings: 'Section settings',
|
||||||
|
core_section_video: 'Video',
|
||||||
|
core_section_video_title: 'Video URL',
|
||||||
|
core_section_video_file: 'File',
|
||||||
|
core_section_video_ytlink: 'Youtube address of the video',
|
||||||
|
core_section_video_ytcode: 'Youtube IFRAME Code',
|
||||||
|
core_section_video_vimeocode: 'Vimeo IFRAME code',
|
||||||
|
core_section_video_type: 'Video type'
|
||||||
|
}
|
||||||
16
src/locale/i18n.js
Normal file
16
src/locale/i18n.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { createI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import pl from './pl'
|
||||||
|
import en from './en'
|
||||||
|
const messages = {
|
||||||
|
pl: { pagebuilder: pl },
|
||||||
|
en: { pagebuilder: en }
|
||||||
|
}
|
||||||
|
const i18n = createI18n({
|
||||||
|
locale: 'en', // Domyślny język
|
||||||
|
fallbackLocale: 'pl', // Język używany, gdy brakuje tłumaczenia w wybranym języku
|
||||||
|
messages,
|
||||||
|
legacy: false
|
||||||
|
})
|
||||||
|
|
||||||
|
export default i18n
|
||||||
26
src/locale/pl.js
Normal file
26
src/locale/pl.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
export default {
|
||||||
|
widget_textarea: 'Pole tekstowe',
|
||||||
|
close: 'Zamknij',
|
||||||
|
save: 'Zapisz',
|
||||||
|
align: 'Wyrównanie',
|
||||||
|
type: 'Typ',
|
||||||
|
content: 'Treść',
|
||||||
|
widget_text: 'Treść',
|
||||||
|
add_section: 'Dodaj sekcję',
|
||||||
|
template: 'Szablony',
|
||||||
|
import_template: 'Wczytaj szablon',
|
||||||
|
save_template: 'Zapisz szablon',
|
||||||
|
copy_template: 'Zapisz do schowka',
|
||||||
|
paste_template: 'Wklej ze schowka',
|
||||||
|
section_type: 'Typ sekcji',
|
||||||
|
container: 'Kontener',
|
||||||
|
full_width: '100% szerokości',
|
||||||
|
section_settings: 'Ustawienia sekcji',
|
||||||
|
core_section_video: 'Wideo',
|
||||||
|
core_section_video_title: 'Adres URL filmu',
|
||||||
|
core_section_video_file: 'Plik',
|
||||||
|
core_section_video_ytlink: 'Adres Youtube filmu',
|
||||||
|
core_section_video_ytcode: 'Kod IFRAME Youtube',
|
||||||
|
core_section_video_vimeocode: 'Kod IFRAME Vimeo',
|
||||||
|
core_section_video_type: 'Typ filmu'
|
||||||
|
}
|
||||||
13
src/main.js
13
src/main.js
@@ -2,16 +2,9 @@ import './assets/main.css'
|
|||||||
|
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import axios from 'axios'
|
||||||
import 'bootstrap/dist/css/bootstrap.min.css'
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
||||||
import MagicoPagebuilder from './components/MagicoPagebuilderPlugin.js'
|
import MagicoPagebuilder from './components/MagicoPagebuilderPlugin.js'
|
||||||
|
import i18n from './locale/i18n'
|
||||||
|
|
||||||
|
const app = createApp(App).use(i18n).use(MagicoPagebuilder).mount('#app')
|
||||||
import { useSections } from "./components/registerSections";
|
|
||||||
const app = createApp(App).use(MagicoPagebuilder).mount("#app");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { register: sectionRegister } = useSections();
|
|
||||||
sectionRegister(app.$pagebuilder);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user