Skip to content

Commit

Permalink
fix: modelValue prop
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Jan 3, 2024
1 parent 42e6cfc commit 57c13fc
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/components/MarkdownUi.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div
v-if="ready"
:id="componentContainerId"
ref="markdownComponent"
class="kong-ui-public-markdown-ui"
Expand Down Expand Up @@ -123,7 +122,7 @@
</template>

<script setup lang="ts">
import { onBeforeMount, onMounted, onUnmounted, computed, ref, nextTick, provide, watch, watchEffect } from 'vue'
import { onMounted, onUnmounted, computed, ref, nextTick, provide, watch, watchEffect } from 'vue'
import type { PropType } from 'vue'
import MarkdownToolbar from '@/components/toolbar/MarkdownToolbar.vue'
import MarkdownContent from '@/components/MarkdownContent.vue'
Expand Down Expand Up @@ -454,26 +453,20 @@ const copyCodeBlock = async (e: any): Promise<void> => {
// Initialize keyboard shortcuts; they will only fire in edit mode when the textarea is active
composables.useKeyboardShortcuts(textareaId.value, rawMarkdown, tabSize, emulateInputEvent)
onBeforeMount(async () => {
onMounted(async () => {
// Initialize markdown-it
await initMarkdownIt(activeTheme.value)
})
const ready = ref<boolean>(false)
onMounted(async () => {
// Render the markdown
markdownHtml.value = getHtmlFromMarkdown(props.modelValue)
// Await a DOM tick
await nextTick()
await updateMermaid()
ready.value = true
// bind code copy button click events
useEventListener(markdownComponent, 'click', copyCodeBlock)
initializeMermaid()
await updateMermaid()
if (currentMode.value === 'split') {
await nextTick()
Expand Down

0 comments on commit 57c13fc

Please sign in to comment.