How to insert a spoiler button in the quill editor?

  • 0
    I want to create a button to add a spoiler inside the text

    var bolt = class Blot extends Inline {}
    bolt.blotName = 'spoiler';
    bolt.tagName = 'div';
    
    $('#bold-button').click(function() {
        title = prompt('Enter title');
        quill.format('spoiler', title);
    });

    as a result, you should get this html code

    <div class="spoiler">
        <div class="'+title+'_block block">
            <a class="'+title+'">title</a>
        </div>
        <div class="hide">
            text
        </div>
    </div>
    JavaScript Anonymous, Mar 3, 2020

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!