From 490e57ded12770913b055a5641315cbbaceb8c28 Mon Sep 17 00:00:00 2001 From: Kasparas Galdikas Date: Fri, 25 Mar 2016 15:56:44 +0000 Subject: [PATCH] Added mark-selection plugin from CodeMirror with config option on simplemde --- README.md | 1 + src/js/simplemde.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5744ba1..be86447 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ simplemde.value("This text will appear in the editor"); - **tabSize**: If set, customize the tab size. Defaults to `2`. - **toolbar**: If set to `false`, hide the toolbar. Defaults to the [array of icons](#toolbar-icons). - **toolbarTips**: If set to `false`, disable toolbar button tips. Defaults to `true`. +- **styleSelectedText**: If set to `false`, remove `.CodeMirror-selectedtext` class from selected lines. Defaults to `true`. ```JavaScript // Most options demonstrate the non-default behavior diff --git a/src/js/simplemde.js b/src/js/simplemde.js index e3ea821..ed5f004 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -7,6 +7,7 @@ require("codemirror/addon/display/fullscreen.js"); require("codemirror/mode/markdown/markdown.js"); require("codemirror/addon/mode/overlay.js"); require("codemirror/addon/display/placeholder.js"); +require("codemirror/addon/selection/mark-selection.js"); require("codemirror/mode/gfm/gfm.js"); require("codemirror/mode/xml/xml.js"); require("spell-checker"); @@ -1483,7 +1484,8 @@ SimpleMDE.prototype.render = function(el) { extraKeys: keyMaps, lineWrapping: (options.lineWrapping === false) ? false : true, allowDropFileTypes: ["text/plain"], - placeholder: options.placeholder || el.getAttribute("placeholder") || "" + placeholder: options.placeholder || el.getAttribute("placeholder") || "", + styleSelectedText: (options.styleSelectedText != undefined) ? options.styleSelectedText : true }); if(options.forceSync === true) {