mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-31 13:54:28 -06:00
Merge pull request #199 from adam187/feature/placeholder
add placeholder option
This commit is contained in:
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`.
|
- **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
|
||||||
},
|
},
|
||||||
|
@ -317,4 +317,8 @@
|
|||||||
|
|
||||||
.CodeMirror .CodeMirror-code .cm-strikethrough {
|
.CodeMirror .CodeMirror-code .cm-strikethrough {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-placeholder{
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user