mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-09-24 16:40:55 -06:00
Compare commits
519 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2996b67ec9 | ||
|
1708e40c42 | ||
|
f1e229f5b8 | ||
|
a602d3b826 | ||
|
fe680f09f6 | ||
|
0eddf94930 | ||
|
22ce228b07 | ||
|
e7a56e11dd | ||
|
f20ff16b81 | ||
|
c93033bb4e | ||
|
c1b06a9613 | ||
|
bdfd0da5ff | ||
|
138c198852 | ||
|
a6b121f2e6 | ||
|
65dfecf484 | ||
|
97bf9ce8fd | ||
|
9b420ac103 | ||
|
f039bae67f | ||
|
c68bdf148a | ||
|
35587a9477 | ||
|
d9ab397b88 | ||
|
abead2a068 | ||
|
c25adab400 | ||
|
a49e867930 | ||
|
cb5564e1b2 | ||
|
fbc181f5c8 | ||
|
041594ae4a | ||
|
6ab32d9fd6 | ||
|
950f689dc7 | ||
|
6560950b65 | ||
|
f60c9b24c5 | ||
|
4b48564730 | ||
|
d26b4e399b | ||
|
84aafddd92 | ||
|
4a73c911d0 | ||
|
086e73b835 | ||
|
aa2f225340 | ||
|
0062ba38e1 | ||
|
f8a66b120b | ||
|
b4c55d9075 | ||
|
c27f5d1d23 | ||
|
f7b4fbfda5 | ||
|
d22fd40625 | ||
|
9ddbc4a585 | ||
|
03f018a472 | ||
|
9232608bf3 | ||
|
2930abdd50 | ||
|
b347a911c1 | ||
|
3e653dc900 | ||
|
acbed01b34 | ||
|
ef827ba61f | ||
|
37561e4458 | ||
|
03fec127eb | ||
|
4d065c361e | ||
|
78fcda535d | ||
|
c84af4c3ed | ||
|
c311b7b8da | ||
|
3d6d56edef | ||
|
67f75535ad | ||
|
8295aa6a5a | ||
|
7338ddb6e3 | ||
|
96a5aac921 | ||
|
0c31e06928 | ||
|
23f241bd47 | ||
|
fc839e8dc8 | ||
|
0eab3e11e8 | ||
|
e4610b3763 | ||
|
24feffcba6 | ||
|
e57c16bc5c | ||
|
eb51f0fe53 | ||
|
554112b05f | ||
|
2972b280a5 | ||
|
eee701ef86 | ||
|
7f9ba6abc8 | ||
|
3895e0a607 | ||
|
b675e611a4 | ||
|
3cc99e47ae | ||
|
f4a02e39a9 | ||
|
4714577c36 | ||
|
45e0f36685 | ||
|
cd9bbe7939 | ||
|
5a4af7e38a | ||
|
611aa50443 | ||
|
68d33ec2c1 | ||
|
855a5d72f5 | ||
|
38717daffe | ||
|
146a5e3fb1 | ||
|
c311bfa6b0 | ||
|
b31cf2bf7c | ||
|
bed6b493c8 | ||
|
2b178671ca | ||
|
2666001eda | ||
|
21fda66d3d | ||
|
9d74ea296c | ||
|
1706b4b0cf | ||
|
aca4b5c816 | ||
|
757d5eb729 | ||
|
be1d994322 | ||
|
0dd2f99f9d | ||
|
9a57f00d92 | ||
|
332cf61086 | ||
|
c1071c8539 | ||
|
16b1de652e | ||
|
8b9cf3e812 | ||
|
a433f72891 | ||
|
4b3930c4a7 | ||
|
a7fb5d8f06 | ||
|
7b4c6dae9e | ||
|
b6f207d235 | ||
|
591e278745 | ||
|
764ce93d59 | ||
|
af81424b78 | ||
|
3d07f0eb97 | ||
|
16f2dde59d | ||
|
57f72bd5ae | ||
|
8765cf197b | ||
|
bf9b0108d7 | ||
|
f283f76f5c | ||
|
a1ad87986d | ||
|
76fda35bf9 | ||
|
1f30a11773 | ||
|
aa711787b2 | ||
|
853efd8a5e | ||
|
ed196be5a0 | ||
|
d8fa00e460 | ||
|
f573560bb4 | ||
|
a021bdf8ae | ||
|
aa6fe59e93 | ||
|
8805c379d8 | ||
|
b0d20adc6e | ||
|
f3dca2e82a | ||
|
50d3680017 | ||
|
81ec7780bc | ||
|
d8eae5d74c | ||
|
0c2cf4cd51 | ||
|
16545eb0e1 | ||
|
47f1e4f892 | ||
|
c174b6f149 | ||
|
33489ab616 | ||
|
5d0294f5f5 | ||
|
4fb35f2758 | ||
|
d0116608e6 | ||
|
6159ed1383 | ||
|
a56badd0dc | ||
|
24d86491da | ||
|
56532f9ce4 | ||
|
722fb61ed2 | ||
|
33a4043dbb | ||
|
75fe53f062 | ||
|
384655f968 | ||
|
6445f3c2d9 | ||
|
7a2373eae5 | ||
|
4ddb5b8e1b | ||
|
98d9049728 | ||
|
565c42e0ff | ||
|
1c656d5712 | ||
|
c1da7424e9 | ||
|
e2db3c6946 | ||
|
267db2dbe3 | ||
|
9862ecf98c | ||
|
2cdc11848a | ||
|
5df842b630 | ||
|
a9d9993dae | ||
|
59a676bc8a | ||
|
2936fc3383 | ||
|
a7170b9392 | ||
|
598821b6bb | ||
|
de1cd3b293 | ||
|
d27adc6a16 | ||
|
c15c699a52 | ||
|
8ad896fb40 | ||
|
b640429f19 | ||
|
8ef68936b0 | ||
|
f004c2d0c3 | ||
|
551c84bc01 | ||
|
86e40bcf4a | ||
|
35b42c404a | ||
|
42304e8a87 | ||
|
dc38624378 | ||
|
c24dd01880 | ||
|
b364a6095a | ||
|
cda237031f | ||
|
534e2cadee | ||
|
aafd40f35b | ||
|
53223c4de0 | ||
|
b121795887 | ||
|
0f559258c5 | ||
|
3e403d9712 | ||
|
cb351333d1 | ||
|
f52f9807a2 | ||
|
c1d35b04c5 | ||
|
737aa13709 | ||
|
038a9204b4 | ||
|
dbab7e95e7 | ||
|
51d496aea6 | ||
|
735d31fb29 | ||
|
ebcc835ee9 | ||
|
c58eb54379 | ||
|
529c7bf04d | ||
|
e3480c2f60 | ||
|
fc0ecfa77e | ||
|
113c5b45b1 | ||
|
b61fe7945a | ||
|
82a8e4a8ce | ||
|
548229dd1a | ||
|
40ddcea4e3 | ||
|
d0f69390ce | ||
|
1ee8519e50 | ||
|
4533dd4776 | ||
|
d636eb7407 | ||
|
7069fd1031 | ||
|
d76872f4ff | ||
|
8ed6cd699e | ||
|
25db654cf0 | ||
|
8702dd22d0 | ||
|
fa8855e3be | ||
|
61e93a3d53 | ||
|
abbec5bde1 | ||
|
3b755026d6 | ||
|
6e7e8f9b82 | ||
|
072176a86e | ||
|
c2dbe77615 | ||
|
95b848a825 | ||
|
6527a311a3 | ||
|
8fa54c496f | ||
|
fdc9ce4935 | ||
|
0ac130306d | ||
|
59b6b0719e | ||
|
bc17533def | ||
|
0241584921 | ||
|
dd449cf9a7 | ||
|
ec94037ac2 | ||
|
0ff81e89a6 | ||
|
65f66138c0 | ||
|
3f90b9fe72 | ||
|
480145264a | ||
|
a070698b34 | ||
|
7b0411fd79 | ||
|
1386fb0319 | ||
|
80e2fc1bbd | ||
|
dbe3872afb | ||
|
b7d5af36c8 | ||
|
67592df8bf | ||
|
db348fe44b | ||
|
3b6402b3e8 | ||
|
a7f4262166 | ||
|
6306b96cf7 | ||
|
c428a37ee3 | ||
|
2a904b24ab | ||
|
f286a6bae5 | ||
|
6209e53c69 | ||
|
62b95316b2 | ||
|
7efef3b003 | ||
|
9a2e12a4e9 | ||
|
e087158074 | ||
|
b06d1fe67f | ||
|
65186e4537 | ||
|
11f805f0b5 | ||
|
21d51a053b | ||
|
f65d2a7cc9 | ||
|
70f3512120 | ||
|
6d173d0024 | ||
|
29d2c6c5be | ||
|
0c9be85cd7 | ||
|
edfeb87653 | ||
|
dba3201c79 | ||
|
23c17b88b4 | ||
|
1e41667ec6 | ||
|
6e48fc293c | ||
|
c696922fe1 | ||
|
3517348ef7 | ||
|
eabb23fd3e | ||
|
206f02272b | ||
|
c780d5af38 | ||
|
3e8830de82 | ||
|
c94ea5301c | ||
|
b86cd5ba01 | ||
|
14a5029306 | ||
|
dc6074d535 | ||
|
3c99ac805e | ||
|
5dc8bd5248 | ||
|
eac3f519fb | ||
|
4ce74e904b | ||
|
00215ecaeb | ||
|
418116c1cc | ||
|
7b90f83ae9 | ||
|
2745b03b71 | ||
|
2c793ee418 | ||
|
b461979067 | ||
|
4796a2f5b6 | ||
|
b9b19bb5ff | ||
|
45e409b85e | ||
|
5a5bb97a20 | ||
|
8b177f9c05 | ||
|
0fc64ff7f9 | ||
|
11d210545b | ||
|
55312d8ec3 | ||
|
065a022644 | ||
|
32e0971483 | ||
|
754bdc3ab2 | ||
|
78c3b6fa28 | ||
|
c8630d6840 | ||
|
87182dda65 | ||
|
3af0a9f5f3 | ||
|
531a0e6227 | ||
|
3b831f87a4 | ||
|
8212d4901a | ||
|
86d6ce7c6a | ||
|
36d9b238cf | ||
|
5db44ab734 | ||
|
825c65e204 | ||
|
450bead2d1 | ||
|
9dbb1dbe8a | ||
|
b23ff6675d | ||
|
04ed77f829 | ||
|
2bd4b289b3 | ||
|
d339c6af97 | ||
|
d90085acb5 | ||
|
711d62cd8f | ||
|
8fa73cf079 | ||
|
4a6119daaf | ||
|
57788bd392 | ||
|
82c447cf85 | ||
|
f72d590332 | ||
|
4862def4a4 | ||
|
d4cbe44fa4 | ||
|
f3b1090e53 | ||
|
f85afc44e1 | ||
|
1fd1ee2a97 | ||
|
a61c7198a3 | ||
|
b7093dabc3 | ||
|
41fef9ae3e | ||
|
454ebc6fb6 | ||
|
890c72589e | ||
|
df3d6511c8 | ||
|
b1d29c491f | ||
|
64705178ab | ||
|
24d4cc87af | ||
|
3150f71342 | ||
|
228fe91a72 | ||
|
546c09da5b | ||
|
cc65563714 | ||
|
bcb1f7dfbd | ||
|
d628896c91 | ||
|
ad439d157a | ||
|
9f15b0e50f | ||
|
c6f99edf46 | ||
|
6711900d72 | ||
|
7033a1f2a7 | ||
|
8d7ba010a9 | ||
|
eec7559aaa | ||
|
6470e10e29 | ||
|
de1f32bd1f | ||
|
cc0706bfc2 | ||
|
85e59747ab | ||
|
39f9cd7813 | ||
|
03ba544095 | ||
|
753bed4772 | ||
|
693db8bf17 | ||
|
4a1e6de4de | ||
|
cca5c07346 | ||
|
d4f0e73384 | ||
|
f69b3c37fc | ||
|
2e7f2546a2 | ||
|
0d178d4dd1 | ||
|
4e5e1c43a6 | ||
|
a42bcddc2f | ||
|
1e64cba17e | ||
|
8a1e2e5d5b | ||
|
7706de0a2b | ||
|
ad83e77aee | ||
|
afa35b9e65 | ||
|
9a20111767 | ||
|
a12ba4790a | ||
|
3096bbe291 | ||
|
b85bdde0ed | ||
|
8c01edd7cd | ||
|
fc81bd476c | ||
|
84ea2c2cca | ||
|
012b66d982 | ||
|
da6a6c81f1 | ||
|
0306c9a2e5 | ||
|
67ba044b5c | ||
|
0fe3eb15b9 | ||
|
1f681e527c | ||
|
23a06e46a3 | ||
|
2a1209da26 | ||
|
f8434d7a4b | ||
|
05fad19787 | ||
|
e7afb10ed9 | ||
|
ab8923096b | ||
|
d0bc3b7e85 | ||
|
83635a30ee | ||
|
c83c593d58 | ||
|
9d2665b895 | ||
|
b11cd8edb0 | ||
|
26d2da9e29 | ||
|
6f4225ccb2 | ||
|
eea2917be1 | ||
|
98fbe56248 | ||
|
661fcc82ab | ||
|
0be4e6ac62 | ||
|
95b177e25c | ||
|
bb3c5cd539 | ||
|
1bb6f6dd0d | ||
|
9ab45526a1 | ||
|
b6301f3976 | ||
|
f319bc3096 | ||
|
9b9edec517 | ||
|
b4eca2a3d6 | ||
|
4245da6eae | ||
|
0dc4c2697e | ||
|
c12761a42a | ||
|
a53ff1eeef | ||
|
eef443f837 | ||
|
187b1b147d | ||
|
17c0987281 | ||
|
c39b521cb3 | ||
|
ef213175ce | ||
|
a49da28f4d | ||
|
e9e5bef137 | ||
|
d4a78e1a43 | ||
|
61937dd5ac | ||
|
8436f67dfb | ||
|
72be232395 | ||
|
94750c8327 | ||
|
2a04d42fb2 | ||
|
375ea8026c | ||
|
4032f10999 | ||
|
981b63cacc | ||
|
7fa4521145 | ||
|
8fa457e5c6 | ||
|
aa01768e5e | ||
|
815a9ce759 | ||
|
d5d99e166e | ||
|
d114dab8a3 | ||
|
78b2083c9e | ||
|
8a2283cf27 | ||
|
efb840c633 | ||
|
02d6653cc5 | ||
|
eb59b22491 | ||
|
509763f3b2 | ||
|
0a5b0d3ac4 | ||
|
a8ee1c7281 | ||
|
ad862a6816 | ||
|
63a1825b6e | ||
|
0558fb0d68 | ||
|
cd7c9b8d4d | ||
|
65af615c9b | ||
|
11963829fc | ||
|
917ea336c4 | ||
|
f1b6a42561 | ||
|
6c66b54e2a | ||
|
d607dc4a15 | ||
|
5f56c27ba7 | ||
|
4f581b0c31 | ||
|
d9ee9c43d3 | ||
|
29d145a9b1 | ||
|
c54168a656 | ||
|
bbf3340581 | ||
|
d317873fb0 | ||
|
ff0db2000a | ||
|
23cfe89fa0 | ||
|
66dcf7d868 | ||
|
41e9d9a806 | ||
|
a919391e34 | ||
|
7cfeb37257 | ||
|
71170a7eef | ||
|
5ffeba5a3c | ||
|
073bfbcea5 | ||
|
912fd584ba | ||
|
83c18f4971 | ||
|
16b6f732d3 | ||
|
f831662fdd | ||
|
786c5b63c6 | ||
|
17b3fe7b4f | ||
|
11d533cb16 | ||
|
672291381d | ||
|
2ca09829b1 | ||
|
c429efaff1 | ||
|
1e9e4e46e0 | ||
|
6b85628042 | ||
|
58f26bc82c | ||
|
c75a5edc1e | ||
|
8c443bf401 | ||
|
bd7c2595e8 | ||
|
23d6aa738d | ||
|
b529d9a28b | ||
|
aa0304fdaa | ||
|
8b5806d663 | ||
|
8e46c9f3c9 | ||
|
cc0c211759 | ||
|
2a0def5fb5 | ||
|
98ab3513a6 | ||
|
9e94709192 | ||
|
8f590f4f96 | ||
|
4ae7fc8bc9 | ||
|
780845b7b2 | ||
|
6e35026a75 | ||
|
4ac86cc49d | ||
|
fb1ce409bb | ||
|
50fb9a9a3f | ||
|
17f5d064a2 | ||
|
5fa549d3b3 | ||
|
8eff45f7a0 | ||
|
6c8ce85ea9 | ||
|
293c402e7d | ||
|
d374c5faec | ||
|
9f33099b1c | ||
|
effc080bae | ||
|
fa2c299455 | ||
|
ad31ea565c | ||
|
3cb4a817f2 | ||
|
e1536da530 | ||
|
c7275aa72b | ||
|
070e3e5c83 | ||
|
aa39672e4e | ||
|
3d1e33396f | ||
|
11e613b3d5 |
@ -1,9 +1,17 @@
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size=2
|
||||
[*]
|
||||
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
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"root": true,
|
||||
"rules": {
|
||||
"strict": 0,
|
||||
"no-console": 0,
|
||||
@ -10,11 +11,17 @@
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"comma-dangle": ["error", "always-multiline"]
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
"always-multiline"
|
||||
]
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
|
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -23,7 +23,7 @@ A clear and concise description of what you expected to happen.
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
** Version information **
|
||||
**Version information**
|
||||
- OS: [e.g. Windows, MacOS]
|
||||
- Browser: [e.g. Chrome 72]
|
||||
- EasyMDE version: [e.g. 2.5.1]
|
||||
|
95
.github/workflows/cd.yaml
vendored
Normal file
95
.github/workflows/cd.yaml
vendored
Normal 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
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -11,3 +11,7 @@ node_modules/
|
||||
.idea/
|
||||
.vscode/
|
||||
dev_test/
|
||||
|
||||
# Test artifacts
|
||||
cypress/screenshots
|
||||
cypress/videos
|
||||
|
32
.travis.yml
32
.travis.yml
@ -1,32 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '11' # EOL: June 2019
|
||||
- '10' # EOL: April 2021
|
||||
- '8' # EOL: December 2019
|
||||
- '6' # EOL: April 2019
|
||||
script:
|
||||
- npm run prepare
|
||||
- npm run test:types
|
||||
before_deploy:
|
||||
- if [ "$TRAVIS_BRANCH" = master ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then npm version prerelease --no-git-tag-version --preid "$TRAVIS_BUILD_NUMBER"; fi
|
||||
deploy:
|
||||
- provider: npm
|
||||
email: info@saturnserver.org
|
||||
api_key:
|
||||
secure: rp4P11u0Vvz6iTkC1uj9LfNVOJASnTjffpqpe9lhuC/php7+fdoYvZ4e1EwKj2RVbi7YNqZE6w+Y6fsxZk72N4RGVO6HROm6gNv2wl+qk0B1XwciONO9y5FhTcdZrsq5Vx5WdoZThs5CSkXpvtHiavAnAt1ufYjqKGBZOENdxJ40kkn9WdQG2WvG7iZWDlDpDoqof2uO9k89d2UuTG5DKAoMpN+4UH0Fr0gV0u11IcBeH7rlSo2btlMaMsSO9Nb10Zf1rC0USHfyrui/BKvVGeRh7FASYrHwjqt4bwqzKZlP5bZ4zGIPMYXXsGLcidxIvSsNIRp7cgkWvsywe8cIi5XzaM48afWsbMUfMgXi9BDNjK7vBiuPBnGWYS3ylJZn/7SvMuqsoj4De5GWrCJ5pTsEKD5yw5+iqQv7v2ZYhuN7/tTSoEy/BOMdN43zWquJp57LXkyFQ9esGoI0bfeYojV2BvcpwY/UFS27e/9bH+RBlXsLfP0kEtosVGZ6i3AuUKtsYOxo4QZSI4yHtP7fKsoCoJIvpW3hcWjrnI8N7IC18/KihsUByuMgDgTTXXtDKxLbNVjbiVvFJeuClwe1oc1uusY1v/EkNpGDFZX5zFEVv3zC76NaLB75kCUN3gGC0RRFk0J9i3k8qa42TLjbOqvxgRxOEtVeRxowBNrymIQ=
|
||||
tag: next
|
||||
skip_cleanup: true
|
||||
on:
|
||||
node: 10
|
||||
branch: master
|
||||
repo: Ionaru/easy-markdown-editor
|
||||
- provider: npm
|
||||
email: info@saturnserver.org
|
||||
api_key:
|
||||
secure: rp4P11u0Vvz6iTkC1uj9LfNVOJASnTjffpqpe9lhuC/php7+fdoYvZ4e1EwKj2RVbi7YNqZE6w+Y6fsxZk72N4RGVO6HROm6gNv2wl+qk0B1XwciONO9y5FhTcdZrsq5Vx5WdoZThs5CSkXpvtHiavAnAt1ufYjqKGBZOENdxJ40kkn9WdQG2WvG7iZWDlDpDoqof2uO9k89d2UuTG5DKAoMpN+4UH0Fr0gV0u11IcBeH7rlSo2btlMaMsSO9Nb10Zf1rC0USHfyrui/BKvVGeRh7FASYrHwjqt4bwqzKZlP5bZ4zGIPMYXXsGLcidxIvSsNIRp7cgkWvsywe8cIi5XzaM48afWsbMUfMgXi9BDNjK7vBiuPBnGWYS3ylJZn/7SvMuqsoj4De5GWrCJ5pTsEKD5yw5+iqQv7v2ZYhuN7/tTSoEy/BOMdN43zWquJp57LXkyFQ9esGoI0bfeYojV2BvcpwY/UFS27e/9bH+RBlXsLfP0kEtosVGZ6i3AuUKtsYOxo4QZSI4yHtP7fKsoCoJIvpW3hcWjrnI8N7IC18/KihsUByuMgDgTTXXtDKxLbNVjbiVvFJeuClwe1oc1uusY1v/EkNpGDFZX5zFEVv3zC76NaLB75kCUN3gGC0RRFk0J9i3k8qa42TLjbOqvxgRxOEtVeRxowBNrymIQ=
|
||||
skip_cleanup: true
|
||||
on:
|
||||
node: 10
|
||||
branch: master
|
||||
tags: true
|
||||
repo: Ionaru/easy-markdown-editor
|
347
CHANGELOG.md
347
CHANGELOG.md
@ -1,10 +1,186 @@
|
||||
# EasyMDE Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
All notable changes to EasyMDE will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
<!--## [Unreleased]-->
|
||||
<!-- ## [Unreleased] -->
|
||||
## [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]).
|
||||
@ -96,6 +272,18 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
||||
- 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
|
||||
@ -107,12 +295,127 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
||||
[#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
|
||||
@ -122,9 +425,47 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
||||
[@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.6.0...HEAD
|
||||
[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
|
||||
|
@ -1,63 +1,44 @@
|
||||
# Contributing
|
||||
|
||||
Hey, welcome to the party! 🎉
|
||||
|
||||
Thank you so much for contributing to EasyMDE. 😘
|
||||
Thank you so much for your interest in contributing to EasyMDE!
|
||||
|
||||
|
||||
## Asking questions, suggesting wonderful ideas or reporting bugs
|
||||
## Asking questions, suggesting ideas or reporting bugs
|
||||
|
||||
You can [submit an issue️](https://github.com/Ionaru/easy-markdown-editor/issues/new) on this GitHub repository.
|
||||
You can [submit an issue️](https://github.com/Ionaru/easy-markdown-editor/issues) on this GitHub repository.
|
||||
|
||||
|
||||
## Coding
|
||||
|
||||
### 📦 Prerequisites
|
||||
|
||||
You need Node.js and npm.
|
||||
To contribute code to this project you'll need an up-to-date LTS or current version of Node.js and npm.
|
||||
|
||||
To install them on Debian-based systems:
|
||||
|
||||
```bash
|
||||
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
echo -e "nodejs version:\t$(nodejs -v) \nnpm version:\t$(npm -v)"
|
||||
# check that you have node.js and npm.
|
||||
```
|
||||
|
||||
For other systems, please [read the official page](https://nodejs.org/en/download/).
|
||||
Please find information about the installation on [the official Node.js website](https://nodejs.org/en/download/).
|
||||
|
||||
|
||||
### 🏗️ Installation
|
||||
### ⤴️ Workflow
|
||||
|
||||
Here we go! 🤠 First, clone this repository:
|
||||
Please make sure any code you submit is compliant and compatible with this repository's [license](./LICENSE).
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Ionaru/easy-markdown-editor.git
|
||||
cd easy-markdown-editor
|
||||
```
|
||||
#### 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!
|
||||
|
||||
Then install the required dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Yay! You are ready! 🍾
|
||||
|
||||
|
||||
### ⤴️ Creating a pull request
|
||||
|
||||
1. First, [create a fork of this project](https://github.com/Ionaru/easy-markdown-editor/fork), and copy the https URL (*clone or download* button) of your project (something like https://github.com/YOUR_USERNAME/easy-markdown-editor.git );
|
||||
2. a) If you already cloned and worked on the project: `git remote add source https://github.com/Ionaru/easy-markdown-editor.git`;
|
||||
b) Otherwise, clone your fork: `git clone https://github.com/YOUR_USERNAME/easy-markdown-editor.git`;
|
||||
3. Create a new dedicated branch `git checkout -b myMergeRequest`;
|
||||
4. Write some nice code and commit your work. (Don't forget to add your changes to the changelog!);
|
||||
5. Check files against the ESLint syntax and build minified versions: `gulp`;
|
||||
6. Test your changes;
|
||||
7. Push it to a dedicated branch `git push origin myMergeRequest`;
|
||||
8. Go to the [main project page](https://github.com/Ionaru/easy-markdown-editor) and click on the button *Compare and pull request*, then fill the description.
|
||||
|
||||
If you want to make other pull requests, go back to the master branch (`git checkout master`), update it (`git pull --rebase source master`), then follow the instructions above from step 3.
|
||||
#### 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! 💜
|
||||
|
468
README.md
468
README.md
@ -1,8 +1,9 @@
|
||||
# EasyMDE - Markdown Editor
|
||||
|
||||
[](https://www.npmjs.com/package/easymde)
|
||||
[](https://www.npmjs.com/package/easymde/v/next)
|
||||
[](https://travis-ci.org/Ionaru/easy-markdown-editor)
|
||||
[](https://www.npmjs.com/package/easymde/v/next)
|
||||
[](https://www.npmjs.com/package/easymde/v/v3-alpha)
|
||||
[](https://github.com/Ionaru/easy-markdown-editor/actions?query=branch%3Amaster)
|
||||
|
||||
> This repository is a fork of
|
||||
[SimpleMDE, made by Sparksuite](https://github.com/sparksuite/simplemde-markdown-editor/).
|
||||
@ -16,32 +17,34 @@ In addition, the syntax is rendered while editing to clearly show the expected r
|
||||
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://easymde.tk/)
|
||||
[**Try the demo**](https://stackblitz.com/edit/easymde/)
|
||||
|
||||
[](https://easymde.tk/)
|
||||
[](https://stackblitz.com/edit/easymde/)
|
||||
|
||||
|
||||
## 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)
|
||||
- [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)
|
||||
|
||||
|
||||
## Install EasyMDE
|
||||
@ -49,7 +52,7 @@ The editor is entirely customizable, from theming to toolbar buttons and javascr
|
||||
Via [npm](https://www.npmjs.com/package/easymde):
|
||||
|
||||
```
|
||||
npm install easymde --save
|
||||
npm install easymde
|
||||
```
|
||||
|
||||
Via the *UNPKG* CDN:
|
||||
@ -59,42 +62,37 @@ Via the *UNPKG* CDN:
|
||||
<script src="https://unpkg.com/easymde/dist/easymde.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>
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
### Loading the editor
|
||||
|
||||
After installing and/or importing the module, you can load EasyMDE onto the first TextArea on the web page:
|
||||
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 easyMDE = new EasyMDE();
|
||||
const easyMDE = new EasyMDE();
|
||||
</script>
|
||||
```
|
||||
|
||||
Alternatively you can select a specific TextArea, via Javascript:
|
||||
Alternatively you can select a specific `textarea`, via JavaScript:
|
||||
|
||||
```html
|
||||
<textarea id="my-text-area"></textarea>
|
||||
<script>
|
||||
var easyMDE = new EasyMDE({element: document.getElementById('my-text-area')});
|
||||
const easyMDE = new EasyMDE({element: document.getElementById('my-text-area')});
|
||||
</script>
|
||||
```
|
||||
|
||||
Or via jQuery:
|
||||
|
||||
```html
|
||||
<textarea id="my-text-area"></textarea>
|
||||
<script>
|
||||
var easyMDE = new EasyMDE({element: $('#my-text-area')[0]});
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
### Editor functions
|
||||
|
||||
Use EasyMDE.value() to get the content of the editor:
|
||||
Use `easyMDE.value()` to get the content of the editor:
|
||||
|
||||
```html
|
||||
<script>
|
||||
@ -102,7 +100,7 @@ easyMDE.value();
|
||||
</script>
|
||||
```
|
||||
|
||||
Use EasyMDE.value(val) to set the content of the editor:
|
||||
Use `easyMDE.value(val)` to set the content of the editor:
|
||||
|
||||
```html
|
||||
<script>
|
||||
@ -119,43 +117,88 @@ easyMDE.value('New input for **EasyMDE**');
|
||||
- **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`, saves the text automatically. Defaults to `false`.
|
||||
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
|
||||
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (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.
|
||||
- **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"`. 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://marked.js.org/#/USING_ADVANCED.md#options). Other `renderingConfig` options will take precedence.
|
||||
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
|
||||
- **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`.
|
||||
@ -164,91 +207,120 @@ easyMDE.value('New input for **EasyMDE**');
|
||||
- **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`.
|
||||
|
||||
|
||||
### Options example
|
||||
|
||||
Most options demonstrate the non-default behavior:
|
||||
|
||||
```JavaScript
|
||||
var editor = new EasyMDE({
|
||||
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: [""],
|
||||
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);
|
||||
```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: [""],
|
||||
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...",
|
||||
|
||||
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,
|
||||
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 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)").
|
||||
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.
|
||||
|
||||
@ -270,12 +342,15 @@ ordered-list | toggleOrderedList | Numbered List<br>fa fa-list-ol
|
||||
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://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
|
||||
|
||||
|
||||
### Toolbar customization
|
||||
@ -284,36 +359,83 @@ Customize the toolbar using the `toolbar` option.
|
||||
|
||||
Only the order of existing buttons:
|
||||
|
||||
```JavaScript
|
||||
var easyMDE = new EasyMDE({
|
||||
toolbar: ["bold", "italic", "heading", "|", "quote"]
|
||||
```js
|
||||
const easyMDE = new EasyMDE({
|
||||
toolbar: ["bold", "italic", "heading", "|", "quote"]
|
||||
});
|
||||
```
|
||||
|
||||
All information and/or add your own icons
|
||||
All information and/or add your own icons or text
|
||||
|
||||
```Javascript
|
||||
var easyMDE = new EasyMDE({
|
||||
toolbar: [{
|
||||
name: "bold",
|
||||
action: EasyMDE.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
|
||||
// [, ...]
|
||||
]
|
||||
```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
|
||||
// [, ...]
|
||||
]
|
||||
});
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
@ -321,30 +443,36 @@ EasyMDE comes with an array of predefined keyboard shortcuts, but they can be al
|
||||
|
||||
Shortcut (Windows / Linux) | Shortcut (macOS) | Action
|
||||
:--- | :--- | :---
|
||||
*Ctrl-'* | *Cmd-'* | "toggleBlockquote"
|
||||
*Ctrl-B* | *Cmd-B* | "toggleBold"
|
||||
*Ctrl-E* | *Cmd-E* | "cleanBlock"
|
||||
*Ctrl-H* | *Cmd-H* | "toggleHeadingSmaller"
|
||||
*Ctrl-I* | *Cmd-I* | "toggleItalic"
|
||||
*Ctrl-K* | *Cmd-K* | "drawLink"
|
||||
*Ctrl-L* | *Cmd-L* | "toggleUnorderedList"
|
||||
*Ctrl-P* | *Cmd-P* | "togglePreview"
|
||||
*Ctrl-Alt-C* | *Cmd-Alt-C* | "toggleCodeBlock"
|
||||
*Ctrl-Alt-I* | *Cmd-Alt-I* | "drawImage"
|
||||
*Ctrl-Alt-L* | *Cmd-Alt-L* | "toggleOrderedList"
|
||||
*Shift-Ctrl-H* | *Shift-Cmd-H* | "toggleHeadingBigger"
|
||||
*F9* | *F9* | "toggleSideBySide"
|
||||
*F11* | *F11* | "toggleFullScreen"
|
||||
<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 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
|
||||
}
|
||||
```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
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
@ -359,10 +487,10 @@ The list of actions that can be bound is the same as the list of built-in action
|
||||
|
||||
You can catch the following list of events: https://codemirror.net/doc/manual.html#events
|
||||
|
||||
```JavaScript
|
||||
var easyMDE = new EasyMDE();
|
||||
easyMDE.codemirror.on("change", function(){
|
||||
console.log(easyMDE.value());
|
||||
```js
|
||||
const easyMDE = new EasyMDE();
|
||||
easyMDE.codemirror.on("change", () => {
|
||||
console.log(easyMDE.value());
|
||||
});
|
||||
```
|
||||
|
||||
@ -371,20 +499,22 @@ easyMDE.codemirror.on("change", function(){
|
||||
|
||||
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.
|
||||
|
||||
```JavaScript
|
||||
var easyMDE = new EasyMDE();
|
||||
```js
|
||||
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
|
||||
var easyMDE = new EasyMDE();
|
||||
const easyMDE = new EasyMDE();
|
||||
easyMDE.isPreviewActive(); // returns boolean
|
||||
easyMDE.isSideBySideActive(); // returns boolean
|
||||
easyMDE.isFullscreenActive(); // returns boolean
|
||||
@ -398,7 +528,7 @@ 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
|
||||
@ -413,7 +543,7 @@ Changes include:
|
||||
* Support for Node 8 and beyond
|
||||
* Lots of refactored code
|
||||
* Links in preview will open in a new tab by default
|
||||
* Typescript support
|
||||
* TypeScript support
|
||||
|
||||
My intention is to continue development on this project, improving it and keeping it alive.
|
||||
|
||||
|
10
cypress.config.ts
Normal file
10
cypress.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { defineConfig } from 'cypress';
|
||||
|
||||
export default defineConfig({
|
||||
e2e: {
|
||||
excludeSpecPattern: [
|
||||
'**/*.html',
|
||||
],
|
||||
video: true,
|
||||
},
|
||||
});
|
14
cypress/.eslintrc
Normal file
14
cypress/.eslintrc
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"plugins": [
|
||||
"cypress"
|
||||
],
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"cypress/globals": true
|
||||
},
|
||||
"extends": [
|
||||
"../.eslintrc",
|
||||
"plugin:cypress/recommended"
|
||||
]
|
||||
}
|
18
cypress/e2e/1-default-editor/index.html
Normal file
18
cypress/e2e/1-default-editor/index.html
Normal 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>
|
31
cypress/e2e/1-default-editor/preview.cy.js
Normal file
31
cypress/e2e/1-default-editor/preview.cy.js
Normal 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>');
|
||||
});
|
||||
});
|
56
cypress/e2e/1-default-editor/statusbar.cy.js
Normal file
56
cypress/e2e/1-default-editor/statusbar.cy.js
Normal 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');
|
||||
});
|
||||
});
|
17
cypress/e2e/1-default-editor/visual.cy.js
Normal file
17
cypress/e2e/1-default-editor/visual.cy.js
Normal 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');
|
||||
});
|
||||
});
|
20
cypress/e2e/2-url-prompt/index.html
Normal file
20
cypress/e2e/2-url-prompt/index.html
Normal 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>
|
232
cypress/e2e/2-url-prompt/url-prompt.cy.js
Normal file
232
cypress/e2e/2-url-prompt/url-prompt.cy.js
Normal 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&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)&more=(param3,param4)&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>');
|
||||
});
|
||||
});
|
17
cypress/e2e/3-class-prefix/class-prefix.cy.js
Normal file
17
cypress/e2e/3-class-prefix/class-prefix.cy.js
Normal 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);
|
||||
});
|
||||
});
|
21
cypress/e2e/3-class-prefix/index-no-prefix.html
Normal file
21
cypress/e2e/3-class-prefix/index-no-prefix.html
Normal 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>
|
22
cypress/e2e/3-class-prefix/index.html
Normal file
22
cypress/e2e/3-class-prefix/index.html
Normal 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>
|
43
cypress/e2e/4.image-rendering/image-rendering.cy.js
Normal file
43
cypress/e2e/4.image-rendering/image-rendering.cy.js
Normal 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}');
|
||||
|
||||
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}');
|
||||
|
||||
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>`);
|
||||
});
|
||||
});
|
20
cypress/e2e/4.image-rendering/index.html
Normal file
20
cypress/e2e/4.image-rendering/index.html
Normal 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>
|
24
cypress/e2e/5-marked-options/index.html
Normal file
24
cypress/e2e/5-marked-options/index.html
Normal 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>
|
18
cypress/e2e/5-marked-options/marked-options.cy.js
Normal file
18
cypress/e2e/5-marked-options/marked-options.cy.js
Normal 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
10
cypress/plugins/index.js
Normal 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
|
||||
};
|
31
cypress/support/commands.js
Normal file
31
cypress/support/commands.js
Normal 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
1
cypress/support/e2e.js
Normal file
@ -0,0 +1 @@
|
||||
require('./commands');
|
20
example/index.html
Normal file
20
example/index.html
Normal 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>
|
20
example/index_sideBySideFullscreenFalse.html
Normal file
20
example/index_sideBySideFullscreenFalse.html
Normal 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>
|
27
gulpfile.js
27
gulpfile.js
@ -2,7 +2,7 @@
|
||||
|
||||
var gulp = require('gulp');
|
||||
var cleanCSS = require('gulp-clean-css');
|
||||
var uglify = require('gulp-uglify');
|
||||
var terser = require('gulp-terser');
|
||||
var concat = require('gulp-concat');
|
||||
var header = require('gulp-header');
|
||||
var buffer = require('vinyl-buffer');
|
||||
@ -15,11 +15,18 @@ 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');
|
||||
|
||||
|
||||
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())
|
||||
@ -31,18 +38,12 @@ 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/'));
|
||||
}
|
||||
|
||||
function styles() {
|
||||
var css_files = [
|
||||
'./node_modules/codemirror/lib/codemirror.css',
|
||||
'./src/css/*.css',
|
||||
'./node_modules/codemirror-spell-checker/src/css/spell-checker.css',
|
||||
];
|
||||
|
||||
return gulp.src(css_files)
|
||||
.pipe(concat('easymde.css'))
|
||||
.pipe(cleanCSS())
|
||||
@ -52,6 +53,14 @@ function styles() {
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
16390
package-lock.json
generated
16390
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "easymde",
|
||||
"version": "2.6.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/**/*",
|
||||
@ -19,27 +19,37 @@
|
||||
"license": "MIT",
|
||||
"author": "Jeroen Akkerman",
|
||||
"dependencies": {
|
||||
"codemirror": "^5.43.0",
|
||||
"@types/codemirror": "^5.60.10",
|
||||
"@types/marked": "^4.0.7",
|
||||
"codemirror": "^5.65.15",
|
||||
"codemirror-spell-checker": "1.1.2",
|
||||
"marked": "^0.6.2"
|
||||
"marked": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/codemirror": "0.0.72",
|
||||
"browserify": "^16.2.3",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-clean-css": "^4.0.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": "^5.0.0",
|
||||
"gulp-header": "^2.0.7",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-uglify": "^3.0.1",
|
||||
"typescript": "^3.3.3",
|
||||
"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": "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"
|
||||
}
|
||||
}
|
||||
|
@ -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,20 +36,27 @@
|
||||
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;
|
||||
}
|
||||
|
||||
.CodeMirror-placeholder {
|
||||
.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;
|
||||
}
|
||||
|
||||
.CodeMirror-focused .CodeMirror-selected {
|
||||
.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected {
|
||||
background: #d9d9d9;
|
||||
}
|
||||
|
||||
@ -46,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;
|
||||
@ -119,12 +122,15 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -133,6 +139,13 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -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,25 +260,32 @@
|
||||
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;
|
||||
}
|
||||
@ -283,23 +303,37 @@
|
||||
}
|
||||
|
||||
.cm-s-easymde .cm-header-1 {
|
||||
font-size: 200%;
|
||||
line-height: 200%;
|
||||
font-size: calc(1.375rem + 1.5vw);
|
||||
}
|
||||
|
||||
.cm-s-easymde .cm-header-2 {
|
||||
font-size: 160%;
|
||||
line-height: 160%;
|
||||
font-size: calc(1.325rem + .9vw);
|
||||
}
|
||||
|
||||
.cm-s-easymde .cm-header-3 {
|
||||
font-size: 125%;
|
||||
line-height: 125%;
|
||||
font-size: calc(1.3rem + .6vw);
|
||||
}
|
||||
|
||||
.cm-s-easymde .cm-header-4 {
|
||||
font-size: 110%;
|
||||
line-height: 110%;
|
||||
font-size: calc(1.275rem + .3vw);
|
||||
}
|
||||
|
||||
.cm-s-easymde .cm-header-5 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.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 {
|
||||
@ -319,3 +353,51 @@
|
||||
color: #7f8c8d;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
1393
src/js/easymde.js
1393
src/js/easymde.js
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,22 @@
|
||||
// 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
|
||||
toggleFullScreen: null,
|
||||
},
|
||||
previewClass: 'my-custom-class',
|
||||
spellChecker: false,
|
||||
onToggleFullScreen: (full: boolean) => {
|
||||
console.log('FullscreenToggled', full);
|
||||
},
|
||||
theme: 'someOtherTheme',
|
||||
minHeight: '200px',
|
||||
});
|
||||
|
||||
// Editor functions
|
||||
@ -28,3 +33,206 @@ editor.codemirror.setOption('readOnly', true);
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
150
types/easymde.d.ts
vendored
150
types/easymde.d.ts
vendored
@ -1,16 +1,16 @@
|
||||
// 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
|
||||
@ -21,11 +21,53 @@
|
||||
|
||||
/// <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 {
|
||||
@ -34,6 +76,10 @@ declare namespace EasyMDE {
|
||||
italic?: string;
|
||||
}
|
||||
|
||||
interface CustomAttributes {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
interface InsertTextOptions {
|
||||
horizontalRule?: ReadonlyArray<string>;
|
||||
image?: ReadonlyArray<string>;
|
||||
@ -47,9 +93,17 @@ declare namespace EasyMDE {
|
||||
underscoresBreakWords?: boolean;
|
||||
}
|
||||
|
||||
interface PromptTexts {
|
||||
image?: string;
|
||||
link?: string;
|
||||
}
|
||||
|
||||
interface RenderingOptions {
|
||||
codeSyntaxHighlighting?: boolean;
|
||||
hljs?: any;
|
||||
markedOptions?: marked.MarkedExtension;
|
||||
sanitizerFunction?: (html: string) => string;
|
||||
singleLineBreaks?: boolean;
|
||||
codeSyntaxHighlighting: boolean;
|
||||
}
|
||||
|
||||
interface Shortcuts {
|
||||
@ -77,6 +131,15 @@ declare namespace EasyMDE {
|
||||
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);
|
||||
@ -84,35 +147,96 @@ declare namespace EasyMDE {
|
||||
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<string>;
|
||||
hideIcons?: ReadonlyArray<ToolbarButton>;
|
||||
indentWithTabs?: boolean;
|
||||
initialValue?: string;
|
||||
insertTexts?: InsertTextOptions;
|
||||
lineNumbers?: boolean;
|
||||
lineWrapping?: boolean;
|
||||
minHeight?: string;
|
||||
maxHeight?: string;
|
||||
parsingConfig?: ParsingOptions;
|
||||
placeholder?: string;
|
||||
previewRender?: (markdownPlaintext: string, previewElement: HTMLElement) => 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<string>;
|
||||
spellChecker?: boolean;
|
||||
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<string | ToolbarIcon>;
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,6 +248,8 @@ declare class EasyMDE {
|
||||
|
||||
codemirror: CodeMirror.Editor;
|
||||
|
||||
cleanup(): void;
|
||||
|
||||
toTextArea(): void;
|
||||
|
||||
isPreviewActive(): boolean;
|
||||
@ -134,6 +260,8 @@ declare class EasyMDE {
|
||||
|
||||
clearAutosavedValue(): void;
|
||||
|
||||
updateStatusBar(itemName: string, content: string): void;
|
||||
|
||||
static toggleBold: (editor: EasyMDE) => void;
|
||||
static toggleItalic: (editor: EasyMDE) => void;
|
||||
static toggleStrikethrough: (editor: EasyMDE) => void;
|
||||
@ -142,6 +270,9 @@ declare class EasyMDE {
|
||||
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;
|
||||
@ -149,6 +280,7 @@ declare class EasyMDE {
|
||||
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;
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es3",
|
||||
"ignoreDeprecations": "5.0",
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noEmit": true
|
||||
|
Loading…
x
Reference in New Issue
Block a user