(flux note) display no content if there is no…

This commit is contained in:
2021-03-21 20:16:17 +01:00
parent 145cdd8984
commit ef521480d5

View File

@@ -15,7 +15,10 @@
</h4> </h4>
</div> </div>
<slot /> <slot />
<p class="note-display" v-html="renderedContent ?? readme"></p> <div v-if="!hasContent">
No content here 📝
</div>
<p class="note-display" v-html="renderedContent"></p>
</div> </div>
<stacked-note <stacked-note
class="note" class="note"
@@ -66,17 +69,26 @@ export default defineComponent({
const { listenToClick } = useLinks('note-display') const { listenToClick } = useLinks('note-display')
const { stackedNotes, resetStackedNotes } = useQueryStackedNotes() const { stackedNotes, resetStackedNotes } = useQueryStackedNotes()
const renderedContent = computed(() => const { readme, ...noteProps } = useNote(
props.content !== null ? renderString(props.content) : null 'note-container',
refProps.user,
refProps.repo
) )
const renderedContent = computed(() =>
props.content !== null ? renderString(props.content) : readme.value
)
const hasContent = computed(() => !!renderedContent.value)
watch(renderedContent, () => nextTick(() => listenToClick())) watch(renderedContent, () => nextTick(() => listenToClick()))
return { return {
hasContent,
renderedContent, renderedContent,
stackedNotes, stackedNotes,
resetStackedNotes, resetStackedNotes,
...useNote('note-container', refProps.user, refProps.repo) ...noteProps
} }
} }
}) })