Merge remote-tracking branch 'origin/translate' into front-styles
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<component :is="Default || 'div'">
|
||||
<div class="flex items-center gap-2 mb-4">
|
||||
<UIcon name="line-md:arrow-left" class="text-(--accent-blue-light) dark:text-(--accent-blue-dark)" />
|
||||
<p class="cursor-pointer text-(--accent-blue-light) dark:text-(--accent-blue-dark)" @click="backFromProduct()">
|
||||
<UIcon name="line-md:arrow-left" class="text-(--text-sky-light) dark:text-(--text-sky-dark)" />
|
||||
<p class="cursor-pointer text-(--text-sky-light) dark:text-(--text-sky-dark)" @click="backFromProduct()">
|
||||
Back to products</p>
|
||||
</div>
|
||||
<div class="container mx-auto ">
|
||||
<div class=" gap-4 mb-6 p-4 border-b border-(--border-light)">
|
||||
<div
|
||||
class="gap-4 mb-6 bg-slate-50 dark:bg-(--main-dark) border border-(--border-light) dark:border-(--border-dark) p-4 rounded-md">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex flex-col items-center gap-3" v-if="!isTranslations">
|
||||
<USelectMenu v-model="toLangId" :items="langs" value-key="id"
|
||||
@@ -125,23 +126,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-16">
|
||||
<div class="flex gap-4 my-6">
|
||||
<UButton @click="activeTab = 'description'"
|
||||
:class="['cursor-pointer', activeTab === 'description' ? 'bg-blue-500 text-white' : '']" color="neutral"
|
||||
variant="outline">
|
||||
<p class="dark:text-white">Description</p>
|
||||
</UButton>
|
||||
|
||||
<UButton @click="activeTab = 'usage'"
|
||||
:class="['cursor-pointer', activeTab === 'usage' ? 'bg-blue-500 text-white' : '']" color="neutral"
|
||||
variant="outline">
|
||||
<p class="dark:text-white">Usage</p>
|
||||
</UButton>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="px-8 py-4 border border-(--border-light) dark:border-(--border-dark) rounded-md bg-(--second-light) dark:bg-(--main-dark)">
|
||||
<UTabs :items="items" v-model="activeTab" color="info" :content="true">
|
||||
<template #description>
|
||||
<div v-if="!isTranslations" class="flex justify-end items-center gap-3 mb-4">
|
||||
<UButton v-if="!isEditing" @click="activeTab === 'usage' ? enableEdit() : enableDescriptionEdit()"
|
||||
class="flex items-center gap-2 m-2 cursor-pointer bg-(--accent-blue-light)! dark:bg-(--accent-blue-dark)!">
|
||||
@@ -157,20 +143,49 @@
|
||||
Cancel
|
||||
</UButton>
|
||||
</div>
|
||||
<UEditor v-slot="{ editor }" v-model="productStore.productDescription.description" content-type="html"
|
||||
:ui="{ base: 'p-8 sm:px-16' }" class="w-full min-h-74">
|
||||
<UEditor v-if="isTranslations" v-slot="{ editor }" v-model="productStore.productDescription.description"
|
||||
content-type="html" :ui="{ base: 'p-8 sm:px-16' }" class="w-full min-h-74" placeholder="Write there ...">
|
||||
<UEditorToolbar :editor="editor" :items="toolbarItems" class="sm:px-8">
|
||||
<template #link>
|
||||
<EditorLinkPopover :editor="editor" auto-open />
|
||||
</template>
|
||||
</UEditorToolbar>
|
||||
</UEditor>
|
||||
<!-- <p v-if="activeTab === 'usage'" ref="usageRef" v-html="productStore.productDescription.usage"
|
||||
class="flex flex-col justify-center w-full text-start dark:text-white! text-black!"></p>
|
||||
<div v-else ref="descriptionRef" v-html="productStore.productDescription.description"
|
||||
class="flex flex-col justify-center dark:text-white text-black"></div> -->
|
||||
</div>
|
||||
</div>
|
||||
<p v-else v-html="productStore.productDescription.description" class="text-black dark:text-white"></p>
|
||||
</template>
|
||||
|
||||
<template #usage>
|
||||
<div class="px-7">
|
||||
<div class="flex justify-end items-center gap-3 mb-4">
|
||||
<UButton v-if="!isEditing" @click="enableEdit"
|
||||
class="flex items-center gap-2 m-2 cursor-pointer bg-(--accent-blue-light)! dark:bg-(--accent-blue-dark)!">
|
||||
<p class="text-white">Change Text</p>
|
||||
<UIcon name="material-symbols-light:stylus-note-sharp" class="text-[30px] text-white!" />
|
||||
</UButton>
|
||||
|
||||
<UButton v-if="isEditing" @click="saveText" color="neutral" variant="outline"
|
||||
class="p-2.5 cursor-pointer">
|
||||
<p class="dark:text-white text-black">Save the edited text</p>
|
||||
</UButton>
|
||||
|
||||
<UButton v-if="isEditing" @click="cancelEdit" color="neutral" variant="outline"
|
||||
class="p-2.5 cursor-pointer">
|
||||
Cancel
|
||||
</UButton>
|
||||
</div>
|
||||
|
||||
<UEditor v-if="isTranslations" v-slot="{ editor }" v-model="productStore.productDescription.usage"
|
||||
content-type="html" :ui="{ base: 'p-8 sm:px-16' }" class="w-full min-h-74" placeholder="Write there ...">
|
||||
<UEditorToolbar :editor="editor" :items="toolbarItems" class="sm:px-8">
|
||||
<template #link>
|
||||
<EditorLinkPopover :editor="editor" auto-open />
|
||||
</template>
|
||||
</UEditorToolbar>
|
||||
</UEditor>
|
||||
<p v-else v-html="productStore.productDescription.usage" class="text-black dark:text-white"></p>
|
||||
</div>
|
||||
</template>
|
||||
</UTabs>
|
||||
</div>
|
||||
</div>
|
||||
</component>
|
||||
@@ -390,6 +405,10 @@ onMounted(async () => {
|
||||
}
|
||||
})
|
||||
|
||||
const items = ref([
|
||||
{ label: 'Description', slot: 'description', name: 'description' },
|
||||
{ label: 'Usage', slot: 'usage', name: 'usage' }
|
||||
])
|
||||
|
||||
// text edit
|
||||
const enableEdit = () => {
|
||||
@@ -472,7 +491,7 @@ function removeInlineStylesFromAll(product) {
|
||||
})
|
||||
div.querySelectorAll('table').forEach(table => {
|
||||
table.querySelectorAll('tbody').forEach(tbody => {
|
||||
tbody.style.setProperty('background-color', '#F5F6FA', 'important')
|
||||
tbody.style.setProperty('background-color', '#F8FAFC', 'important')
|
||||
tbody.querySelectorAll('tr').forEach(tr => {
|
||||
tr.querySelectorAll('td').forEach(td => {
|
||||
td.style.setProperty('padding', '10px', 'important')
|
||||
|
||||
Reference in New Issue
Block a user