Chatwoot/app/javascript/dashboard/components/helpCenter/EditArticle.vue
Sivin Varghese 92bb84127b
feat: Creates view for edit/new article page (#5061)
* feat: Creates view for edit/new article page

* chore: Minor fixes

* chore: Minor fixes

* Update HelpCenterLayout.vue

* chore: Minor fixes

* chore: Review fixes

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2022-07-26 11:39:53 +05:30

102 lines
2.1 KiB
Vue

<template>
<div class="edit-article--container">
<input
v-model="articleTitle"
type="text"
class="article-heading"
:placeholder="$t('HELP_CENTER.EDIT_ARTICLE.TITLE_PLACEHOLDER')"
@focus="onFocus"
@blur="onBlur"
@input="onTitleInput"
/>
<woot-message-editor
v-model="articleContent"
class="article-content"
:placeholder="$t('HELP_CENTER.EDIT_ARTICLE.CONTENT_PLACEHOLDER')"
:is-format-mode="true"
@focus="onFocus"
@blur="onBlur"
@input="onContentInput"
/>
</div>
</template>
<script>
import WootMessageEditor from 'dashboard/components/widgets/WootWriter/Editor.vue';
export default {
components: {
WootMessageEditor,
},
props: {
article: {
type: Object,
default: () => ({}),
},
},
data() {
return {
articleTitle: '',
articleContent: '',
};
},
mounted() {
this.articleTitle = this.article.title;
this.articleContent = this.article.content;
},
methods: {
onFocus() {
this.$emit('focus');
},
onBlur() {
this.$emit('blur');
},
onTitleInput() {
this.$emit('titleInput', this.articleTitle);
},
onContentInput() {
this.$emit('contentInput', this.articleContent);
},
},
};
</script>
<style lang="scss" scoped>
.edit-article--container {
margin: var(--space-medium) var(--space-giga);
min-width: 640px;
}
.article-heading {
font-size: var(--font-size-giga);
font-weight: var(--font-weight-bold);
min-height: var(--space-jumbo);
max-height: var(--space-jumbo);
border: 0px solid transparent;
padding: 0;
}
::v-deep {
.ProseMirror-menubar-wrapper {
.ProseMirror-menubar .ProseMirror-menuitem {
.ProseMirror-icon {
margin-right: var(--space-normal);
font-size: var(--font-size-small);
}
}
.ProseMirror-woot-style {
min-height: var(--space-giga);
max-height: 100%;
p {
font-size: var(--font-size-default);
line-height: 1.5;
}
li::marker {
font-size: var(--font-size-default);
}
}
}
}
</style>