mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-12-22 01:55:42 +00:00
Change logic to allow as many comment vue apps to be charged on same page as needed
This commit is contained in:
@@ -1,36 +1,29 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="comment-container" v-if="shouldRenderPublic">
|
||||
<label class="col-form-label" for="content">{{
|
||||
$t("comment.label_public")
|
||||
}}</label>
|
||||
<comment-editor type="public"></comment-editor>
|
||||
</div>
|
||||
<div class="comment-container" v-if="shouldRenderPrivate">
|
||||
<label class="col-form-label" for="content">{{
|
||||
$t("comment.label_private")
|
||||
}}</label>
|
||||
<comment-editor type="private"></comment-editor>
|
||||
<div>
|
||||
<comment-editor :isSimple="globalState.isSimple" @toggle="toggleEditorMode"></comment-editor>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, inject } from 'vue';
|
||||
import CommentEditor from "../CommentEditor/component/CommentEditor.vue";
|
||||
|
||||
export default {
|
||||
export default defineComponent({
|
||||
name: "App",
|
||||
components: { CommentEditor },
|
||||
props: {
|
||||
commentMode: String,
|
||||
},
|
||||
computed: {
|
||||
shouldRenderPublic() {
|
||||
return this.commentMode === "public" || this.commentMode === "both";
|
||||
},
|
||||
shouldRenderPrivate() {
|
||||
return this.commentMode === "private" || this.commentMode === "both";
|
||||
},
|
||||
},
|
||||
};
|
||||
setup() {
|
||||
const globalState = inject('globalState');
|
||||
const toggleEditorMode = () => {
|
||||
globalState.isSimple = !globalState.isSimple;
|
||||
localStorage.setItem('editorMode', globalState.isSimple ? 'simple' : 'rich');
|
||||
};
|
||||
|
||||
return {
|
||||
globalState,
|
||||
toggleEditorMode
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user