diff --git a/README.md b/README.md index 7f87d65..ab4a974 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Unordered List | toggleUnorderedList | fa fa-list-ul | Generic List (Ctrl+L) Numbered List | toggleOrderedList | fa fa-list-ol | Numbered List (Ctrl+Alt+L) Link | drawLink | fa fa-link | Create Link (Ctrl+K) Image | drawImage | fa fa-picture-o | Insert Image (Ctrl+Alt+I) +Horizontal Rule | drawHorizontalRule | fa fa-minus | Insert Horizontal Line Preview | togglePreview | fa fa-eye | Toggle Preview (Ctrl+P) Markdown Guide | [This link](http://nextstepwebs.github.io/simplemde-markdown-editor/markdown-guide) | fa fa-question-circle | Markdown Guide diff --git a/source files/simplemde.js b/source files/simplemde.js index d458652..c6d71db 100644 --- a/source files/simplemde.js +++ b/source files/simplemde.js @@ -195,6 +195,16 @@ function drawImage(editor) { } +/** + * Action for drawing a horizontal rule. + */ +function drawHorizontalRule(editor) { + var cm = editor.codemirror; + var stat = getState(cm); + _replaceSelection(cm, stat.image, '', '\n\n-----\n\n'); +} + + /** * Undo action. */ @@ -719,10 +729,12 @@ SimpleMDE.prototype.value = function(val) { SimpleMDE.toggleBold = toggleBold; SimpleMDE.toggleItalic = toggleItalic; SimpleMDE.toggleBlockquote = toggleBlockquote; +SimpleMDE.toggleCodeBlock = toggleCodeBlock; SimpleMDE.toggleUnorderedList = toggleUnorderedList; SimpleMDE.toggleOrderedList = toggleOrderedList; SimpleMDE.drawLink = drawLink; SimpleMDE.drawImage = drawImage; +SimpleMDE.drawHorizontalRule = drawHorizontalRule; SimpleMDE.undo = undo; SimpleMDE.redo = redo; SimpleMDE.togglePreview = togglePreview; @@ -740,6 +752,9 @@ SimpleMDE.prototype.toggleItalic = function() { SimpleMDE.prototype.toggleBlockquote = function() { toggleBlockquote(this); }; +SimpleMDE.prototype.toggleCodeBlock = function() { + toggleCodeBlock(this); +}; SimpleMDE.prototype.toggleUnorderedList = function() { toggleUnorderedList(this); }; @@ -752,6 +767,9 @@ SimpleMDE.prototype.drawLink = function() { SimpleMDE.prototype.drawImage = function() { drawImage(this); }; +SimpleMDE.prototype.drawHorizontalRule = function() { + drawHorizontalRule(this); +}; SimpleMDE.prototype.undo = function() { undo(this); };