Browse Source

Implement iframe detection in Project.vue to conditionally render control buttons. This enhancement improves user experience by hiding controls when the component is displayed within an iframe.

deploy
dash 11 months ago
parent
commit
9c069d4822
  1. 6
      frontend/src/views/Project.vue

6
frontend/src/views/Project.vue

@ -6,7 +6,7 @@
class="preview-iframe" class="preview-iframe"
sandbox="allow-scripts allow-same-origin allow-forms" sandbox="allow-scripts allow-same-origin allow-forms"
></iframe> ></iframe>
<div class="control-buttons"> <div v-if="!isInIframe" class="control-buttons">
<button @click="goHome" class="control-btn back-btn" title="BACK HOME"> <button @click="goHome" class="control-btn back-btn" title="BACK HOME">
<span>🏠</span> <span>🏠</span>
</button> </button>
@ -111,6 +111,10 @@ const documentVisible = ref(false);
const currentDocument = ref<Document | null>(null); const currentDocument = ref<Document | null>(null);
const previewUrl = ref(''); const previewUrl = ref('');
const isInIframe = computed(() => {
return window.self !== window.top;
});
const canEdit = computed(() => { const canEdit = computed(() => {
if (!project.value) return false; if (!project.value) return false;
return userStore.isAuthenticated && return userStore.isAuthenticated &&

Loading…
Cancel
Save