diff --git a/source/components/AppEditor.vue b/source/components/AppEditor.vue index 4b73334..6092ca6 100644 --- a/source/components/AppEditor.vue +++ b/source/components/AppEditor.vue @@ -1,11 +1,8 @@ - - - - + + + + + {{ tab[0] }} {{ tab[1] }} - - - + + + - update(tab[0], d)" /> diff --git a/source/components/BaseHeader.vue b/source/components/BaseHeader.vue index f4de686..95d591e 100644 --- a/source/components/BaseHeader.vue +++ b/source/components/BaseHeader.vue @@ -11,18 +11,13 @@ import { MenubarSubTrigger, MenubarSubContent, } from './ui/menubar' -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from './ui/tooltip' import BaseLogo from './BaseLogo.vue' -import { Button } from './ui/button' +import IconButton from './IconButton.vue' import SplitView from './icons/SplitView.vue' import SideView from './icons/SideView.vue' import { useAppStore } from '@/store' -import { useFullscreen } from '@/helpers/fullscreen'; +import { useFullscreen } from '@/helpers/fullscreen' +import { onMounted, onBeforeUnmount } from 'vue' const fullscreen = useFullscreen() const store = useAppStore() @@ -32,6 +27,20 @@ const newTab = () => window.open(window.location.href) const closeTab = () => window.close() const reloadTab = () => window.location.reload() +function newTabHandler(ev) { + if (ev.key?.toLowerCase() === 'n' && ev.ctrlKey && ev.altKey) { + newTab() + } +} + +onMounted(() => { + document.addEventListener('keydown', newTabHandler, false) +}) + +onBeforeUnmount(() => { + document.removeEventListener('keydown', newTabHandler) +}) + @@ -61,8 +70,8 @@ const reloadTab = () => window.location.reload() Editor - only Preview - only - Split View - + Column View + Row View @@ -93,41 +102,21 @@ const reloadTab = () => window.location.reload() - - - - - - - - - Editor - - - - - - - - - - - - Split view - - - - - - - - - - - - Preview - - - + store.layout = 'left'"> + + + store.layout = 'row'"> + + + store.layout = 'column'"> + + + store.layout = 'right'"> + + \ No newline at end of file diff --git a/source/components/BaseView.vue b/source/components/BaseView.vue index c9b16ed..d9b940c 100644 --- a/source/components/BaseView.vue +++ b/source/components/BaseView.vue @@ -12,16 +12,20 @@ const store = useAppStore() const panelLeft = ref() const panelRight = ref() +const verticalAlign = ref(false) + watchEffect(() => { const view = store.layout if (view === 'left') viewLeft() else if (view === 'right') viewRight() - else splitView() + else if (view === 'column') splitView(true) + else splitView(false) }) -function splitView() { +function splitView(column = false) { panelLeft.value?.expand() panelRight.value?.expand() + verticalAlign.value = !!column } function viewLeft() { @@ -31,15 +35,16 @@ function viewLeft() { function viewRight() { !panelLeft.value?.isCollapsed && panelLeft.value?.collapse() } + - + - + diff --git a/source/components/IconButton.vue b/source/components/IconButton.vue new file mode 100644 index 0000000..27a0b36 --- /dev/null +++ b/source/components/IconButton.vue @@ -0,0 +1,29 @@ + + + + + + + + + + + + {{ text }} + + + + \ No newline at end of file diff --git a/source/components/ui/tabs/Tabs.vue b/source/components/ui/tabs/Tabs.vue deleted file mode 100644 index 0b76cdf..0000000 --- a/source/components/ui/tabs/Tabs.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/source/components/ui/tabs/TabsContent.vue b/source/components/ui/tabs/TabsContent.vue deleted file mode 100644 index 19bb066..0000000 --- a/source/components/ui/tabs/TabsContent.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - diff --git a/source/components/ui/tabs/TabsList.vue b/source/components/ui/tabs/TabsList.vue deleted file mode 100644 index 00ebff5..0000000 --- a/source/components/ui/tabs/TabsList.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - diff --git a/source/components/ui/tabs/TabsTrigger.vue b/source/components/ui/tabs/TabsTrigger.vue deleted file mode 100644 index 43a5309..0000000 --- a/source/components/ui/tabs/TabsTrigger.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - diff --git a/source/components/ui/tabs/index.js b/source/components/ui/tabs/index.js deleted file mode 100644 index 8f5f744..0000000 --- a/source/components/ui/tabs/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export { default as Tabs } from './Tabs.vue'; -export { default as TabsContent } from './TabsContent.vue'; -export { default as TabsList } from './TabsList.vue'; -export { default as TabsTrigger } from './TabsTrigger.vue'; diff --git a/source/store/index.js b/source/store/index.js index 73a549f..1d578dd 100644 --- a/source/store/index.js +++ b/source/store/index.js @@ -6,9 +6,7 @@ import { useToast } from '@/components/ui/toast/use-toast' const prevSession = restore() || template export const useAppStore = defineStore("app", () => { - const layout = ref("split"); - - const tab = ref("html"); + const layout = ref(window.innerWidth < 768 ? 'column' : 'row'); const code = reactive({ html: prevSession['index.html'], @@ -40,5 +38,5 @@ export const useAppStore = defineStore("app", () => { } }); - return { layout, code, tab, saveSession }; + return { layout, code, saveSession }; });
Editor
Split view
Preview
{{ text }}