Skip to content
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

make tab key insert tabs and set tab size to 4 in playground #1626

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion civet.dev/.vitepress/components/Playground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { compileCivetToHtml } from '../utils/compileCivetToHtml';
import { b64 } from '../utils/b64';
import { ligatures } from '../store/ligatures.store';

const document_ = document

const emit = defineEmits(['input']);
const props = defineProps<{
b64Code: string;
Expand Down Expand Up @@ -141,11 +143,17 @@ const playgroundUrl = computed(() => {
<template>
<div v-if="props.compileAtStart && loading">Loading playground...</div>
<div v-else :class="{ wrapper: true, ligatures: ligatures}">
<div class="col scroll" @click="textareaEl?.focus()">
<div class="col scroll" @click="textareaEl?.focus()" style="tab-size: 4">
<div class="code code--user">
<textarea
:value="userCode"
:onInput="(e: any) => (userCode = e.target.value)"
:onkeydown="(event: any) => {
if (event.key == `Tab`) {
event.preventDefault()
document_.execCommand(`insertText`, false, `\t`)
}
}"
ref="textareaEl"
resize="false"
spellcheck="false"
Expand Down