Compare commits
No commits in common. "de5d12c0fa052151d041edadc2e2a41dba0e7ccb" and "b584a539fe7c4c8eab71a7693ea561b1947e3c69" have entirely different histories.
de5d12c0fa
...
b584a539fe
2 changed files with 5 additions and 57 deletions
13
src/App.vue
13
src/App.vue
|
|
@ -2,7 +2,6 @@
|
||||||
import PagedJsWrapper from './components/PagedJsWrapper.vue';
|
import PagedJsWrapper from './components/PagedJsWrapper.vue';
|
||||||
import EditorPanel from './components/editor/EditorPanel.vue';
|
import EditorPanel from './components/editor/EditorPanel.vue';
|
||||||
import ElementPopup from './components/ElementPopup.vue';
|
import ElementPopup from './components/ElementPopup.vue';
|
||||||
import PreviewLoader from './components/PreviewLoader.vue';
|
|
||||||
import { onMounted, ref, watch, computed, provide } from 'vue';
|
import { onMounted, ref, watch, computed, provide } from 'vue';
|
||||||
import { useStylesheetStore } from './stores/stylesheet';
|
import { useStylesheetStore } from './stores/stylesheet';
|
||||||
import Coloris from '@melloware/coloris';
|
import Coloris from '@melloware/coloris';
|
||||||
|
|
@ -17,7 +16,7 @@ provide('activeTab', activeTab);
|
||||||
|
|
||||||
let savedScrollPercentage = 0;
|
let savedScrollPercentage = 0;
|
||||||
const currentFrameIndex = ref(1); // 1 or 2, which iframe is currently visible
|
const currentFrameIndex = ref(1); // 1 or 2, which iframe is currently visible
|
||||||
const isTransitioning = ref(false);
|
let isTransitioning = false;
|
||||||
|
|
||||||
const activeFrame = computed(() => {
|
const activeFrame = computed(() => {
|
||||||
return currentFrameIndex.value === 1
|
return currentFrameIndex.value === 1
|
||||||
|
|
@ -26,8 +25,8 @@ const activeFrame = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const renderPreview = async (shouldReloadFromFile = false) => {
|
const renderPreview = async (shouldReloadFromFile = false) => {
|
||||||
if (isTransitioning.value) return;
|
if (isTransitioning) return;
|
||||||
isTransitioning.value = true;
|
isTransitioning = true;
|
||||||
|
|
||||||
// Determine which iframe is currently visible and which to render to
|
// Determine which iframe is currently visible and which to render to
|
||||||
const visibleFrame =
|
const visibleFrame =
|
||||||
|
|
@ -36,7 +35,7 @@ const renderPreview = async (shouldReloadFromFile = false) => {
|
||||||
currentFrameIndex.value === 1 ? previewFrame2.value : previewFrame1.value;
|
currentFrameIndex.value === 1 ? previewFrame2.value : previewFrame1.value;
|
||||||
|
|
||||||
if (!hiddenFrame) {
|
if (!hiddenFrame) {
|
||||||
isTransitioning.value = false;
|
isTransitioning = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +112,7 @@ const renderPreview = async (shouldReloadFromFile = false) => {
|
||||||
|
|
||||||
// Swap current frame
|
// Swap current frame
|
||||||
currentFrameIndex.value = currentFrameIndex.value === 1 ? 2 : 1;
|
currentFrameIndex.value = currentFrameIndex.value === 1 ? 2 : 1;
|
||||||
isTransitioning.value = false;
|
isTransitioning = false;
|
||||||
}, 200); // Match CSS transition duration
|
}, 200); // Match CSS transition duration
|
||||||
}, 50); // Small delay to ensure scroll is set
|
}, 50); // Small delay to ensure scroll is set
|
||||||
}, 200); // Wait for PagedJS
|
}, 200); // Wait for PagedJS
|
||||||
|
|
@ -148,8 +147,6 @@ onMounted(() => renderPreview(true));
|
||||||
:class="{ shifted: activeTab.length > 0 }"
|
:class="{ shifted: activeTab.length > 0 }"
|
||||||
></iframe>
|
></iframe>
|
||||||
|
|
||||||
<PreviewLoader :isLoading="isTransitioning" :shifted="activeTab.length > 0" />
|
|
||||||
|
|
||||||
<ElementPopup ref="elementPopup" :iframeRef="activeFrame" />
|
<ElementPopup ref="elementPopup" :iframeRef="activeFrame" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
<template>
|
|
||||||
<div v-if="isLoading" class="preview-loader" :class="{ shifted }">
|
|
||||||
<div class="spinner"></div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
defineProps({
|
|
||||||
isLoading: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
shifted: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.preview-loader {
|
|
||||||
position: fixed;
|
|
||||||
top: 2rem;
|
|
||||||
right: 2rem;
|
|
||||||
z-index: 1000;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: all 0.2s ease-in-out var(--curve);
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner {
|
|
||||||
width: 2rem;
|
|
||||||
height: 2rem;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: inline-block;
|
|
||||||
border-top: 3px solid #000;
|
|
||||||
border-right: 3px solid transparent;
|
|
||||||
box-sizing: border-box;
|
|
||||||
animation: rotation 1s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rotation {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue