feat: Disable options from the message signature editor (#7777)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2023-08-26 08:51:39 +05:30
committed by GitHub
parent 6ab964b161
commit 04aa13e8aa
8 changed files with 84 additions and 14 deletions

View File

@@ -16,7 +16,7 @@
<script>
import {
fullSchema,
wootArticleWriterSetup,
buildEditor,
EditorView,
ArticleMarkdownSerializer,
ArticleMarkdownTransformer,
@@ -33,15 +33,17 @@ const createState = (
content,
placeholder,
plugins = [],
onImageUpload = () => {}
methods = {},
enabledMenuOptions
) => {
return EditorState.create({
doc: new ArticleMarkdownTransformer(fullSchema).parse(content),
plugins: wootArticleWriterSetup({
plugins: buildEditor({
schema: fullSchema,
placeholder,
methods,
plugins,
onImageUpload,
enabledMenuOptions,
}),
});
};
@@ -52,6 +54,7 @@ export default {
value: { type: String, default: '' },
editorId: { type: String, default: '' },
placeholder: { type: String, default: '' },
enabledMenuOptions: { type: Array, default: () => [] },
},
data() {
return {
@@ -83,7 +86,8 @@ export default {
this.value,
this.placeholder,
this.plugins,
this.openFileBrowser
{ onImageUpload: this.openFileBrowser },
this.enabledMenuOptions
);
},
mounted() {
@@ -152,7 +156,8 @@ export default {
this.value,
this.placeholder,
this.plugins,
this.openFileBrowser
{ onImageUpload: this.openFileBrowser },
this.enabledMenuOptions
);
this.editorView.updateState(this.state);
this.focusEditorInputField();