mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-23 01:44:31 -06:00
Merge pull request #249 from mbolli/codemirror-autorefresh
include codemirror autorefresh addon
This commit is contained in:
commit
70f3512120
@ -126,6 +126,7 @@ easyMDE.value('New input for **EasyMDE**');
|
||||
- **uniqueId**: You must set a unique string identifier so that EasyMDE can autosave. Something that separates this from other instances of EasyMDE elsewhere on your website.
|
||||
- **timeFormat**: Set DateTimeFormat. More information see [DateTimeFormat instances](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). Default `locale: en-US, format: hour:minute`.
|
||||
- **text**: Set text for autosave.
|
||||
- **autoRefresh**: Useful, when initializing the editor in a hidden DOM node. If set to `{ delay: 300 }`, it will check every 300 ms if the editor is visible and if positive, call CodeMirror's [`refresh()`](https://codemirror.net/doc/manual.html#refresh).
|
||||
- **blockStyles**: Customize how certain buttons that style blocks of text behave.
|
||||
- **bold**: Can be set to `**` or `__`. Defaults to `**`.
|
||||
- **code**: Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
|
||||
|
@ -6,6 +6,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/display/autorefresh.js');
|
||||
require('codemirror/addon/selection/mark-selection.js');
|
||||
require('codemirror/addon/search/searchcursor.js');
|
||||
require('codemirror/mode/gfm/gfm.js');
|
||||
@ -2043,6 +2044,7 @@ EasyMDE.prototype.render = function (el) {
|
||||
configureMouse: configureMouse,
|
||||
inputStyle: (options.inputStyle != undefined) ? options.inputStyle : isMobile() ? 'contenteditable' : 'textarea',
|
||||
spellcheck: (options.nativeSpellcheck != undefined) ? options.nativeSpellcheck : true,
|
||||
autoRefresh: (options.autoRefresh != undefined) ? options.autoRefresh : false,
|
||||
});
|
||||
|
||||
this.codemirror.getScrollerElement().style.minHeight = options.minHeight;
|
||||
|
1
types/easymde.d.ts
vendored
1
types/easymde.d.ts
vendored
@ -168,6 +168,7 @@ declare namespace EasyMDE {
|
||||
autoDownloadFontAwesome?: boolean;
|
||||
autofocus?: boolean;
|
||||
autosave?: AutoSaveOptions;
|
||||
autoRefresh?: boolean | { delay: number };
|
||||
blockStyles?: BlockStyleOptions;
|
||||
element?: HTMLElement;
|
||||
forceSync?: boolean;
|
||||
|
Loading…
x
Reference in New Issue
Block a user