Added markdown support to features
This commit is contained in:
20
app/imports/ui/components/MarkdownText.vue
Normal file
20
app/imports/ui/components/MarkdownText.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template lang="html">
|
||||
<div v-html="compiledMarkdown">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import marked from 'marked';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
markdown: String,
|
||||
},
|
||||
computed: {
|
||||
compiledMarkdown() {
|
||||
if (!this.markdown) return;
|
||||
return marked(this.markdown, { sanitize: true });
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -13,13 +13,14 @@
|
||||
@click.stop="$emit('update', {_id, update: {enabled: !enabled}})"
|
||||
/>
|
||||
</template>
|
||||
<v-card-text>
|
||||
{{description}}
|
||||
<v-card-text v-if="description">
|
||||
<markdown-text :markdown="description"/>
|
||||
</v-card-text>
|
||||
</toolbar-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||
import ToolbarCard from '/imports/ui/components/ToolbarCard.vue';
|
||||
|
||||
export default {
|
||||
@@ -33,9 +34,9 @@
|
||||
alwaysEnabled: Boolean,
|
||||
},
|
||||
components: {
|
||||
MarkdownText,
|
||||
ToolbarCard,
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<template lang="html">
|
||||
<property-dialog :doc="feature" collection="features" @remove="$emit('remove')">
|
||||
<div>
|
||||
{{feature.description}}
|
||||
<markdown-text :markdown="feature.computedDescription || feature.description"/>
|
||||
<!--
|
||||
<child-lists
|
||||
:parent="feature"
|
||||
/>
|
||||
-->
|
||||
</div>
|
||||
<feature-foremovet="form" :feature="feature" @update="(update, ack) => $emit('update', update, ack)"/>
|
||||
<feature-form slot="form" :feature="feature" @update="(update, ack) => $emit('update', update, ack)"/>
|
||||
</property-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PropertyDialog from '/imports/ui/components/properties/PropertyDialog.vue';
|
||||
import FeatureForm from '/imports/ui/components/features/FeatureForm.vue';
|
||||
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PropertyDialog,
|
||||
FeatureForm,
|
||||
MarkdownText,
|
||||
},
|
||||
props: {
|
||||
feature: Object,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<script>
|
||||
import Features, {updateFeature} from '/imports/api/creature/properties/Features.js';
|
||||
import FeatureDialog from '/imports/ui/components/features/FeatureDialog.vue';
|
||||
import {evaluateStringForCharId} from '/imports/ui/utility/evaluate.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -19,7 +20,11 @@
|
||||
},
|
||||
meteor: {
|
||||
feature(){
|
||||
return Features.findOne(this._id);
|
||||
let feature = Features.findOne(this._id);
|
||||
feature.computedDescription = evaluateStringForCharId(
|
||||
feature.description, feature.charId
|
||||
);
|
||||
return feature;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import propertyUpdateMethods from '/imports/api/creature/properties/propertyUpdateMethods.js';
|
||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||
export default {
|
||||
components: {
|
||||
|
||||
Reference in New Issue
Block a user