Skip to content

Commit 93051f3

Browse files
lecepinsxzz
andauthored
fix: output toggle button (#279)
Co-authored-by: 三咲智子 Kevin Deng <[email protected]>
1 parent ec393cf commit 93051f3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/Repl.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export interface Props {
4040
autoSaveText?: string | false
4141
monacoOptions?: monaco.editor.IStandaloneEditorConstructionOptions
4242
}
43+
splitPaneOptions?: {
44+
codeTogglerText?: string
45+
outputTogglerText?: string
46+
}
4347
}
4448
4549
const autoSave = defineModel<boolean>({ default: true })
@@ -57,6 +61,7 @@ const props = withDefaults(defineProps<Props>(), {
5761
layout: 'horizontal',
5862
previewOptions: () => ({}),
5963
editorOptions: () => ({}),
64+
splitPaneOptions: () => ({}),
6065
})
6166
6267
if (!props.editor) {

src/SplitPane.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ const containerRef = useTemplateRef('container')
99
const previewRef = inject(injectKeyPreviewRef)!
1010
1111
// mobile only
12-
const { store } = inject(injectKeyProps)!
13-
const showOutput = computed(() => store.value.showOutput)
12+
const { store, splitPaneOptions } = inject(injectKeyProps)!
1413
1514
const state = reactive({
1615
dragging: false,
@@ -66,7 +65,7 @@ function changeViewSize() {
6665
class="split-pane"
6766
:class="{
6867
dragging: state.dragging,
69-
'show-output': showOutput,
68+
'show-output': store.showOutput,
7069
vertical: isVertical,
7170
}"
7271
@mousemove="dragMove"
@@ -90,8 +89,12 @@ function changeViewSize() {
9089
<slot name="right" />
9190
</div>
9291

93-
<button class="toggler" @click="showOutput = !showOutput">
94-
{{ showOutput ? '< Code' : 'Output >' }}
92+
<button class="toggler" @click="store.showOutput = !store.showOutput">
93+
{{
94+
store.showOutput
95+
? splitPaneOptions?.codeTogglerText || '< Code'
96+
: splitPaneOptions?.outputTogglerText || 'Output >'
97+
}}
9598
</button>
9699
</div>
97100
</template>

0 commit comments

Comments
 (0)