Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit b1d953d

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 100819f + 531a0e6 commit b1d953d

11 files changed

+1414
-1212
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
language: node_js
22
node_js:
3+
- '14' # EOL: April 2023
34
- '12' # EOL: April 2022
45
- '11' # EOL: June 2019
56
- '10' # EOL: April 2021
67
- '8' # EOL: December 2019
7-
- '6' # EOL: April 2019
88

99
jobs:
1010
include:

CHANGELOG.md

+64-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,42 @@ All notable changes to easymde will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
<!--## [Unreleased]-->
7+
## [Unreleased]
8+
### Added
9+
- Support for Node.js 14.
10+
- Preview without fullscreen (Thanks to [@nick-denry], [#196]).
11+
12+
### Fixed
13+
- Fix cursor displayed position on activity ([#183]).
14+
- Checkboxes always have bullets in front of them ([#136]).
15+
- Save the text only when modifying the content of the easymde instance (Thanks to [@firm1], [#181]).
16+
17+
## [2.10.1] - 2020-04-06
18+
### Fixed
19+
- Typescript error when entering certain strings for toolbar buttons ([#178]).
20+
21+
## [2.10.0] - 2020-04-02
22+
### Added
23+
- `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser (Thanks to [@firm1], [#143]).
24+
- Group buttons in drop-down lists by adding a sub-option `children` for the items in the toolbar (Thanks to [@firm1], [#141]).
25+
- `sanitizerFunction` option to allow custom HTML sanitizing in the markdown preview (Thanks to [@adamb70], [#147]).
26+
- Time formatting and custom text options for the autosave message (Thanks to [@dima-bzz], [#170]).
27+
### Changed
28+
- Delay before assuming that submit of the form as failed is `autosave.submit_delay` instead of `autosave.delay` (Thanks to [@Situphen], [#139]).
29+
- Add `watch` task for gulp (Thanks to [@A-312], [#150]).
30+
### Fixed
31+
- Issue with Marked when using IE11 and webpack (Thanks to [@felipefdl], [#169]).
32+
- Updated codemirror to version 5.52.2 (Thanks to [@A-312], [#173]).
33+
- Editor displaying on top of other elements on a webpage (Thanks to [@StefKors], [#175]).
34+
35+
## [2.9.0] - 2020-01-13
36+
### Added
37+
- Missing minHeight option in type definition (Thanks to [@t49tran], [#123]).
38+
- Other missing type definitions ([#126]).
39+
40+
### Changed
41+
- The editor will remove its saved contents when the editor is emptied, allowing to reload a default value (Thanks to [@Situphen], [#132]).
42+
843
## [2.8.0] - 2019-08-20
944
### Added
1045
- Upload images functionality (Thanks to [@roipoussiere] and [@JeroenvO], [#71], [#101]).
@@ -119,6 +154,10 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
119154
- Cursor not always showing in "text" mode over the edit field
120155

121156
<!-- Linked issues -->
157+
[#183]: https://github.com/Ionaru/easy-markdown-editor/issues/183
158+
[#178]: https://github.com/Ionaru/easy-markdown-editor/issues/178
159+
[#136]: https://github.com/Ionaru/easy-markdown-editor/issues/136
160+
[#126]: https://github.com/Ionaru/easy-markdown-editor/issues/126
122161
[#99]: https://github.com/Ionaru/easy-markdown-editor/issues/99
123162
[#45]: https://github.com/Ionaru/easy-markdown-editor/issues/45
124163
[#44]: https://github.com/Ionaru/easy-markdown-editor/issues/44
@@ -131,6 +170,18 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
131170
[#9]: https://github.com/Ionaru/easy-markdown-editor/issues/9
132171

133172
<!-- Linked PRs -->
173+
[#196]: https://github.com/Ionaru/easy-markdown-editor/pull/196
174+
[#175]: https://github.com/Ionaru/easy-markdown-editor/pull/175
175+
[#173]: https://github.com/Ionaru/easy-markdown-editor/pull/173
176+
[#170]: https://github.com/Ionaru/easy-markdown-editor/pull/170
177+
[#169]: https://github.com/Ionaru/easy-markdown-editor/pull/169
178+
[#150]: https://github.com/Ionaru/easy-markdown-editor/pull/150
179+
[#147]: https://github.com/Ionaru/easy-markdown-editor/pull/147
180+
[#143]: https://github.com/Ionaru/easy-markdown-editor/pull/143
181+
[#141]: https://github.com/Ionaru/easy-markdown-editor/pull/141
182+
[#139]: https://github.com/Ionaru/easy-markdown-editor/pull/139
183+
[#132]: https://github.com/Ionaru/easy-markdown-editor/pull/132
184+
[#123]: https://github.com/Ionaru/easy-markdown-editor/pull/123
134185
[#109]: https://github.com/Ionaru/easy-markdown-editor/pull/109
135186
[#106]: https://github.com/Ionaru/easy-markdown-editor/pull/106
136187
[#101]: https://github.com/Ionaru/easy-markdown-editor/pull/101
@@ -144,6 +195,14 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
144195
[#19]: https://github.com/Ionaru/easy-markdown-editor/pull/19
145196

146197
<!-- Linked users -->
198+
[@nick-denry]: https://github.com/nick-denry
199+
[@StefKors]: https://github.com/StefKors
200+
[@felipefdl]: https://github.com/felipefdl
201+
[@A-312]: https://github.com/A-312
202+
[@dima-bzz]: https://github.com/dima-bzz
203+
[@firm1]: https://github.com/firm1
204+
[@Situphen]: https://github.com/Situphen
205+
[@t49tran]: https://github.com/t49tran
147206
[@richtera]: https://github.com/richtera
148207
[@jfly]: https://github.com/jfly
149208
[@sperezp]: https://github.com/sperezp
@@ -162,7 +221,10 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
162221
[@sne11ius]: https://github.com/sne11ius
163222

164223
<!-- Linked versions -->
165-
[Unreleased]: https://github.com/Ionaru/easy-markdown-editor/compare/2.8.0...HEAD
224+
[Unreleased]: https://github.com/Ionaru/easy-markdown-editor/compare/2.10.1...HEAD
225+
[2.10.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.10.0...2.10.1
226+
[2.10.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.9.0...2.10.0
227+
[2.9.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.8.0...2.9.0
166228
[2.8.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.7.0...2.8.0
167229
[2.7.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.6.1...2.7.0
168230
[2.6.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.6.0...2.6.1

README.md

+77-12
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ The editor is entirely customizable, from theming to toolbar buttons and javascr
2525

2626
- [Install EasyMDE](#install-easymde)
2727
- [How to use](#how-to-use)
28-
- [Loading the editor](#loading-the-editor)
29-
- [Editor functions](#editor-functions)
28+
- [Loading the editor](#loading-the-editor)
29+
- [Editor functions](#editor-functions)
3030
- [Configuration](#configuration)
31-
- [Options list](#options-list)
32-
- [Options example](#options-example)
33-
- [Toolbar icons](#toolbar-icons)
34-
- [Toolbar customization](#toolbar-customization)
35-
- [Keyboard shortcuts](#keyboard-shortcuts)
31+
- [Options list](#options-list)
32+
- [Options example](#options-example)
33+
- [Toolbar icons](#toolbar-icons)
34+
- [Toolbar customization](#toolbar-customization)
35+
- [Keyboard shortcuts](#keyboard-shortcuts)
3636
- [Advanced use](#advanced-use)
37-
- [Event handling](#event-handling)
38-
- [Removing EasyMDE from text area](#removing-easymde-from-text-area)
39-
- [Useful methods](#useful-methods)
37+
- [Event handling](#event-handling)
38+
- [Removing EasyMDE from text area](#removing-easymde-from-text-area)
39+
- [Useful methods](#useful-methods)
4040
- [How it works](#how-it-works)
4141
- [SimpleMDE fork](#simplemde-fork)
4242
- [Hacking EasyMDE](#hacking-easymde)
@@ -120,7 +120,10 @@ easyMDE.value('New input for **EasyMDE**');
120120
- **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.*
121121
- **enabled**: If set to `true`, saves the text automatically. Defaults to `false`.
122122
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
123+
- **submit_delay**: Delay before assuming that submit of the form failed and saving the text, in milliseconds. Defaults to `autosave.delay` or `10000` (10s).
123124
- **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.
125+
- **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`.
126+
- **text**: Set text for autosave.
124127
- **blockStyles**: Customize how certain buttons that style blocks of text behave.
125128
- **bold**: Can be set to `**` or `__`. Defaults to `**`.
126129
- **code**: Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
@@ -137,6 +140,7 @@ easyMDE.value('New input for **EasyMDE**');
137140
- table
138141
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
139142
- **minHeight**: Sets the minimum height for the composition area, before it starts auto-growing. Should be a string containing a valid CSS value like `"500px"`. Defaults to `"300px"`.
143+
- **maxHeight**: Sets fixed height for the composition area. `minHeight` option will be ignored. Should be a string containing a valid CSS value like `"500px"`. Defaults to `undefined`.
140144
- **onToggleFullScreen**: A function that gets called when the editor's full screen mode is toggled. The function will be passed a boolean as parameter, `true` when the editor is currently going into full screen mode, or `false`.
141145
- **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
142146
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
@@ -177,9 +181,13 @@ easyMDE.value('New input for **EasyMDE**');
177181
- **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`.
178182
- **markedOptions**: Set the internal Markdown renderer's [options](https://marked.js.org/#/USING_ADVANCED.md#options). Other `renderingConfig` options will take precedence.
179183
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
184+
- **sanitizerFunction**: Custom function for sanitizing the HTML output of markdown renderer.
180185
- **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
181186
- **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
182187
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
188+
- **inputStyle**: `textarea` or `contenteditable`. Defaults to `textarea` for desktop and `contenteditable` for mobile. `contenteditable` option is necessary to enable nativeSpellcheck.
189+
- **nativeSpellcheck**: If set to `false`, disable native spell checker. Defaults to `true`.
190+
- **sideBySideFullscreen**: If set to `false`, allows side-by-side editing without going into fullscreen. Defaults to `true`.
183191
- **status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items.
184192
- Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items.
185193
- **styleSelectedText**: If set to `false`, remove the `CodeMirror-selectedtext` class from selected lines. Defaults to `true`.
@@ -201,6 +209,18 @@ var editor = new EasyMDE({
201209
enabled: true,
202210
uniqueId: "MyUniqueID",
203211
delay: 1000,
212+
submit_delay: 5000,
213+
timeFormat: {
214+
locale: 'en-US',
215+
format: {
216+
year: 'numeric',
217+
month: 'long',
218+
day: '2-digit',
219+
hour: '2-digit',
220+
minute: '2-digit',
221+
},
222+
},
223+
text: "Autosaved: "
204224
},
205225
blockStyles: {
206226
bold: "__",
@@ -225,10 +245,10 @@ var editor = new EasyMDE({
225245
underscoresBreakWords: true,
226246
},
227247
placeholder: "Type here...",
228-
248+
229249
previewClass: "my-custom-styling",
230250
previewClass: ["my-custom-styling", "more-custom-styling"],
231-
251+
232252
previewRender: function(plainText) {
233253
return customMarkdownParser(plainText); // Returns HTML from a custom parser
234254
},
@@ -247,6 +267,10 @@ var editor = new EasyMDE({
247267
renderingConfig: {
248268
singleLineBreaks: false,
249269
codeSyntaxHighlighting: true,
270+
sanitizerFunction: function(renderedHTML) {
271+
// Using DOMPurify and only allowing <b> tags
272+
return DOMPurify.sanitize(renderedHTML, {ALLOWED_TAGS: ['b']})
273+
},
250274
},
251275
shortcuts: {
252276
drawTable: "Cmd-Alt-T"
@@ -266,6 +290,7 @@ var editor = new EasyMDE({
266290
},
267291
}], // Another optional usage, with a custom status bar item that counts keystrokes
268292
styleSelectedText: false,
293+
sideBySideFullscreen: false,
269294
syncSideBySidePreviewScroll: false,
270295
tabSize: 4,
271296
toolbar: false,
@@ -342,6 +367,46 @@ var easyMDE = new EasyMDE({
342367
});
343368
```
344369

370+
Put some buttons on dropdown menu
371+
372+
```Javascript
373+
var easyMDE = new EasyMDE({
374+
toolbar: [{
375+
name: "heading",
376+
action: EasyMDE.toggleHeadingSmaller,
377+
className: "fa fa-header",
378+
title: "Headers",
379+
},
380+
"|",
381+
{
382+
name: "others",
383+
className: "fa fa-blind",
384+
title: "others buttons",
385+
children: [
386+
{
387+
name: "image",
388+
action: EasyMDE.drawImage,
389+
className: "fa fa-picture-o",
390+
title: "Image",
391+
},
392+
{
393+
name: "quote",
394+
action: EasyMDE.toggleBlockquote,
395+
className: "fa fa-percent",
396+
title: "Quote",
397+
},
398+
{
399+
name: "link",
400+
action: EasyMDE.drawLink,
401+
className: "fa fa-link",
402+
title: "Link",
403+
}
404+
]
405+
},
406+
// [, ...]
407+
]
408+
});
409+
```
345410

346411
### Keyboard shortcuts
347412

example/index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>Example / Preview</title>
9+
<link rel="stylesheet" href="../dist/easymde.min.css">
10+
<script src="../dist/easymde.min.js"></script>
11+
</head>
12+
13+
<body>
14+
<textarea></textarea>
15+
<script>
16+
var easyMDE = new EasyMDE();
17+
</script>
18+
</body>
19+
20+
</html>

gulpfile.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ var banner = ['/**',
2020
' */',
2121
''].join('\n');
2222

23+
24+
var css_files = [
25+
'./node_modules/codemirror/lib/codemirror.css',
26+
'./src/css/*.css',
27+
'./node_modules/codemirror-spell-checker/src/css/spell-checker.css',
28+
];
29+
2330
function lint() {
2431
return gulp.src('./src/js/**/*.js')
2532
.pipe(eslint())
@@ -37,12 +44,6 @@ function scripts() {
3744
}
3845

3946
function styles() {
40-
var css_files = [
41-
'./node_modules/codemirror/lib/codemirror.css',
42-
'./src/css/*.css',
43-
'./node_modules/codemirror-spell-checker/src/css/spell-checker.css',
44-
];
45-
4647
return gulp.src(css_files)
4748
.pipe(concat('easymde.css'))
4849
.pipe(cleanCSS())
@@ -52,6 +53,14 @@ function styles() {
5253
.pipe(gulp.dest('./dist/'));
5354
}
5455

56+
// Watch for file changes
57+
function watch() {
58+
gulp.watch('./src/js/**/*.js', scripts);
59+
gulp.watch(css_files, styles);
60+
}
61+
5562
var build = gulp.parallel(gulp.series(lint, scripts), styles);
5663

5764
gulp.task('default', build);
65+
gulp.task('watch', gulp.series(build, watch));
66+
gulp.task('lint', lint);

0 commit comments

Comments
 (0)