angyLe
11/21/2017 - 9:23 AM

redactor editor, how to add buttons

redactor editor, how to add buttons

 console.log("component did mount");

        let doc = document.getElementsByClassName("redactor-toolbar");
        if(doc){
            console.log(doc[0]);
            let lastChild = doc[0].lastChild;
            console.log("last child");
            console.log(lastChild);

            var newElement = document.createElement("li");
            newElement.classList = "";
            newElement.innerHTML = '<a href="javascript:void(null);" onclick="' + this.bla + '"><i class="fa fa-address-book-o" aria-hidden="true"></i></a>';

            // Insert the new element before the first child
            doc[0].insertBefore(newElement, lastChild);
        }