From a93f7a2570c513ae2a7e35d3a27b954bf0ce6c08 Mon Sep 17 00:00:00 2001 From: Wes Cossick Date: Thu, 24 Sep 2015 15:03:20 -0500 Subject: [PATCH] New hide icons option --- README.md | 4 ++-- src/js/simplemde.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd9d103..b5ad3b7 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ simplemde.value("This text will appear in the editor"); - **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s). - **unique_id**: You must set a unique identifier so that SimpleMDE can autosave. Something that separates this from other textareas. - **element**: The DOM element for the textarea to use. Defaults to the first textarea on the page. +- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons without completely customizing the toolbar. - **indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`. - **initialValue**: If set, will customize the initial value of the editor. - **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`. @@ -80,7 +81,6 @@ simplemde.value("This text will appear in the editor"); - Optionally, you can set an array of status bar elements to include, and in what order. - **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). -- **toolbarGuideIcon**: If set to `false`, disable guide icon in the toolbar. Defaults to `true`. - **toolbarTips**: If set to `false`, disable toolbar button tips. Defaults to `true`. ```JavaScript @@ -92,6 +92,7 @@ var simplemde = new SimpleMDE({ delay: 1000, }, element: document.getElementById("MyID"), + hideIcons: ["guide", "heading"], indentWithTabs: false, initialValue: "Hello world!", lineWrapping: false, @@ -116,7 +117,6 @@ var simplemde = new SimpleMDE({ status: ['autosave', 'lines', 'words', 'cursor'], // Optional usage tabSize: 4, toolbar: false, - toolbarGuideIcon: false, toolbarTips: false, }); ``` diff --git a/src/js/simplemde.js b/src/js/simplemde.js index 05a7af1..9727adb 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -1033,6 +1033,9 @@ SimpleMDE.prototype.createToolbar = function(items) { for(var i = 0; i < items.length; i++) { if(items[i].name == "guide" && self.options.toolbarGuideIcon === false) continue; + + if(self.options.hideIcons.indexOf(items[i].name) != -1) + continue; (function(item) { var el;