Merge pull request #139 from Situphen/delay

Differentiate between regular autosave delay and submit autosave delay
pull/145/head
Jeroen Akkerman 4 years ago committed by GitHub
commit 9b9edec517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,10 @@ All notable changes to easymde will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<!--## [Unreleased]--> ## [Unreleased]
### Changed
- Delay before assuming that submit of the form as failed is `autosave.submit_delay` instead of `autosave.delay` (Thanks to [@Situphen], [#139]).
## [2.9.0] - 2020-01-13 ## [2.9.0] - 2020-01-13
### Added ### Added
- Missing minHeight option in type definition (Thanks to [@t49tran], [#123]). - Missing minHeight option in type definition (Thanks to [@t49tran], [#123]).

@ -120,6 +120,7 @@ easyMDE.value('New input for **EasyMDE**');
- **autosave**: *Saves the text that's being written and will load it back in the future. It will forget the text when the form it's contained in is submitted.* - **autosave**: *Saves the text that's being written and will load it back in the future. It will forget the text when the form it's contained in is submitted.*
- **enabled**: If set to `true`, saves the text automatically. Defaults to `false`. - **enabled**: If set to `true`, saves the text automatically. Defaults to `false`.
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s). - **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
- **submit_delay**: Delay before assuming that submit of the form failed and saving the text, in milliseconds. Defaults to `autosave.delay` or `10000` (10s).
- **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. - **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.
- **blockStyles**: Customize how certain buttons that style blocks of text behave. - **blockStyles**: Customize how certain buttons that style blocks of text behave.
- **bold**: Can be set to `**` or `__`. Defaults to `**`. - **bold**: Can be set to `**` or `__`. Defaults to `**`.
@ -201,6 +202,7 @@ var editor = new EasyMDE({
enabled: true, enabled: true,
uniqueId: "MyUniqueID", uniqueId: "MyUniqueID",
delay: 1000, delay: 1000,
submit_delay: 5000,
}, },
blockStyles: { blockStyles: {
bold: "__", bold: "__",

@ -1929,7 +1929,7 @@ EasyMDE.prototype.autosave = function () {
// Restart autosaving in case the submit will be cancelled down the line // Restart autosaving in case the submit will be cancelled down the line
setTimeout(function () { setTimeout(function () {
easyMDE.autosave(); easyMDE.autosave();
}, easyMDE.options.autosave.delay || 10000); }, easyMDE.options.autosave.submit_delay || easyMDE.options.autosave.delay || 10000);
}); });
} }

Loading…
Cancel
Save