question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while adding Quill Emojis to editor

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
M1CK431commented, Dec 16, 2019

Kind of work this way:

<template>
  <VueEditor v-model="html" :editorOptions="editorOptions" />
</template>

<script>
import { VueEditor, Quill } from "vue2-editor";
import Emoji from "quill-emoji";
import "quill-emoji/dist/quill-emoji.css";

Quill.register(
  {
    "formats/emoji": Emoji.EmojiBlot,
    "modules/short_name_emoji": Emoji.ShortNameEmoji,
    "modules/toolbar_emoji": Emoji.ToolbarEmoji,
    "modules/textarea_emoji": Emoji.TextAreaEmoji
  },
  true
);

const editorOptions = {
  modules: {
    toolbar: {
      container: [
        [{ size: ["small", false, "large"] }],
        ["bold", "italic", "underline", "strike"],
        ["blockquote", "code-block"],
        [{ 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() {}
      }
    },
    short_name_emoji: true,
    toolbar_emoji: true,
    textarea_emoji: true
  }
};

export default {
  components: { VueEditor },
  data: () => ({ html: "" }),
  computed: { editorOptions: () => editorOptions }
};
</script>

Not a perfect solution however: image

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).

2reactions
hamzajbcommented, Jul 5, 2021

@M1CK431 thank you for your help the emoji in the textarea you can hide it with

.textarea-emoji-control { display: none; }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quill-emoji: Quill editor emoji remove issue - Stack Overflow
The demo I tested with uses Quill 1.3.5 and the latest master version of Quill Emoji. Before deleting emoji: Quill editor panel and...
Read more >
quill-emoji - npm
Start using quill-emoji in your project by running `npm i quill-emoji`. There are 22 other projects in the npm registry using quill-emoji.
Read more >
API - Quill Rich Text Editor
Quill is a free, open source WYSIWYG editor built for the modern web. Completely customize it for any need with its modular architecture...
Read more >
Add an emoji picker to the textarea in two steps | TinyMCE
When working within a React application, if you receive an error that states “could not load emoticons” this means that editor init (tinymce....
Read more >
ngx-quill | Yarn - Package Manager
include theme styling: bubble.css or snow.css of quilljs in your index.html (you can find them in node_modules/quill/dist ), or add them in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found