Skip to content

Commit 44b323f

Browse files
committed
🧼 format & lint
1 parent cfd341c commit 44b323f

2 files changed

Lines changed: 39 additions & 21 deletions

File tree

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,22 @@ Per-component props override these values.
122122

123123
## 🧩 `<Editor />` props
124124

125-
| Prop | Type | Default | Description |
126-
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------------------- |
127-
| `session` | `string` | auto | Unique session identifier. Auto-generated from slide number if omitted. |
128-
| `defaultFolder` | `string` | project root | Workspace folder to open. Absolute or relative to the Slidev root. |
129-
| `colorScheme` | `'dark' \| 'light'` | auto | VS Code color theme. Defaults to Slidev's `colorSchema` if set, otherwise none. |
130-
| `fontSize` | `number` | — | Editor font size. Useful for visibility in large rooms. |
131-
| `disableInitialFocus` | `boolean` | `false` | Prevent VS Code from stealing keyboard focus on slide entry. |
132-
| `hideActivityBar` | `boolean` | `false` | Hide the VS Code activity bar (left icon sidebar). |
133-
| `hideMinimap` | `boolean` | `false` | Hide the editor minimap. |
134-
| `hideStatusBar` | `boolean` | `false` | Hide the VS Code status bar (bottom bar). |
135-
| `height` | `string` | `100%` | CSS height of the editor container. |
136-
| `persist` | `boolean` | `false` | Keep the session alive when navigating away. |
137-
| `preload` | `boolean` | `false` | Start the session while the slide is not yet active (requires Slidev preload). |
138-
| `port` | `number` | auto | Force a specific port for this session. |
139-
| `startTimeout` | `number` | `30000` | Max startup time in ms before the session is marked as failed. |
140-
| `zoom` | `number` | `1` | Scale factor for the VS Code UI (e.g. `0.8` for 80%). |
125+
| Prop | Type | Default | Description |
126+
| --------------------- | ------------------- | ------------ | ------------------------------------------------------------------------------- |
127+
| `session` | `string` | auto | Unique session identifier. Auto-generated from slide number if omitted. |
128+
| `defaultFolder` | `string` | project root | Workspace folder to open. Absolute or relative to the Slidev root. |
129+
| `colorScheme` | `'dark' \| 'light'` | auto | VS Code color theme. Defaults to Slidev's `colorSchema` if set, otherwise none. |
130+
| `fontSize` | `number` | — | Editor font size. Useful for visibility in large rooms. |
131+
| `disableInitialFocus` | `boolean` | `false` | Prevent VS Code from stealing keyboard focus on slide entry. |
132+
| `hideActivityBar` | `boolean` | `false` | Hide the VS Code activity bar (left icon sidebar). |
133+
| `hideMinimap` | `boolean` | `false` | Hide the editor minimap. |
134+
| `hideStatusBar` | `boolean` | `false` | Hide the VS Code status bar (bottom bar). |
135+
| `height` | `string` | `100%` | CSS height of the editor container. |
136+
| `persist` | `boolean` | `false` | Keep the session alive when navigating away. |
137+
| `preload` | `boolean` | `false` | Start the session while the slide is not yet active (requires Slidev preload). |
138+
| `port` | `number` | auto | Force a specific port for this session. |
139+
| `startTimeout` | `number` | `30000` | Max startup time in ms before the session is marked as failed. |
140+
| `zoom` | `number` | `1` | Scale factor for the VS Code UI (e.g. `0.8` for 80%). |
141141

142142
## ⚠️ Static exports
143143

components/Editor.vue

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<script setup lang="ts">
2-
import { computed, inject, onBeforeUnmount, ref, shallowRef, useAttrs, useTemplateRef, watch } from 'vue'
2+
import {
3+
computed,
4+
inject,
5+
onBeforeUnmount,
6+
ref,
7+
shallowRef,
8+
useAttrs,
9+
useTemplateRef,
10+
watch,
11+
} from 'vue'
312
import { useIsSlideActive, useNav, useSlideContext } from '@slidev/client'
413
514
import { requestStart, requestStop } from '../composables/useStartRequest'
@@ -35,8 +44,11 @@ const { currentPage } = useNav()
3544
const sessionId = props.session ?? `livecode-${currentPage.value}-${props.port ?? 'default'}`
3645
3746
const attrs = useAttrs()
38-
const isDisableInitialFocus = computed(() =>
39-
!!props.disableInitialFocus || 'disableInitialFocus' in attrs || 'disable-initial-focus' in attrs,
47+
const isDisableInitialFocus = computed(
48+
() =>
49+
!!props.disableInitialFocus ||
50+
'disableInitialFocus' in attrs ||
51+
'disable-initial-focus' in attrs,
4052
)
4153
const isPreload = computed(() => !!props.preload || 'preload' in attrs)
4254
@@ -143,12 +155,18 @@ function startGuard() {
143155
144156
function stopGuard() {
145157
window.removeEventListener('blur', handleWindowBlur)
146-
if (guardTimer) { clearTimeout(guardTimer); guardTimer = null }
158+
if (guardTimer) {
159+
clearTimeout(guardTimer)
160+
guardTimer = null
161+
}
147162
isGuarding.value = false
148163
}
149164
150165
watch(isActive, (active) => {
151-
if (!active || !isDisableInitialFocus.value) { stopGuard(); return }
166+
if (!active || !isDisableInitialFocus.value) {
167+
stopGuard()
168+
return
169+
}
152170
if (session.value?.state === 'RUNNING') startGuard()
153171
})
154172

0 commit comments

Comments
 (0)