Skip to content

Commit 655c613

Browse files
committed
feat: add open in editor button in list overview
1 parent 5efb009 commit 655c613

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed
File renamed without changes.

packages/client/pages/overview.vue

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useHead } from '@unhead/vue'
44
import type { RouteRecordRaw } from 'vue-router'
55
import type { ClicksContext } from 'packages/types'
66
import { themeVars } from '../env'
7-
import { rawRoutes } from '../logic/nav'
7+
import { openInEditor, rawRoutes } from '../logic/nav'
88
import { useFixedClicks } from '../composables/useClicks'
99
import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
1010
import { getSlideClass } from '../utils'
@@ -131,10 +131,25 @@ onMounted(() => {
131131
:ref="el => blocks.set(idx, el as any)"
132132
class="relative border-t border-main of-hidden flex gap-4 min-h-50 group"
133133
>
134-
<div class="select-none w-13 text-right my4">
134+
<div class="select-none w-13 text-right my4 flex flex-col gap-1 items-end">
135135
<div class="text-3xl op20 mb2">
136136
{{ idx + 1 }}
137137
</div>
138+
<IconButton
139+
class="mr--3 op0 group-hover:op80"
140+
title="Play in new tab"
141+
@click="openSlideInNewTab(route.path)"
142+
>
143+
<carbon:presentation-file />
144+
</IconButton>
145+
<IconButton
146+
v-if="route.meta?.slide"
147+
class="mr--3 op0 group-hover:op80"
148+
title="Open in editor"
149+
@click="openInEditor(`${route.meta.slide.filepath}:${route.meta.slide.start}`)"
150+
>
151+
<carbon:cics-program />
152+
</IconButton>
138153
</div>
139154
<div class="flex flex-col gap-2 my5">
140155
<div

packages/client/pages/play.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ useSwipeControls(root)
3131
3232
const persistNav = computed(() => isScreenVertical.value || showEditor.value)
3333
34-
const Editor = shallowRef<any>()
34+
const SideEditor = shallowRef<any>()
3535
if (__DEV__ && __SLIDEV_FEATURE_EDITOR__)
36-
import('../internals/Editor.vue').then(v => Editor.value = v.default)
36+
import('../internals/SideEditor.vue').then(v => SideEditor.value = v.default)
3737
3838
const DrawingControls = shallowRef<any>()
3939
if (__SLIDEV_FEATURE_DRAWINGS__)
@@ -70,8 +70,8 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
7070
</template>
7171
</SlideContainer>
7272

73-
<template v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && Editor && showEditor">
74-
<Editor :resize="true" />
73+
<template v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && SideEditor && showEditor">
74+
<SideEditor :resize="true" />
7575
</template>
7676
</div>
7777
<Controls />

packages/client/pages/presenter.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ watch([currentRoute, queryClicks], () => {
5252
nextFrameClicksCtx.value && (nextFrameClicksCtx.value.current = nextFrame.value![1])
5353
}, { immediate: true })
5454
55-
const Editor = shallowRef<any>()
55+
const SideEditor = shallowRef<any>()
5656
if (__DEV__ && __SLIDEV_FEATURE_EDITOR__)
57-
import('../internals/Editor.vue').then(v => Editor.value = v.default)
57+
import('../internals/SideEditor.vue').then(v => SideEditor.value = v.default)
5858
5959
// sync presenter cursor
6060
onMounted(() => {
@@ -134,8 +134,8 @@ onMounted(() => {
134134
</div>
135135
</div>
136136
<!-- Notes -->
137-
<div v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && Editor && showEditor" class="grid-section note of-auto">
138-
<Editor />
137+
<div v-if="__DEV__ && __SLIDEV_FEATURE_EDITOR__ && SideEditor && showEditor" class="grid-section note of-auto">
138+
<SideEditor />
139139
</div>
140140
<div v-else class="grid-section note grid grid-rows-[1fr_min-content] overflow-hidden">
141141
<NoteEditor

packages/client/styles/index.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ html {
1616
}
1717

1818
.slidev-icon-btn {
19-
@apply inline-block cursor-pointer select-none !outline-none;
19+
aspect-ratio: 1;
20+
display: inline-block;
21+
user-select: none;
22+
outline: none;
23+
cursor: pointer;
2024
@apply opacity-75 transition duration-200 ease-in-out align-middle rounded p-1;
2125
@apply hover:(opacity-100 bg-gray-400 bg-opacity-10);
2226
@apply md:p-2;

0 commit comments

Comments
 (0)