(share) add main content when sharing notes

This commit is contained in:
2021-05-13 21:06:10 +02:00
parent e80ab6e375
commit d3c2736138
2 changed files with 11 additions and 4 deletions

View File

@@ -74,6 +74,7 @@ export default defineComponent({
user: { type: String, required: true },
repo: { type: String, required: true },
content: { type: String, required: false, default: null },
parseContent: { type: Boolean, required: false, default: true },
withHeader: { type: Boolean, required: false, default: true }
},
setup(props) {
@@ -88,7 +89,11 @@ export default defineComponent({
const { titles } = useNote('note-container')
const renderedContent = computed(() =>
props.content !== null ? renderString(props.content) : store.readme
props.content !== null
? props.parseContent
? renderString(props.content)
: props.content
: store.readme
)
const hasContent = computed(() => !!renderedContent.value)

View File

@@ -12,13 +12,15 @@
:repo="repo"
:content="content"
:with-header="false"
:parse-content="false"
/>
</div>
</template>
<script lang="ts">
import { useFile } from '@/hooks/useFile.hook'
import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
import { defineAsyncComponent, defineComponent, onMounted, ref } from 'vue'
import { defineAsyncComponent, defineComponent, onMounted } from 'vue'
const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue'))
@@ -32,9 +34,9 @@ export default defineComponent({
repo: { type: String, required: true },
note: { type: String, required: true }
},
setup() {
const content = ref('Getting stacked notes...')
setup(props) {
const { resetStackedNotes } = useQueryStackedNotes()
const { content } = useFile(props.note)
onMounted(() => {
resetStackedNotes()