refactor: integrate StylesheetViewer into EditorPanel code tab
Move StylesheetViewer from standalone fixed panel to integrated component within EditorPanel's "code" tab. Maintains full functionality including: - Bidirectional sync with Pinia store and PagedJS preview - Toggle between read/edit modes - CSS syntax highlighting - Debounced updates Changes: - EditorPanel.vue: Import and render StylesheetViewer in code tab - EditorPanel.vue: Add flexbox layout for proper height management - StylesheetViewer.vue: Convert from fixed positioning to flex container - App.vue: Remove standalone StylesheetViewer component 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
19077fb133
commit
7ed57d000b
3 changed files with 49 additions and 46 deletions
21
src/App.vue
21
src/App.vue
|
|
@ -1,7 +1,6 @@
|
|||
<script setup>
|
||||
import PagedJsWrapper from './components/PagedJsWrapper.vue';
|
||||
import EditorPanel from './components/editor/EditorPanel.vue';
|
||||
import StylesheetViewer from './components/StylesheetViewer.vue';
|
||||
import ElementPopup from './components/ElementPopup.vue';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useStylesheetStore } from './stores/stylesheet';
|
||||
|
|
@ -42,7 +41,10 @@ const renderPreview = async (shouldReloadFromFile = false) => {
|
|||
`;
|
||||
|
||||
iframe.onload = () => {
|
||||
iframe.contentDocument.addEventListener('click', elementPopup.value.handleIframeClick);
|
||||
iframe.contentDocument.addEventListener(
|
||||
'click',
|
||||
elementPopup.value.handleIframeClick
|
||||
);
|
||||
|
||||
setTimeout(() => {
|
||||
const scrollHeight = iframe.contentDocument.documentElement.scrollHeight;
|
||||
|
|
@ -55,9 +57,12 @@ const renderPreview = async (shouldReloadFromFile = false) => {
|
|||
};
|
||||
};
|
||||
|
||||
watch(() => stylesheetStore.content, () => {
|
||||
renderPreview();
|
||||
});
|
||||
watch(
|
||||
() => stylesheetStore.content,
|
||||
() => {
|
||||
renderPreview();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => renderPreview(true));
|
||||
</script>
|
||||
|
|
@ -71,8 +76,6 @@ onMounted(() => renderPreview(true));
|
|||
|
||||
<iframe ref="previewFrame" id="preview-frame"></iframe>
|
||||
|
||||
<StylesheetViewer :stylesheet="stylesheetStore.content" />
|
||||
|
||||
<ElementPopup ref="elementPopup" :iframeRef="previewFrame" />
|
||||
</template>
|
||||
|
||||
|
|
@ -80,8 +83,8 @@ onMounted(() => renderPreview(true));
|
|||
#preview-frame {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 250px;
|
||||
width: calc(100% - 600px);
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
border: none;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue