Change default size units from 'b,Kb,Mb' to ' B, kB, MB' (#239)

pull/242/head
Boris Dalstein 4 years ago
parent 7b90f83ae9
commit 418116c1cc

@ -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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<!--## [Unreleased]-->
## [Unreleased]
### Fixed
- Corrected default size units from `b,Kb,Mb` to ` B, KB, MB` ([#239]).
## [2.11.0] - 2020-07-16
### Added
- Support for Node.js 14.
@ -155,6 +158,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
- Cursor not always showing in "text" mode over the edit field
<!-- Linked issues -->
[#239]: https://github.com/Ionaru/easy-markdown-editor/issues/239
[#178]: https://github.com/Ionaru/easy-markdown-editor/issues/178
[#136]: https://github.com/Ionaru/easy-markdown-editor/issues/136
[#126]: https://github.com/Ionaru/easy-markdown-editor/issues/126

@ -170,7 +170,7 @@ easyMDE.value('New input for **EasyMDE**');
- **sbOnDrop**: Status message displayed when the user drops a file in the text area. Defaults to `Uploading images #images_names#`.
- **sbProgress**: Status message displayed to show uploading progress. Defaults to `Uploading #file_name#: #progress#%`.
- **sbOnUploaded**: Status message displayed when the image has been uploaded. Defaults to `Uploaded #image_name#`.
- **sizeUnits**: A comma-separated list of units used to display messages with human-readable file sizes. Defaults to `b,Kb,Mb`.
- **sizeUnits**: A comma-separated list of units used to display messages with human-readable file sizes. Defaults to ` B, KB, MB` (example: `218 KB`). You can use `B,KB,MB` instead if you prefer without whitespaces (`218KB`).
- **errorMessages**: Errors displayed to the user, using the `errorCallback` option, where `#image_name#`, `#image_size#` and `#image_max_size#` will replaced by their respective values, that can be used for customization or internationalization:
- **noFileGiven**: The server did not receive any file from the user. Defaults to `You must select a file.`.
- **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.`.

@ -1296,10 +1296,12 @@ function _cleanBlock(cm) {
}
/**
* Convert a number of bytes to a human-readable file size.
* Convert a number of bytes to a human-readable file size. If you desire
* to add a space between the value and the unit, you need to add this space
* to the given units.
* @param bytes {integer} A number of bytes, as integer. Ex: 421137
* @param units {number[]} An array of human-readable units, ie. ['b', 'Kb', 'Mb']
* @returns string A human-readable file size. Ex: '412Kb'
* @param units {number[]} An array of human-readable units, ie. [' B', ' K', ' MB']
* @returns string A human-readable file size. Ex: '412 KB'
*/
function humanFileSize(bytes, units) {
if (Math.abs(bytes) < 1024) {
@ -1585,7 +1587,7 @@ var imageTexts = {
sbOnDrop: 'Uploading image #images_names#...',
sbProgress: 'Uploading #file_name#: #progress#%',
sbOnUploaded: 'Uploaded #image_name#',
sizeUnits: 'b,Kb,Mb',
sizeUnits: ' B, KB, MB',
};
/**
@ -2058,7 +2060,7 @@ EasyMDE.prototype.render = function (el) {
}, self.options.autosave.submit_delay || self.options.autosave.delay || 1000);
});
}
function handleImages() {
if (options.previewImagesInEditor === false) {
@ -2101,7 +2103,7 @@ EasyMDE.prototype.render = function (el) {
handleImages();
});
this.onWindowResize = function() {
handleImages();

Loading…
Cancel
Save