add placeholder option

pull/198/head
Adam Misiorny 9 years ago
parent 7a2e75eb48
commit f891cfb787

@ -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`. - **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`. - **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`. - **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. - **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). - **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`. - **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
@ -131,6 +132,7 @@ var simplemde = new SimpleMDE({
strikethrough: false, strikethrough: false,
underscoresBreakWords: true, underscoresBreakWords: true,
}, },
placeholder: 'Type here...',
previewRender: function(plainText) { previewRender: function(plainText) {
return customMarkdownParser(plainText); // Returns HTML from a custom parser return customMarkdownParser(plainText); // Returns HTML from a custom parser
}, },

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

Loading…
Cancel
Save