vue2-editor: Error while adding Quill Emojis to editor
I tried to add Quill Emojis to editor but I am getting console error as Uncaught ReferenceError: Quill is not defined
This is I have tried so far:
<template>
<div id="app">
<vue-editor v-model="content"></vue-editor>
</div>
</template>
<script>
import { VueEditor, Quill } from 'vue2-editor';
import Emoji from 'quill-emoji/dist/quill-emoji';
Quill.register('modules/quill-emoji', Emoji);
export default {
name: 'vue2editor',
components: { VueEditor },
data() {
return {
content: "<h1>Some initial content</h1>",
editorSettings: {
modules: {
toolbar: {
container: [
[{'size': ['small', false, 'large']}],
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }],
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'script': 'sub' }, { 'script': 'super' }],
[{ 'indent': '-1' }, { 'indent': '+1' }],
[{ 'direction': 'rtl' }],
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }],
[{ 'font': [] }],
[{ 'align': [] }],
['clean'],
['link', 'image', 'video'],
['emoji'],
],
handlers: {
'emoji': function () {}
},
},
toolbar_emoji: true,
short_name_emoji: true,
textarea_emoji:true,
},
},
text: null,
};
},
};
</script>
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
Kind of work this way:
Not a perfect solution however:
As you can see, there is an “extra” emoji button inserted in the editor (don’t know why). Also, the shortcut
:to add an emoji directly doesn’t work (issues are already open in the quill emojis module project about that).@M1CK431 thank you for your help the emoji in the textarea you can hide it with
just in case someone bumps into this in the future… the emoji in the textarea is showing because of this line of code located in …
"modules/textarea_emoji": Emoji.TextAreaEmoji@tuannguyenminh2086 need register
It work when add config quill in webpack
I think the proper way to disable it would be to set textarea-emoji to false in your options:
textarea_emoji: false