Skip to content

Commit

Permalink
fix when deleting last character in block
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Apr 5, 2016
1 parent f279ac4 commit c29e9b0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/code-highlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import CodeBlock from 'quill/formats/code';
class HighlightCodeBlock extends CodeBlock {
highlight() {
if (this.cachedHTML !== this.domNode.innerHTML) {
this.domNode.textContent = this.domNode.textContent;
hljs.highlightBlock(this.domNode);
this.attach();
let text = this.domNode.textContent;
if (text.trim().length > 0) {
this.domNode.textContent = this.domNode.textContent;
hljs.highlightBlock(this.domNode);
this.attach();
}
this.cachedHTML = this.domNode.innerHTML;
}
}
Expand Down

0 comments on commit c29e9b0

Please sign in to comment.