mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-12-21 09:35:42 +00:00
WIP Allow for comment content to be submitted to backend
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<comment-editor :isSimple="globalState.isSimple" @toggle="toggleEditorMode"></comment-editor>
|
||||
<comment-editor :isSimple="globalState.isSimple" @toggle="toggleEditorMode" @change="handleChange"></comment-editor>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -15,14 +15,23 @@ export default defineComponent({
|
||||
components: { CommentEditor },
|
||||
setup() {
|
||||
const globalState = inject('globalState');
|
||||
const fieldName = inject('fieldName')
|
||||
const toggleEditorMode = () => {
|
||||
globalState.isSimple = !globalState.isSimple;
|
||||
localStorage.setItem('editorMode', globalState.isSimple ? 'simple' : 'rich');
|
||||
};
|
||||
|
||||
const handleChange = (newContent) => {
|
||||
const hiddenField = document.querySelector(`input[name="${fieldName}"]`);
|
||||
if (hiddenField) {
|
||||
hiddenField.value = newContent || '';
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
globalState,
|
||||
toggleEditorMode
|
||||
toggleEditorMode,
|
||||
handleChange
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user