Merge pull request #199 from adam187/feature/placeholder

add placeholder option
patch-ionaru
Wes Cossick 9 years ago
commit 6e659cf0ab

@ -90,6 +90,7 @@ simplemde.value("This text will appear in the editor");
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
- **strikethrough**: If set to `false`, will not process GFM strikethrough syntax. Defaults to `true`.
- **underscoresBreakWords**: If set to `true`, let underscores be a delimiter for separating words. Defaults to `false`.
- **placeholder**: Custom placeholder that should be displayed
- **previewRender**: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
@ -131,6 +132,7 @@ var simplemde = new SimpleMDE({
strikethrough: false,
underscoresBreakWords: true,
},
placeholder: "Type here...",
previewRender: function(plainText) {
return customMarkdownParser(plainText); // Returns HTML from a custom parser
},

@ -317,4 +317,8 @@
.CodeMirror .CodeMirror-code .cm-strikethrough {
text-decoration: line-through;
}
}
.CodeMirror .CodeMirror-placeholder{
opacity: .5;
}

@ -6,6 +6,7 @@ require("./codemirror/tablist");
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/mode/gfm/gfm.js");
require("codemirror/mode/xml/xml.js");
require("spell-checker");
@ -1047,7 +1048,8 @@ SimpleMDE.prototype.render = function(el) {
autofocus: (options.autofocus === true) ? true : false,
extraKeys: keyMaps,
lineWrapping: (options.lineWrapping === false) ? false : true,
allowDropFileTypes: ["text/plain"]
allowDropFileTypes: ["text/plain"],
placeholder: options.placeholder || el.getAttribute("placeholder") || ""
});
if(options.toolbar !== false) {

Loading…
Cancel
Save