2017-08-18 3 views
0
<style> 
#editor-container { 
    height: 375px; 
} 
.link { 
    color:blue; 
} 
</style> 

<div id="editor-container"> 
    This is a 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 an epic...', 
    theme: 'bubble' // or 'bubble' 
}); 

quill.clipboard.dangerouslyPasteHTML(5, "<span class=\"link\" data-test=\"test\">testing</span>", "silent"); 
</script> 

MVCEに単純なHTML dangerouslyPasteHTMLを除去します。クイル貼り付けHTMLを許可しない方法が原因クイルは、エディタ

答えて

0

私の現在の計画、である(前述の人の名前をクリックするアクションの一部として):

$("#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 up to the tag start 
       delta.push({ retain: parseInt(startIndex) }); 
      } 
      //delete the junk 
      delta.push({ delete: tagStatus.Total.length }); 
      //insert the new characters 
      delta.push({ 
       insert: "@@" + userName, 
       attributes: { 
        color: "blue", 
        underline: "true" 
       } 
      }); 
      //insert a blank space to end the span 
      delta.push({ insert: " " }); 

      quill.updateContents(delta, 
       'api'); 
     }); 
    }