2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-09-24 16:40:55 -06:00

Compare commits

...

656 Commits

Author SHA1 Message Date
Jeroen Akkerman
2996b67ec9
Update README.md 2025-05-01 18:41:05 +02:00
Jeroen akkerman
1708e40c42 2.20.0 2025-03-04 18:01:55 +01:00
Jeroen akkerman
f1e229f5b8 Update changelog for 2.20.0 2025-03-04 17:59:40 +01:00
Jeroen akkerman
a602d3b826 Add support for marked extensions
Fixes #514
Fixes #611
2025-02-21 22:31:16 +01:00
Jeroen akkerman
fe680f09f6 2.19.0 2025-02-18 01:12:05 +01:00
Jeroen akkerman
0eddf94930 Update changelog for 2.19.0 2025-02-18 01:10:31 +01:00
Jeroen Akkerman
22ce228b07
Merge pull request #608 from mayraamaral/master
chore: adjust the regex for previewing images so that it only attempts to render if the image has a bracket immediately preceding the parentheses
2025-02-18 00:56:58 +01:00
Jeroen akkerman
e7a56e11dd Add a test for the parentheses problem 2025-02-18 00:53:11 +01:00
Mayra Amaral
f20ff16b81
Merge branch 'Ionaru:master' into master 2025-02-17 20:39:59 -03:00
Jeroen Akkerman
c93033bb4e
Merge pull request #609 from mayraamaral/v4
chore: update actions to v4
2025-02-18 00:05:45 +01:00
Jeroen akkerman
c1b06a9613 Add Node.js version to artifact name 2025-02-18 00:01:28 +01:00
Mayra Amaral
bdfd0da5ff chore: update actions to v4 2025-02-14 21:41:15 -03:00
Mayra Amaral
138c198852 chore: adjust regex from previewing images to only try to render if image has bracket before of parentheses 2025-02-11 16:05:13 -03:00
Jeroen Akkerman
a6b121f2e6
Merge pull request #592 from p1gp1g/fix/image-processing
Avoid processing many times the same image
2024-06-07 12:34:49 +02:00
Jeroen Akkerman
65dfecf484
Merge pull request #591 from p1gp1g/fix/relative-img-url
Fix relative image url fetched from stylesheet domain
2024-06-07 12:18:18 +02:00
S1m
97bf9ce8fd Avoid processing many times the same image
Cache img key during processing to avoid having to process it
thousands of times
2024-06-04 14:39:15 +02:00
S1m
9b420ac103 Fix relative image url fetched from stylesheet domain
Partial URLs are interpreted relative to the source of
the style sheet, not relative to the document
https://www.w3.org/TR/CSS1/
2024-06-04 14:32:24 +02:00
Jeroen Akkerman
f039bae67f
Merge pull request #573 from robinvandernoord/custom-image-input-name-option
Allow setting a custom `name` for the upload-image input
2023-12-21 21:35:00 +01:00
Robin van der Noord
c68bdf148a
Allow setting a custom name for the upload-image input 2023-12-18 10:57:48 +01:00
Jeroen Akkerman
35587a9477 Update dependencies, fixes #562 2023-09-27 00:52:59 +02:00
Jeroen Akkerman
d9ab397b88
Update demo URL
fixes #526
2023-04-28 02:40:34 +02:00
Jeroen Akkerman
abead2a068
Update build status badge 2023-01-12 15:34:45 +01:00
Jeroen Akkerman
c25adab400
Merge pull request #519 from borodean/update-status-bar-typing 2023-01-12 15:14:11 +01:00
Jeroen Akkerman
a49e867930
Merge pull request #520 from borodean/upload-image-typing 2023-01-12 15:14:04 +01:00
Vadym Borodin
cb5564e1b2 Expose the "upload-image" variant for ToolbarButton 2023-01-12 14:44:10 +02:00
Vadym Borodin
fbc181f5c8 Expose the updateStatusBar type 2023-01-12 14:38:17 +02:00
Jeroen akkerman
041594ae4a 2.18.0 2022-09-20 16:45:08 +02:00
Jeroen akkerman
6ab32d9fd6 Update changelog for 2.18.0 2022-09-20 16:44:48 +02:00
Jeroen akkerman
950f689dc7 Update codemirror 2022-09-20 16:41:06 +02:00
Jeroen akkerman
6560950b65 Update workflow file 2022-09-18 02:20:36 +02:00
Jeroen akkerman
f60c9b24c5 Update dependencies 2022-09-18 01:08:09 +02:00
Jeroen akkerman
4b48564730 Revert example html 2022-09-17 23:08:33 +02:00
Jeroen akkerman
d26b4e399b Add toolbarButtonClassPrefix option
Fixes #493
2022-09-17 23:07:24 +02:00
Jeroen akkerman
84aafddd92 Add extra typing tests for previewRender 2022-08-20 18:19:18 +02:00
Jeroen akkerman
4a73c911d0 2.17.0 2022-08-20 18:14:26 +02:00
Jeroen akkerman
086e73b835 Update changelog for 2.17.0 2022-08-20 18:14:21 +02:00
Jeroen akkerman
aa2f225340 Add past merges to README 2022-08-20 18:10:14 +02:00
Jeroen akkerman
0062ba38e1 Update dependencies 2022-08-20 17:26:20 +02:00
Jeroen akkerman
f8a66b120b Edit regex pattern for Safari browser, fixes #478 2022-08-20 17:25:49 +02:00
Jeroen Akkerman
b4c55d9075
Merge pull request #471 from LevitatingOrange/detachedPreviewRendering 2022-08-20 17:24:15 +02:00
Jeroen Akkerman
c27f5d1d23
Merge pull request #492 from vanillajonathan/patch-1 2022-08-17 01:45:27 +02:00
Jonathan
f7b4fbfda5
Add support for Header size 4, 5, 6 2022-08-12 12:15:42 +02:00
Jeroen Akkerman
d22fd40625
Merge pull request #488 from LoyalPotato/master 2022-07-28 17:51:08 +02:00
David Bazílio Ribeiro
9ddbc4a585 Fix type for hideIcons 2022-07-27 17:58:51 +01:00
Jeroen akkerman
03f018a472 Migrate cypress files 2022-07-27 18:35:35 +02:00
Jeroen akkerman
9232608bf3 Fix changelog 2022-07-27 18:19:50 +02:00
Jeroen akkerman
2930abdd50 Update dependencies 2022-07-27 18:18:24 +02:00
Jeroen Akkerman
b347a911c1
Merge pull request #486 from hlf20010508/master 2022-07-27 18:09:50 +02:00
Jeroen Akkerman
3e653dc900
Merge pull request #484 from kicksent/patch-1
Fix typo in readme
2022-07-27 18:09:14 +02:00
L-ING
acbed01b34
Add missed "upload-image" icon 2022-07-24 13:58:19 +08:00
Nick Trierweiler
ef827ba61f
Fix typo in readme
This is meant to be "italic" not "italics" which will render an empty icon here. The docs specify this as well and I tested locally while working through implementing this on a project.
2022-07-15 15:07:19 -04:00
Jeroen Akkerman
37561e4458
Merge pull request #479 from hackerwins/fix-invalid-icons 2022-06-27 18:36:08 +02:00
hackerwins
03fec127eb Fix invalid icons 2022-06-27 09:30:56 +09:00
Jeroen Akkerman
4d065c361e
Merge pull request #454 from vanillajonathan/patch-8
Refactor into using a map for icon classes
2022-06-16 17:25:43 +02:00
Jonathan
78fcda535d
Update easymde.js 2022-06-16 14:09:13 +02:00
Jeroen Akkerman
c84af4c3ed Fix hyperlink doubling
Closes #25
Closes #95
Closes #281
2022-06-16 10:52:01 +02:00
Jeroen Akkerman
c311b7b8da Merge branch 'master' of https://github.com/Ionaru/easy-markdown-editor 2022-06-16 10:48:49 +02:00
Jeroen Akkerman
3d6d56edef
Merge pull request #467 from vanillajonathan/patch-1
Use classList.add and classList.remove
2022-06-16 10:47:54 +02:00
Lennart Vogelsang
67f75535ad
Updated documentation 2022-06-07 20:11:27 +02:00
Lennart Vogelsang
8295aa6a5a
Changed: ignore output of previewRender if it is null 2022-06-07 19:55:27 +02:00
Jeroen Akkerman
7338ddb6e3 Replace remaining className usages 2022-05-24 12:25:09 +02:00
Jeroen Akkerman
96a5aac921 Add testing on Node.js 18 2022-05-24 11:46:38 +02:00
Jeroen Akkerman
0c31e06928 Update dependencies 2022-05-24 11:39:56 +02:00
Jonathan
23f241bd47
Use classList.add and classList.remove 2022-05-23 19:05:42 +02:00
Jonathan
fc839e8dc8
Update README.md 2022-05-22 21:17:59 +02:00
Jonathan
0eab3e11e8
Update easymde.js 2022-05-22 20:43:55 +02:00
Jeroen Akkerman
e4610b3763
Merge pull request #452 from vanillajonathan/patch-4
Use Responsive Font Sizes
2022-05-22 18:55:07 +02:00
Jeroen Akkerman
24feffcba6
Merge pull request #464 from vanillajonathan/patch-1
Add ARIA role=application
2022-05-22 18:47:33 +02:00
Jeroen Akkerman
e57c16bc5c
Merge pull request #461 from vanillajonathan/patch-12 2022-05-22 18:45:14 +02:00
Jeroen Akkerman
eb51f0fe53
Merge pull request #466 from vanillajonathan/patch-5
Fix inconsistent border color
2022-05-22 18:41:39 +02:00
Jonathan
554112b05f
Update easymde.css 2022-05-22 18:25:49 +02:00
Jonathan
2972b280a5
Update easymde.css 2022-05-22 18:19:21 +02:00
Jonathan
eee701ef86
Update easymde.js 2022-05-22 18:15:02 +02:00
Jonathan
7f9ba6abc8
Fix inconsistent border color 2022-05-22 17:57:58 +02:00
Jeroen Akkerman
3895e0a607
Merge pull request #451 from vanillajonathan/patch-7
Add keyboard shortcuts for headings
2022-05-22 14:14:45 +02:00
Jonathan
b675e611a4
Update easymde.css 2022-05-22 12:22:39 +02:00
Jonathan
3cc99e47ae
Add ARIA role=application 2022-05-22 12:04:03 +02:00
Jonathan
f4a02e39a9
Update README.md 2022-05-22 11:38:09 +02:00
Jonathan
4714577c36
Update easymde.js 2022-05-22 11:34:31 +02:00
Jeroen Akkerman
45e0f36685
Merge pull request #463 from vanillajonathan/patch-1
Add ARIA attribute to button
2022-05-22 02:08:17 +02:00
Jonathan
cd9bbe7939
Add ARIA attribute to button 2022-05-22 00:17:53 +02:00
Jonathan
5a4af7e38a
Update easymde.css 2022-05-22 00:02:10 +02:00
Jeroen Akkerman
611aa50443
Merge pull request #455 from vanillajonathan/patch-9
Set role attribute on the toolbar
2022-05-21 11:38:52 +02:00
Jeroen Akkerman
68d33ec2c1
Merge pull request #459 from vanillajonathan/patch-2
Accept APNG for image uploads
2022-05-19 23:54:33 +02:00
Jonathan
855a5d72f5
Update README.md 2022-05-19 22:57:16 +02:00
Jonathan
38717daffe
Add support for text buttons 2022-05-19 22:49:29 +02:00
Jonathan
146a5e3fb1
Accept APNG for image uploads 2022-05-19 19:02:14 +02:00
Jeroen Akkerman
c311bfa6b0
Merge pull request #458 from vanillajonathan/patch-2
Accept AVIF for image uploads
2022-05-19 14:40:51 +02:00
Jonathan
b31cf2bf7c
Accept AVIF for image uploads 2022-05-19 12:20:40 +02:00
Jonathan
bed6b493c8
Update easymde.js 2022-05-19 10:14:11 +02:00
Jeroen Akkerman
2b178671ca
Merge pull request #449 from vanillajonathan/patch-2
Add actions for header size 4, 5 and 6
2022-05-19 09:37:22 +02:00
Jonathan
2666001eda
Set role attribute on the toolbar 2022-05-18 22:03:48 +02:00
Jonathan
21fda66d3d
Update easymde.js 2022-05-18 19:45:35 +02:00
Jonathan
9d74ea296c
Refactor into using a map for icon classes 2022-05-18 19:39:39 +02:00
Jonathan
1706b4b0cf
Use Responsive Font Sizes 2022-05-18 18:35:45 +02:00
Jeroen Akkerman
aca4b5c816
Merge pull request #450 from vanillajonathan/patch-6
Accept GIF for image uploads
2022-05-18 01:54:43 +02:00
Jonathan
757d5eb729
Add keyboard shortcuts for headings 2022-05-18 00:54:20 +02:00
Jonathan
be1d994322
Update easymde.js 2022-05-18 00:50:08 +02:00
Jonathan
0dd2f99f9d
Accept GIF for image uploads 2022-05-18 00:39:54 +02:00
Jonathan
9a57f00d92
Update easymde.js 2022-05-17 23:25:02 +02:00
Jonathan
332cf61086
Add header size 4, 5 and 6 2022-05-17 23:17:04 +02:00
Jonathan
c1071c8539
Add header size 4, 5 and 6 2022-05-17 23:15:13 +02:00
Jeroen Akkerman
16b1de652e Update dependencies 2022-05-17 14:42:41 +02:00
Jeroen Akkerman
8b9cf3e812
Merge pull request #444 from vanillajonathan/patch-2 2022-05-17 13:24:08 +02:00
Jonathan
a433f72891
Update README.md
Co-authored-by: Jeroen Akkerman <Jeroen_akkerman1@hotmail.com>
2022-05-17 11:12:46 +02:00
Jonathan
4b3930c4a7
Update README.md 2022-05-17 00:26:02 +02:00
Jeroen Akkerman
a7fb5d8f06
Merge pull request #436 from vanillajonathan/patch-2
Add missing undo and redo actions
2022-05-16 23:01:58 +02:00
Jeroen Akkerman
7b4c6dae9e
Merge pull request #438 from vanillajonathan/patch-3
Use <kbd> markup element for keyboard shortcuts
2022-05-16 23:00:06 +02:00
Jeroen Akkerman
b6f207d235
Merge pull request #440 from vanillajonathan/patch-5
Fix broken markdown
2022-05-16 22:57:47 +02:00
Jonathan
591e278745
Fix broken markdown 2022-05-16 21:57:06 +02:00
Jonathan
764ce93d59
Use <kbd> markup element for keyboard shortcuts 2022-05-16 16:38:53 +02:00
Jonathan
af81424b78
Add missing undo and redo actions 2022-05-16 16:23:25 +02:00
Jeroen Akkerman
3d07f0eb97 Update dependencies 2022-04-23 22:06:59 +02:00
Jeroen Akkerman
16f2dde59d Fix #399 autofocus property 2022-04-04 15:45:12 +02:00
Jeroen Akkerman
57f72bd5ae Merge branch 'master' of https://github.com/Ionaru/simplemde-markdown-editor 2022-04-04 15:43:02 +02:00
Jeroen Akkerman
8765cf197b
Merge pull request #417 from sghoweri/patch-1 2022-03-23 20:32:49 +01:00
Salem Cobalt
bf9b0108d7
Handle Webp Image Uploads
With this fix, uploaded WebP images render as links in the markdown (vs images).
2022-03-23 14:45:32 -04:00
Jeroen Akkerman
f283f76f5c Update dependencies 2022-03-19 23:25:58 +01:00
Jeroen Akkerman
a1ad87986d Merge branch 'master' of https://github.com/Ionaru/simplemde-markdown-editor 2022-03-12 01:54:17 +01:00
Jeroen Akkerman
76fda35bf9
Merge pull request #411 from diego-gw/imagePreviewHandler 2022-03-12 01:53:27 +01:00
Jeroen Akkerman
1f30a11773 Add changelog entry 2022-03-12 01:45:14 +01:00
Diego Garcia Weber
aa711787b2 clarified readme description of parameter, removed extra parantheses from type 2022-03-07 10:58:09 -05:00
Jeroen Akkerman
853efd8a5e Update dependencies 2022-03-06 21:30:06 +01:00
Diego Garcia Weber
ed196be5a0 added option to readme, imagesPreviewHandler to types and defensive check that the handler provided by the user returns a string 2022-03-01 20:47:30 -05:00
Diego Garcia Weber
d8fa00e460 Adds the option to add a handler for images preview 2022-03-01 17:15:35 -05:00
Jeroen Akkerman
f573560bb4 Update dependencies 2022-02-15 01:19:04 +01:00
Jeroen Akkerman
a021bdf8ae
Merge pull request #394 from ZsgsDesign/master
Add robust CSRF support and provide default values for CSRF fields
2022-02-14 15:15:00 +01:00
ZsgsDesign
aa6fe59e93 fixed default image configuration typo 2022-01-25 16:46:06 +08:00
ZsgsDesign
8805c379d8 fixed comment typo for csrf token 2022-01-24 12:24:27 +08:00
ZsgsDesign
b0d20adc6e add instances example for imageCSRFToken 2022-01-24 12:07:07 +08:00
ZsgsDesign
f3dca2e82a add robust CSRF support and provide default values for CSRF fields 2022-01-24 12:05:00 +08:00
Jeroen Akkerman
50d3680017
Merge pull request #393 from Zignature/escape-url-via-prompt
Fix #373 Encode and escape URLs entered via prompt
2022-01-17 00:17:36 +01:00
Jeroen Akkerman
81ec7780bc Update changelog 2022-01-17 00:13:40 +01:00
Jeroen Akkerman
d8eae5d74c Improve readability of encode/escape functionality 2022-01-17 00:13:40 +01:00
Jeroen Akkerman
0c2cf4cd51 Add tests for url prompts 2022-01-17 00:13:40 +01:00
Zignature
16545eb0e1 Made escaping prompt URLs automatic instead of optional again 2022-01-16 00:14:00 +01:00
Zignature
47f1e4f892 Updated readme and easymde.d.ts to reflect escapePrompURLs option 2022-01-15 23:56:27 +01:00
Zignature
c174b6f149 Changed function name escapeURI to escapedPromptURL and option escapeURLs to option escapePromptURLs 2022-01-15 23:34:05 +01:00
Zignature
33489ab616 URL encoding and escaping for JS prompt URLs
- URL encoding and escaping added for JS prompt entered URLs
- added option escapeURLs (boolean)
2022-01-15 23:26:10 +01:00
Zignature
5d0294f5f5 Fix issue #373 problems in urls with special characters
Added function to escape URLs entered via JS prompt.

It's a partial fix because people cannot be stopped entering URLs manually and forgetting to escape them.
2022-01-15 13:20:28 +01:00
Jeroen Akkerman
4fb35f2758 2.16.1 2022-01-14 23:27:44 +01:00
Jeroen Akkerman
d0116608e6 Update changelog for 2.16.1 2022-01-14 23:27:23 +01:00
Jeroen Akkerman
6159ed1383 Update marked to resolve security vulnerability 2022-01-14 23:23:54 +01:00
Jeroen Akkerman
a56badd0dc Add test for markdown rendering 2022-01-14 23:09:20 +01:00
Jeroen Akkerman
24d86491da Fix incorrect initial line and column count 2022-01-14 22:33:35 +01:00
Jeroen Akkerman
56532f9ce4 Add cypress tests 2022-01-14 22:27:43 +01:00
Jeroen Akkerman
722fb61ed2 Remove old travis build status badge 2022-01-11 21:51:01 +01:00
Jeroen Akkerman
33a4043dbb Update build status badge 2022-01-11 21:50:30 +01:00
Jeroen Akkerman
75fe53f062 2.16.0 2022-01-11 21:44:56 +01:00
Jeroen Akkerman
384655f968 Update changelog for 2.16.0 2022-01-11 21:44:50 +01:00
Jeroen Akkerman
6445f3c2d9
Merge pull request #388 from Zignature/options-toolbarbutton-attributes
Fix for issue #380 Custom attributes for toolbar buttons
2022-01-11 21:41:22 +01:00
Jeroen Akkerman
7a2373eae5 Update changelog 2022-01-11 21:40:13 +01:00
Jeroen Akkerman
4ddb5b8e1b Add toolbar button attributes to type declaration 2022-01-11 21:38:36 +01:00
Jeroen Akkerman
98d9049728 Move adding custom attributes above all others 2022-01-11 21:30:34 +01:00
Jeroen Akkerman
565c42e0ff Add hasOwnProperty check 2022-01-11 21:28:22 +01:00
Jeroen Akkerman
1c656d5712 Merge branch 'master' into options-toolbarbutton-attributes 2022-01-11 21:23:42 +01:00
Jeroen Akkerman
c1da7424e9
Merge pull request #389 from Zignature/options-liststyle
Fix for issue #386 Show '-' instead of '*' for unordered list
2022-01-11 21:22:31 +01:00
Jeroen Akkerman
e2db3c6946 Attempt at improving submenus in Safari for #362 2022-01-11 20:10:00 +01:00
Jeroen Akkerman
267db2dbe3 Update changelog 2022-01-11 19:56:18 +01:00
Jeroen Akkerman
9862ecf98c Add unorderedListStyle option to type declaration 2022-01-11 19:49:39 +01:00
Zignature
2cdc11848a Requested changes applied 2022-01-11 17:16:38 +01:00
Zignature
5df842b630 Fix for issue #386 Show '-' instead of '*' for unordered list
Added unorderedListStyle to the options
2022-01-11 15:45:36 +01:00
Zignature
a9d9993dae Fix for issue #380 Custom attributes for toolbar buttons
Added "attributes" option to custom toolbar button
2022-01-11 11:00:56 +01:00
Jeroen Akkerman
59a676bc8a
Merge pull request #384 from Zignature/ZignatureEasyMDE
Fix #381 Accurate line and column count in status bar
2022-01-08 21:53:54 +01:00
Zignature
2936fc3383 Accurate line and column count in status bar
Both Line and column (character) count are increased by 1.

This fixes issue #381
2022-01-08 21:03:25 +01:00
Zignature
a7170b9392 Fix issue #381 2022-01-08 16:01:19 +01:00
Jeroen Akkerman
598821b6bb Add typings and tests for 'direction' option 2021-10-28 11:33:17 +02:00
Jeroen Akkerman
de1cd3b293 Update changelog for 2.16.0 2021-10-28 11:29:44 +02:00
Jeroen Akkerman
d27adc6a16 Update dependencies 2021-10-28 01:59:33 +02:00
Jeroen Akkerman
c15c699a52 Update changelog for PR #364 2021-10-28 01:53:59 +02:00
Jeroen Akkerman
8ad896fb40
Merge pull request #364 from robjean9/master
update easymde.css, fix issue #362
2021-10-27 23:51:32 +02:00
Robson Jean Penteado
b640429f19 fix issue #362 2021-10-27 14:47:43 -03:00
Robson Jean Penteado
8ef68936b0 update easymde.css, fix issue #362 2021-10-27 14:42:25 -03:00
Jeroen Akkerman
f004c2d0c3 More small README improvements 2021-10-10 01:04:28 +02:00
Jeroen Akkerman
551c84bc01 Fix indenting and some leftover old JS 2021-10-06 01:51:02 +02:00
Jeroen Akkerman
86e40bcf4a Update README with some more modern JS 2021-10-06 01:43:47 +02:00
Jeroen Akkerman
35b42c404a Update changelog 2021-10-05 22:42:24 +02:00
Jeroen Akkerman
42304e8a87 Update editorconfig and automatic code format 2021-10-05 22:28:22 +02:00
Jeroen Akkerman
dc38624378 Update dependencies 2021-10-05 22:19:04 +02:00
Jeroen Akkerman
c24dd01880 Drop testing support on older Node.js versions 2021-10-05 22:18:55 +02:00
Jeroen Akkerman
b364a6095a Use Github Actions instead of Tavis 2021-10-05 22:07:43 +02:00
Jeroen Akkerman
cda237031f
Merge pull request #357 from ukjinjang/fix/compare_image_extension
Convert media file extension to lowercase before check if image
2021-10-05 21:59:15 +02:00
Jeroen Akkerman
534e2cadee
Merge pull request #358 from souljuse/master
Add support for RTL languages
2021-10-05 21:59:05 +02:00
Irene Oppo
aafd40f35b Add direction option to README 2021-10-05 10:04:05 +02:00
Irene Oppo
53223c4de0 Support rtl languages by adding a direction option 2021-10-05 09:51:51 +02:00
Uk-Jin Jang
b121795887 fix: convert media file extension to lowercase before check if image 2021-10-05 15:50:48 +09:00
Jeroen Akkerman
0f559258c5
Merge pull request #338 from mrlugilugi/fix-error-formatting-asterisks-as-unordered-list
fix: Formatting asterisks divided by space results in console error #337
2021-06-16 21:30:53 +02:00
Jeroen Akkerman
3e403d9712
Merge pull request #339 from CamilleDrapier/add-cleanup-to-ts
Add the cleanup function to TypeScript definition
2021-06-16 21:30:43 +02:00
Camille Drapier
cb351333d1 Add cleanup function to TypeScript definition 2021-06-10 16:18:35 +09:00
mrlugilugi
f52f9807a2
fix: Escaping asterisk to produce valid RegEx 2021-06-09 13:14:20 +02:00
Jeroen Akkerman
c1d35b04c5
Merge pull request #333 from smundro/custom-spellchecker
Allow for specifying a custom spell-checker
2021-05-23 16:13:24 +02:00
Steve
737aa13709 add a dash 2021-05-18 16:12:44 -07:00
Steve
038a9204b4 Allow for specifying a custom spell-checker for EasyMDE 2021-05-18 16:05:40 -07:00
Jeroen Akkerman
dbab7e95e7 2.15.0 2021-04-22 22:41:34 +02:00
Jeroen Akkerman
51d496aea6 Update changelog for 2.15.0 2021-04-22 22:41:27 +02:00
Jeroen Akkerman
735d31fb29 Update dependencies 2021-04-22 22:39:01 +02:00
Jeroen Akkerman
ebcc835ee9 Update changelog 2021-04-22 22:37:27 +02:00
Jeroen Akkerman
c58eb54379
Merge pull request #322 from marekdedic/320-fix
Exposing types as non-dev dependencies
2021-04-12 19:33:22 +02:00
Marek Dědič
529c7bf04d
Fixes #320 2021-04-12 13:05:26 +02:00
Jeroen Akkerman
e3480c2f60 Update dependencies 2021-04-09 19:22:31 +02:00
Jeroen Akkerman
fc0ecfa77e
Merge pull request #313 from wwsalmon/absolute-image-paths
Absolute image paths
2021-04-08 18:05:14 +02:00
Jeroen Akkerman
113c5b45b1
Merge pull request #316 from smundro/bugfix-fullscreen-sidebyside-handle
Bugfix: Correctly keep preview active during fullscreen-toggle
2021-03-27 16:29:15 +01:00
Steve
b61fe7945a Add simple class handling utiltity to DRY adding/removing class names.
Note that this isn't necessary and can be rolled back, but could be used throughout the code to make class handling more clear and consistent.
2021-03-17 11:17:14 -07:00
Steve
82a8e4a8ce restore removed comment 2021-03-17 10:46:18 -07:00
Steve
548229dd1a remove added comment 2021-03-17 10:45:45 -07:00
Steve
40ddcea4e3 remove extra comment updates 2021-03-17 10:44:46 -07:00
Steve
d0f69390ce a little comment/cleanup 2021-03-17 10:41:38 -07:00
Steve
1ee8519e50 Unwind all the onlyCleanup stuff and set classes directly. 2021-03-17 10:25:39 -07:00
Steve
4533dd4776 clarify comments in togglePreview 2021-03-16 09:21:03 -07:00
Steve
d636eb7407 clean up diff 2021-03-16 09:17:19 -07:00
Steve
7069fd1031 Move from multiple "no-fullscreen" classes to one using inheritance 2021-03-16 09:08:54 -07:00
Steve
d76872f4ff undo some comment changes to make diff cleaner 2021-03-15 20:15:39 -07:00
Steve
8ed6cd699e make toggle cleanup flag clearer 2021-03-15 20:13:26 -07:00
Steve
25db654cf0 more code cleanup for readibilty 2021-03-15 20:08:38 -07:00
Steve
8702dd22d0 correct test page title 2021-03-15 19:57:47 -07:00
Steve
fa8855e3be code refactoring to improve readability 2021-03-15 19:40:57 -07:00
Steve
61e93a3d53 handle fullscreen toggle consistently by adusting toggleSideBySide 2021-03-15 19:30:56 -07:00
Steve
abbec5bde1 bugfix: move sidebyside accessor outside of options check 2021-03-15 13:53:08 -07:00
Samson Zhang
3b755026d6 update readme with imagePathAbsolute option info 2021-03-11 12:14:44 -07:00
Samson Zhang
6e7e8f9b82 add imagePathAbsolute option 2021-03-11 12:09:09 -07:00
Jeroen Akkerman
072176a86e
Merge pull request #311 from deerboy/patch-1
Fixed extension acquisition logic
2021-03-08 15:59:03 +01:00
Daichi Ninomiya
c2dbe77615
fix(easymde.js): Fixed extension acquisition logic 2021-03-08 23:48:57 +09:00
Jeroen Akkerman
95b848a825
Merge pull request #308 from ChronosMasterOfAllTime/307-fix-toolbaricon-typing
Resolve Issue #307 - add optional icon field to ToolbarIcon interface in easymde.d.ts
2021-02-26 17:13:21 +01:00
ChronosMasterOfAllTime
6527a311a3 #307 - add optional icon field to ToolbarIcon interface in easymde.d.ts 2021-02-26 09:06:01 -06:00
Jeroen Akkerman
8fa54c496f Fix changelog version link 2021-02-14 13:13:25 +01:00
Jeroen Akkerman
fdc9ce4935 2.14.0 2021-02-14 13:11:48 +01:00
Jeroen Akkerman
0ac130306d Update changelog for 2.14.0 2021-02-14 13:10:53 +01:00
Jeroen Akkerman
59b6b0719e Update dependencies 2021-02-14 12:53:26 +01:00
Jeroen Akkerman
bc17533def
Merge pull request #293 from sn3p/toolbar-top-and-bottom-padding
Add toolbar top and bottom padding
2021-02-14 12:50:21 +01:00
Jeroen Akkerman
0241584921
Merge pull request #298 from Ionaru/dependabot/npm_and_yarn/marked-2.0.0
Bump marked from 1.2.6 to 2.0.0
2021-02-10 19:27:25 +01:00
dependabot[bot]
dd449cf9a7
Bump marked from 1.2.6 to 2.0.0
Bumps [marked](https://github.com/markedjs/marked) from 1.2.6 to 2.0.0.
- [Release notes](https://github.com/markedjs/marked/releases)
- [Changelog](https://github.com/markedjs/marked/blob/master/release.config.js)
- [Commits](https://github.com/markedjs/marked/compare/v1.2.6...v2.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-08 21:27:50 +00:00
Matthijs Kuiper
ec94037ac2 Add toolbar top and bottom padding 2021-01-28 20:28:29 +01:00
Jeroen Akkerman
0ff81e89a6
Merge pull request #286 from smundro/retain-preview-on-fullscreen-toggle
don't toggle preview if sideBySideFullscreen is false
2020-12-31 17:27:54 +01:00
Jeroen Akkerman
65f66138c0
Merge pull request #285 from Situphen/dropdown
Use visibility:hidden; instead of display:none; for the dropdown menu
2020-12-31 17:27:40 +01:00
Jeroen Akkerman
3f90b9fe72
Merge pull request #284 from Fanvadar/fix-spellchecker
Fix spell checker
2020-12-31 17:27:31 +01:00
Steve
480145264a don't toggle preview if sideBySideFullscreen is false 2020-12-30 13:49:11 -08:00
Situphen
a070698b34 Use visibility:hidden; instead of display:none; for the dropdown menu 2020-12-30 21:59:45 +01:00
Alexander Wilson
7b0411fd79 Fix spell checker 2020-12-29 11:58:40 +10:00
Jeroen Akkerman
1386fb0319
Merge pull request #280 from emirotin/patch-1
Fix #278
2020-12-28 16:43:50 +01:00
Jeroen Akkerman
80e2fc1bbd Merge remote-tracking branch 'origin/master' 2020-12-28 16:42:16 +01:00
Jeroen Akkerman
dbe3872afb Update demo website link in README
Closes #283
2020-12-28 16:41:50 +01:00
Eugene Mirotin
b7d5af36c8
Fix #278
Remove erroneous and unneeded call to window.removeEventListener
2020-12-22 13:38:39 +02:00
Jeroen Akkerman
67592df8bf
Merge pull request #277 from Juupaa/drag_and_drop_link
Drag and drop a file checks the extension to either create an image or link
2020-12-17 19:35:05 +01:00
Marc-Etienne Trudel
db348fe44b
wip 2020-12-16 14:18:19 -05:00
Jeroen Akkerman
3b6402b3e8 Update dependencies 2020-12-12 00:40:56 +01:00
Jeroen Akkerman
a7f4262166 Update changelog for PR #272 2020-12-12 00:38:19 +01:00
Jeroen Akkerman
6306b96cf7
Merge pull request #272 from joahim/master
Fix the sideBySideFullscreen=false + status=false bug
2020-12-09 14:13:27 +01:00
Joh Dokler
c428a37ee3 Fix additional edge case for the sideBySideFullscreen=false + status=false bug 2020-12-09 12:08:15 +01:00
Joh Dokler
2a904b24ab Fix the sideBySideFullscreen=false + status=false bug 2020-12-09 11:58:57 +01:00
Jeroen Akkerman
f286a6bae5
Merge pull request #250 from danice/scrollbar-styles
Include Codemirror scrollbar style property
2020-11-11 22:59:59 +01:00
Jeroen Akkerman
6209e53c69
Merge pull request #253 from devforth/master
Bugfixes for preview images in editor
2020-11-11 22:57:08 +01:00
Jeroen Akkerman
62b95316b2 2.13.0 2020-11-11 22:54:38 +01:00
Jeroen Akkerman
7efef3b003 Update changelog for 2.13.0 2020-11-11 22:54:29 +01:00
Jeroen Akkerman
9a2e12a4e9 Update dependencies 2020-11-11 22:52:34 +01:00
Jeroen Akkerman
e087158074
Merge pull request #267 from nhymxu/patch-1
Allow modify lineNumbers via config options
2020-11-11 22:49:21 +01:00
Jeroen Akkerman
b06d1fe67f Add documentation and typings 2020-11-11 22:41:49 +01:00
Dung Nguyen
65186e4537
Allow modify lineNumbers via config options 2020-11-11 21:48:53 +07:00
Jeroen Akkerman
11f805f0b5 Fix CSS scoping issues (#252) 2020-10-30 13:29:42 +01:00
Jeroen Akkerman
21d51a053b Updated dependencies 2020-10-30 13:24:18 +01:00
Jeroen Akkerman
f65d2a7cc9 Updated changelog for PR #249 2020-10-30 13:20:25 +01:00
Jeroen Akkerman
70f3512120
Merge pull request #249 from mbolli/codemirror-autorefresh
include codemirror autorefresh addon
2020-10-30 12:39:22 +01:00
Jeroen Akkerman
6d173d0024
Update CONTRIBUTING.md 2020-10-16 14:35:34 +02:00
dani
29d2c6c5be fix for undefined scrollbar style 2020-10-11 08:44:20 +02:00
Ivan Borshchov
0c9be85cd7 fix not option 2020-10-08 13:27:01 +03:00
Ivan Borshchov
edfeb87653 previewImagesInEditor doc improve 2020-10-08 12:20:26 +03:00
Ivan Borshchov
dba3201c79 fix cursor preceise positioning when content with images are loaded into editor, show preview only for images on separate lines (not inlines) 2020-10-08 12:19:11 +03:00
Jeroen Akkerman
23c17b88b4 2.12.1 2020-10-06 15:00:21 +02:00
Jeroen Akkerman
1e41667ec6 Update changelog for 2.12.1 2020-10-06 14:59:40 +02:00
Jeroen Akkerman
6e48fc293c Set previewImagesInEditor option to false by default
Fixes #251
2020-10-06 14:52:54 +02:00
Daniel Calbet
c696922fe1 changelog: include new scrollbarStyle option 2020-10-04 06:55:35 +00:00
Daniel Calbet
3517348ef7 scrollbar style in options type 2020-10-04 06:39:01 +00:00
Daniel Calbet
eabb23fd3e using scrollbarStyle option 2020-10-02 09:25:13 +00:00
Michael Bolli
206f02272b changelog: include new autoRefresh option 2020-10-02 11:16:38 +02:00
Michael Bolli
c780d5af38 include codemirror autorefresh addon 2020-10-02 10:45:53 +02:00
Jeroen Akkerman
3e8830de82 2.12.0 2020-09-29 22:38:25 +02:00
Jeroen Akkerman
c94ea5301c Add missing type for previewImagesInEditor 2020-09-29 22:38:22 +02:00
Jeroen Akkerman
b86cd5ba01 Update changelog for 2.12.0 2020-09-29 22:33:06 +02:00
Jeroen Akkerman
14a5029306
Merge pull request #244 from czynskee/cm_overlay_mode_param
Cm overlay mode param
2020-09-29 22:13:52 +02:00
Jeroen Akkerman
dc6074d535 Merge branch 'master' into cm_overlay_mode_param 2020-09-29 22:07:25 +02:00
Jeroen Akkerman
3c99ac805e Update dependencies, closes #246 2020-09-29 21:51:12 +02:00
Jeroen Akkerman
5dc8bd5248 Add some static methods to typing tests 2020-09-29 21:47:34 +02:00
czynskee
eac3f519fb Update readme with overlayMode options. 2020-09-16 12:48:52 -07:00
czynskee
4ce74e904b Added option to supply an additional code-mirror overlay mode 2020-09-16 12:31:35 -07:00
Jeroen Akkerman
00215ecaeb
Merge pull request #242 from dalboris/better-size-units-2
Change default size units from 'b,Kb,Mb' to ' B, kB, MB' (#239)
2020-09-14 17:40:07 +02:00
Boris Dalstein
418116c1cc Change default size units from 'b,Kb,Mb' to ' B, kB, MB' (#239) 2020-09-14 17:21:51 +02:00
Jeroen Akkerman
7b90f83ae9
Merge pull request #235 from devforth/master
Add images preview in edit mode plus add keydown cleanup
2020-09-10 16:40:47 +02:00
Ivan Borshchov
2745b03b71 move line to another section ,rollback unneded change 2020-09-10 13:32:56 +03:00
Ivan Borshchov
2c793ee418 Add images preview in edit mode plus add keydown cleanup 2020-09-10 11:30:09 +03:00
Jeroen Akkerman
b461979067 Add missing drawUploadedImage export 2020-08-16 19:31:00 +02:00
Jeroen Akkerman
4796a2f5b6
Merge pull request #222 from nick-denry/fix_maxHeight_less_than_minHeight
Fix max height less than min height
2020-08-15 20:19:19 +02:00
Jeroen Akkerman
b9b19bb5ff
Merge pull request #225 from JoshuaLicense/pass-context-to-custom-image-upload-function
Pass the MDE context to the custom image function
2020-08-11 12:38:19 +02:00
Jeroen Akkerman
45e409b85e
Merge pull request #224 from JoshuaLicense/fix-image-upload-without-status-bar
Fix calls to updateStatusBar when the status bar is hidden
2020-08-10 16:58:45 +02:00
Jeroen Akkerman
5a5bb97a20
Merge pull request #223 from nick-denry/fix_to_textarea
Fix toTextArea issue
2020-08-10 16:43:45 +02:00
Nick Denry
8b177f9c05 KISS fix 2020-08-09 17:45:49 +03:00
Joshua License
0fc64ff7f9 Pass the MDE context to the image function
Removes the need to bind the context manually when wanting to access the class methods.
2020-08-08 11:05:56 +01:00
Joshua License
11d210545b Early exit from updateStatusBar if no status bar is available 2020-08-08 09:18:18 +01:00
Nick Denry
55312d8ec3
Fix toTextArea issue
Solves https://github.com/Ionaru/easy-markdown-editor/issues/217
2020-08-08 00:22:06 +03:00
Nick Denry
065a022644 Fix comment 2020-08-07 23:46:51 +03:00
Nick Denry
32e0971483 Fix maxHeight less than minHeight 2020-08-07 23:41:56 +03:00
Jeroen Akkerman
754bdc3ab2 Add missing changelog link 2020-07-16 18:47:20 +02:00
Jeroen Akkerman
78c3b6fa28 Fix changelog link 2020-07-16 18:46:39 +02:00
Jeroen Akkerman
c8630d6840 2.11.0 2020-07-16 18:45:15 +02:00
Jeroen Akkerman
87182dda65 Update changelog for 2.11.0 2020-07-16 18:45:02 +02:00
Jeroen Akkerman
3af0a9f5f3 Update dependencies 2020-07-16 18:42:53 +02:00
Jeroen Akkerman
531a0e6227
Merge pull request #204 from firm1/fix_181
forget debug options
2020-06-11 17:15:20 +02:00
firm1
3b831f87a4 forget debug options 2020-06-11 17:09:09 +02:00
Jeroen Akkerman
8212d4901a
Merge pull request #182 from firm1/fix_181
fix #181 : allow saving only on change content
2020-06-11 12:57:44 +02:00
Jeroen Akkerman
86d6ce7c6a
Merge pull request #203 from cornerman/highlightjs
adhere to language ascription in highlightjs
2020-06-11 12:52:28 +02:00
johannes karoff
36d9b238cf adhere to language ascription in highlightjs 2020-06-11 12:29:33 +02:00
firm1
5db44ab734 better debounce 2020-06-08 11:20:46 +02:00
firm1
825c65e204 not an option but a bugfix 2020-06-08 11:20:46 +02:00
firm1
450bead2d1 fix #181 : allow saving only on change content 2020-06-08 11:19:52 +02:00
Jeroen Akkerman
9dbb1dbe8a
Merge pull request #201 from nick-denry/describe_maxheight_option
Describe maxHeight option
2020-06-03 22:18:48 +02:00
Nick Denry
b23ff6675d Use undefined instead of false 2020-06-03 22:45:59 +03:00
Nick Denry
04ed77f829 KISS fix 2020-06-03 22:09:01 +03:00
Nick Denry
2bd4b289b3 maxHeight option typings 2020-06-03 17:30:13 +03:00
Nick Denry
d339c6af97 Describe maxHeight option 2020-06-03 17:15:06 +03:00
Jeroen Akkerman
d90085acb5
Merge pull request #196 from nick-denry/preview_without_fullscreen
Preview without fullscreen
2020-06-03 13:40:09 +02:00
Jeroen Akkerman
711d62cd8f Fix whitespace character in readme 2020-06-03 13:00:55 +02:00
Jeroen Akkerman
8fa73cf079 Add new option to documentation and typings 2020-06-03 12:55:27 +02:00
Jeroen Akkerman
4a6119daaf Add contribution to changelog 2020-06-03 12:52:28 +02:00
Nick Denry
57788bd392 Code style 2020-06-03 00:59:02 +03:00
Nick Denry
82c447cf85 Remove bottom rigth radius for CM-sided 2020-06-03 00:45:28 +03:00
Nick Denry
f72d590332 Semantic fix 2020-06-02 16:05:45 +03:00
Nick Denry
4862def4a4 Toggle sideBySide first due to classes set properly 2020-06-01 16:16:40 +03:00
Nick Denry
d4cbe44fa4 Set preview height after element is added 2020-06-01 16:15:18 +03:00
Nick Denry
f3b1090e53 Adjust sideBySide with no fullscreen and maxHeight option 2020-06-01 15:44:57 +03:00
Nick Denry
f85afc44e1 Code style 2020-05-29 17:42:07 +03:00
Nick Denry
1fd1ee2a97 Deal with minHeight option 2020-05-29 03:15:56 +03:00
Nick Denry
a61c7198a3 Extra border fix 2020-05-29 01:59:22 +03:00
Nick Denry
b7093dabc3 Preview without fullscreen 2020-05-29 01:53:15 +03:00
Jeroen Akkerman
41fef9ae3e Update dependencies 2020-05-09 01:16:24 +02:00
Jeroen Akkerman
454ebc6fb6 Add support for Node.js 14 2020-05-09 01:14:50 +02:00
Jeroen Akkerman
890c72589e Fix checkboxes always have bullets in front of them
Fixes #136
2020-05-09 01:14:41 +02:00
Jeroen Akkerman
df3d6511c8
Merge pull request #180 from A-312/no-previous-function
Add `toolbar` variable instead `wrapper.previousSibling`
2020-04-27 15:43:31 +02:00
Jeroen Akkerman
b1d29c491f
Merge pull request #184 from firm1/fix_183
Fix refresh display cursor position
2020-04-20 15:12:49 +02:00
firm1
64705178ab changelog 2020-04-15 15:12:11 +02:00
firm1
24d4cc87af fix #183 : refresh cursor position on activity 2020-04-15 15:10:59 +02:00
A-312
3150f71342 Add toolbar variable instead wrapper.previousSibling
In my project we customize Easymde and add div between toolbar and wrapper, this break fullscreen feature.
2020-04-10 22:34:10 +02:00
Jeroen Akkerman
228fe91a72 2.10.1 2020-04-06 14:09:36 +02:00
Jeroen Akkerman
546c09da5b Update changelog for 2.10.1 2020-04-06 14:09:30 +02:00
Jeroen Akkerman
cc65563714 Fixed typescript error when entering certain strings for toolbar buttons
Closes #178
2020-04-06 14:07:24 +02:00
Jeroen Akkerman
bcb1f7dfbd 2.10.0 2020-04-02 12:15:12 +02:00
Jeroen Akkerman
d628896c91 Update changelog for 2.10.0 2020-04-02 12:15:01 +02:00
Jeroen Akkerman
ad439d157a Update dependencies 2020-04-02 12:11:14 +02:00
Jeroen Akkerman
9f15b0e50f Merge branch 'master' into changelog 2020-04-02 12:09:10 +02:00
Jeroen Akkerman
c6f99edf46
Merge pull request #176 from StefKors/update-marked-to-0.8.2
Update Marked dependency to 0.8.2
2020-04-01 08:38:07 -07:00
StefKors
6711900d72 update Marked dependency to 0.8.2
Change-type: patch
Signed-off-by: Stef Kors <stef@balena.io>
2020-03-30 12:14:19 +02:00
Jeroen Akkerman
7033a1f2a7 Add most recently merged PR (#175) to changelog 2020-03-26 13:48:35 +01:00
Jeroen Akkerman
8d7ba010a9
Merge pull request #175 from StefKors/fix-z-index
Set .CodeMirror z-index to 0
2020-03-26 13:45:19 +01:00
StefKors
eec7559aaa Set base z-index to 0 2020-03-25 17:15:51 +01:00
Jeroen Akkerman
6470e10e29
Merge pull request #168 from kolaente/feature/137-custom-icons
Add support for custom icon markup
2020-03-24 15:55:16 +01:00
kolaente
de1f32bd1f
Fix icon class handling if no custom icon classes are provided 2020-03-23 18:18:04 +01:00
kolaente
cc0706bfc2
Also still add custom classes when using custom icon markup 2020-03-23 18:07:52 +01:00
kolaente
85e59747ab
Merge branch 'master' into feature/137-custom-icons 2020-03-23 17:48:29 +01:00
Jeroen Akkerman
39f9cd7813
Merge pull request #173 from A-312/update5.52.2
Updated codemirror to version 5.52.2
2020-03-21 23:22:08 +01:00
A-312
03ba544095
Update CHANGELOG.md (Add Thanks)
Co-Authored-By: Situphen <Situphen@users.noreply.github.com>
2020-03-21 13:06:27 +01:00
A-312
753bed4772 Update package-lock.json 2020-03-21 12:08:59 +01:00
A-312
693db8bf17 Updated codemirror to version 5.52.2 (fix:#160) 2020-03-21 11:47:05 +01:00
Jeroen Akkerman
4a1e6de4de Add typings for options added in PR #170 2020-03-20 14:35:24 +01:00
Jeroen Akkerman
cca5c07346 Add most recently merged PR (#169) to changelog 2020-03-20 14:24:14 +01:00
Jeroen Akkerman
d4f0e73384 Merge remote-tracking branch 'origin/master' 2020-03-20 14:18:44 +01:00
Jeroen Akkerman
f69b3c37fc
Merge pull request #169 from felipefdl/master
bugfix for IE compatibility, thanks to markedjs/marked#1585 (comment)
2020-03-20 14:17:19 +01:00
Jeroen Akkerman
2e7f2546a2 Add missing links to changelog 2020-03-20 13:55:22 +01:00
Jeroen Akkerman
0d178d4dd1 Update dependencies 2020-03-20 13:49:42 +01:00
Jeroen Akkerman
4e5e1c43a6 Add most recently merged PR (#170) to changelog 2020-03-20 13:47:43 +01:00
Jeroen Akkerman
a42bcddc2f
Merge pull request #170 from dima-bzz/autosave
Added time format and text for autosave
2020-03-20 13:11:32 +01:00
Dmitry Mazurov
1e64cba17e Added DateTimeFormat support for autosave.
Signed-off-by: Dmitry Mazurov <dimabzz@gmail.com>
2020-03-19 12:17:40 +03:00
dima-bzz
8a1e2e5d5b
Update Readme 2020-03-18 14:48:23 +03:00
Dmitry Mazurov
7706de0a2b Update Readme
Signed-off-by: Dmitry Mazurov <dimabzz@gmail.com>
2020-03-18 14:45:10 +03:00
Dmitry Mazurov
ad83e77aee Added option time format for autosave (12/24). Added option text for autosave. 2020-03-18 14:39:46 +03:00
Felipe Lima
afa35b9e65 bugfix for IE compatibility, thanks to markedjs/marked#1585 (comment) 2020-03-16 11:15:59 -03:00
kolaente
9a20111767
Remove unused empty line 2020-03-14 22:26:42 +01:00
kolaente
a12ba4790a
Add support for custom icon markup 2020-03-14 22:18:23 +01:00
Jeroen Akkerman
3096bbe291
Merge pull request #141 from firm1/dropdown
feat : allow dropdown menu on toolbar to group secondary buttons
2020-03-08 13:22:40 +01:00
Jeroen Akkerman
b85bdde0ed Add button shortcuts and typings 2020-03-06 01:17:33 +01:00
Jeroen Akkerman
8c01edd7cd Merge branch 'master' into dropdown 2020-03-06 00:52:20 +01:00
Jeroen Akkerman
fc81bd476c Add sanitizerFunction to typings 2020-03-06 00:43:08 +01:00
Jeroen Akkerman
84ea2c2cca
Merge pull request #147 from adamb70/sanitize-deprecation
Allow custom sanitize function
2020-03-06 00:37:29 +01:00
Jeroen Akkerman
012b66d982
Merge pull request #120 from jecsham/dev-feature-example
Added example directory with default demo file
2020-03-06 00:35:50 +01:00
Jeroen Akkerman
da6a6c81f1
Merge branch 'master' into sanitize-deprecation 2020-03-06 00:34:36 +01:00
Jeroen Akkerman
0306c9a2e5
Merge pull request #150 from A-312/improve-gulp
Add `watch` command (instead build after each change)
2020-03-06 00:34:07 +01:00
A-312
67ba044b5c Watch all js files 2020-03-05 18:34:24 +01:00
Jeroen Akkerman
0fe3eb15b9
Merge branch 'master' into sanitize-deprecation 2020-03-04 20:33:01 +01:00
Jecsham
1f681e527c
Merge branch 'master' into dev-feature-example 2020-03-03 18:00:31 -05:00
A-312
23a06e46a3 Add watch command (instead build after each change) 2020-03-01 17:49:17 +01:00
Jeroen Akkerman
2a1209da26 Update dependencies 2020-02-18 00:29:56 +01:00
adamb70
f8434d7a4b Update CHANGELOG.md 2020-02-06 12:36:30 +00:00
adamb70
05fad19787
Merge branch 'master' into sanitize-deprecation 2020-02-06 10:43:36 +00:00
Jecsham
e7afb10ed9
Merge branch 'master' into dev-feature-example 2020-02-05 20:33:46 -05:00
Jeroen Akkerman
ab8923096b
Merge pull request #148 from craigteegarden/patch-1
fix link in changelog
2020-02-05 21:42:32 +01:00
Craig Teegarden
d0bc3b7e85
fix link in changelog 2020-02-05 15:34:22 -05:00
Jecsham
83635a30ee
Merge branch 'master' into dev-feature-example 2020-02-04 22:06:12 -05:00
adamb70
c83c593d58 Use .call() on the sanitize function 2020-02-04 18:21:54 +00:00
adamb70
9d2665b895 Allow custom sanitize function
Update README.md
2020-02-04 13:46:56 +00:00
firm1
b11cd8edb0 don't use down icon 2020-01-28 21:35:28 +01:00
firm1
26d2da9e29 @Ionaru 's review : disable actions on top of dropdown, add dropdown icon and open on clic 2020-01-28 18:55:25 +01:00
firm1
6f4225ccb2 update changelog. 2020-01-28 18:55:25 +01:00
firm1
eea2917be1 @situphen 's review 2020-01-28 18:54:35 +01:00
firm1
98fbe56248 allow dropdown menu on toolbar to group secondary buttons 2020-01-28 18:54:35 +01:00
Jeroen Akkerman
661fcc82ab Fix name link in changelog 2020-01-27 10:57:52 +01:00
Jeroen Akkerman
0be4e6ac62 Fix links in changelog 2020-01-27 10:34:37 +01:00
Jeroen Akkerman
95b177e25c Add typings for features added in #143 and #139 2020-01-27 10:30:31 +01:00
Jeroen Akkerman
bb3c5cd539
Merge pull request #143 from firm1/allow-options
add two options inputStyle and nativeSpellcheck
2020-01-26 22:34:01 +01:00
firm1
1bb6f6dd0d typo 2020-01-26 21:25:52 +01:00
firm1
9ab45526a1 Merge remote-tracking branch 'origin/allow-options' into allow-options
# Conflicts:
#	CHANGELOG.md
2020-01-26 20:28:08 +01:00
firm1
b6301f3976 update Changelog and @situphen 's review ! 2020-01-26 20:26:32 +01:00
Jeroen Akkerman
f319bc3096 Merge branch 'master' into allow-options 2020-01-26 00:05:09 +01:00
Jeroen Akkerman
9b9edec517
Merge pull request #139 from Situphen/delay
Differentiate between regular autosave delay and submit autosave delay
2020-01-25 23:41:57 +01:00
Jeroen Akkerman
b4eca2a3d6 Add name to changelog and add non-breaking option 2020-01-25 23:36:13 +01:00
firm1
4245da6eae add two options inputStyle and nativeSpellcheck 2020-01-25 03:43:44 +01:00
Situphen
0dc4c2697e Differentiate between regular autosave delay and submit autosave delay 2020-01-20 21:44:16 +01:00
Jeroen Akkerman
c12761a42a 2.9.0 2020-01-13 22:33:22 +01:00
Jeroen Akkerman
a53ff1eeef Drop Node.js 6 testing 2020-01-13 22:31:24 +01:00
Jeroen Akkerman
eef443f837 Update changelog for 2.9.0 2020-01-13 22:29:05 +01:00
Jeroen Akkerman
187b1b147d Update dependencies 2020-01-13 22:26:35 +01:00
Jeroen Akkerman
17c0987281 Add changelog entry for PR #132 2020-01-13 22:17:13 +01:00
Jeroen Akkerman
c39b521cb3
Merge pull request #132 from Situphen/localstorage
Remove empty localStorage entries
2020-01-13 22:09:04 +01:00
Situphen
ef213175ce Remove empty localStorage entries 2020-01-12 13:25:23 +01:00
Jeroen Akkerman
a49da28f4d Update dependencies 2019-11-04 16:42:49 +01:00
Jeroen Akkerman
e9e5bef137 Add missing configuration options
Fixes #126
2019-11-03 17:11:41 +01:00
Jeroen Akkerman
d4a78e1a43
Merge pull request #123 from t49tran/feat-add-missing-prop-types
feat: add missing minHeight attribute to Option interface
2019-10-25 10:12:15 +02:00
Duong Tran
61937dd5ac test: add minHeight to easymde-test 2019-10-19 16:00:18 +11:00
Duong Tran
8436f67dfb feat: add missing minHeight attribute to Option interface 2019-10-16 23:20:50 +11:00
jecsham
72be232395 dev-feature: added example directory with default demo 2019-09-12 20:48:21 -05:00
Jeroen Akkerman
94750c8327
Merge pull request #115 from Ionaru/dependabot/npm_and_yarn/eslint-utils-1.4.2
Bump eslint-utils from 1.4.0 to 1.4.2
2019-08-26 20:37:51 +02:00
dependabot[bot]
2a04d42fb2
Bump eslint-utils from 1.4.0 to 1.4.2
Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.4.0...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-08-26 17:18:58 +00:00
Jeroen Akkerman
375ea8026c 2.8.0 2019-08-20 01:10:55 +02:00
Jeroen Akkerman
4032f10999 Updated changelog for 2.8.0 2019-08-20 01:10:39 +02:00
Jeroen Akkerman
981b63cacc Fixed missing link in dist file header 2019-08-20 01:10:31 +02:00
Jeroen Akkerman
7fa4521145 Updated dependencies 2019-08-20 01:05:09 +02:00
Jeroen Akkerman
8fa457e5c6
Merge pull request #97 from getselfstudy/master
Allow html to stay on preview page to make it easier to use with react.
2019-08-20 00:55:45 +02:00
Jeroen Akkerman
aa01768e5e Updated changelog for PR #97 2019-08-20 00:51:44 +02:00
Jeroen Akkerman
815a9ce759 Removed dist files 2019-08-20 00:39:33 +02:00
Jeroen Akkerman
d5d99e166e Merge branch 'master' into html_stay 2019-08-20 00:38:20 +02:00
Jeroen Akkerman
d114dab8a3
Merge pull request #109 from jfly/upload-polish
Upload polish
2019-08-20 00:31:10 +02:00
Jeroen Akkerman
78b2083c9e Updated changelog for PR #109 2019-08-20 00:26:27 +02:00
Jeremy Fleischman
8a2283cf27
Bail out if there are no files to upload.
Without this change, if you either:
  - Click and drag some text into the markdown editor, or
  - Copy paste some text into the markdown editor

The status bar will get updated to say "Uploading image ...", and will
never stop.
2019-07-29 02:54:20 -07:00
Jeremy Fleischman
efb840c633
Fix openBrowseFileWindow to also obey self.options.imageUploadFunction if specified.
I think this part just got missed in
https://github.com/Ionaru/easy-markdown-editor/pull/106.

I'm not sure if I should be doing anything with the `onSuccess` and
`onError` callbacks here.
2019-07-29 02:49:36 -07:00
Jeroen Akkerman
02d6653cc5 Updated changelog for PR #106 2019-07-24 14:58:19 +02:00
Jeroen Akkerman
eb59b22491
Allow custom upload function (#106)
Allow custom upload function

Co-authored-by: Jeroen Akkerman <Jeroen_akkerman1@hotmail.com>
2019-07-24 14:53:27 +02:00
Jeroen Akkerman
509763f3b2 Stricter typings for the onSuccess and onError calls 2019-07-24 14:26:11 +02:00
Sebastián Pérez Pérez
0a5b0d3ac4 Allow custom upload function 2019-07-23 13:35:49 +01:00
dependabot[bot]
a8ee1c7281 Bump lodash.template from 4.4.0 to 4.5.0
Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-19 15:01:10 +02:00
Jeroen Akkerman
ad862a6816
Upload images functionality update (#101)
Upload images functionality update

Co-authored-by: Nathanaël <njourdane@irap.omp.eu>
Co-authored-by: Jeroen Akkerman <Jeroen_akkerman1@hotmail.com>
2019-07-19 12:51:54 +02:00
Jeroen Akkerman
63a1825b6e Log errors to console.error 2019-07-18 14:46:08 +02:00
Jeroen Akkerman
0558fb0d68 Increase timeout of error message to 10s 2019-07-18 14:29:54 +02:00
Jeroen Akkerman
cd7c9b8d4d Fixed errorMessages 2019-07-18 12:56:51 +02:00
Jeroen Akkerman
65af615c9b This PR will close #46 (super small edit to make that comment) 2019-07-18 12:43:10 +02:00
Jeroen Akkerman
11963829fc Added typings for image upload 2019-07-18 12:35:14 +02:00
Jeroen Akkerman
917ea336c4 Pre-calculate max file size 2019-07-18 12:01:50 +02:00
Jeroen Akkerman
f1b6a42561 Auto-format of the code 2019-07-18 12:00:32 +02:00
Jeroen Akkerman
6c66b54e2a Improve status bar logic 2019-07-18 11:45:39 +02:00
Jeroen Akkerman
d607dc4a15 Merge branch 'master' into upload_images_2 2019-07-18 11:31:46 +02:00
Jeroen van Oorschot
5f56c27ba7 update changelog 2019-07-16 11:01:05 +02:00
Jeroen van Oorschot
4f581b0c31 Show error message in status bar and reset status bar afterwards. 2019-07-15 22:29:11 +02:00
Jeroen van Oorschot
d9ee9c43d3 Allow server side error messages. 2019-07-15 22:04:02 +02:00
Jeroen van Oorschot
29d145a9b1 Add option for CSRF token on AJAX image upload 2019-07-15 21:39:49 +02:00
Jeroen van Oorschot
c54168a656 Fix status bar. 2019-07-15 15:52:43 +02:00
Jeroen van Oorschot
bbf3340581 IE11 compat. Fix status bar. 2019-07-15 15:11:07 +02:00
Jeroen van Oorschot
d317873fb0 update auxilary files and readme with 2.7.0 2019-07-15 13:24:58 +02:00
Jeroen van Oorschot
ff0db2000a Merge with 2.7.0. 2019-07-15 11:37:22 +02:00
Jeroen Akkerman
23cfe89fa0 Run typescript tests automatically 2019-07-13 19:22:16 +02:00
Jeroen Akkerman
66dcf7d868 2.7.0 2019-07-13 19:22:16 +02:00
Jeroen Akkerman
41e9d9a806 Updated changelog for 2.7.0 2019-07-13 19:22:12 +02:00
Jeroen Akkerman
a919391e34
Merge pull request #100 from Ionaru/custom-preview-class
Added option to override the preview screen styling, closes #99
2019-07-13 17:40:01 +02:00
Jeroen Akkerman
7cfeb37257 Added typings for new option 2019-07-12 14:36:59 +02:00
Jeroen Akkerman
71170a7eef Updated changelog for previewClass feature, closes #99 2019-07-12 14:10:56 +02:00
Jeroen Akkerman
5ffeba5a3c Added option to override the preview screen styling 2019-07-12 14:00:23 +02:00
Jeroen Akkerman
073bfbcea5 Updated dependencies and made code comply with new eslint rules 2019-07-11 10:19:42 +02:00
Jeroen Akkerman
912fd584ba
Bump lodash.template from 4.4.0 to 4.5.0 (#98)
Bump lodash.template from 4.4.0 to 4.5.0

Co-authored-by: null <49699333+dependabot[bot]@users.noreply.github.com>
2019-07-11 09:54:31 +02:00
dependabot[bot]
83c18f4971
Bump lodash.template from 4.4.0 to 4.5.0
Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-11 02:31:16 +00:00
Andreas Richter
16b6f732d3 Allow deployment from git by adding dist folder. 2019-06-26 11:17:37 -04:00
Andreas Richter
f831662fdd Allow html to stay on preview page. 2019-06-26 11:06:00 -04:00
Jeroen Akkerman
786c5b63c6 Fixed version link in changelog 2019-06-17 15:16:32 +02:00
Jeroen Akkerman
17b3fe7b4f 2.6.1 2019-06-17 15:14:06 +02:00
Jeroen Akkerman
11d533cb16 Updated changelog for 2.6.1 2019-06-17 15:13:51 +02:00
Jeroen Akkerman
672291381d Added .npmrc to disable git tag prefix 2019-06-17 15:12:59 +02:00
Jeroen Akkerman
2ca09829b1 Updated changelog for PR #93 2019-06-17 15:07:54 +02:00
Jeroen Akkerman
c429efaff1 Merge branch 'master' of https://github.com/Ionaru/easy-markdown-editor 2019-06-17 15:04:17 +02:00
Jeroen Akkerman
1e9e4e46e0
fix: untoggle ordered-list items first when toggling unordered-list items (#93)
fix: untoggle ordered-list items first when toggling unordered-list items
Fixes #92
2019-06-17 13:02:43 +00:00
Jeroen Akkerman
6b85628042 Use Terser for JS minification instead of (deprecated) UglifyJS 2019-06-17 14:54:29 +02:00
roryok
58f26bc82c reset package-lock changes 2019-06-17 13:26:48 +01:00
roryok
c75a5edc1e remove console logging 2019-06-17 13:26:18 +01:00
roryok
8c443bf401 fix: untoggle ordered-list items first when toggling unordered-list items 2019-06-17 13:23:57 +01:00
Jeroen Akkerman
bd7c2595e8 Rewrite travis config to use job stages 2019-06-02 21:29:15 +02:00
Jeroen Akkerman
23d6aa738d Add Node.js 12 to Travis 2019-06-02 21:26:55 +02:00
Jeroen Akkerman
b529d9a28b Updated dependencies 2019-06-02 21:23:18 +02:00
Jeroen Akkerman
aa0304fdaa Merge branch 'pull-75' 2019-04-15 15:44:42 +02:00
Jeroen Akkerman
8b5806d663 Updated changelog for PR #75 2019-04-15 15:43:25 +02:00
Jeroen Akkerman
8e46c9f3c9
Merge pull request #75 from ysykzheng/master
fix custom action shortcut not working
2019-04-15 15:42:06 +02:00
Jeroen Akkerman
cc0c211759 Fixed shortcut code so links are opened as well. 2019-04-15 15:20:48 +02:00
Jeroen Akkerman
2a0def5fb5 Merge branch 'master' into pull-75 2019-04-15 15:15:17 +02:00
Jeroen Akkerman
aa7ea0b762 2.6.0 2019-04-15 12:58:18 +02:00
Jeroen Akkerman
5882c03933 Updated changelog for 2.6.0 2019-04-15 12:58:06 +02:00
Jeroen Akkerman
8f7d4dcb11 Simplify links in package.json 2019-04-15 12:55:51 +02:00
ysykzheng
98ab3513a6
Merge branch 'master' into master 2019-04-15 17:52:50 +08:00
Jeroen Akkerman
11de338c25
Merge pull request #81 from xmikasax/marked-merge-request
Update marked dependency. DOS vulnerability was patched in 0.6.2
2019-04-10 21:51:37 +02:00
xmikasax
d50378970a Update marked dependency. DOS vulnerability was patched in 0.6.2 2019-04-10 21:56:02 +03:00
ysykzheng
9e94709192 fix custom action shortcut not working 2019-03-26 23:36:17 +08:00
ysykzheng
8f590f4f96
Merge pull request #1 from Ionaru/master
update
2019-03-26 22:15:31 +08:00
Nathanaël Jourdane
4ae7fc8bc9 Allow openBrowseFileWindow() external call with custom callback 2019-03-13 18:48:36 +01:00
Nathanaël Jourdane
780845b7b2 Merge master into upload_images 2019-03-12 16:08:09 +01:00
Nathanaël Jourdane
6e35026a75 [wip upload-image] bugfix error message displayed twice 2019-03-12 16:07:55 +01:00
Nathanaël Jourdane
4ac86cc49d [wip upload-image] use more generic error codes, so the server could be used to upload other files than images 2019-03-12 16:07:55 +01:00
Jeroen Akkerman
fb1ce409bb Did not mean to commit that test.html file 2019-03-12 16:07:55 +01:00
Jeroen Akkerman
50fb9a9a3f Version 2.2.1 wasn't yanked 2019-03-12 16:07:55 +01:00
Jeroen Akkerman
17f5d064a2 Added links to users, issues and PRs to changelog 2019-03-12 16:07:55 +01:00
Nathanaël Jourdane
5fa549d3b3 [wip upload-image] make onError optionnal 2019-03-11 18:17:29 +01:00
Nathanaël Jourdane
8eff45f7a0 [wip upload-image] image server is now supposed to return a json object 2019-03-11 17:19:27 +01:00
Jeroen Akkerman
77038e4883 Did not mean to commit that test.html file 2019-03-08 18:10:46 +01:00
Jeroen Akkerman
6d5716f7c3 Version 2.2.1 wasn't yanked 2019-03-08 18:08:25 +01:00
Jeroen Akkerman
24d6cfb159 Added links to users, issues and PRs to changelog 2019-03-08 15:11:17 +01:00
roipoussiere
6c8ce85ea9 Add errorCallback option 2019-03-07 20:41:45 +01:00
Nathanaël
293c402e7d
Merge branch 'master' into upload_images 2019-03-07 18:20:23 +01:00
Nathanaël Jourdane
d374c5faec [wip upload-image] Better errors support and small code improvements 2019-03-07 18:15:59 +01:00
Jeroen Akkerman
c98bb016ff Fixed headers in the changelog being too big. 2019-03-07 13:43:50 +01:00
Jeroen Akkerman
087bc8cfed Added standardized changelog file. 2019-03-07 13:42:09 +01:00
Nathanaël Jourdane
9f33099b1c Use textContent instead innerHTML when appropriate to avoid XSS 2019-03-07 11:31:48 +01:00
Nathanaël Jourdane
effc080bae [wip upload-image] Allow image upload with copy-paste 2019-03-06 15:36:58 +01:00
Nathanaël Jourdane
fa2c299455 [wip upload-image] Refactoring: remove createImageInput(), set uploadImage() as a prototype, create uploadImages() 2019-03-06 15:35:52 +01:00
Nathanaël Jourdane
ad31ea565c [wip upload-image] Display status messages about image upload in status bar. 2019-03-05 18:08:33 +01:00
Nathanaël Jourdane
3cb4a817f2 [wip upload-image] Allow image upload with drag&drop 2019-03-05 11:44:31 +01:00
Nathanaël Jourdane
e1536da530 [wip upload-image] bugfix error popup 2019-03-05 10:08:01 +01:00
Nathanaël
c7275aa72b
Merge branch 'master' into upload_images 2019-03-05 07:51:29 +01:00
Jeroen Akkerman
e1ae0e4230
Create issue templates 2019-03-05 00:58:57 +01:00
Jeroen Akkerman
8f435686d7
Merge pull request #70 from roipoussiere/fix_markdown_help_link
Update markdown guide link in readme
2019-03-04 22:13:48 +01:00
Nathanaël Jourdane
070e3e5c83 [wip upload-image] update readme with new upload-image options 2019-03-04 18:12:54 +01:00
Nathanaël Jourdane
aa39672e4e [wip upload-image] After image upload, insert image markdown template with uploaded image url 2019-03-04 18:10:46 +01:00
Nathanaël Jourdane
3d1e33396f [wip upload-image] Upload image when selecting it on browse-file window 2019-03-04 18:07:59 +01:00
Jeroen Akkerman
dd0e96b204 Improve icon class regex 2019-03-04 17:46:15 +01:00
Nathanaël Jourdane
11e613b3d5 [wip upload-image] Add image icon to open the browse-file window 2019-03-04 17:05:22 +01:00
Jeroen Akkerman
14bfa678ab
Merge pull request #58 from Ionaru/bugfix/simplemde-compatibility
Restore backwards compatibility with SimpleMDE
2019-03-04 15:56:07 +01:00
Jeroen Akkerman
b14d7dda1c Merge branch 'master' into bugfix/simplemde-compatibility 2019-03-04 15:43:47 +01:00
roipoussiere
526f2ec82a Update markdown guide link in readme 2019-02-28 22:41:02 +01:00
Jeroen Akkerman
07d96c3842
Merge pull request #69 from roipoussiere/comma_dangle
Set eslint rule comma-dangle to always-multiline and apply it
2019-02-28 18:03:59 +01:00
Nathanaël Jourdane
dec5ca1148 Set eslint rule comma-dangle to always-multiline and apply it 2019-02-28 17:29:06 +01:00
Jeroen Akkerman
c81e7466fd
Merge pull request #63 from roipoussiere/fix_link
Fix marked option link in readme
2019-02-28 16:22:23 +01:00
Jeroen Akkerman
1158ef13aa
Merge pull request #62 from roipoussiere/prompt_with_https
Fill image and link prompts to 'https://' by default
2019-02-28 16:22:07 +01:00
Nathanaël Jourdane
7c0c530995 Merge master into fix_link 2019-02-28 16:13:15 +01:00
Jeroen Akkerman
bbe78803b0 Only include necessary files in build package 2019-02-28 16:12:42 +01:00
Nathanaël Jourdane
d875d98b9c Ignore dist folder and remove it 2019-02-28 16:12:42 +01:00
Nathanaël Jourdane
96c8c228b5 merge master 2019-02-28 16:01:58 +01:00
Jeroen Akkerman
d95de92048
Merge pull request #67 from roipoussiere/no_dist
Ignore dist folder and remove it
2019-02-28 15:09:39 +01:00
Jeroen Akkerman
48ece14c95
Merge branch 'master' into no_dist 2019-02-28 15:06:01 +01:00
Jeroen Akkerman
a8306bf617 Only include necessary files in build package 2019-02-28 14:58:54 +01:00
Nathanaël Jourdane
b309645005 Ignore dist folder and remove it 2019-02-28 10:10:59 +01:00
Jeroen Akkerman
c0ea7aab25
Merge branch 'master' into fix_link 2019-02-27 23:49:07 +01:00
Nathanaël Jourdane
e2f4508ec2 Fix marked option link in readme 2019-02-27 17:31:01 +01:00
Nathanaël Jourdane
1c7ce2a0d4 Fill image and link prompts to 'https://' by default 2019-02-27 17:10:07 +01:00
Jeroen Akkerman
99f303229b Updated packages 2019-02-27 13:59:42 +01:00
Jeroen Akkerman
c1a695af51 Auto-format of types folder. 2019-02-27 13:54:57 +01:00
Jeroen Akkerman
df530cf465 Change markdown guide link to open-source Markdown guide website. 2019-02-27 13:54:27 +01:00
Jeroen Akkerman
0baa96af59 Only show build status of the master branch 2019-02-27 11:07:32 +01:00
Jeroen Akkerman
4556f4f1d3 Added latin extensions to wordCount pattern, fixes #61. 2019-02-27 11:06:59 +01:00
Jeroen Akkerman
104e10b401 Fix small typos in CONTRIBUTING.md and remove old file. 2019-02-21 17:50:46 +01:00
Jeroen Akkerman
f50c96bc01 Small fixes for this change
* Removed redundant code.
* Renamed function to better reflect its behaviour.
* Marked `noDisable` and `noMobile` as optional.
2019-02-20 01:59:54 +01:00
Jeroen Akkerman
4385d733e5 Update packages and build dist files. 2019-02-20 01:42:48 +01:00
Jeroen Akkerman
fa9ff580c4 Restore backwards compatibility with SimpleMDE, fixes #41 2019-02-20 01:41:53 +01:00
Jeroen Akkerman
aa47cbd638 Change branch for build badge in README 2019-02-19 00:59:43 +01:00
Jeroen Akkerman
78c91a3977 Update npm key 2019-02-19 00:55:43 +01:00
Jeroen Akkerman
aa7a5f041d Rebuilt dist JS & don't use npx yet in travis.yml 2019-02-19 00:26:04 +01:00
Jeroen Akkerman
4bea687682 Remove old (and not working) CONTRIBUTING.md 2019-02-19 00:20:21 +01:00
Jeroen Akkerman
711ce62657 Adjust travis.yml for master-only repository. 2019-02-19 00:19:53 +01:00
Jeroen Akkerman
b9ee1db9be Merge branch 'development' 2019-02-19 00:13:34 +01:00
Jeroen Akkerman
cae45434b0
Merge pull request #54 from roipoussiere/readme_rework_dev
Readme rework
2019-02-18 11:27:47 +01:00
Nathanaël Jourdane
51498a3fe6 contributing.md: install node v10 instead of v8 2019-02-13 11:58:46 +01:00
Jeroen Akkerman
9c8c8dc0c2
fix bullets-points indentation in CONTRIBUTING.md
Co-Authored-By: roipoussiere <roipoussiere@protonmail.com>
2019-02-13 11:23:29 +01:00
Nathanaël Jourdane
99380d4fde Improve list rendering in PR steps 2019-02-13 09:40:47 +01:00
Nathanaël Jourdane
75ea30f3a1 typo 2019-02-12 14:05:54 +01:00
Nathanaël Jourdane
6f0740fedf Add hacking in readme TOC. 2019-02-12 14:04:35 +01:00
Nathanaël Jourdane
3437ced229 Add hacking instructions in readme and add minor changes in contribution guide. 2019-02-12 13:42:01 +01:00
Nathanaël Jourdane
c46ddde5e0 Add modifications suggested in code review 2019-02-11 17:13:12 +01:00
Nathanaël Jourdane
7f7554effd fix bullets on contribution guide 2019-02-11 15:24:55 +01:00
Nathanaël Jourdane
9fefb494ba Add contribution guide 2019-02-11 15:19:08 +01:00
Nathanaël Jourdane
2555bc0b24 Fix typos and other minor improvements. 2019-02-11 14:46:16 +01:00
Nathanaël Jourdane
e0e988d463 Add summary 2019-02-11 14:28:33 +01:00
Nathanaël Jourdane
a4a89775dc Improve titles structure 2019-02-11 14:26:05 +01:00
Nathanaël Jourdane
bb1279ed2f move badges to the top (quick access) 2019-02-11 14:15:18 +01:00
Nathanaël Jourdane
ab4ac71f5a Add license section 2019-02-11 14:13:26 +01:00
Nathanaël Jourdane
05cd00d36e Move fork explanation to the end of readme (better readability). 2019-02-11 14:12:36 +01:00
Jeroen Akkerman
b697af6254 README update
* Added more information about EasyMDE
* Replace most mentions of SimpleMDE with EasyMDE
2019-01-17 17:25:03 +01:00
Jeroen Akkerman
92e1425a4f Force dist js file override from hotfix 2019-01-17 12:33:23 +01:00
Jeroen Akkerman
9c779bf85c Merge branch 'hotfix/2.5.1' 2019-01-17 12:32:17 +01:00
Jeroen Akkerman
20cd3e4586 Hotfix: change role="button" to type="button"
* Closes issue #45 and properly fixes issue #38
* Added typescript support line to README
* Bumped version to 2.5.1
* Rebuilt dist files
2019-01-17 12:29:45 +01:00
Jeroen Akkerman
5abc4d7292 Package updates 2019-01-17 11:50:33 +01:00
Jeroen Akkerman
28c247279b Merge branch 'release/2.5.0' into development 2019-01-17 11:38:14 +01:00
Jeroen Akkerman
8c6ae58a6c Merge branch 'release/2.5.0' 2019-01-17 11:38:05 +01:00
Jeroen Akkerman
40303a5fc6 Prepare for release 2.5.0
* Bump version to 2.5.0
* Build files for distribution
2019-01-17 11:31:37 +01:00
Jeroen Akkerman
61b8aa2293
Merge pull request #44 from FranklinWhale/add-typings
Add typings
2019-01-17 11:17:19 +01:00
Jeroen Akkerman
5b01fba882 Added more tests for the types file. 2019-01-17 11:12:40 +01:00
Jeroen Akkerman
5a37a534dc Forgot npm run in the command, added. 2019-01-17 09:50:54 +01:00
Jeroen Akkerman
2ad0d26127 Automatic Travis tests & consistency
* Added `test:types` to travis run script.
* Changed `main` value in package.json to match `types` value style.
2019-01-17 09:46:57 +01:00
Jeroen Akkerman
88a1411462
Update types/easymde.d.ts
Co-Authored-By: FranklinWhale <FranklinWhale@users.noreply.github.com>
2019-01-16 23:04:19 +08:00
Franklin Tse
ce4171a3b7 Add license, use ReadonlyArray 2019-01-16 22:07:52 +08:00
Franklin Tse
4e6b0876e9 Initial commit 2019-01-16 21:32:41 +08:00
Jeroen Akkerman
b31c0a1a02 Added role="button" to toolbar buttons, closes #38 2018-12-20 01:57:12 +01:00
Jeroen Akkerman
75cfd34191 Fix eraser icon not working in FA5 2018-11-09 14:41:48 +01:00
Jeroen Akkerman
7c9186d223 Merge branch 'master' into development 2018-11-09 14:29:46 +01:00
Jeroen Akkerman
3551c6c003 Change badge styles to for-the-badge 2018-11-09 14:28:55 +01:00
Jeroen Akkerman
cd92cc441a Merge branch 'release/2.4.2' 2018-11-09 11:05:02 +01:00
Jeroen Akkerman
7ddb988e79 Merge branch 'release/2.4.2' into development 2018-11-09 11:05:01 +01:00
Jeroen Akkerman
226a1d22b5 Build dist files 2018-11-09 11:04:46 +01:00
Jeroen Akkerman
9fa18cee1e Bump version numbers 2018-11-09 11:04:39 +01:00
Jeroen Akkerman
09ba21374d Add Node 11 to Travis CI 2018-11-09 10:57:35 +01:00
Jeroen Akkerman
fbbc23df0e Update package-lock.json to resolve security issue. 2018-11-09 10:50:50 +01:00
Jeroen Akkerman
604f2c8ea9
Merge pull request #31 from adamb70/master
Fix autosave event handler
2018-11-09 10:40:50 +01:00
Jeroen Akkerman
e81e1f2c38 Fix sub-icons issue with FA5 2018-11-09 10:37:20 +01:00
Jeroen Akkerman
bc49e2589e Update codemirror 2018-11-09 10:25:42 +01:00
Jeroen Akkerman
d81b2326f6 Change deprecated "prepublish" to "prepare" in package.json. 2018-11-09 10:25:06 +01:00
adamb70
04777b49fb
Merge pull request #3 from adamb70/fix-autosave-submit-handler
Use user autosave delay
2018-11-08 18:37:04 +00:00
adamb70
7cbfacbbdd Use user autosave delay 2018-11-08 18:35:44 +00:00
adamb70
613fb0fcad
Merge pull request #2 from adamb70/fix-autosave-submit-handler
Update src/js/easymde.js
2018-11-08 18:10:02 +00:00
adamb70
265b2ed9d4 Update src/js/easymde.js 2018-11-08 18:08:27 +00:00
Jeroen Akkerman
d0e64127ac Merge branch 'release/2.4.1' 2018-10-15 13:45:59 +02:00
Jeroen Akkerman
098236a153 Merge branch 'release/2.4.1' into development 2018-10-15 13:45:59 +02:00
Jeroen Akkerman
5af2ac1b41 Update packages and bump version number. 2018-10-15 13:44:56 +02:00
Jeroen Akkerman
8d5dd2517d Merge branch 'master' into development 2018-10-15 13:38:28 +02:00
Jeroen Akkerman
886f465335
Merge pull request #27 from Summon528/master
Add fa-redo class for FA5
2018-10-15 11:04:08 +02:00
Summon528
3588edd929
Add fa-redo class for FA5 2018-10-06 12:09:16 +08:00
jeroen.akkerman
4c3ee66e35 Merge branch 'release/2.4.0' 2018-08-14 13:34:10 +02:00
jeroen.akkerman
43abcaf655 Bump version and build new files for distribution 2018-08-14 13:25:55 +02:00
jeroen.akkerman
34e1a02bbf Merge remote-tracking branch 'origin/master' into development 2018-08-14 13:24:14 +02:00
Jeroen Akkerman
900a0c4d7c
Merge pull request #19 from aphitiel/fullscreen-without-toolbar
Fullscreen without toolbar
2018-08-14 12:26:06 +02:00
Jeroen Akkerman
95abc3ef1b
Merge pull request #17 from LeviticusMB/themable
Made EasyMDE themable (again?).
2018-08-14 12:17:28 +02:00
Jeroen Akkerman
cbd638d93a
Super small edit to (hopefully) retrigger CI
CI feedback was broken in this pull request, this small irrelevant edit will hopefully fix that.
2018-08-14 10:01:55 +02:00
pk
b8e7293516 Fix fullscreen not working with toolbar: false 2018-08-13 21:23:32 +02:00
jeroen.akkerman
23327bf21d Badges badges badges badges badges badgers badges badges badges badges! 2018-07-31 17:58:52 +02:00
jeroen.akkerman
8b6c7de99f Update version for onToggleFullScreen option, lint fix & updates. 2018-07-31 17:27:06 +02:00
Jeroen Akkerman
9b735ce20f
Merge pull request #16 from n-3-0/development
Add optional onToggleFullScreen support from options
2018-07-31 17:01:36 +02:00
Jeroen Akkerman
21ef42937c
Merge pull request #13 from sne11ius/development
Add searchcursor plugin
2018-07-31 17:00:19 +02:00
Martin Blom
e6537588e8 Forgot to commit doc change. 2018-07-29 11:59:50 +02:00
Martin Blom
35b2176bac Made EasyMDE themable (again?).
* The default theme is 'easymde', but can be overridden by options.theme.
* Changed styles to use this theme as selector instead of .CodeMirror.
* Dropped unnecessary .cm-strikethrough styling.
* Added .cm-quote styling.
* Changed .CodeMirror-selected rule to match codemirror.css.
2018-07-29 10:08:54 +02:00
N-3-0
efda8d4a21 n-3-0 : Add optional onToggleFullScreen support from options 2018-07-15 03:04:10 -06:00
Unknown
7fb35ce968 Merge branch 'development' 2018-06-29 11:45:12 +02:00
jeroen.akkerman
382449c0bc Deploy does not work when combining both tags and branch filters. 2018-06-29 11:16:16 +02:00
Unknown
7fda2e09dd Merge branch 'development' 2018-06-29 10:54:10 +02:00
jeroen.akkerman
da4eba8d47 Update version in package-lock.json 2018-06-29 10:52:47 +02:00
jeroen.akkerman
18c03985ea Disabled text multi-select 2018-06-29 10:41:24 +02:00
Cornelius Wichering
b60b3cd184 Added searchcursor plugin 2018-05-28 22:08:02 +02:00
Jeroen Akkerman
f4905ea6b9 Increment version 2018-05-17 23:54:26 +02:00
Jeroen Akkerman
0bacebb176 NPM token was wrong according to Travis, created a new one 2018-05-17 23:47:14 +02:00
Jeroen Akkerman
3654672e8d api_key/secure was in the wrong place 2018-05-17 23:41:18 +02:00
Jeroen Akkerman
715d721aa8 Not sure what's wrong here 2018-05-17 23:39:45 +02:00
Jeroen Akkerman
e7b5611278 Indent might have been an issue 2018-05-17 23:34:54 +02:00
Jeroen Akkerman
fb5d8619bd Attempt at automatic publish on NPM
* Changed SimpleMDE to EasyMDE in contributing guidelines
* Added to the SimpleMDE / EasyMDE diff in the README
2018-05-17 23:24:53 +02:00
Jeroen Akkerman
23b96e5952
Merge pull request #11 from sne11ius/development
Fixed main: simplemde.js -> easymde.js
2018-05-17 23:05:01 +02:00
Cornelius Wichering
e0945b856a
Fixed main: simplemde.js -> easymde.js
Looks like the file itself was renamed but the package.json wasn't updated accordingly
2018-05-17 22:13:27 +02:00
Jeroen Akkerman
e50bffba36 Links in rendered preview will now open in a new tab by default. 2018-05-13 22:38:05 +02:00
Jeroen Akkerman
82d12b1830 Merge branch 'development' 2018-05-13 16:54:33 +02:00
Jeroen Akkerman
31310fc4dd Version 2.0.1 2018-05-13 16:49:19 +02:00
Jeroen Akkerman
c8614d9186 Fixed CSS that was broken after my FA5 changes, fixes #9 2018-05-13 16:47:49 +02:00
Jeroen Akkerman
e8e2a0cd2a * Update gulp to version 4
* Added Windows/Linux shortcuts to documentation
* Drop Node 4 testing
* Added Node 10 testing
* Updated packages
2018-05-13 01:00:38 +02:00
Jeroen Akkerman
fd1665d012
Fixed incorrect jQuery selector example, fixes #8 2018-05-09 10:28:22 +02:00
jeroen.akkerman
2adb4dcfa1 Updated documentation 2018-04-25 15:32:52 +02:00
Unknown
4bc5500d18 Merge branch 'master' into development 2018-04-23 15:58:56 +02:00
44 changed files with 19960 additions and 3632 deletions

View File

@ -1,6 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
[*.yaml]
indent_size = 2
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@ -1,4 +1,5 @@
{
"root": true,
"rules": {
"strict": 0,
"no-console": 0,
@ -9,11 +10,18 @@
"semi": [
"error",
"always"
],
"comma-dangle": [
"error",
"always-multiline"
]
},
"env": {
"browser": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"extends": "eslint:recommended"
}

View File

@ -1,10 +0,0 @@
### Overview
First of all, thanks for your interest in helping make EasyMDE even better. Contributions help resolve rare bugs, accomplish neat new features, polish the code, and improve the documentation.
### Guidelines for contributing
- The *most important* guideline for contributing is to compare against the `development` branch when creating a pull request. This allows time to test and modify code changes before merging them into the stable master branch with the next release.
- Travis CI is configured to build and verify all PRs. If your PR causes the build to fail, please add an additional commit that resolves any problems.
- If you really want to earn some brownie points, create a JSFiddle that demonstrates your code changes. Seriously, this helps immensely and allows one or multiple people to easily provide feedback on the great work you've done.
- When creating the JSFiddle, keep in mind that you can use http://rawgit.com for your files.
- Do your best to fully test your changes. Anticipate edge-case behavior.
- Try to keep your codebase that you're making changes to as up-to-date as possible with the origin. SimpleMDE creates new releases frequently, so it's easy to fall behind if you've been working on something new for a while.

32
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: Bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Version information**
- OS: [e.g. Windows, MacOS]
- Browser: [e.g. Chrome 72]
- EasyMDE version: [e.g. 2.5.1]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Feature
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots/mock-ups about the feature request here.

11
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@ -0,0 +1,11 @@
---
name: Question
about: Ask a question if anything is unclear
title: ''
labels: Question
assignees: ''
---
**Describe your question**
Please describe your question in as much detail as possible.

95
.github/workflows/cd.yaml vendored Normal file
View File

@ -0,0 +1,95 @@
name: Test & Deploy
on:
workflow_dispatch:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: current
- uses: actions/checkout@v4
- run: npm audit --omit=dev
test:
needs: [ audit ]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ '14', '16', '18' ]
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v4
- run: npm ci
- name: Test
run: npm test
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots-nodejs-${{ matrix.node-version }}
path: cypress/screenshots
retention-days: 7
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos-nodejs-${{ matrix.node-version }}
path: cypress/videos
retention-days: 7
deploy:
needs: [ test ]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/setup-node@v4
with:
node-version: current
- uses: actions/checkout@v4
- run: npm ci
- name: Deploy @latest version to npm
if: startsWith(github.ref, 'refs/tags/')
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Update @next version
if: startsWith(github.ref, 'refs/heads/')
run: npm version prerelease --no-git-tag-version --preid "$GITHUB_RUN_NUMBER"
- name: Deploy @next version to npm
if: startsWith(github.ref, 'refs/heads/')
uses: JS-DevTools/npm-publish@v1
with:
tag: next
token: ${{ secrets.NPM_TOKEN }}
check-version: false

9
.gitignore vendored
View File

@ -1,3 +1,6 @@
# generated files
dist/
# NPM files
node_modules/
@ -6,3 +9,9 @@ node_modules/
*.ipr
*.iws
.idea/
.vscode/
dev_test/
# Test artifacts
cypress/screenshots
cypress/videos

1
.npmrc Normal file
View File

@ -0,0 +1 @@
tag-version-prefix=""

View File

@ -1,9 +0,0 @@
language: node_js
node_js:
- '9'
- '8'
- '6'
- '4'
before_script:
- npm install -g gulp
script: gulp

478
CHANGELOG.md Normal file
View File

@ -0,0 +1,478 @@
# EasyMDE Changelog
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] -->
## [2.20.0] - 2025-03-04
### Added
- Support for `marked` extensions (Thanks to [@codingjoe], [#611], [#514]).
## [2.19.0] - 2025-02-18
### Added
- `updateStatusBar` type to typescript definitions (Thanks to [@borodean], [#519]).
- `"upload-image"` option to the `ToolbarButton` typescript definitions (Thanks to [@borodean], [#520]).
- `imageInputName` option to set a custom "name" attribute for the image input (Thanks to [@robinvandernoord], [#573]).
### Fixed
- Relative image paths using the stylesheet as the source instead of the document (Thanks to [@p1gp1g], [#591]).
- Excessive memory usage with the `previewImagesInEditor` option (Thanks to [@p1gp1g], [#592]).
- Parentheses in the alt text of images causing the image not to load then using `previewImagesInEditor` (Thanks to [@mayraamaral], [#608]).
## [2.18.0] - 2022-09-20
### Added
- `toolbarButtonClassPrefix` option to resolve conflicts with Bootstrap classes ([#493]).
## [2.17.0] - 2022-08-20
### Added
- Improved CSRF support for uploading images (Thanks to [@ZsgsDesign], [#394]).
- Option to register an image preview handler: `imagesPreviewHandler` (Thanks to [@diego-gw], [#411]).
- Support for `.webp` image formats (Thanks to [@sghoweri], [#417]).
- `toggleHeading` methods for headings 4, 5 and 6 (Thanks to [@vanillajonathan], [#449] and [#492]).
- Support for `.gif`, `.avif` and `.apng` image formats (Thanks to [@vanillajonathan], [#450], [#458] and [#459]).
- Keyboard shortcuts for `toggleHeading` methods (Thanks to [@vanillajonathan], [#451]).
- `iconClassMap` option to specify icon class names for toolbar buttons (Thanks to [@vanillajonathan], [#454]).
- `role="toolbar"` on the toolbar element (Thanks to [@vanillajonathan], [#455]).
- Support for text buttons in the toolbar (Thanks to [@vanillajonathan], [#461]).
- `aria-label` attribute for toolbar buttons (uses the `title` option) (Thanks to [@vanillajonathan], [#463]).
- `role="application"` on the editor container element (Thanks to [@vanillajonathan], [#464]).
- Option to not overwrite the preview HTML by returning `null` from `previewRender` (Thanks to [@LevitatingOrange], [#471]).
### Fixed
- Hyperlink doubling (Thanks to [@danielok1993], [#95]).
- URLs with certain characters entered through prompts causing invalid markdown (Thanks to [@Zignature], [#393]).
- Autofocus option not working properly ([#399]).
- Inconsistent border colour (Thanks to [@vanillajonathan], [#466]).
- Invalid regex on Safari browsers ([#478])
- `hideIcons` option type (Thanks to [@LoyalPotato], [#488]).
### Changed
- Editor now uses responsive font sizes (Thanks to [@vanillajonathan], [#452]).
### Documentation
- Added several improvements to README (Thanks to [@vanillajonathan], [#436], [#438], [#440], [#444]).
- Fixed typo in README (Thanks to [@kicksent], [#484]).
- Added missing icon for `upload-image` in README (Thanks to [@hlf20010508], [#486]).
## [2.16.1] - 2022-01-14
### Fixed
- Incorrect initial line and column count in status bar.
- Security issue in `marked` dependency.
## [2.16.0] - 2022-01-11
### Added
- `direction` option to enable RTL mode (Thanks to [@souljuse], [#358]).
- `attributes` option to add custom attributes to toolbar buttons (Thanks to [@Zignature], [#388]).
- `unorderedListStyle` option to change the character used for unordered lists (Thanks to [@Zignature], [#389]).
### Fixed
- Image extension detection when extension is uppercase (Thanks to [@ukjinjang], [#357]).
- Submenu actions not working in Chromium Browsers (Thanks to [@Offerel], [@robjean9] and [@kelvinj], [#364]).
- Incorrect line and column count in status bar (Thanks to [@Zignature], [#384]).
## [2.15.0] - 2021-04-22
### Added
- `imagePathAbsolute` option to return the absolute path when uploading an image (Thanks to [@wwsalmon], [#313]).
### Fixed
- `ToolbarIcon` typings, added `icon` (Thanks to [@ChronosMasterOfAllTime], [#308]).
- Image link extension when it was not the last part of the URL (Thanks to [@deerboy], [#311]).
- Preview mode did not stay enabled when toggling to fullscreen (Thanks to [@smundro], [#316]).
- Required typings not being included in `dependencies` (Thanks to [@marekdedic], [#322]).
## [2.14.0] - 2021-02-14
### Added
- The `scrollbarStyle` option to change the style of the scrollbar (Thanks to [@danice], [#250]).
### Fixed
- Issues with images not displaying correctly in the preview screen (Thanks to [@ivictbor], [#253]).
- An error when both `sideBySideFullscreen` and `status` were set to `false` (Thanks to [@joahim], [#272]).
- Editor trying to display non-image files (Thanks to [@Juupaa], [#277])
- Unneeded call to `window.removeEventListener` (Thanks to [@emirotin], [#280])
- Spell checker (Thanks to [@Fanvadar], [#284]).
- Focus issues with toolbar dropdown menus (Thanks to [@Situphen], [#285]).
- Interaction between the `sideBySideFullscreen` and the preview state (Thanks to [@smundro], [#286])
- Refactored strange method of padding the toolbar into regular padding (Thanks to [@sn3p], [#293]).
- Security issue in `marked` dependency (Thanks to [@dependabot], [#298]).
## [2.13.0] - 2020-11-11
### Added
- CodeMirror autorefresh plugin and autoRefresh option (Thanks to [@mbolli], [#249]).
- `lineNumbers` option to display line numbers in the editor (Thanks to [@nhymxu], [#267]).
### Fixed
- CSS scoping issues when the editor is used in combination with other CodeMirror instances ([#252]).
## [2.12.1] - 2020-10-06
### Changed
- Set `previewImagesInEditor` option to `false` by default ([#251]).
## [2.12.0] - 2020-09-29
### Added
- `this` context in imageUploadFunction (Thanks to [@JoshuaLicense], [#225]).
- `previewImagesInEditor` option to display images in editor mode (Thanks to [@ivictbor], [#235]).
- `overlayMode` options to supply an additional codemirror mode (Thanks to [@czynskee], [#244]).
### Fixed
- Corrected default size units from `b,Kb,Mb` to ` B, KB, MB` ([#239]).
- Max height less than min height (Thanks to [@nick-denry], [#222]).
- toTextArea issue (Thanks to [@nick-denry], [#223]).
- Error when updateStatusBar was called during image upload, but the status bar is disabled (Thanks to [@JoshuaLicense], [#224]).
## [2.11.0] - 2020-07-16
### Added
- Support for Node.js 14.
- Preview without fullscreen (Thanks to [@nick-denry], [#196]).
### Fixed
- Fix cursor displayed position on activity (Thanks to [@firm1], [#184]).
- Checkboxes always have bullets in front of them ([#136]).
- Save the text only when modifying the content of the easymde instance (Thanks to [@firm1], [#181]).
## [2.10.1] - 2020-04-06
### Fixed
- Typescript error when entering certain strings for toolbar buttons ([#178]).
## [2.10.0] - 2020-04-02
### Added
- `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser (Thanks to [@firm1], [#143]).
- Group buttons in drop-down lists by adding a sub-option `children` for the items in the toolbar (Thanks to [@firm1], [#141]).
- `sanitizerFunction` option to allow custom HTML sanitizing in the markdown preview (Thanks to [@adamb70], [#147]).
- Time formatting and custom text options for the autosave message (Thanks to [@dima-bzz], [#170]).
### Changed
- Delay before assuming that submit of the form as failed is `autosave.submit_delay` instead of `autosave.delay` (Thanks to [@Situphen], [#139]).
- Add `watch` task for gulp (Thanks to [@A-312], [#150]).
### Fixed
- Issue with Marked when using IE11 and webpack (Thanks to [@felipefdl], [#169]).
- Updated codemirror to version 5.52.2 (Thanks to [@A-312], [#173]).
- Editor displaying on top of other elements on a webpage (Thanks to [@StefKors], [#175]).
## [2.9.0] - 2020-01-13
### Added
- Missing minHeight option in type definition (Thanks to [@t49tran], [#123]).
- Other missing type definitions ([#126]).
### Changed
- The editor will remove its saved contents when the editor is emptied, allowing to reload a default value (Thanks to [@Situphen], [#132]).
## [2.8.0] - 2019-08-20
### Added
- Upload images functionality (Thanks to [@roipoussiere] and [@JeroenvO], [#71], [#101]).
- Allow custom image upload function (Thanks to [@sperezp], [#106]).
- More polish to the upload images functionality (Thanks to [@jfly], [#109]).
- Improved React compatibility (Thanks to [@richtera], [#97]).
### Fixed
- Missing link in dist file header.
## [2.7.0] - 2019-07-13
### Added
- `previewClass` option for overwriting the preview screen class ([#99]).
### Fixed
- Updated dependencies to resolve potential security issue.
- Resolved small code style issues shown by new eslint rules.
## [2.6.1] - 2019-06-17
### Fixed
- Error when toggling between ordered and unordered lists (Thanks to [@roryok], [#93]).
- Keyboard shortcuts for custom actions not working (Thanks to [@ysykzheng], [#75]).
## [2.6.0] - 2019-04-15
### Added
- Contributing guide (Thanks to [@roipoussiere], [#54]).
- Issue templates.
- Standardized changelog file.
### Changed
- Finish rewrite of README (Thanks to [@roipoussiere], [#54]).
- Image and link prompt fill with "https://" by default.
- Link to markdown guide to <https://www.markdownguide.org/basic-syntax/>.
### Fixed
- Backwards compatibility in the API with SimpleMDE 1.0.0 ([#41]).
- Automatic publish of master branch to `@next`
### Removed
- Distribution files from source-control.
## [2.5.1] - 2019-01-17
### Fixed
- `role="button"` needed to be `type="button"` ([#45]).
## [2.5.0] - 2019-01-17
### Added
- Typescript support (Thanks to [@FranklinWhale], [#44]).
- `role="button"` to toolbar buttons ([#38]).
### Fixed
- Eraser icon not working with FontAwesome 5.
## [2.4.2] - 2018-11-09
### Added
- Node.js 11 support.
### Fixed
- Header button icons not showing sub-icons with FontAwesome 5.
- Inconsistent autosave behaviour when submitting a form (Thanks to [@Furgas] and [@adamb70], [#31]).
## [2.4.1] - 2018-10-15
### Added
- `fa-redo` class to redo button for FA5 compatibility (Thanks to [@Summon528], [#27]).
## [2.4.0] - 2018-10-15
### Added
- Theming support (Thanks to [@LeviticusMB], [#17]).
- onToggleFullscreen event hook (Thanks to [@n-3-0], [#16]).
### Fixed
- Fullscreen not working with `toolbar: false` (Thanks to [@aphitiel], [#19]).
## [2.2.2] - 2019-07-03
### Fixed
- Automatic publish only publishing tags.
## [2.2.1] - 2019-06-29
### Changed
- Attempt automatic publish `@next` version on npm.
- Links in the preview window will open in a new tab by default.
### Fixed
- Multi-text select issue by disabling multi-select in the editor ([#10]).
- `main` file in package.json (Thanks to [@sne11ius], [#11]).
## [2.0.1] - 2018-05-13
### Changed
- Rewrote part of the documentation for EasyMDE.
- Updated gulp to version 4.0.0.
### Fixed
- Icons for `heading-smaller`, `heading-bigger`, `heading-1`, `heading-2` and `heading-3` not showing ([#9]).
## [2.0.0] - 2018-04-23
Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown-editor)
### BREAKING CHANGES
- Dropped Bower support.
- Dropped support for older Node.js versions.
### Added
- FontAwesome 5 support.
- Support for newer Node.js versions.
### Changed
- Packages are now version-locked.
- Simplified build script.
- Markdown guide button is no longer disabled in preview mode.
### Fixed
- Cursor not always showing in "text" mode over the edit field
<!-- Linked issues -->
[#611]: https://github.com/Ionaru/easy-markdown-editor/issues/611
[#514]: https://github.com/Ionaru/easy-markdown-editor/issues/514
[#493]: https://github.com/Ionaru/easy-markdown-editor/issues/493
[#478]: https://github.com/Ionaru/easy-markdown-editor/issues/478
[#399]: https://github.com/Ionaru/easy-markdown-editor/issues/399
[#252]: https://github.com/Ionaru/easy-markdown-editor/issues/252
[#251]: https://github.com/Ionaru/easy-markdown-editor/issues/251
[#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
[#99]: https://github.com/Ionaru/easy-markdown-editor/issues/99
[#45]: https://github.com/Ionaru/easy-markdown-editor/issues/45
[#44]: https://github.com/Ionaru/easy-markdown-editor/issues/44
[#41]: https://github.com/Ionaru/easy-markdown-editor/issues/41
[#38]: https://github.com/Ionaru/easy-markdown-editor/issues/38
[#17]: https://github.com/Ionaru/easy-markdown-editor/issues/17
[#16]: https://github.com/Ionaru/easy-markdown-editor/issues/16
[#11]: https://github.com/Ionaru/easy-markdown-editor/issues/11
[#10]: https://github.com/Ionaru/easy-markdown-editor/issues/10
[#9]: https://github.com/Ionaru/easy-markdown-editor/issues/9
<!-- Linked PRs -->
[#608]: https://github.com/Ionaru/easy-markdown-editor/pull/608
[#592]: https://github.com/Ionaru/easy-markdown-editor/pull/592
[#591]: https://github.com/Ionaru/easy-markdown-editor/pull/591
[#573]: https://github.com/Ionaru/easy-markdown-editor/pull/573
[#520]: https://github.com/Ionaru/easy-markdown-editor/pull/520
[#519]: https://github.com/Ionaru/easy-markdown-editor/pull/519
[#492]: https://github.com/Ionaru/easy-markdown-editor/pull/492
[#488]: https://github.com/Ionaru/easy-markdown-editor/pull/488
[#486]: https://github.com/Ionaru/easy-markdown-editor/pull/486
[#484]: https://github.com/Ionaru/easy-markdown-editor/pull/484
[#479]: https://github.com/Ionaru/easy-markdown-editor/pull/479
[#471]: https://github.com/Ionaru/easy-markdown-editor/pull/471
[#467]: https://github.com/Ionaru/easy-markdown-editor/pull/467
[#466]: https://github.com/Ionaru/easy-markdown-editor/pull/466
[#464]: https://github.com/Ionaru/easy-markdown-editor/pull/464
[#463]: https://github.com/Ionaru/easy-markdown-editor/pull/463
[#461]: https://github.com/Ionaru/easy-markdown-editor/pull/461
[#459]: https://github.com/Ionaru/easy-markdown-editor/pull/459
[#458]: https://github.com/Ionaru/easy-markdown-editor/pull/458
[#455]: https://github.com/Ionaru/easy-markdown-editor/pull/455
[#454]: https://github.com/Ionaru/easy-markdown-editor/pull/454
[#452]: https://github.com/Ionaru/easy-markdown-editor/pull/452
[#451]: https://github.com/Ionaru/easy-markdown-editor/pull/451
[#450]: https://github.com/Ionaru/easy-markdown-editor/pull/450
[#449]: https://github.com/Ionaru/easy-markdown-editor/pull/449
[#444]: https://github.com/Ionaru/easy-markdown-editor/pull/444
[#440]: https://github.com/Ionaru/easy-markdown-editor/pull/440
[#438]: https://github.com/Ionaru/easy-markdown-editor/pull/438
[#436]: https://github.com/Ionaru/easy-markdown-editor/pull/436
[#417]: https://github.com/Ionaru/easy-markdown-editor/pull/417
[#411]: https://github.com/Ionaru/easy-markdown-editor/pull/411
[#394]: https://github.com/Ionaru/easy-markdown-editor/pull/394
[#393]: https://github.com/Ionaru/easy-markdown-editor/pull/393
[#389]: https://github.com/Ionaru/easy-markdown-editor/pull/389
[#388]: https://github.com/Ionaru/easy-markdown-editor/pull/388
[#384]: https://github.com/Ionaru/easy-markdown-editor/pull/384
[#364]: https://github.com/Ionaru/easy-markdown-editor/pull/364
[#358]: https://github.com/Ionaru/easy-markdown-editor/pull/358
[#357]: https://github.com/Ionaru/easy-markdown-editor/pull/357
[#322]: https://github.com/Ionaru/easy-markdown-editor/pull/322
[#316]: https://github.com/Ionaru/easy-markdown-editor/pull/316
[#313]: https://github.com/Ionaru/easy-markdown-editor/pull/313
[#311]: https://github.com/Ionaru/easy-markdown-editor/pull/311
[#308]: https://github.com/Ionaru/easy-markdown-editor/pull/308
[#298]: https://github.com/Ionaru/easy-markdown-editor/pull/298
[#293]: https://github.com/Ionaru/easy-markdown-editor/pull/293
[#286]: https://github.com/Ionaru/easy-markdown-editor/pull/286
[#285]: https://github.com/Ionaru/easy-markdown-editor/pull/285
[#284]: https://github.com/Ionaru/easy-markdown-editor/pull/284
[#280]: https://github.com/Ionaru/easy-markdown-editor/pull/280
[#277]: https://github.com/Ionaru/easy-markdown-editor/pull/277
[#272]: https://github.com/Ionaru/easy-markdown-editor/pull/272
[#267]: https://github.com/Ionaru/easy-markdown-editor/pull/267
[#253]: https://github.com/Ionaru/easy-markdown-editor/pull/253
[#250]: https://github.com/Ionaru/easy-markdown-editor/pull/250
[#249]: https://github.com/Ionaru/easy-markdown-editor/pull/249
[#244]: https://github.com/Ionaru/easy-markdown-editor/pull/244
[#235]: https://github.com/Ionaru/easy-markdown-editor/pull/235
[#225]: https://github.com/Ionaru/easy-markdown-editor/pull/225
[#224]: https://github.com/Ionaru/easy-markdown-editor/pull/224
[#223]: https://github.com/Ionaru/easy-markdown-editor/pull/223
[#222]: https://github.com/Ionaru/easy-markdown-editor/pull/222
[#196]: https://github.com/Ionaru/easy-markdown-editor/pull/196
[#184]: https://github.com/Ionaru/easy-markdown-editor/pull/184
[#181]: https://github.com/Ionaru/easy-markdown-editor/pull/181
[#175]: https://github.com/Ionaru/easy-markdown-editor/pull/175
[#173]: https://github.com/Ionaru/easy-markdown-editor/pull/173
[#170]: https://github.com/Ionaru/easy-markdown-editor/pull/170
[#169]: https://github.com/Ionaru/easy-markdown-editor/pull/169
[#150]: https://github.com/Ionaru/easy-markdown-editor/pull/150
[#147]: https://github.com/Ionaru/easy-markdown-editor/pull/147
[#143]: https://github.com/Ionaru/easy-markdown-editor/pull/143
[#141]: https://github.com/Ionaru/easy-markdown-editor/pull/141
[#139]: https://github.com/Ionaru/easy-markdown-editor/pull/139
[#132]: https://github.com/Ionaru/easy-markdown-editor/pull/132
[#123]: https://github.com/Ionaru/easy-markdown-editor/pull/123
[#109]: https://github.com/Ionaru/easy-markdown-editor/pull/109
[#106]: https://github.com/Ionaru/easy-markdown-editor/pull/106
[#101]: https://github.com/Ionaru/easy-markdown-editor/pull/101
[#97]: https://github.com/Ionaru/easy-markdown-editor/pull/97
[#95]: https://github.com/Ionaru/easy-markdown-editor/pull/95
[#93]: https://github.com/Ionaru/easy-markdown-editor/pull/93
[#75]: https://github.com/Ionaru/easy-markdown-editor/pull/75
[#71]: https://github.com/Ionaru/easy-markdown-editor/pull/71
[#54]: https://github.com/Ionaru/easy-markdown-editor/pull/54
[#31]: https://github.com/Ionaru/easy-markdown-editor/pull/31
[#27]: https://github.com/Ionaru/easy-markdown-editor/pull/27
[#19]: https://github.com/Ionaru/easy-markdown-editor/pull/19
<!-- Linked users -->
[@dependabot]: https://github.com/dependabot
[@wwsalmon]: https://github.com/wwsalmon
[@ChronosMasterOfAllTime]: https://github.com/ChronosMasterOfAllTime
[@deerboy]: https://github.com/deerboy
[@marekdedic]: https://github.com/marekdedic
[@emirotin]: https://github.com/emirotin
[@smundro]: https://github.com/smundro
[@Juupaa]: https://github.com/Juupaa
[@Fanvadar]: https://github.com/Fanvadar
[@danice]: https://github.com/danice
[@joahim]: https://github.com/joahim
[@nhymxu]: https://github.com/nhymxu
[@mbolli]: https://github.com/mbolli
[@ivictbor]: https://github.com/ivictbor
[@JoshuaLicense]: https://github.com/JoshuaLicense
[@czynskee]: https://github.com/czynskee
[@nick-denry]: https://github.com/nick-denry
[@StefKors]: https://github.com/StefKors
[@felipefdl]: https://github.com/felipefdl
[@A-312]: https://github.com/A-312
[@dima-bzz]: https://github.com/dima-bzz
[@firm1]: https://github.com/firm1
[@Situphen]: https://github.com/Situphen
[@t49tran]: https://github.com/t49tran
[@richtera]: https://github.com/richtera
[@jfly]: https://github.com/jfly
[@sperezp]: https://github.com/sperezp
[@JeroenvO]: https://github.com/JeroenvO
[@sn3p]: https://github.com/sn3p
[@roryok]: https://github.com/roryok
[@ysykzheng]: https://github.com/ysykzheng
[@roipoussiere]: https://github.com/roipoussiere
[@FranklinWhale]: https://github.com/FranklinWhale
[@Furgas]: https://github.com/Furgas
[@adamb70]: https://github.com/adamb70
[@Summon528]: https://github.com/Summon528
[@LeviticusMB]: https://github.com/LeviticusMB
[@n-3-0]: https://github.com/n-3-0
[@aphitiel]: https://github.com/aphitiel
[@sne11ius]: https://github.com/sne11ius
[@souljuse]: https://github.com/souljuse
[@ukjinjang]: https://github.com/ukjinjang
[@robjean9]: https://github.com/robjean9
[@Offerel]: https://github.com/Offerel
[@Zignature]: https://github.com/Zignature
[@kelvinj]: https://github.com/kelvinj
[@diego-gw]: https://github.com/diego-gw
[@danielok1993]: https://github.com/danielok1993
[@vanillajonathan]: https://github.com/vanillajonathan
[@LevitatingOrange]: https://github.com/LevitatingOrange
[@LoyalPotato]: https://github.com/LoyalPotato
[@kicksent]: https://github.com/kicksent
[@hlf20010508]: https://github.com/hlf20010508
[@ZsgsDesign]: https://github.com/ZsgsDesign
[@sghoweri]: https://github.com/sghoweri
[@borodean]: https://github.com/borodean
[@robinvandernoord]: https://github.com/robinvandernoord
[@p1gp1g]: https://github.com/p1gp1g
[@mayraamaral]: https://github.com/mayraamaral
[@codingjoe]: https://github.com/codingjoe
<!-- Linked versions -->
[Unreleased]: https://github.com/Ionaru/easy-markdown-editor/compare/2.20.0...HEAD
[2.20.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.19.0...2.20.0
[2.19.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.18.0...2.19.0
[2.18.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.17.0...2.18.0
[2.17.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.16.1...2.17.0
[2.16.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.16.0...2.16.1
[2.16.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.15.0...2.16.0
[2.15.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.14.0...2.15.0
[2.14.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.13.0...2.14.0
[2.13.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.12.1...2.13.0
[2.12.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.12.0...2.12.1
[2.12.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.11.0...2.12.0
[2.11.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.10.1...2.11.0
[2.10.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.10.0...2.10.1
[2.10.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.9.0...2.10.0
[2.9.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.8.0...2.9.0
[2.8.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.7.0...2.8.0
[2.7.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.6.1...2.7.0
[2.6.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.6.0...2.6.1
[2.6.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.5.1...2.6.0
[2.5.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.5.0...2.5.1
[2.5.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.4.2...2.5.0
[2.4.2]: https://github.com/Ionaru/easy-markdown-editor/compare/2.4.1...2.4.2
[2.4.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.4.0...2.4.1
[2.4.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.2.2...2.4.0
[2.2.2]: https://github.com/Ionaru/easy-markdown-editor/compare/2.2.1...2.2.2
[2.2.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.0.1...2.2.1
[2.0.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/Ionaru/easy-markdown-editor/compare/1.11.2...2.0.0

44
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,44 @@
# Contributing
Thank you so much for your interest in contributing to EasyMDE!
## Asking questions, suggesting ideas or reporting bugs
You can [submit an issue](https://github.com/Ionaru/easy-markdown-editor/issues) on this GitHub repository.
## Coding
### 📦 Prerequisites
To contribute code to this project you'll need an up-to-date LTS or current version of Node.js and npm.
Please find information about the installation on [the official Node.js website](https://nodejs.org/en/download/).
### ⤴️ Workflow
Please make sure any code you submit is compliant and compatible with this repository's [license](./LICENSE).
#### Your first pull request
1. [Create a fork of this project](https://github.com/Ionaru/easy-markdown-editor/fork).
1. Clone your fork: `git clone https://github.com/YOUR_USERNAME/easy-markdown-editor.git`.
1. Add the original repository as remote to keep it up-to-date: `git remote add upstream https://github.com/Ionaru/easy-markdown-editor.git`.
1. Fetch the latest changes from upstream: `git fetch upstream`.
1. Run `npm ci` to install the required dependencies.
1. Create a new branch to work on: `git checkout -b MyNewFeatureName`.
1. Write your awesome improvement and commit your work.
1. Make sure your changes comply with the established code and tests succeed: `npm run test`.
1. Push your changes to GitHub: `git push origin`.
1. On GitHub, go to your forked branch, and click **New pull request**.
1. Choose the correct branches, add a description and submit your pull request!
#### Continuing development
To create more pull requests, please follow the steps below:
1. Go back to the master branch: `git checkout master`.
1. Fetch the upstream changes: `git fetch upstream`.
1. Update the master branch with upstream changes: `git merge upstream/master`.
1. Repeat ["Your first pull request"](#your-first-pull-request) from step 5.
Thank you! 💜

652
README.md
View File

@ -1,220 +1,326 @@
# EasyMDE is a fork of SimpleMDE
This repository is a fork of [SimpleMDE, made by Sparksuite](https://github.com/sparksuite/simplemde-markdown-editor/).
# EasyMDE - Markdown Editor
I originally made this fork to implement FontAwesome 5 compatibility into SimpleMDE. When that was done I submitted a [pull request](https://github.com/sparksuite/simplemde-markdown-editor/pull/666), which has not been accepted yet. This, and the project being inactive since May 2017, triggered me to make more changes and try to put new life into the project.
[![npm version](https://img.shields.io/npm/v/easymde.svg?style=for-the-badge)](https://www.npmjs.com/package/easymde)
[![npm @next version](https://img.shields.io/npm/v/easymde/next.svg?style=for-the-badge)](https://www.npmjs.com/package/easymde/v/next)
[![npm @v3-alpha version](https://img.shields.io/npm/v/easymde/v3-alpha.svg?style=for-the-badge)](https://www.npmjs.com/package/easymde/v/v3-alpha)
[![Build Status](https://img.shields.io/github/actions/workflow/status/ionaru/easy-markdown-editor/cd.yaml?branch=master&style=for-the-badge)](https://github.com/Ionaru/easy-markdown-editor/actions?query=branch%3Amaster)
Changes include:
* FontAwesome 5 compatibility
* Guide button works when editor is in preview mode
* Links are now `https://` by default
* Small styling changes
* Node 8 and Node 9 support
* Lots of refactored code
> This repository is a fork of
[SimpleMDE, made by Sparksuite](https://github.com/sparksuite/simplemde-markdown-editor/).
Go to the [dedicated section](#simplemde-fork) for more information.
My intention is to continue development on this project, improving it and keeping it alive.
A drop-in JavaScript text area replacement for writing beautiful and understandable Markdown.
EasyMDE allows users who may be less experienced with Markdown to use familiar toolbar buttons and shortcuts.
In addition, the syntax is rendered while editing to clearly show the expected result. Headings are larger, emphasized words are italicized, links are underlined, etc.
EasyMDE also features both built-in auto saving and spell checking.
The editor is entirely customizable, from theming to toolbar buttons and javascript hooks.
[**Try the demo**](https://stackblitz.com/edit/easymde/)
[![Preview](https://user-images.githubusercontent.com/3472373/51319377-26fe6e00-1a5d-11e9-8cc6-3137a566796d.png)](https://stackblitz.com/edit/easymde/)
## Quick access
- [EasyMDE - Markdown Editor](#easymde---markdown-editor)
- [Quick access](#quick-access)
- [Install EasyMDE](#install-easymde)
- [How to use](#how-to-use)
- [Loading the editor](#loading-the-editor)
- [Editor functions](#editor-functions)
- [Configuration](#configuration)
- [Options list](#options-list)
- [Options example](#options-example)
- [Toolbar icons](#toolbar-icons)
- [Toolbar customization](#toolbar-customization)
- [Keyboard shortcuts](#keyboard-shortcuts)
- [Advanced use](#advanced-use)
- [Event handling](#event-handling)
- [Removing EasyMDE from text area](#removing-easymde-from-text-area)
- [Useful methods](#useful-methods)
- [How it works](#how-it-works)
- [SimpleMDE fork](#simplemde-fork)
- [Hacking EasyMDE](#hacking-easymde)
- [Contributing](#contributing)
- [License](#license)
[![npm version](https://badge.fury.io/js/easymde.svg)](https://badge.fury.io/js/easymde)
[![Build Status](https://travis-ci.org/Ionaru/easy-markdown-editor.svg?branch=development)](https://travis-ci.org/Ionaru/easy-markdown-editor)
## Install EasyMDE
Via [npm](https://www.npmjs.com/package/easymde).
Via [npm](https://www.npmjs.com/package/easymde):
```
npm install easymde --save
npm install easymde
```
Below is the original [README](https://github.com/sparksuite/simplemde-markdown-editor/), rewrite for EasyMDE pending.
Via the *UNPKG* CDN:
# SimpleMDE - Markdown Editor
A drop-in JavaScript textarea replacement for writing beautiful and understandable Markdown. The WYSIWYG-esque editor allows users who may be less experienced with Markdown to use familiar toolbar buttons and shortcuts. In addition, the syntax is rendered while editing to clearly show the expected result. Headings are larger, emphasized words are italicized, links are underlined, etc. SimpleMDE is one of the first editors to feature both built-in autosaving and spell checking.
[**Demo**](https://simplemde.com)
[![Preview](http://i.imgur.com/zqWfJwO.png)](https://simplemde.com)
## Why not a WYSIWYG editor or pure Markdown?
WYSIWYG editors that produce HTML are often complex and buggy. Markdown solves this problem in many ways, plus Markdown can be rendered natively on more platforms than HTML. However, Markdown is not a syntax that an average user will be familiar with, nor is it visually clear while editing. In otherwords, for an unfamiliar user, the syntax they write will make little sense until they click the preview button. SimpleMDE has been designed to bridge this gap for non-technical users who are less familiar with or just learning Markdown syntax.
## Install
Via [npm](https://www.npmjs.com/package/simplemde).
```
npm install simplemde --save
```html
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
```
Via [jsDelivr](https://www.jsdelivr.com/).
```HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sparksuite/simplemde-markdown-editor@1/dist/simplemde.min.css">
<script src="https://cdn.jsdelivr.net/gh/sparksuite/simplemde-markdown-editor@1/dist/simplemde.min.js"></script>
Or *jsDelivr*:
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css">
<script src="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.js"></script>
```
## Quick start
## How to use
After installing, load SimpleMDE on the first textarea on a page
### Loading the editor
```HTML
After installing and/or importing the module, you can load EasyMDE onto the first `textarea` element on the web page:
```html
<textarea></textarea>
<script>
var simplemde = new SimpleMDE();
const easyMDE = new EasyMDE();
</script>
```
#### Using a specific textarea
Alternatively you can select a specific `textarea`, via JavaScript:
Pure JavaScript method
```HTML
```html
<textarea id="my-text-area"></textarea>
<script>
var simplemde = new SimpleMDE({ element: document.getElementById("MyID") });
const easyMDE = new EasyMDE({element: document.getElementById('my-text-area')});
</script>
```
jQuery method
### Editor functions
```HTML
Use `easyMDE.value()` to get the content of the editor:
```html
<script>
var simplemde = new SimpleMDE({ element: $("#MyID")[0] });
easyMDE.value();
</script>
```
## Get/set the content
Use `easyMDE.value(val)` to set the content of the editor:
```JavaScript
simplemde.value();
```html
<script>
easyMDE.value('New input for **EasyMDE**');
</script>
```
```JavaScript
simplemde.value("This text will appear in the editor");
```
## Configuration
### Options list
- **autoDownloadFontAwesome**: If set to `true`, force downloads Font Awesome (used for icons). If set to `false`, prevents downloading. Defaults to `undefined`, which will intelligently check whether Font Awesome has already been included, then download accordingly.
- **autofocus**: If set to `true`, autofocuses the editor. Defaults to `false`.
- **autofocus**: If set to `true`, focuses the editor automatically. Defaults to `false`.
- **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`, autosave the text. Defaults to `false`.
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
- **uniqueId**: You must set a unique string identifier so that SimpleMDE can autosave. Something that separates this from other instances of SimpleMDE elsewhere on your website.
- **enabled**: If set to `true`, saves the text automatically. Defaults to `false`.
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10 seconds).
- **submit_delay**: Delay before assuming that submit of the form failed and saving the text, in milliseconds. Defaults to `autosave.delay` or `10000` (10 seconds).
- **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 ```` ``` ````.
- **italic**: Can be set to `*` or `_`. Defaults to `*`.
- **element**: The DOM element for the textarea to use. Defaults to the first textarea on the page.
- **forceSync**: If set to `true`, force text changes made in SimpleMDE to be immediately stored in original textarea. Defaults to `false`.
- **unorderedListStyle**: can be `*`, `-` or `+`. Defaults to `*`.
- **scrollbarStyle**: Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models.
- **element**: The DOM element for the `textarea` element to use. Defaults to the first `textarea` element on the page.
- **forceSync**: If set to `true`, force text changes made in EasyMDE to be immediately stored in original text area. Defaults to `false`.
- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
- **indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
- **initialValue**: If set, will customize the initial value of the editor.
- **previewImagesInEditor**: - EasyMDE will show preview of images, `false` by default, preview for images will appear only for images on separate lines.
- **imagesPreviewHandler**: - A custom function for handling the preview of images. Takes the parsed string between the parantheses of the image markdown `![]( )` as argument and returns a string that serves as the `src` attribute of the `<img>` tag in the preview. Enables dynamic previewing of images in the frontend without having to upload them to a server, allows copy-pasting of images to the editor with preview.
- **insertTexts**: Customize how certain buttons that insert text behave. Takes an array with two elements. The first element will be the text inserted before the cursor or highlight, and the second element will be inserted after. For example, this is the default link value: `["[", "](http://)"]`.
- horizontalRule
- image
- link
- table
- **lineNumbers**: If set to `true`, enables line numbers in the editor.
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
- **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"`. Dafaults to `"300px"`.
- **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"`.
- **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`.
- **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`.
- **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
- **strikethrough**: If set to `false`, will not process GFM strikethrough syntax. Defaults to `true`.
- **underscoresBreakWords**: If set to `true`, let underscores be a delimiter for separating words. Defaults to `false`.
- **overlayMode**: Pass a custom codemirror [overlay mode](https://codemirror.net/doc/manual.html#modeapi) to parse and style the Markdown during editing.
- **mode**: A codemirror mode object.
- **combine**: If set to `false`, will *replace* CSS classes returned by the default Markdown mode. Otherwise the classes returned by the custom mode will be combined with the classes returned by the default mode. Defaults to `true`.
- **placeholder**: If set, displays a custom placeholder message.
- **previewClass**: A string or array of strings that will be applied to the preview screen when activated. Defaults to `"editor-preview"`.
- **previewRender**: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
- **promptURLs**: If set to `true`, a JS alert window appears asking for the link or image URL. Defaults to `false`.
- **promptTexts**: Customize the text used to prompt for URLs.
- **image**: The text to use when prompting for an image's URL. Defaults to `URL of the image:`.
- **link**: The text to use when prompting for a link's URL. Defaults to `URL for the link:`.
- **iconClassMap**: Used to specify the icon class names for the various toolbar buttons.
- **uploadImage**: If set to `true`, enables the image upload functionality, which can be triggered by drag and drop, copy-paste and through the browse-file window (opened when the user click on the *upload-image* icon). Defaults to `false`.
- **imageMaxSize**: Maximum image size in bytes, checked before upload (note: never trust client, always check the image size at server-side). Defaults to `1024 * 1024 * 2` (2 MB).
- **imageAccept**: A comma-separated list of mime-types used to check image type before upload (note: never trust client, always check file types at server-side). Defaults to `image/png, image/jpeg`.
- **imageUploadFunction**: A custom function for handling the image upload. Using this function will render the options `imageMaxSize`, `imageAccept`, `imageUploadEndpoint` and `imageCSRFToken` ineffective.
- The function gets a file and `onSuccess` and `onError` callback functions as parameters. `onSuccess(imageUrl: string)` and `onError(errorMessage: string)`
- **imageUploadEndpoint**: The endpoint where the images data will be sent, via an asynchronous *POST* request. The server is supposed to save this image, and return a JSON response.
- if the request was successfully processed (HTTP 200 OK): `{"data": {"filePath": "<filePath>"}}` where *filePath* is the path of the image (absolute if `imagePathAbsolute` is set to true, relative if otherwise);
- otherwise: `{"error": "<errorCode>"}`, where *errorCode* can be `noFileGiven` (HTTP 400 Bad Request), `typeNotAllowed` (HTTP 415 Unsupported Media Type), `fileTooLarge` (HTTP 413 Payload Too Large) or `importError` (see *errorMessages* below). If *errorCode* is not one of the *errorMessages*, it is alerted unchanged to the user. This allows for server-side error messages.
No default value.
- **imagePathAbsolute**: If set to `true`, will treat `imageUrl` from `imageUploadFunction` and *filePath* returned from `imageUploadEndpoint` as an absolute rather than relative path, i.e. not prepend `window.location.origin` to it.
- **imageCSRFToken**: CSRF token to include with AJAX call to upload image. For various instances like Django, Spring and Laravel.
- **imageCSRFName**: CSRF token filed name to include with AJAX call to upload image, applied when `imageCSRFToken` has value, defaults to `csrfmiddlewaretoken`.
- **imageCSRFHeader**: If set to `true`, passing CSRF token via header. Defaults to `false`, which pass CSRF through request body.
- **imageTexts**: Texts displayed to the user (mainly on the status bar) for the import image feature, where `#image_name#`, `#image_size#` and `#image_max_size#` will replaced by their respective values, that can be used for customization or internationalization:
- **sbInit**: Status message displayed initially if `uploadImage` is set to `true`. Defaults to `Attach files by drag and dropping or pasting from clipboard.`.
- **sbOnDragEnter**: Status message displayed when the user drags a file to the text area. Defaults to `Drop image to upload it.`.
- **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` (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.`.
- **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#.`.
- **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).
- **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>`<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<link rel="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`.
- **markedOptions**: Set the internal Markdown renderer's [options](https://github.com/chjj/marked#options-1). Other `renderingConfig` options will take precedence.
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
- **markedOptions**: Set the internal Markdown renderer's [options](https://marked.js.org/#/USING_ADVANCED.md#options). Other `renderingConfig` options will take precedence.
- **singleLineBreaks**: If set to `false`, disable parsing [GitHub Flavored Markdown](https://github.github.com/gfm/) (GFM) single line breaks. Defaults to `true`.
- **sanitizerFunction**: Custom function for sanitizing the HTML output of Markdown renderer.
- **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
- **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`. Optionally pass a CodeMirrorSpellChecker-compliant function.
- **inputStyle**: `textarea` or `contenteditable`. Defaults to `textarea` for desktop and `contenteditable` for mobile. `contenteditable` option is necessary to enable nativeSpellcheck.
- **nativeSpellcheck**: If set to `false`, disable native spell checker. Defaults to `true`.
- **sideBySideFullscreen**: If set to `false`, allows side-by-side editing without going into fullscreen. Defaults to `true`.
- **status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items.
- 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.
- **styleSelectedText**: If set to `false`, remove the `CodeMirror-selectedtext` class from selected lines. Defaults to `true`.
- **syncSideBySidePreviewScroll**: If set to `false`, disable syncing scroll in side by side mode. Defaults to `true`.
- **tabSize**: If set, customize the tab size. Defaults to `2`.
- **theme**: Override the theme. Defaults to `easymde`.
- **toolbar**: If set to `false`, hide the toolbar. Defaults to the [array of icons](#toolbar-icons).
- **toolbarTips**: If set to `false`, disable toolbar button tips. Defaults to `true`.
- **toolbarButtonClassPrefix**: Adds a prefix to the toolbar button classes when set. For example, a value of `"mde"` results in `"mde-bold"` for the Bold button.
- **direction**: `rtl` or `ltr`. Changes text direction to support right-to-left languages. Defaults to `ltr`.
```JavaScript
// Most options demonstrate the non-default behavior
var simplemde = new SimpleMDE({
autofocus: true,
autosave: {
enabled: true,
uniqueId: "MyUniqueID",
delay: 1000,
},
blockStyles: {
bold: "__",
italic: "_"
},
element: document.getElementById("MyID"),
forceSync: true,
hideIcons: ["guide", "heading"],
indentWithTabs: false,
initialValue: "Hello world!",
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
link: ["[", "](http://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
lineWrapping: false,
minHeight: "500px",
parsingConfig: {
allowAtxHeaderWithoutSpace: true,
strikethrough: false,
underscoresBreakWords: true,
},
placeholder: "Type here...",
previewRender: function(plainText) {
return customMarkdownParser(plainText); // Returns HTML from a custom parser
},
previewRender: function(plainText, preview) { // Async method
setTimeout(function(){
preview.innerHTML = customMarkdownParser(plainText);
}, 250);
return "Loading...";
},
promptURLs: true,
promptTexts: {
image: "Custom prompt for URL:",
link: "Custom prompt for URL:",
},
renderingConfig: {
singleLineBreaks: false,
codeSyntaxHighlighting: true,
},
shortcuts: {
drawTable: "Cmd-Alt-T"
},
showIcons: ["code", "table"],
spellChecker: false,
status: false,
status: ["autosave", "lines", "words", "cursor"], // Optional usage
status: ["autosave", "lines", "words", "cursor", {
className: "keystrokes",
defaultValue: function(el) {
this.keystrokes = 0;
el.innerHTML = "0 Keystrokes";
},
onUpdate: function(el) {
el.innerHTML = ++this.keystrokes + " Keystrokes";
}
}], // Another optional usage, with a custom status bar item that counts keystrokes
styleSelectedText: false,
syncSideBySidePreviewScroll: false,
tabSize: 4,
toolbar: false,
toolbarTips: false,
### Options example
Most options demonstrate the non-default behavior:
```js
const editor = new EasyMDE({
autofocus: true,
autosave: {
enabled: true,
uniqueId: "MyUniqueID",
delay: 1000,
submit_delay: 5000,
timeFormat: {
locale: 'en-US',
format: {
year: 'numeric',
month: 'long',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
},
},
text: "Autosaved: "
},
blockStyles: {
bold: "__",
italic: "_",
},
unorderedListStyle: "-",
element: document.getElementById("MyID"),
forceSync: true,
hideIcons: ["guide", "heading"],
indentWithTabs: false,
initialValue: "Hello world!",
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
link: ["[", "](https://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
lineWrapping: false,
minHeight: "500px",
parsingConfig: {
allowAtxHeaderWithoutSpace: true,
strikethrough: false,
underscoresBreakWords: true,
},
placeholder: "Type here...",
previewClass: "my-custom-styling",
previewClass: ["my-custom-styling", "more-custom-styling"],
previewRender: (plainText) => customMarkdownParser(plainText), // Returns HTML from a custom parser
previewRender: (plainText, preview) => { // Async method
setTimeout(() => {
preview.innerHTML = customMarkdownParser(plainText);
}, 250);
// If you return null, the innerHTML of the preview will not
// be overwritten. Useful if you control the preview node's content via
// vdom diffing.
// return null;
return "Loading...";
},
promptURLs: true,
promptTexts: {
image: "Custom prompt for URL:",
link: "Custom prompt for URL:",
},
renderingConfig: {
singleLineBreaks: false,
codeSyntaxHighlighting: true,
sanitizerFunction: (renderedHTML) => {
// Using DOMPurify and only allowing <b> tags
return DOMPurify.sanitize(renderedHTML, {ALLOWED_TAGS: ['b']})
},
},
shortcuts: {
drawTable: "Cmd-Alt-T"
},
showIcons: ["code", "table"],
spellChecker: false,
status: false,
status: ["autosave", "lines", "words", "cursor"], // Optional usage
status: ["autosave", "lines", "words", "cursor", {
className: "keystrokes",
defaultValue: (el) => {
el.setAttribute('data-keystrokes', 0);
},
onUpdate: (el) => {
const keystrokes = Number(el.getAttribute('data-keystrokes')) + 1;
el.innerHTML = `${keystrokes} Keystrokes`;
el.setAttribute('data-keystrokes', keystrokes);
},
}], // Another optional usage, with a custom status bar item that counts keystrokes
styleSelectedText: false,
sideBySideFullscreen: false,
syncSideBySidePreviewScroll: false,
tabSize: 4,
toolbar: false,
toolbarTips: false,
toolbarButtonClassPrefix: "mde",
});
```
#### Toolbar icons
Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. "Name" is the name of the icon, referenced in the JS. "Action" is either a function or a URL to open. "Class" is the class given to the icon. "Tooltip" is the small tooltip that appears via the `title=""` attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a keybind assigned to it (i.e. with the value of `action` set to `bold` and that of `tooltip` set to `Bold`, the final text the user will see would be "Bold (Ctrl-B)").
### Toolbar icons
Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. "Name" is the name of the icon, referenced in the JavaScript. "Action" is either a function or a URL to open. "Class" is the class given to the icon. "Tooltip" is the small tooltip that appears via the `title=""` attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a key bind assigned to it (i.e. with the value of `action` set to `bold` and that of `tooltip` set to `Bold`, the final text the user will see would be "Bold (Ctrl-B)").
Additionally, you can add a separator between any icons by adding `"|"` to the toolbar array.
@ -226,83 +332,147 @@ strikethrough | toggleStrikethrough | Strikethrough<br>fa fa-strikethrough
heading | toggleHeadingSmaller | Heading<br>fa fa-header
heading-smaller | toggleHeadingSmaller | Smaller Heading<br>fa fa-header
heading-bigger | toggleHeadingBigger | Bigger Heading<br>fa fa-lg fa-header
heading-1 | toggleHeading1 | Big Heading<br>fa fa-header fa-header-x fa-header-1
heading-2 | toggleHeading2 | Medium Heading<br>fa fa-header fa-header-x fa-header-2
heading-3 | toggleHeading3 | Small Heading<br>fa fa-header fa-header-x fa-header-3
heading-1 | toggleHeading1 | Big Heading<br>fa fa-header header-1
heading-2 | toggleHeading2 | Medium Heading<br>fa fa-header header-2
heading-3 | toggleHeading3 | Small Heading<br>fa fa-header header-3
code | toggleCodeBlock | Code<br>fa fa-code
quote | toggleBlockquote | Quote<br>fa fa-quote-left
unordered-list | toggleUnorderedList | Generic List<br>fa fa-list-ul
ordered-list | toggleOrderedList | Numbered List<br>fa fa-list-ol
clean-block | cleanBlock | Clean block<br>fa fa-eraser fa-clean-block
clean-block | cleanBlock | Clean block<br>fa fa-eraser
link | drawLink | Create Link<br>fa fa-link
image | drawImage | Insert Image<br>fa fa-picture-o
upload-image | drawUploadedImage | Raise browse-file window<br>fa fa-image
table | drawTable | Insert Table<br>fa fa-table
horizontal-rule | drawHorizontalRule | Insert Horizontal Line<br>fa fa-minus
preview | togglePreview | Toggle Preview<br>fa fa-eye no-disable
side-by-side | toggleSideBySide | Toggle Side by Side<br>fa fa-columns no-disable no-mobile
fullscreen | toggleFullScreen | Toggle Fullscreen<br>fa fa-arrows-alt no-disable no-mobile
guide | [This link](https://simplemde.com/markdown-guide) | Markdown Guide<br>fa fa-question-circle
guide | [This link](https://www.markdownguide.org/basic-syntax/) | Markdown Guide<br>fa fa-question-circle
undo | undo | Undo<br>fa fa-undo
redo | redo | Redo<br>fa fa-redo
Customize the toolbar using the `toolbar` option like:
```JavaScript
// Customize only the order of existing buttons
var simplemde = new SimpleMDE({
toolbar: ["bold", "italic", "heading", "|", "quote"],
});
### Toolbar customization
// Customize all information and/or add your own icons
var simplemde = new SimpleMDE({
toolbar: [{
name: "bold",
action: SimpleMDE.toggleBold,
className: "fa fa-bold",
title: "Bold",
},
{
name: "custom",
action: function customFunction(editor){
// Add your own code
},
className: "fa fa-star",
title: "Custom Button",
},
"|", // Separator
...
],
Customize the toolbar using the `toolbar` option.
Only the order of existing buttons:
```js
const easyMDE = new EasyMDE({
toolbar: ["bold", "italic", "heading", "|", "quote"]
});
```
#### Keyboard shortcuts
All information and/or add your own icons or text
SimpleMDE comes with an array of predefined keyboard shortcuts, but they can be altered with a configuration option. The list of default ones is as follows:
```js
const easyMDE = new EasyMDE({
toolbar: [
{
name: "bold",
action: EasyMDE.toggleBold,
className: "fa fa-bold",
title: "Bold",
},
"italic", // shortcut to pre-made button
{
name: "custom",
action: (editor) => {
// Add your own code
},
className: "fa fa-star",
text: "Starred",
title: "Custom Button",
attributes: { // for custom attributes
id: "custom-id",
"data-value": "custom value" // HTML5 data-* attributes need to be enclosed in quotation marks ("") because of the dash (-) in its name.
}
},
"|" // Separator
// [, ...]
]
});
```
Shortcut | Action
:------- | :-----
*Cmd-'* | "toggleBlockquote"
*Cmd-B* | "toggleBold"
*Cmd-E* | "cleanBlock"
*Cmd-H* | "toggleHeadingSmaller"
*Cmd-I* | "toggleItalic"
*Cmd-K* | "drawLink"
*Cmd-L* | "toggleUnorderedList"
*Cmd-P* | "togglePreview"
*Cmd-Alt-C* | "toggleCodeBlock"
*Cmd-Alt-I* | "drawImage"
*Cmd-Alt-L* | "toggleOrderedList"
*Shift-Cmd-H* | "toggleHeadingBigger"
*F9* | "toggleSideBySide"
*F11* | "toggleFullScreen"
Put some buttons on dropdown menu
```js
const easyMDE = new EasyMDE({
toolbar: [{
name: "heading",
action: EasyMDE.toggleHeadingSmaller,
className: "fa fa-header",
title: "Headers",
},
"|",
{
name: "others",
className: "fa fa-blind",
title: "others buttons",
children: [
{
name: "image",
action: EasyMDE.drawImage,
className: "fa fa-picture-o",
title: "Image",
},
{
name: "quote",
action: EasyMDE.toggleBlockquote,
className: "fa fa-percent",
title: "Quote",
},
{
name: "link",
action: EasyMDE.drawLink,
className: "fa fa-link",
title: "Link",
}
]
},
// [, ...]
]
});
```
### Keyboard shortcuts
EasyMDE comes with an array of predefined keyboard shortcuts, but they can be altered with a configuration option. The list of default ones is as follows:
Shortcut (Windows / Linux) | Shortcut (macOS) | Action
:--- | :--- | :---
<kbd>Ctrl</kbd>-<kbd>'</kbd> | <kbd>Cmd</kbd>-<kbd>'</kbd> | "toggleBlockquote"
<kbd>Ctrl</kbd>-<kbd>B</kbd> | <kbd>Cmd</kbd>-<kbd>B</kbd> | "toggleBold"
<kbd>Ctrl</kbd>-<kbd>E</kbd> | <kbd>Cmd</kbd>-<kbd>E</kbd> | "cleanBlock"
<kbd>Ctrl</kbd>-<kbd>H</kbd> | <kbd>Cmd</kbd>-<kbd>H</kbd> | "toggleHeadingSmaller"
<kbd>Ctrl</kbd>-<kbd>I</kbd> | <kbd>Cmd</kbd>-<kbd>I</kbd> | "toggleItalic"
<kbd>Ctrl</kbd>-<kbd>K</kbd> | <kbd>Cmd</kbd>-<kbd>K</kbd> | "drawLink"
<kbd>Ctrl</kbd>-<kbd>L</kbd> | <kbd>Cmd</kbd>-<kbd>L</kbd> | "toggleUnorderedList"
<kbd>Ctrl</kbd>-<kbd>P</kbd> | <kbd>Cmd</kbd>-<kbd>P</kbd> | "togglePreview"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>C</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>C</kbd> | "toggleCodeBlock"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>I</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>I</kbd> | "drawImage"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>L</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>L</kbd> | "toggleOrderedList"
<kbd>Shift</kbd>-<kbd>Ctrl</kbd>-<kbd>H</kbd> | <kbd>Shift</kbd>-<kbd>Cmd</kbd>-<kbd>H</kbd> | "toggleHeadingBigger"
<kbd>F9</kbd> | <kbd>F9</kbd> | "toggleSideBySide"
<kbd>F11</kbd> | <kbd>F11</kbd> | "toggleFullScreen"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>1</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>1</kbd> | "toggleHeading1"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>2</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>2</kbd> | "toggleHeading2"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>3</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>3</kbd> | "toggleHeading3"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>4</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>4</kbd> | "toggleHeading4"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>5</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>5</kbd> | "toggleHeading5"
<kbd>Ctrl</kbd>-<kbd>Alt</kbd>-<kbd>6</kbd> | <kbd>Cmd</kbd>-<kbd>Alt</kbd>-<kbd>6</kbd> | "toggleHeading6"
Here is how you can change a few, while leaving others untouched:
```JavaScript
var simplemde = new SimpleMDE({
shortcuts: {
"toggleOrderedList": "Ctrl-Alt-K", // alter the shortcut for toggleOrderedList
"toggleCodeBlock": null, // unbind Ctrl-Alt-C
"drawTable": "Cmd-Alt-T" // bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
}
```js
const editor = new EasyMDE({
shortcuts: {
"toggleOrderedList": "Ctrl-Alt-K", // alter the shortcut for toggleOrderedList
"toggleCodeBlock": null, // unbind Ctrl-Alt-C
"drawTable": "Cmd-Alt-T", // bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
}
});
```
@ -310,38 +480,92 @@ Shortcuts are automatically converted between platforms. If you define a shortcu
The list of actions that can be bound is the same as the list of built-in actions available for [toolbar buttons](#toolbar-icons).
## Event handling
## Advanced use
### Event handling
You can catch the following list of events: https://codemirror.net/doc/manual.html#events
```JavaScript
var simplemde = new SimpleMDE();
simplemde.codemirror.on("change", function(){
console.log(simplemde.value());
```js
const easyMDE = new EasyMDE();
easyMDE.codemirror.on("change", () => {
console.log(easyMDE.value());
});
```
## Removing SimpleMDE from textarea
You can revert to the initial textarea by calling the `toTextArea` method. Note that this clears up the autosave (if enabled) associated with it. The textarea will retain any text from the destroyed SimpleMDE instance.
```JavaScript
var simplemde = new SimpleMDE();
...
simplemde.toTextArea();
simplemde = null;
```
### Removing EasyMDE from text area
## Useful methods
The following self-explanatory methods may be of use while developing with SimpleMDE.
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.
```js
var simplemde = new SimpleMDE();
simplemde.isPreviewActive(); // returns boolean
simplemde.isSideBySideActive(); // returns boolean
simplemde.isFullscreenActive(); // returns boolean
simplemde.clearAutosavedValue(); // no returned value
const easyMDE = new EasyMDE();
// ...
easyMDE.toTextArea();
easyMDE = null;
```
If you need to remove registered event listeners (when the editor is not needed anymore), call `easyMDE.cleanup()`.
### Useful methods
The following self-explanatory methods may be of use while developing with EasyMDE.
```js
const easyMDE = new EasyMDE();
easyMDE.isPreviewActive(); // returns boolean
easyMDE.isSideBySideActive(); // returns boolean
easyMDE.isFullscreenActive(); // returns boolean
easyMDE.clearAutosavedValue(); // no returned value
```
## How it works
EasyMDE is a continuation of SimpleMDE.
SimpleMDE began as an improvement of [lepture's Editor project](https://github.com/lepture/editor), but has now taken on an identity of its own. It is bundled with [CodeMirror](https://github.com/codemirror/codemirror) and depends on [Font Awesome](http://fontawesome.io).
CodeMirror is the backbone of the project and parses much of the Markdown syntax as it's being written. This allows us to add styles to the Markdown that's being written. Additionally, a toolbar and status bar have been added to the top and bottom, respectively. Previews are rendered by [Marked](https://github.com/chjj/marked) using GFM.
CodeMirror is the backbone of the project and parses much of the Markdown syntax as it's being written. This allows us to add styles to the Markdown that's being written. Additionally, a toolbar and status bar have been added to the top and bottom, respectively. Previews are rendered by [Marked](https://github.com/chjj/marked) using GitHub Flavored Markdown (GFM).
## SimpleMDE fork
I originally made this fork to implement FontAwesome 5 compatibility into SimpleMDE. When that was done I submitted a [pull request](https://github.com/sparksuite/simplemde-markdown-editor/pull/666), which has not been accepted yet. This, and the project being inactive since May 2017, triggered me to make more changes and try to put new life into the project.
Changes include:
* FontAwesome 5 compatibility
* Guide button works when editor is in preview mode
* Links are now `https://` by default
* Small styling changes
* Support for Node 8 and beyond
* Lots of refactored code
* Links in preview will open in a new tab by default
* TypeScript support
My intention is to continue development on this project, improving it and keeping it alive.
## Hacking EasyMDE
You may want to edit this library to adapt its behavior to your needs. This can be done in some quick steps:
1. Follow the [prerequisites](./CONTRIBUTING.md#prerequisites) and [installation](./CONTRIBUTING.md#installation) instructions in the contribution guide;
2. Do your changes;
3. Run `gulp` command, which will generate files: `dist/easymde.min.css` and `dist/easymde.min.js`;
4. Copy-paste those files to your code base, and you are done.
## Contributing
Want to contribute to EasyMDE? Thank you! We have a [contribution guide](./CONTRIBUTING.md) just for you!
## License
This project is released under the [MIT License](./LICENSE).
- Copyright (c) 2015 Sparksuite, Inc.
- Copyright (c) 2017 Jeroen Akkerman.

10
cypress.config.ts Normal file
View File

@ -0,0 +1,10 @@
import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
excludeSpecPattern: [
'**/*.html',
],
video: true,
},
});

14
cypress/.eslintrc Normal file
View File

@ -0,0 +1,14 @@
{
"plugins": [
"cypress"
],
"env": {
"node": true,
"es6": true,
"cypress/globals": true
},
"extends": [
"../.eslintrc",
"plugin:cypress/recommended"
]
}

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default</title>
<link rel="stylesheet" href="../../../dist/easymde.min.css">
<script src="../../../dist/easymde.min.js"></script>
</head>
<body>
<textarea id="textarea"></textarea>
<script>
const easyMDE = new EasyMDE();
</script>
</body>
</html>

View File

@ -0,0 +1,31 @@
/// <reference types="cypress" />
describe('Preview', () => {
beforeEach(() => {
cy.visit(__dirname + '/index.html');
});
it('can show a preview of markdown text', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('.EasyMDEContainer .editor-preview').should('not.be.visible');
// Enter markdown text.
cy.get('.EasyMDEContainer .CodeMirror').type('# My Big Title');
cy.get('.EasyMDEContainer .CodeMirror').type('{enter}');
cy.get('.EasyMDEContainer .CodeMirror').type('This is some **important** text!');
cy.get('.EasyMDEContainer .CodeMirror-line').should('contain', '# My Big Title');
cy.get('.EasyMDEContainer .cm-header.cm-header-1').should('contain', '#');
cy.get('.EasyMDEContainer .cm-header.cm-header-1').should('contain', 'My Big Title');
cy.get('.EasyMDEContainer .CodeMirror-line').should('contain', 'This is some **important** text!');
cy.get('.EasyMDEContainer .cm-strong').should('contain', '**');
cy.get('.EasyMDEContainer .cm-strong').should('contain', 'important');
cy.previewOn();
// Check preview window for rendered markdown.
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<h1 id="my-big-title">My Big Title</h1>');
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p>This is some <strong>important</strong> text!</p>');
});
});

View File

@ -0,0 +1,56 @@
/// <reference types="cypress" />
describe('Default statusbar', () => {
beforeEach(() => {
cy.visit(__dirname + '/index.html');
});
it('loads the editor with default statusbar', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('.EasyMDEContainer .editor-statusbar').should('be.visible');
cy.get('.EasyMDEContainer .editor-statusbar .autosave').should('be.empty');
cy.get('.EasyMDEContainer .editor-statusbar .lines').before('content').should('contain', 'lines: ');
cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '1');
cy.get('.EasyMDEContainer .editor-statusbar .words').before('content').should('contain', 'words: ');
cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '0');
cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '1:1');
});
it('updates the statusbar when typing', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('.EasyMDEContainer .editor-statusbar').should('be.visible');
cy.get('.EasyMDEContainer .CodeMirror').type('Hello');
cy.get('.EasyMDEContainer .editor-statusbar .autosave').should('be.empty');
cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '1');
cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '1');
cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '1:6');
cy.get('.EasyMDEContainer .CodeMirror').type(' World');
cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '1');
cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '2');
cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '1:12');
cy.get('.EasyMDEContainer .CodeMirror').type('{enter}');
cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '2');
cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '2');
cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '2:1');
cy.get('.EasyMDEContainer .CodeMirror').type('This is a sample text.{enter}We\'re testing the statusbar.{enter}Did it work?');
cy.get('.EasyMDEContainer .editor-statusbar .autosave').should('be.empty');
cy.get('.EasyMDEContainer .editor-statusbar .lines').before('content').should('contain', 'lines: ');
cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '4');
cy.get('.EasyMDEContainer .editor-statusbar .words').before('content').should('contain', 'words: ');
cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '15');
cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '4:13');
});
});

View File

@ -0,0 +1,17 @@
/// <reference types="cypress" />
describe('Default editor', () => {
beforeEach(() => {
cy.visit(__dirname + '/index.html');
});
it('loads the editor with default settings', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.get('.EasyMDEContainer .editor-toolbar').should('be.visible');
cy.get('.EasyMDEContainer .CodeMirror').should('be.visible');
cy.get('.EasyMDEContainer .editor-preview').should('not.be.visible');
cy.get('.EasyMDEContainer .editor-statusbar').should('be.visible');
});
});

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default</title>
<link rel="stylesheet" href="../../../dist/easymde.min.css">
<script src="../../../dist/easymde.min.js"></script>
</head>
<body>
<textarea id="textarea"></textarea>
<script>
const easyMDE = new EasyMDE({
promptURLs: true,
});
</script>
</body>
</html>

View File

@ -0,0 +1,232 @@
/// <reference types="cypress" />
describe('URL prompts', () => {
beforeEach(() => {
cy.visit(__dirname + '/index.html');
});
it('must show the correct text for a link prompt', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
const stub = cy.stub($win, 'prompt');
cy.get('button.link').click();
cy.get('button.link').then(() => {
expect(stub).to.be.calledWith('URL for the link:', 'https://');
});
});
});
it('must show the correct text for an image prompt', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
const stub = cy.stub($win, 'prompt');
cy.get('button.image').click();
cy.get('button.image').then(() => {
expect(stub).to.be.calledWith('URL of the image:', 'https://');
});
});
});
it('must enter a link correctly through a prompt', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com" target="_blank">Link to a website!</a></p>');
});
it('can use the prompt multiple times', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
const stub = cy.stub($win, 'prompt');
stub.returns('https://example.com');
cy.get('button.link').click();
cy.get('button.link').then(() => {
expect(stub).to.be.calledWith('URL for the link:', 'https://');
stub.restore();
});
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!{end}{enter}');
cy.window().then(($win) => {
const stub = cy.stub($win, 'prompt');
stub.returns('https://example.eu');
cy.get('button.link').click();
cy.get('button.link').then(() => {
expect(stub).to.be.calledWith('URL for the link:', 'https://');
stub.restore();
});
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.eu)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a second website!');
cy.get('.EasyMDEContainer .CodeMirror').contains('[Link to a website!](https://example.com)');
cy.get('.EasyMDEContainer .CodeMirror').contains('[Link to a second website!](https://example.eu)');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should(
'contain.html',
'<p><a href="https://example.com" target="_blank">Link to a website!</a><br><a href="https://example.eu" target="_blank">Link to a second website!</a></p>',
);
});
it('must be able to deal with parameters in links', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=param&moo=cow');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=param&moo=cow)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=param&amp;moo=cow" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with brackets in links', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=[]param');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=%5B%5Dparam)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=%5B%5Dparam" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with parentheses in links', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=(param)');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=\\(param\\))');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=(param)" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with parentheses in links (multiple)', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=(param1,param2)&more=(param3,param4)&end=true');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=\\(param1,param2\\)&more=\\(param3,param4\\)&end=true)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=(param1,param2)&amp;more=(param3,param4)&amp;end=true" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with unbalanced parentheses in links (opening)', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=(param');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=\\(param)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=(param" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with unbalanced parentheses in links (closing)', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=)param');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=\\)param)');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=)param" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with inequality symbols in links', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=<param');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=%3Cparam');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=%3Cparam" target="_blank">Link to a website!</a></p>');
});
it('must be able to deal with emoji in links', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=👷‍♂️');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=%F0%9F%91%B7%E2%80%8D%E2%99%82%EF%B8%8F');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a 👌 website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=%F0%9F%91%B7%E2%80%8D%E2%99%82%EF%B8%8F" target="_blank">Link to a 👌 website!</a></p>');
});
it('must be able to deal with spaces in links', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns('https://example.com?some=very special param');
cy.get('button.link').click();
});
cy.get('.EasyMDEContainer .CodeMirror').contains('[](https://example.com?some=very%20special%20param');
cy.get('.EasyMDEContainer .CodeMirror').type('{home}{rightarrow}Link to a website!');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<p><a href="https://example.com?some=very%20special%20param" target="_blank">Link to a website!</a></p>');
});
});

View File

@ -0,0 +1,17 @@
/// <reference types="cypress" />
describe('Default editor', () => {
it('table', () => {
cy.visit(__dirname + '/index-no-prefix.html');
cy.get('button.table').should('be.visible');
cy.get('button.table').invoke('outerWidth').should('not.equal', 30);
});
it('loads the editor with default settings', () => {
cy.visit(__dirname + '/index.html');
cy.get('button.mde-table').should('be.visible');
cy.get('button.mde-table').invoke('outerWidth').should('equal', 30);
});
});

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="../../../dist/easymde.min.css">
<script src="../../../dist/easymde.min.js"></script>
</head>
<body>
<textarea id="textarea"></textarea>
<script>
const easyMDE = new EasyMDE({
showIcons: ["table"],
});
</script>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="../../../dist/easymde.min.css">
<script src="../../../dist/easymde.min.js"></script>
</head>
<body>
<textarea id="textarea"></textarea>
<script>
const easyMDE = new EasyMDE({
toolbarButtonClassPrefix: 'mde',
showIcons: ["table"],
});
</script>
</body>
</html>

View File

@ -0,0 +1,43 @@
/// <reference types="cypress" />
describe('Image rendering', () => {
const imageUrl = 'https://picsum.photos/id/237/150';
beforeEach(() => {
cy.visit(__dirname + '/index.html');
cy.intercept('GET', imageUrl).as('image');
});
it('must render an image inside the editor', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.get('.EasyMDEContainer .CodeMirror').type(imageUrl);
cy.get('.EasyMDEContainer .CodeMirror').type('{home}![Dog!]({end})');
cy.wait('@image');
cy.get(`.EasyMDEContainer [data-img-src="${imageUrl}"]`).should('be.visible');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', `<p><img src="${imageUrl}" alt="Dog!"></p>`);
});
it('must be able to handle parentheses inside image alt text', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.get('.EasyMDEContainer .CodeMirror').type(imageUrl);
cy.get('.EasyMDEContainer .CodeMirror').type('{home}![Dog! (He\'s a good boy!)]({end})');
cy.wait('@image');
cy.get(`.EasyMDEContainer [data-img-src="${imageUrl}"]`).should('be.visible');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', `<p><img src="${imageUrl}" alt="Dog! (He's a good boy!)"></p>`);
});
});

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default</title>
<link rel="stylesheet" href="../../../dist/easymde.min.css">
<script src="../../../dist/easymde.min.js"></script>
</head>
<body>
<textarea id="textarea"></textarea>
<script>
const easyMDE = new EasyMDE({
previewImagesInEditor: true,
});
</script>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Default</title>
<link rel="stylesheet" href="../../../dist/easymde.min.css">
<script src="../../../dist/easymde.min.js"></script>
</head>
<body>
<textarea id="textarea"></textarea>
<script>
const easyMDE = new EasyMDE({
renderingConfig: {
markedOptions: {
headerPrefix: 'header-prefix-',
}
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
/// <reference types="cypress" />
describe('Marked options', () => {
beforeEach(() => {
cy.visit(__dirname + '/index.html');
});
it('must apply the markedOptions to the markdown parser', () => {
cy.get('.EasyMDEContainer').should('be.visible');
cy.get('#textarea').should('not.be.visible');
cy.get('.EasyMDEContainer .CodeMirror').type('# Title{enter}');
cy.previewOn();
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<h1 id="header-prefix-title">Title</h1>');
});
});

10
cypress/plugins/index.js Normal file
View File

@ -0,0 +1,10 @@
/// <reference types="cypress" />
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

View File

@ -0,0 +1,31 @@
/// <reference types="cypress" />
const unquote = (str) => str.replace(/(^")|("$)/g, '');
Cypress.Commands.add(
'before',
{
prevSubject: 'element',
},
(element, property) => {
const win = element[0].ownerDocument.defaultView;
const before = win.getComputedStyle(element[0], 'before');
return unquote(before.getPropertyValue(property));
},
);
Cypress.Commands.add('previewOn' , () => {
cy.get('.EasyMDEContainer .editor-preview').should('not.be.visible');
cy.get('.EasyMDEContainer .editor-toolbar button.preview').should('not.have.class', 'active');
cy.get('.EasyMDEContainer .editor-toolbar button.preview').click();
cy.get('.EasyMDEContainer .editor-toolbar button.preview').should('have.class', 'active');
cy.get('.EasyMDEContainer .editor-preview').should('be.visible');
});
Cypress.Commands.add('previewOff' , () => {
cy.get('.EasyMDEContainer .editor-preview').should('be.visible');
cy.get('.EasyMDEContainer .editor-toolbar button.preview').should('have.class', 'active');
cy.get('.EasyMDEContainer .editor-toolbar button.preview').click();
cy.get('.EasyMDEContainer .editor-toolbar button.preview').should('not.have.class', 'active');
cy.get('.EasyMDEContainer .editor-preview').should('not.be.visible');
});

1
cypress/support/e2e.js Normal file
View File

@ -0,0 +1 @@
require('./commands');

File diff suppressed because one or more lines are too long

7
dist/easymde.min.js vendored

File diff suppressed because one or more lines are too long

20
example/index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Example / Preview</title>
<link rel="stylesheet" href="../dist/easymde.min.css">
<script src="../dist/easymde.min.js"></script>
</head>
<body>
<textarea></textarea>
<script>
const easyMDE = new EasyMDE();
</script>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Example / Preview / sideBySideFullscreen : false</title>
<link rel="stylesheet" href="../dist/easymde.min.css">
<script src="../dist/easymde.min.js"></script>
</head>
<body>
<textarea></textarea>
<script>
const easyMDE = new EasyMDE({sideBySideFullscreen: false});
</script>
</body>
</html>

View File

@ -1,55 +1,66 @@
'use strict';
var gulp = require('gulp'),
minifycss = require('gulp-clean-css'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
header = require('gulp-header'),
buffer = require('vinyl-buffer'),
pkg = require('./package.json'),
eslint = require('gulp-eslint'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
rename = require('gulp-rename');
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var terser = require('gulp-terser');
var concat = require('gulp-concat');
var header = require('gulp-header');
var buffer = require('vinyl-buffer');
var pkg = require('./package.json');
var eslint = require('gulp-eslint');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var rename = require('gulp-rename');
var banner = ['/**',
' * <%= pkg.name %> v<%= pkg.version %>',
' * Copyright <%= pkg.author %>',
' * @link <%= pkg.repository.url %>',
' * @link https://github.com/ionaru/easy-markdown-editor',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('lint', function () {
gulp.src('./src/js/**/*.js')
var css_files = [
'./node_modules/codemirror/lib/codemirror.css',
'./src/css/*.css',
'./node_modules/codemirror-spell-checker/src/css/spell-checker.css',
];
function lint() {
return gulp.src('./src/js/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
}
gulp.task('scripts', ['lint'], function () {
function scripts() {
return browserify({entries: './src/js/easymde.js', standalone: 'EasyMDE'}).bundle()
.pipe(source('easymde.min.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(terser())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('styles', function () {
var css_files = [
'./node_modules/codemirror/lib/codemirror.css',
'./src/css/*.css',
'./node_modules/codemirror-spell-checker/src/css/spell-checker.css'
];
}
function styles() {
return gulp.src(css_files)
.pipe(concat('easymde.css'))
.pipe(minifycss())
.pipe(cleanCSS())
.pipe(rename('easymde.min.css'))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest('./dist/'));
});
}
gulp.task('default', ['scripts', 'styles']);
// Watch for file changes
function watch() {
gulp.watch('./src/js/**/*.js', scripts);
gulp.watch(css_files, styles);
}
var build = gulp.parallel(gulp.series(lint, scripts), styles);
gulp.task('default', build);
gulp.task('watch', gulp.series(build, watch));
gulp.task('lint', lint);

19064
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,12 @@
{
"name": "easymde",
"version": "2.0.0",
"version": "2.20.0",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor that easy to use. Features include autosaving and spell checking.",
"files": [
"dist/**/*",
"src/**/*",
"types/easymde.d.ts"
],
"keywords": [
"embeddable",
"markdown",
@ -9,31 +14,42 @@
"javascript",
"fontawesome"
],
"main": "./src/js/simplemde.js",
"main": "src/js/easymde.js",
"types": "types/easymde.d.ts",
"license": "MIT",
"author": "Jeroen Akkerman",
"bugs": {
"url": "https://github.com/ionaru/easy-markdown-editor/issues"
},
"dependencies": {
"codemirror": "^5.37.0",
"@types/codemirror": "^5.60.10",
"@types/marked": "^4.0.7",
"codemirror": "^5.65.15",
"codemirror-spell-checker": "1.1.2",
"marked": "0.3.19"
"marked": "^4.1.0"
},
"devDependencies": {
"browserify": "^16.2.0",
"gulp": "^3.9.1",
"gulp-clean-css": "^3.9.0",
"browserify": "^17.0.0",
"cypress": "^13.2.0",
"eslint": "^8.50.0",
"eslint-plugin-cypress": "^2.15.1",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^4.0.0",
"gulp-header": "^2.0.5",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^3.0.0",
"vinyl-buffer": "^1.0.0",
"gulp-eslint": "^6.0.0",
"gulp-header": "^2.0.9",
"gulp-rename": "^2.0.0",
"gulp-terser": "^2.1.0",
"gulp-uglify": "^3.0.2",
"typescript": "^5.2.2",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/ionaru/easy-markdown-editor"
"repository": "github:Ionaru/easy-markdown-editor",
"scripts": {
"prepare": "gulp",
"test": "npm run lint && npm run test:types && npm run e2e",
"lint": "gulp lint",
"cypress:lint": "eslint cypress",
"cypress:run": "cypress run",
"e2e": "gulp && npm run cypress:lint && npm run cypress:run",
"test:types": "tsc --project types/tsconfig.json"
}
}

View File

@ -1,20 +1,34 @@
.CodeMirror {
.EasyMDEContainer {
display: block;
}
.CodeMirror-rtl pre {
direction: rtl;
}
.EasyMDEContainer.sided--no-fullscreen {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.EasyMDEContainer .CodeMirror {
box-sizing: border-box;
height: auto;
border: 1px solid #ddd;
border: 1px solid #ced4da;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
padding: 10px;
font: inherit;
z-index: 1;
z-index: 0;
word-wrap: break-word;
}
.CodeMirror-scroll {
.EasyMDEContainer .CodeMirror-scroll {
cursor: text;
}
.CodeMirror-fullscreen {
.EasyMDEContainer .CodeMirror-fullscreen {
background: #fff;
position: fixed !important;
top: 50px;
@ -22,15 +36,30 @@
right: 0;
bottom: 0;
height: auto;
z-index: 9;
z-index: 8;
border-right: none !important;
border-bottom-right-radius: 0 !important;
}
.CodeMirror-sided {
.EasyMDEContainer .CodeMirror-sided {
width: 50% !important;
}
.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided {
border-right: none !important;
border-bottom-right-radius: 0;
position: relative;
flex: 1 1 auto;
}
.EasyMDEContainer .CodeMirror-placeholder {
opacity: .5;
}
.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected {
background: #d9d9d9;
}
.editor-toolbar {
position: relative;
-webkit-user-select: none;
@ -38,35 +67,17 @@
-ms-user-select: none;
-o-user-select: none;
user-select: none;
padding: 0 10px;
border-top: 1px solid #bbb;
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
padding: 9px 10px;
border-top: 1px solid #ced4da;
border-left: 1px solid #ced4da;
border-right: 1px solid #ced4da;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.editor-toolbar:after,
.editor-toolbar:before {
display: block;
content: ' ';
height: 1px;
}
.editor-toolbar:before {
margin-bottom: 8px
}
.editor-toolbar:after {
margin-top: 8px
}
.editor-toolbar.fullscreen {
width: 100%;
height: 50px;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
padding-top: 10px;
padding-bottom: 10px;
box-sizing: border-box;
@ -111,13 +122,15 @@
padding: 0;
}
.editor-toolbar a,
.editor-toolbar button {
.EasyMDEContainer.sided--no-fullscreen .editor-toolbar {
width: 100%;
}
.editor-toolbar button, .editor-toolbar .easymde-dropdown {
background: transparent;
display: inline-block;
text-align: center;
text-decoration: none !important;
width: 30px;
height: 30px;
margin: 0;
padding: 0;
@ -126,19 +139,19 @@
cursor: pointer;
}
.editor-toolbar a.active,
.editor-toolbar a:hover,
.editor-toolbar button {
font-weight: bold;
min-width: 30px;
padding: 0 6px;
white-space: nowrap;
}
.editor-toolbar button.active,
.editor-toolbar button:hover {
background: #fcfcfc;
border-color: #95a5a6;
}
.editor-toolbar a:before,
.editor-toolbar button:before {
line-height: 30px
}
.editor-toolbar i.separator {
display: inline-block;
width: 0;
@ -149,7 +162,7 @@
margin: 0 6px;
}
.editor-toolbar a.fa-header-x:after {
.editor-toolbar button:after {
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 65%;
vertical-align: text-bottom;
@ -157,23 +170,23 @@
top: 2px;
}
.editor-toolbar a.fa-header-1:after {
.editor-toolbar button.heading-1:after {
content: "1";
}
.editor-toolbar a.fa-header-2:after {
.editor-toolbar button.heading-2:after {
content: "2";
}
.editor-toolbar a.fa-header-3:after {
.editor-toolbar button.heading-3:after {
content: "3";
}
.editor-toolbar a.fa-header-bigger:after {
.editor-toolbar button.heading-bigger:after {
content: "▲";
}
.editor-toolbar a.fa-header-smaller:after {
.editor-toolbar button.heading-smaller:after {
content: "▼";
}
@ -183,7 +196,7 @@
}
@media only screen and (max-width: 700px) {
.editor-toolbar a.no-mobile {
.editor-toolbar i.no-mobile {
display: none;
}
}
@ -195,6 +208,10 @@
text-align: right;
}
.EasyMDEContainer.sided--no-fullscreen .editor-statusbar {
width: 100%;
}
.editor-statusbar span {
display: inline-block;
min-width: 4em;
@ -213,14 +230,12 @@
content: 'characters: '
}
.editor-preview {
padding: 10px;
.editor-preview-full {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #fafafa;
z-index: 7;
overflow: auto;
display: none;
@ -228,13 +243,11 @@
}
.editor-preview-side {
padding: 10px;
position: fixed;
bottom: 0;
width: 50%;
top: 50px;
right: 0;
background: #fafafa;
z-index: 9;
overflow: auto;
display: none;
@ -247,82 +260,144 @@
display: block
}
.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side {
flex: 1 1 auto;
height: auto;
position: static;
}
.editor-preview-active {
display: block
}
.editor-preview > p,
.editor-preview-side > p {
.editor-preview {
padding: 10px;
background: #fafafa;
}
.editor-preview > p {
margin-top: 0
}
.editor-preview pre,
.editor-preview-side pre {
.editor-preview pre {
background: #eee;
margin-bottom: 10px;
}
.editor-preview table td,
.editor-preview table th,
.editor-preview-side table td,
.editor-preview-side table th {
.editor-preview table th {
border: 1px solid #ddd;
padding: 5px;
}
.CodeMirror .CodeMirror-code .cm-tag {
.cm-s-easymde .cm-tag {
color: #63a35c;
}
.CodeMirror .CodeMirror-code .cm-attribute {
.cm-s-easymde .cm-attribute {
color: #795da3;
}
.CodeMirror .CodeMirror-code .cm-string {
.cm-s-easymde .cm-string {
color: #183691;
}
.CodeMirror .CodeMirror-selected {
background: #d9d9d9;
.cm-s-easymde .cm-header-1 {
font-size: calc(1.375rem + 1.5vw);
}
.CodeMirror .CodeMirror-code .cm-header-1 {
font-size: 200%;
line-height: 200%;
.cm-s-easymde .cm-header-2 {
font-size: calc(1.325rem + .9vw);
}
.CodeMirror .CodeMirror-code .cm-header-2 {
font-size: 160%;
line-height: 160%;
.cm-s-easymde .cm-header-3 {
font-size: calc(1.3rem + .6vw);
}
.CodeMirror .CodeMirror-code .cm-header-3 {
font-size: 125%;
line-height: 125%;
.cm-s-easymde .cm-header-4 {
font-size: calc(1.275rem + .3vw);
}
.CodeMirror .CodeMirror-code .cm-header-4 {
font-size: 110%;
line-height: 110%;
.cm-s-easymde .cm-header-5 {
font-size: 1.25rem;
}
.CodeMirror .CodeMirror-code .cm-comment {
.cm-s-easymde .cm-header-6 {
font-size: 1rem;
}
.cm-s-easymde .cm-header-1,
.cm-s-easymde .cm-header-2,
.cm-s-easymde .cm-header-3,
.cm-s-easymde .cm-header-4,
.cm-s-easymde .cm-header-5,
.cm-s-easymde .cm-header-6 {
margin-bottom: .5rem;
line-height: 1.2;
}
.cm-s-easymde .cm-comment {
background: rgba(0, 0, 0, .05);
border-radius: 2px;
}
.CodeMirror .CodeMirror-code .cm-link {
.cm-s-easymde .cm-link {
color: #7f8c8d;
}
.CodeMirror .CodeMirror-code .cm-url {
.cm-s-easymde .cm-url {
color: #aab2b3;
}
.CodeMirror .CodeMirror-code .cm-strikethrough {
text-decoration: line-through;
.cm-s-easymde .cm-quote {
color: #7f8c8d;
font-style: italic;
}
.CodeMirror .CodeMirror-placeholder {
opacity: .5;
.editor-toolbar .easymde-dropdown {
position: relative;
background: linear-gradient(to bottom right, #fff 0%, #fff 84%, #333 50%, #333 100%);
border-radius: 0;
border: 1px solid #fff;
}
.editor-toolbar .easymde-dropdown:hover {
background: linear-gradient(to bottom right, #fff 0%, #fff 84%, #333 50%, #333 100%);
}
.easymde-dropdown-content {
display: block;
visibility: hidden;
position: absolute;
background-color: #f9f9f9;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
padding: 8px;
z-index: 2;
top: 30px;
}
.easymde-dropdown:active .easymde-dropdown-content,
.easymde-dropdown:focus .easymde-dropdown-content,
.easymde-dropdown:focus-within .easymde-dropdown-content {
visibility: visible;
}
.easymde-dropdown-content button {
display: block;
}
span[data-img-src]::after {
content: '';
/*noinspection CssUnresolvedCustomProperty, added through JS*/
background-image: var(--bg-image);
display: block;
max-height: 100%;
max-width: 100%;
background-size: contain;
height: 0;
/*noinspection CssUnresolvedCustomProperty, added through JS*/
padding-top: var(--height);
/*noinspection CssUnresolvedCustomProperty, added through JS*/
width: var(--width);
background-repeat: no-repeat;
}

View File

@ -16,8 +16,7 @@ CodeMirror.commands.tabAndIndentMarkdownList = function (cm) {
if (cm.options.indentWithTabs) {
cm.execCommand('insertTab');
}
else {
} else {
var spaces = Array(cm.options.tabSize + 1).join(' ');
cm.replaceSelection(spaces);
}
@ -36,8 +35,7 @@ CodeMirror.commands.shiftTabAndUnindentMarkdownList = function (cm) {
if (cm.options.indentWithTabs) {
cm.execCommand('insertTab');
}
else {
} else {
var spaces = Array(cm.options.tabSize + 1).join(' ');
cm.replaceSelection(spaces);
}

File diff suppressed because it is too large Load Diff

238
types/easymde-test.ts Normal file
View File

@ -0,0 +1,238 @@
// Create new instance
import EasyMDE = require('./easymde');
const editor = new EasyMDE({
autoDownloadFontAwesome: false,
element: document.getElementById('mdEditor')!,
hideIcons: ['side-by-side', 'fullscreen'],
inputStyle: 'textarea',
shortcuts: {
drawTable: 'Cmd-Alt-T',
toggleFullScreen: null,
},
previewClass: 'my-custom-class',
spellChecker: false,
onToggleFullScreen: (full: boolean) => {
console.log('FullscreenToggled', full);
},
theme: 'someOtherTheme',
minHeight: '200px',
});
// Editor functions
const value = editor.value() as string;
editor.value(value.toUpperCase());
const sbs = editor.isSideBySideActive() as boolean;
const fullscreen = editor.isFullscreenActive() as boolean;
// Access to codemirror object
editor.codemirror.setOption('readOnly', true);
// Static properties
EasyMDE.toggleItalic = (editor: EasyMDE) => {
console.log('SomeButtonOverride');
};
const editor2 = new EasyMDE({
autoDownloadFontAwesome: undefined,
previewClass: ['my-custom-class', 'some-other-class'],
nativeSpellcheck: true,
unorderedListStyle: '-',
inputStyle: 'contenteditable',
toolbar: [
{
name: 'bold',
action: EasyMDE.toggleBold,
className: 'fa fas fa-bolt',
title: 'Bold',
},
'|',
'undo',
{
name: 'alert',
action: (editor: EasyMDE) => {
alert('This is from a custom button action!');
// Custom functions have access to the `editor` instance.
},
className: 'fa fas fa-star',
title: 'A Custom Button',
noDisable: undefined,
noMobile: false,
attributes: {
'data-custom': 'attribute',
}
},
'|',
{
name: 'link',
action: 'https://github.com/Ionaru/easy-markdown-editor',
className: 'fa fab fa-github',
title: 'A Custom Link',
noDisable: true,
noMobile: true,
},
'preview',
{
name: 'links',
className: 'fa fas fa-arrow-down',
title: 'A Custom Link',
children: [
{
name: 'link',
action: 'https://github.com/Ionaru/easy-markdown-editor',
className: 'fa fab fa-github',
title: 'A Custom Link',
noDisable: true,
noMobile: true,
},
'preview',
{
name: 'bold',
action: EasyMDE.toggleBold,
className: 'fa fas fa-bold',
title: 'Bold',
attributes: {
'data-custom': 'some value',
'data-custom-2': 'another value',
}
},
],
},
],
});
editor2.clearAutosavedValue();
editor2.updateStatusBar('upload-image', 'Drag & drop images!');
EasyMDE.togglePreview(editor2);
EasyMDE.toggleSideBySide(editor2);
const editorImages = new EasyMDE({
uploadImage: true,
previewImagesInEditor: false,
imageAccept: 'image/png, image/bmp',
imageCSRFToken: undefined,
unorderedListStyle: '+',
imageMaxSize: 10485760,
imageUploadEndpoint: 'https://my.domain/image-upload/',
imageTexts: {
sbInit: 'Drag & drop images!',
sbOnDragEnter: 'Let it go, let it go',
sbOnDrop: 'Uploading...',
sbProgress: 'Uploading... (#progress#)',
sbOnUploaded: 'Upload complete!',
sizeUnits: 'b,Kb,Mb',
},
errorMessages: {
noFileGiven: 'Please select a file',
typeNotAllowed: 'This file type is not allowed!',
fileTooLarge: 'Image too big',
importError: 'Something went oops!',
},
errorCallback: errorMessage => {
console.error(errorMessage);
},
});
const editorImagesCustom = new EasyMDE({
uploadImage: true,
imageAccept: 'image/png, image/bmp',
imageCSRFToken: undefined,
imageMaxSize: 10485760,
imageUploadFunction: (file: File, onSuccess, onError) => {
console.log(file);
onSuccess('http://image.url/9.png');
onError('Failed because reasons.');
},
imageTexts: {
sbInit: 'Drag & drop images!',
sbOnDragEnter: 'Let it go, let it go',
sbOnDrop: 'Uploading...',
sbProgress: 'Uploading... (#progress#)',
sbOnUploaded: 'Upload complete!',
sizeUnits: 'b,Kb,Mb',
},
errorMessages: {
noFileGiven: 'Please select a file',
typeNotAllowed: 'This file type is not allowed!',
fileTooLarge: 'Image too big',
importError: 'Something went oops!',
},
errorCallback: errorMessage => {
console.error(errorMessage);
},
renderingConfig: {
codeSyntaxHighlighting: true,
markedOptions: {
silent: true,
highlight(code: string, lang: string, callback?: (error: (any | undefined), code: string) => void): string {
return 'something';
},
},
},
promptTexts: {
image: 'Insert URL',
},
syncSideBySidePreviewScroll: true,
});
new EasyMDE({
toolbarButtonClassPrefix: 'mde',
sideBySideFullscreen: true,
lineNumbers: false,
unorderedListStyle: '*',
autosave: {
enabled: true,
delay: 2000,
submit_delay: 10000,
uniqueId: 'abc',
timeFormat: {
locale: 'en-GB',
format: {
month: 'long',
},
},
text: 'Stored: ',
},
});
new EasyMDE({
sideBySideFullscreen: false,
lineNumbers: true,
maxHeight: '500px',
toolbar: [
'bold',
'italic',
'heading',
'|',
'quote',
'unordered-list',
'ordered-list',
'table',
'upload-image',
'|',
'link',
],
});
new EasyMDE({
direction: 'ltr',
});
new EasyMDE({
direction: 'rtl',
});
new EasyMDE({
previewRender: (plainText: string) => {
return '<pre>' + plainText + '</pre>';
}
});
new EasyMDE({
previewRender: (plainText: string, preview) => {
preview.innerHTML = '<pre>' + plainText + '</pre>';
return null;
}
});

294
types/easymde.d.ts vendored Normal file
View File

@ -0,0 +1,294 @@
// This file is based on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/simplemde/index.d.ts,
// which is written by Scalesoft <https://github.com/Scalesoft> and licensed under the MIT license:
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
/// <reference types="codemirror"/>
import { marked } from 'marked';
interface ArrayOneOrMore<T> extends Array<T> {
0: T;
}
type ToolbarButton =
'bold'
| 'italic'
| 'quote'
| 'unordered-list'
| 'ordered-list'
| 'link'
| 'image'
| 'upload-image'
| 'strikethrough'
| 'code'
| 'table'
| 'redo'
| 'heading'
| 'undo'
| 'heading-bigger'
| 'heading-smaller'
| 'heading-1'
| 'heading-2'
| 'heading-3'
| 'clean-block'
| 'horizontal-rule'
| 'preview'
| 'side-by-side'
| 'fullscreen'
| 'guide';
declare namespace EasyMDE {
interface TimeFormatOptions {
locale?: string | string[];
format?: Intl.DateTimeFormatOptions;
}
interface AutoSaveOptions {
enabled?: boolean;
delay?: number;
submit_delay?: number;
uniqueId: string;
timeFormat?: TimeFormatOptions;
text?: string;
}
interface BlockStyleOptions {
bold?: string;
code?: string;
italic?: string;
}
interface CustomAttributes {
[key: string]: string;
}
interface InsertTextOptions {
horizontalRule?: ReadonlyArray<string>;
image?: ReadonlyArray<string>;
link?: ReadonlyArray<string>;
table?: ReadonlyArray<string>;
}
interface ParsingOptions {
allowAtxHeaderWithoutSpace?: boolean;
strikethrough?: boolean;
underscoresBreakWords?: boolean;
}
interface PromptTexts {
image?: string;
link?: string;
}
interface RenderingOptions {
codeSyntaxHighlighting?: boolean;
hljs?: any;
markedOptions?: marked.MarkedExtension;
sanitizerFunction?: (html: string) => string;
singleLineBreaks?: boolean;
}
interface Shortcuts {
[action: string]: string | undefined | null;
toggleBlockquote?: string | null;
toggleBold?: string | null;
cleanBlock?: string | null;
toggleHeadingSmaller?: string | null;
toggleItalic?: string | null;
drawLink?: string | null;
toggleUnorderedList?: string | null;
togglePreview?: string | null;
toggleCodeBlock?: string | null;
drawImage?: string | null;
toggleOrderedList?: string | null;
toggleHeadingBigger?: string | null;
toggleSideBySide?: string | null;
toggleFullScreen?: string | null;
}
interface StatusBarItem {
className: string;
defaultValue: (element: HTMLElement) => void;
onUpdate: (element: HTMLElement) => void;
}
interface ToolbarDropdownIcon {
name: string;
children: ArrayOneOrMore<ToolbarIcon | ToolbarButton>;
className: string;
title: string;
noDisable?: boolean;
noMobile?: boolean;
}
interface ToolbarIcon {
name: string;
action: string | ((editor: EasyMDE) => void);
className: string;
title: string;
noDisable?: boolean;
noMobile?: boolean;
icon?: string;
attributes?: CustomAttributes;
}
interface ImageTextsOptions {
sbInit?: string;
sbOnDragEnter?: string;
sbOnDrop?: string;
sbProgress?: string;
sbOnUploaded?: string;
sizeUnits?: string;
}
interface ImageErrorTextsOptions {
noFileGiven?: string;
typeNotAllowed?: string;
fileTooLarge?: string;
importError?: string;
}
interface OverlayModeOptions {
mode: CodeMirror.Mode<any>;
combine?: boolean;
}
interface SpellCheckerOptions {
codeMirrorInstance: CodeMirror.Editor;
}
interface Options {
autoDownloadFontAwesome?: boolean;
autofocus?: boolean;
autosave?: AutoSaveOptions;
autoRefresh?: boolean | { delay: number; };
blockStyles?: BlockStyleOptions;
element?: HTMLElement;
forceSync?: boolean;
hideIcons?: ReadonlyArray<ToolbarButton>;
indentWithTabs?: boolean;
initialValue?: string;
insertTexts?: InsertTextOptions;
lineNumbers?: boolean;
lineWrapping?: boolean;
minHeight?: string;
maxHeight?: string;
parsingConfig?: ParsingOptions;
placeholder?: string;
previewClass?: string | ReadonlyArray<string>;
previewImagesInEditor?: boolean;
imagesPreviewHandler?: (src: string) => string,
previewRender?: (markdownPlaintext: string, previewElement: HTMLElement) => string | null;
promptURLs?: boolean;
renderingConfig?: RenderingOptions;
shortcuts?: Shortcuts;
showIcons?: ReadonlyArray<ToolbarButton>;
spellChecker?: boolean | ((options: SpellCheckerOptions) => void);
inputStyle?: 'textarea' | 'contenteditable';
nativeSpellcheck?: boolean;
sideBySideFullscreen?: boolean;
status?: boolean | ReadonlyArray<string | StatusBarItem>;
styleSelectedText?: boolean;
tabSize?: number;
toolbar?: boolean | ReadonlyArray<'|' | ToolbarButton | ToolbarIcon | ToolbarDropdownIcon>;
toolbarTips?: boolean;
toolbarButtonClassPrefix?: string;
onToggleFullScreen?: (goingIntoFullScreen: boolean) => void;
theme?: string;
scrollbarStyle?: string;
unorderedListStyle?: '*' | '-' | '+';
uploadImage?: boolean;
imageMaxSize?: number;
imageAccept?: string;
imageUploadFunction?: (file: File, onSuccess: (url: string) => void, onError: (error: string) => void) => void;
imageUploadEndpoint?: string;
imagePathAbsolute?: boolean;
imageCSRFToken?: string;
imageCSRFName?: string;
imageCSRFHeader?: boolean;
imageTexts?: ImageTextsOptions;
imageInputName?: string
errorMessages?: ImageErrorTextsOptions;
errorCallback?: (errorMessage: string) => void;
promptTexts?: PromptTexts;
syncSideBySidePreviewScroll?: boolean;
overlayMode?: OverlayModeOptions;
direction?: 'ltr' | 'rtl';
}
}
declare class EasyMDE {
constructor(options?: EasyMDE.Options);
value(): string;
value(val: string): void;
codemirror: CodeMirror.Editor;
cleanup(): void;
toTextArea(): void;
isPreviewActive(): boolean;
isSideBySideActive(): boolean;
isFullscreenActive(): boolean;
clearAutosavedValue(): void;
updateStatusBar(itemName: string, content: string): void;
static toggleBold: (editor: EasyMDE) => void;
static toggleItalic: (editor: EasyMDE) => void;
static toggleStrikethrough: (editor: EasyMDE) => void;
static toggleHeadingSmaller: (editor: EasyMDE) => void;
static toggleHeadingBigger: (editor: EasyMDE) => void;
static toggleHeading1: (editor: EasyMDE) => void;
static toggleHeading2: (editor: EasyMDE) => void;
static toggleHeading3: (editor: EasyMDE) => void;
static toggleHeading4: (editor: EasyMDE) => void;
static toggleHeading5: (editor: EasyMDE) => void;
static toggleHeading6: (editor: EasyMDE) => void;
static toggleCodeBlock: (editor: EasyMDE) => void;
static toggleBlockquote: (editor: EasyMDE) => void;
static toggleUnorderedList: (editor: EasyMDE) => void;
static toggleOrderedList: (editor: EasyMDE) => void;
static cleanBlock: (editor: EasyMDE) => void;
static drawLink: (editor: EasyMDE) => void;
static drawImage: (editor: EasyMDE) => void;
static drawUploadedImage: (editor: EasyMDE) => void;
static drawTable: (editor: EasyMDE) => void;
static drawHorizontalRule: (editor: EasyMDE) => void;
static togglePreview: (editor: EasyMDE) => void;
static toggleSideBySide: (editor: EasyMDE) => void;
static toggleFullScreen: (editor: EasyMDE) => void;
static undo: (editor: EasyMDE) => void;
static redo: (editor: EasyMDE) => void;
}
export as namespace EasyMDE;
export = EasyMDE;

9
types/tsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "es3",
"ignoreDeprecations": "5.0",
"strict": true,
"noImplicitReturns": true,
"noEmit": true
}
}