[Vuejs]-How to implement Quill Emojis in vue2editor?

0👍

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

you need register the model, add the up code to you code.

👤km0612

0👍

Edit:

//1) Add plugin to laravel mix

    const mix = require('laravel-mix')
    mix.webpackConfig(webpack => {
        return {
            plugins: [
                new webpack.ProvidePlugin({
                    "window.Quill": "quill/dist/quill.js",
                    Quill: "quill/dist/quill.js"
                })
            ]
        };
    });


//2 example vue file


 

<template>
      <div class="mt-1">
        <vue-editor
          ref="editor"
          v-model="content"
          :editor-toolbar="customToolbar"
          :editorOptions="editorSettings"
        />
    

      </div>
    </template>
    <script>
    import { VueEditor, Quill } from "vue2-editor";
    
    import Emoji from "quill-emoji/dist/quill-emoji";
    Quill.register("modules/emoji", Emoji);
    
    export default {
      components: {
        VueEditor,
      },
      props: {
        bubble: Object,
        contentCol: {
          type: String,
        },
      },
      data() {
        return {
          edit: false,
          content: "<b>Content is here</b>",
          customToolbar: [["bold", "italic", "underline"], ["link"], ["emoji"]],
          editorSettings: {
            modules: {
              "emoji-toolbar": true,
              "emoji-textarea": true,
              "emoji-shortname": true,
            },
          },
        };
      },
      beforeDestroy() {},
    
     
    };
    </script>
    
    <style  src="quill-emoji/dist/quill-emoji.css"/>

Leave a comment