fix(editor): actually populate loaded data into the editor
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2023-10-20 22:52:21 +02:00
parent 05bf7ccf0b
commit 671c658868
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 13 additions and 5 deletions

View File

@ -6,7 +6,10 @@
:upload-callback="uploadCallback"
@image-added="bubbleChanges"
/>
<editor-content class="tiptap__editor" :editor="editor" />
<editor-content
class="tiptap__editor"
:editor="editor"
/>
</div>
</template>
@ -79,10 +82,10 @@ const CustomTableCell = TableCell.extend({
})
const {
modelValue = '',
modelValue,
uploadCallback,
} = defineProps<{
modelValue?: string,
modelValue: string,
uploadCallback?: UploadCallback,
}>()
@ -92,12 +95,17 @@ const inputHTML = ref('')
watch(
() => modelValue,
() => {
if (modelValue === '') {
return
}
if (!modelValue.startsWith(TIPTAP_TEXT_VALUE_PREFIX)) {
// convert Markdown to HTML
return TIPTAP_TEXT_VALUE_PREFIX + marked.parse(modelValue)
inputHTML.value = TIPTAP_TEXT_VALUE_PREFIX + marked.parse(modelValue)
return
}
return modelValue.replace(tiptapRegex, '')
inputHTML.value = modelValue.replace(tiptapRegex, '')
},
{ immediate: true },
)