@ -190,7 +190,7 @@ easyMDE.value('New input for **EasyMDE**');
- **typeNotAllowed**: The user send a file type which doesn't match the `imageAccept` list, or the server returned this error code. Defaults to `This image type is not allowed.`.
- **typeNotAllowed**: The user send a file type which doesn't match the `imageAccept` list, or the server returned this error code. Defaults to `This image type is not allowed.`.
- **fileTooLarge**: The size of the image being imported is bigger than the `imageMaxSize`, or if the server returned this error code. Defaults to `Image #image_name# is too big (#image_size#).\nMaximum file size is #image_max_size#.`.
- **fileTooLarge**: The size of the image being imported is bigger than the `imageMaxSize`, or if the server returned this error code. Defaults to `Image #image_name# is too big (#image_size#).\nMaximum file size is #image_max_size#.`.
- **importError**: An unexpected error occurred when uploading the image. Defaults to `Something went wrong when uploading the image #image_name#.`.
- **importError**: An unexpected error occurred when uploading the image. Defaults to `Something went wrong when uploading the image #image_name#.`.
- **errorCallback**: A callback function used to define how to display an error message. Defaults to `function(errorMessage) {alert(errorMessage);};`.
- **errorCallback**: A callback function used to define how to display an error message. Defaults to `(errorMessage) => alert(errorMessage)`.
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
- **codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page or pass in using the `hljs` option. For example, include the script and the CSS files like:<br>`<scriptsrc="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<linkrel="stylesheet"href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
- **codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page or pass in using the `hljs` option. For example, include the script and the CSS files like:<br>`<scriptsrc="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<linkrel="stylesheet"href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
- **hljs**: An injectible instance of [highlight.js](https://github.com/isagalaev/highlight.js). If you don't want to rely on the global namespace (`window.hljs`), you can provide an instance here. Defaults to `undefined`.
- **hljs**: An injectible instance of [highlight.js](https://github.com/isagalaev/highlight.js). If you don't want to rely on the global namespace (`window.hljs`), you can provide an instance here. Defaults to `undefined`.
@ -218,83 +218,83 @@ easyMDE.value('New input for **EasyMDE**');
Most options demonstrate the non-default behavior:
Most options demonstrate the non-default behavior:
```JavaScript
```js
const editor = new EasyMDE({
const editor = new EasyMDE({
autofocus: true,
autofocus: true,
autosave: {
autosave: {
enabled: true,
enabled: true,
uniqueId: "MyUniqueID",
uniqueId: "MyUniqueID",
delay: 1000,
delay: 1000,
submit_delay: 5000,
submit_delay: 5000,
timeFormat: {
timeFormat: {
locale: 'en-US',
locale: 'en-US',
format: {
format: {
year: 'numeric',
year: 'numeric',
month: 'long',
month: 'long',
day: '2-digit',
day: '2-digit',
hour: '2-digit',
hour: '2-digit',
minute: '2-digit',
minute: '2-digit',
},
},
},
},
text: "Autosaved: "
text: "Autosaved: "
},
},
blockStyles: {
blockStyles: {
bold: "__",
bold: "__",
italic: "_",
italic: "_",
},
},
element: document.getElementById("MyID"),
element: document.getElementById("MyID"),
forceSync: true,
forceSync: true,
hideIcons: ["guide", "heading"],
hideIcons: ["guide", "heading"],
indentWithTabs: false,
indentWithTabs: false,
initialValue: "Hello world!",
initialValue: "Hello world!",
insertTexts: {
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
image: ["![](http://", ")"],
link: ["[", "](https://)"],
link: ["[", "](https://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
You can revert to the initial text area by calling the `toTextArea` method. Note that this clears up the autosave (if enabled) associated with it. The text area will retain any text from the destroyed EasyMDE instance.
You can revert to the initial text area by calling the `toTextArea` method. Note that this clears up the autosave (if enabled) associated with it. The text area will retain any text from the destroyed EasyMDE instance.