Skip to content

Menu editor settings #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/editor/EditorContainer.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<script setup lang="ts">
import FileSelector from './FileSelector.vue'
import Message from '../Message.vue'
import WrapToggle from './WrapToggle.vue'
import { debounce } from '../utils'
import { inject, ref, watch } from 'vue'
import { Store } from '../store'
import MessageToggle from './MessageToggle.vue'
import type { EditorComponentType } from './types'
import EditorSettings from './EditorSettings.vue'

const SHOW_ERROR_KEY = 'repl_show_error'
const TOGGLE_WRAP_KEY = 'repl_toggle_wrap'
Expand Down Expand Up @@ -52,8 +51,7 @@ watch(
:filename="store.state.activeFile.filename"
/>
<Message v-show="showMessage" :err="store.state.errors[0]" />
<MessageToggle v-model="showMessage" />
<WrapToggle v-model="store.state.wordWrap" />
<EditorSettings v-model:show-message="showMessage" />
</div>
</template>

Expand Down
51 changes: 51 additions & 0 deletions src/editor/EditorSettings.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script setup lang="ts">
import { inject } from 'vue'
import { Store } from '../store'
import { VIconBtn } from 'vuetify/lib/labs/components'

const store = inject('store') as Store
const showMessage = defineModel<boolean>('showMessage')
</script>

<template>
<div class="wrapper">
<v-menu :close-on-content-click="false" location="top end">
<template v-slot:activator="{ props }">
<v-icon-btn icon="mdi-cog" v-bind="props" variant="tonal" />
</template>

<v-list density="compact">
<v-list-item>
<v-switch
v-model="showMessage"
label="Show errors"
color="primary"
inset
hide-details
density="compact"
/>
</v-list-item>
<v-divider />
<v-list-item>
<v-switch
v-model="store.state.wordWrap"
label="Word wrap"
color="primary"
inset
hide-details
density="compact"
/>
</v-list-item>
</v-list>
</v-menu>
</div>
</template>

<style>
.wrapper {
position: absolute;
bottom: 10px;
right: 24px;
z-index: 1000;
}
</style>
28 changes: 0 additions & 28 deletions src/editor/MessageToggle.vue

This file was deleted.

28 changes: 0 additions & 28 deletions src/editor/WrapToggle.vue

This file was deleted.