contentco / quill-emoji

Quill module toolbar extension for emoji
274 stars 166 forks source link

Can't type anything after putting emoji #104

Open msahinciftci opened 4 years ago

msahinciftci commented 4 years ago

As the title says, when I place an emoji, I can't write anything. Also I can't go past to emoji. It doesn't allow me to. This is my code:

<script>
        var toolbarOptions = [
            ['bold', 'italic', 'underline', 'strike'],
            [{ 'color': [] }, { 'background': [] }],
            [{ 'header': 1 }, { 'header': 2 }],
            [{ 'list': 'ordered' }, { 'list': 'bullet' }],
            [{ 'indent': '-1' }, { 'indent': '+1' }],
            [{ 'size': ['small', false, 'large', 'huge'] }],
            [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
            ['direction', {
                'align': []
            }],
            [{ 'font': [] }],
            [{ 'align': [] }],
            ['clean'],
            ['link', 'image', 'video'],
            ['blockquote', 'code-block'],
            ['emoji']
        ];
        var quill = new Quill('div.editor', {
            theme: 'snow',
            modules: {
                formula: true,
                syntax: true,
                toolbar: {
                    container: toolbarOptions,
                    handlers: {
                        image: imageHandler,
                        'emoji': function () { }
                    }
                },
                "emoji-toolbar": true,
                "emoji-textarea": true,
                "emoji-shortname": true,
            },
        });

        function imageHandler() {
            var range = this.quill.getSelection();
            var value = prompt('Lütfen görselin linkini giriniz');
            if (value) {
                this.quill.insertEmbed(range.index, 'image', value, Quill.sources.USER);
            }
        }
    </script>
jhades commented 4 years ago

I noticed something similar, I think this is only temporary while the image loads. The emoji image is 7MB and on mobile this takes longer and the website gets blocked while the loading is ongoing.

Ikodi-julien commented 3 years ago

I had the same issue, it seems that behaviour was predictible cause i just had to uncomment 2 lines and comment the others, it works well now : module.textarea-emoji.js, line : 162;

` let customButton = document.querySelector('.bem-' + emoji.item.name); if (customButton) { customButton.addEventListener('click', function() {

            /* Lines I uncommented */
            quill.insertText(range.index, customButton.innerHTML);
            quill.setSelection(range.index + customButton.innerHTML.length, 0);
            // range.index = range.index + customButton.innerHTML.length;

            /* Lines I had to comment */
            // quill.insertEmbed(range.index, 'emoji', emoji.item, Quill.sources.USER);
            // setTimeout(() => quill.setSelection(range.index + 1), 0, Quill.sources.USER);
            fn_close();
        });
    }`