Fix editor state issues (#173)

* Add MarkdownEditor component with default value and disabled option

* Add editorThemeCompartment for customizing editor theme
This commit is contained in:
Carter
2023-12-28 16:47:05 -08:00
parent f6eff090e7
commit 1940c6e1ba
2 changed files with 127 additions and 16 deletions

View File

@@ -7,6 +7,10 @@ const description1 = ref(null);
const description2 = ref(null);
const description3 = ref(null);
const description4 = ref("Hello, world! This is a **bold** statement.");
const isDisabled = ref(false);
const onImageUpload = (file) => {
return URL.createObjectURL(file).replace("blob:", "");
};
@@ -79,3 +83,34 @@ const description = ref(null)
<MarkdownEditor v-model="description" :heading-buttons="false" />
```
## With default value
<DemoContainer>
<MarkdownEditor v-model="description4" />
</DemoContainer>
```vue
<script setup>
import { ref } from "vue";
const description = ref("Hello, world! This is a **bold** statement.");
</script>
<MardownEditor v-model="description" />
```
## Disabled
<DemoContainer>
<Toggle v-model="isDisabled" label="Disabled" />
<MarkdownEditor v-model="description" :disabled="isDisabled" />
</DemoContainer>
```vue
<script setup>
import { ref } from "vue";
const description = ref(null);
</script>
<MardownEditor v-model="description" disabled />
```