Quill strips out simple html when dangerouslyPasteHTML into editor -
<style> #editor-container { height: 375px; } .link { color:blue; } </style> <div id="editor-container"> test </div> <script type="text/javascript"> var quill = new quill('#editor-container', { modules: { toolbar: [ [{ header: [1, 2, false] }], ['bold', 'italic', 'underline'], ['image', 'code-block'] ] }, placeholder: 'compose epic...', theme: 'bubble' // or 'bubble' }); quill.clipboard.dangerouslypastehtml(5, "<span class=\"link\" data-test=\"test\">testing</span>", "silent"); </script> mvce - https://codepen.io/anon/pen/qmqmee
the html stripped out despite being pretty harmless (this handled better later).
my current plan, due way quill not allow pasted html, (as part of click action on mentioned person's name):
$("#tag-selectable-users-list li").on("click", function() { var $this = $(this); var startindex = $this.data("data-start-index"); var username = $this.data("data-user-name"); var userid = $this.data("data-user-id"); var taggeduserids = $("#hiddentaggedusers"); taggeduserids.val((taggeduserids.val()||"") + ";" + userid); var delta = []; if (startindex > 0) { //retain tag start delta.push({ retain: parseint(startindex) }); } //delete junk delta.push({ delete: tagstatus.total.length }); //insert new characters delta.push({ insert: "@@" + username, attributes: { color: "blue", underline: "true" } }); //insert blank space end span delta.push({ insert: " " }); quill.updatecontents(delta, 'api'); }); }
Comments
Post a Comment