2023-12-09 15:47:03 +01:00
|
|
|
<template>
|
2024-04-15 19:39:03 +02:00
|
|
|
<input-wrapper v-bind="inputWrapperProps">
|
2023-12-09 15:47:03 +01:00
|
|
|
<template #label>
|
|
|
|
|
<slot name="label" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template #help>
|
|
|
|
|
<slot name="help" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<div
|
2024-04-15 19:39:03 +02:00
|
|
|
:class="[
|
|
|
|
|
theme.CodeInput.input,
|
2024-06-27 17:52:49 +02:00
|
|
|
theme.CodeInput.borderRadius,
|
2024-04-15 19:39:03 +02:00
|
|
|
{
|
|
|
|
|
'!ring-red-500 !ring-2 !border-transparent': hasError,
|
|
|
|
|
'!cursor-not-allowed !bg-gray-200': disabled,
|
|
|
|
|
},
|
|
|
|
|
]"
|
2023-12-09 15:47:03 +01:00
|
|
|
>
|
2024-04-15 19:39:03 +02:00
|
|
|
<codemirror
|
|
|
|
|
:id="id ? id : name"
|
|
|
|
|
v-model="compVal"
|
|
|
|
|
:disabled="disabled ? true : null"
|
|
|
|
|
:extensions="extensions"
|
|
|
|
|
:style="inputStyle"
|
|
|
|
|
:name="name"
|
|
|
|
|
:tab-size="4"
|
|
|
|
|
:placeholder="placeholder"
|
2023-12-09 15:47:03 +01:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<template #error>
|
|
|
|
|
<slot name="error" />
|
|
|
|
|
</template>
|
|
|
|
|
</input-wrapper>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-04-15 19:39:03 +02:00
|
|
|
import { Codemirror } from "vue-codemirror"
|
2023-12-09 15:47:03 +01:00
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
import { html } from "@codemirror/lang-html"
|
2023-12-09 15:47:03 +01:00
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
import { inputProps, useFormInput } from "./useFormInput.js"
|
|
|
|
|
import InputWrapper from "./components/InputWrapper.vue"
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
export default {
|
2024-01-16 12:20:05 +01:00
|
|
|
components: { InputWrapper, Codemirror },
|
2023-12-09 15:47:03 +01:00
|
|
|
props: {
|
2024-04-15 19:39:03 +02:00
|
|
|
...inputProps,
|
2023-12-09 15:47:03 +01:00
|
|
|
},
|
|
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
setup(props, context) {
|
2024-01-16 12:20:05 +01:00
|
|
|
const extensions = [html()]
|
2023-12-09 15:47:03 +01:00
|
|
|
return {
|
2024-01-16 12:20:05 +01:00
|
|
|
...useFormInput(props, context),
|
2024-04-15 19:39:03 +02:00
|
|
|
extensions,
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
2024-04-15 19:39:03 +02:00
|
|
|
},
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
|
|
|
|
</script>
|