@standardnotes/markdown-visual 1.0.7 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/config-overrides.js +2 -0
  3. package/package.json +43 -49
  4. package/{build → public}/favicon.ico +0 -0
  5. package/public/index.html +31 -0
  6. package/{build → public}/logo192.png +0 -0
  7. package/{build → public}/logo512.png +0 -0
  8. package/{build → public}/manifest.json +0 -0
  9. package/{build → public}/robots.txt +0 -0
  10. package/public/sample.ext.json +15 -0
  11. package/src/components/CodeMirror/index.tsx +94 -0
  12. package/src/components/CodeMirror/styles.scss +55 -0
  13. package/src/components/Milkdown/editor.ts +62 -0
  14. package/src/components/Milkdown/index.tsx +77 -0
  15. package/src/components/Milkdown/plugins/advanced-menu/README.md +3 -0
  16. package/src/components/Milkdown/plugins/advanced-menu/button.ts +102 -0
  17. package/src/components/Milkdown/plugins/advanced-menu/config.ts +94 -0
  18. package/src/components/Milkdown/plugins/advanced-menu/divider.ts +37 -0
  19. package/src/components/Milkdown/plugins/advanced-menu/index.ts +64 -0
  20. package/src/components/Milkdown/plugins/advanced-menu/manager.ts +122 -0
  21. package/src/components/Milkdown/plugins/advanced-menu/menuBar.ts +108 -0
  22. package/src/components/Milkdown/plugins/advanced-menu/select.ts +163 -0
  23. package/src/components/Milkdown/styles.scss +209 -0
  24. package/src/components/SplitView/index.tsx +42 -0
  25. package/src/components/SplitView/styles.scss +51 -0
  26. package/src/index.tsx +215 -0
  27. package/src/react-app-env.d.ts +1 -0
  28. package/src/setupTests.ts +5 -0
  29. package/src/stylesheets/main.scss +45 -0
  30. package/src/stylesheets/prism/material-light.css +207 -0
  31. package/tsconfig.json +21 -0
  32. package/.env +0 -1
  33. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  34. package/.github/ISSUE_TEMPLATE/config.yml +0 -4
  35. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -22
  36. package/.github/ISSUE_TEMPLATE/help-request.md +0 -38
  37. package/.husky/pre-commit +0 -4
  38. package/build/asset-manifest.json +0 -83
  39. package/build/index.html +0 -1
  40. package/build/package.json +0 -22
  41. package/build/static/css/main.904cd38b.css +0 -2
  42. package/build/static/css/main.904cd38b.css.map +0 -1
  43. package/build/static/js/main.ad13c3af.js +0 -3
  44. package/build/static/js/main.ad13c3af.js.LICENSE.txt +0 -65
  45. package/build/static/js/main.ad13c3af.js.map +0 -1
  46. package/build/static/media/KaTeX_AMS-Regular.73ea273a72f4aca30ca5.woff2 +0 -0
  47. package/build/static/media/KaTeX_AMS-Regular.853be92419a6c3766b9a.ttf +0 -0
  48. package/build/static/media/KaTeX_AMS-Regular.d562e886c52f12660a41.woff +0 -0
  49. package/build/static/media/KaTeX_Caligraphic-Bold.7489a2fbfb9bfe704420.ttf +0 -0
  50. package/build/static/media/KaTeX_Caligraphic-Bold.a1abf90dfd72792a577a.woff2 +0 -0
  51. package/build/static/media/KaTeX_Caligraphic-Bold.d757c535a2e5902f1325.woff +0 -0
  52. package/build/static/media/KaTeX_Caligraphic-Regular.7e873d3833eb108a0758.ttf +0 -0
  53. package/build/static/media/KaTeX_Caligraphic-Regular.d6484fce1ef428d5bd94.woff2 +0 -0
  54. package/build/static/media/KaTeX_Caligraphic-Regular.db074fa22cf224af93d7.woff +0 -0
  55. package/build/static/media/KaTeX_Fraktur-Bold.354501bac435c3264834.woff +0 -0
  56. package/build/static/media/KaTeX_Fraktur-Bold.4c761b3711973ab04edf.ttf +0 -0
  57. package/build/static/media/KaTeX_Fraktur-Bold.931d67ea207ab37ee693.woff2 +0 -0
  58. package/build/static/media/KaTeX_Fraktur-Regular.172d3529b26f8cedef6b.woff2 +0 -0
  59. package/build/static/media/KaTeX_Fraktur-Regular.6fdf0ac577be0ba82a4c.woff +0 -0
  60. package/build/static/media/KaTeX_Fraktur-Regular.ed305b5434865e06ffde.ttf +0 -0
  61. package/build/static/media/KaTeX_Main-Bold.0c3b8929d377c0e9b2f3.woff +0 -0
  62. package/build/static/media/KaTeX_Main-Bold.39890742bc957b368704.woff2 +0 -0
  63. package/build/static/media/KaTeX_Main-Bold.8169508bf58f8bd92ad8.ttf +0 -0
  64. package/build/static/media/KaTeX_Main-BoldItalic.20f389c4120be058d80a.woff2 +0 -0
  65. package/build/static/media/KaTeX_Main-BoldItalic.428978dc7837d46de091.woff +0 -0
  66. package/build/static/media/KaTeX_Main-BoldItalic.828abcb200061cffbaae.ttf +0 -0
  67. package/build/static/media/KaTeX_Main-Italic.fa675e5e4bec9eb250b6.ttf +0 -0
  68. package/build/static/media/KaTeX_Main-Italic.fd947498bc16392e76c2.woff +0 -0
  69. package/build/static/media/KaTeX_Main-Italic.fe2176f79edaa716e621.woff2 +0 -0
  70. package/build/static/media/KaTeX_Main-Regular.4f35fbcc9ee8614c2bcc.woff +0 -0
  71. package/build/static/media/KaTeX_Main-Regular.9eba1d77abcf2aa6e94e.ttf +0 -0
  72. package/build/static/media/KaTeX_Main-Regular.f650f111a3b890d116f1.woff2 +0 -0
  73. package/build/static/media/KaTeX_Math-BoldItalic.3f07ed67f06c720120ce.woff +0 -0
  74. package/build/static/media/KaTeX_Math-BoldItalic.bf2d440b3a42ea78a998.ttf +0 -0
  75. package/build/static/media/KaTeX_Math-BoldItalic.dcbcbd93bac0470b462d.woff2 +0 -0
  76. package/build/static/media/KaTeX_Math-Italic.6d3d25f4820d0da8f01f.woff2 +0 -0
  77. package/build/static/media/KaTeX_Math-Italic.8a5f936332e8028c7278.ttf +0 -0
  78. package/build/static/media/KaTeX_Math-Italic.96759856b4e70f3a8338.woff +0 -0
  79. package/build/static/media/KaTeX_SansSerif-Bold.5b49f4993ae22d7975b4.ttf +0 -0
  80. package/build/static/media/KaTeX_SansSerif-Bold.95591a929f0d32aa282a.woff2 +0 -0
  81. package/build/static/media/KaTeX_SansSerif-Bold.b9cd458ac6d5889ff9c3.woff +0 -0
  82. package/build/static/media/KaTeX_SansSerif-Italic.7d393d382f3e7fb1c637.woff2 +0 -0
  83. package/build/static/media/KaTeX_SansSerif-Italic.8d593cfaa96238d5e2f8.woff +0 -0
  84. package/build/static/media/KaTeX_SansSerif-Italic.b257a18c016f37ee4543.ttf +0 -0
  85. package/build/static/media/KaTeX_SansSerif-Regular.02271ec5cb9f5b4588ac.woff +0 -0
  86. package/build/static/media/KaTeX_SansSerif-Regular.2f7bc363fc5424ebda59.ttf +0 -0
  87. package/build/static/media/KaTeX_SansSerif-Regular.cd5e231e0cc53b2cb2c0.woff2 +0 -0
  88. package/build/static/media/KaTeX_Script-Regular.073b3402d036714b4370.woff +0 -0
  89. package/build/static/media/KaTeX_Script-Regular.c81d1b2a4b75d3eded60.woff2 +0 -0
  90. package/build/static/media/KaTeX_Script-Regular.fc9ba5249878cd8f8d88.ttf +0 -0
  91. package/build/static/media/KaTeX_Size1-Regular.0108e89c9003e8c14ea3.woff +0 -0
  92. package/build/static/media/KaTeX_Size1-Regular.6de7d4b539221a49e9e2.ttf +0 -0
  93. package/build/static/media/KaTeX_Size1-Regular.6eec866c69313624be60.woff2 +0 -0
  94. package/build/static/media/KaTeX_Size2-Regular.2960900c4f271311eb36.woff2 +0 -0
  95. package/build/static/media/KaTeX_Size2-Regular.3a99e70aee4076660d38.woff +0 -0
  96. package/build/static/media/KaTeX_Size2-Regular.57f5c1837853986ea1db.ttf +0 -0
  97. package/build/static/media/KaTeX_Size3-Regular.7947224e8a9914fa332b.woff +0 -0
  98. package/build/static/media/KaTeX_Size3-Regular.8d6b6822586eea3d3b20.ttf +0 -0
  99. package/build/static/media/KaTeX_Size3-Regular.e1951519f6f0596f7356.woff2 +0 -0
  100. package/build/static/media/KaTeX_Size4-Regular.4ad7c7e8bb8d10a34bb7.ttf +0 -0
  101. package/build/static/media/KaTeX_Size4-Regular.aeffd8025cba3647f1a6.woff +0 -0
  102. package/build/static/media/KaTeX_Size4-Regular.e418bf257af1052628d8.woff2 +0 -0
  103. package/build/static/media/KaTeX_Typewriter-Regular.4c6b94fd1d07f8beff7c.woff +0 -0
  104. package/build/static/media/KaTeX_Typewriter-Regular.c295e7f71970f03c0549.woff2 +0 -0
  105. package/build/static/media/KaTeX_Typewriter-Regular.c5c02d763c89380dcb4e.ttf +0 -0
  106. package/build/static/media/material-icons-outlined.123a7ad6784163c39aaa.woff +0 -0
  107. package/build/static/media/material-icons-outlined.5d7deb03b9cecba7d247.woff2 +0 -0
  108. package/build/static/media/material-icons-round.159dc8004e17a33f287f.woff +0 -0
  109. package/build/static/media/material-icons-round.7c985a8aea387341edf9.woff2 +0 -0
  110. package/build/static/media/material-icons-sharp.25f4d306806e85bc60f6.woff2 +0 -0
  111. package/build/static/media/material-icons-sharp.77bc1b022b575be35fa7.woff +0 -0
  112. package/build/static/media/material-icons-two-tone.7e94e72135150c6b387c.woff2 +0 -0
  113. package/build/static/media/material-icons-two-tone.ee71463e28071436d096.woff +0 -0
  114. package/build/static/media/material-icons.824b570fb059ee0a44a9.woff +0 -0
  115. package/build/static/media/material-icons.aba5a2a316a1d312db26.woff2 +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,108 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.3.0](https://github.com/standardnotes/plugins/compare/@standardnotes/markdown-visual@1.2.3...@standardnotes/markdown-visual@1.3.0) (2023-01-20)
7
+
8
+ ### Features
9
+
10
+ * designate markdown visual as community ([25c2b06](https://github.com/standardnotes/plugins/commit/25c2b0691c56c0eb96d5c2989ff2a9362dac37c2))
11
+
12
+ ## [1.2.3](https://github.com/standardnotes/plugins/compare/@standardnotes/markdown-visual@1.2.2...@standardnotes/markdown-visual@1.2.3) (2022-11-04)
13
+
14
+ **Note:** Version bump only for package @standardnotes/markdown-visual
15
+
16
+ ## [1.2.2](https://github.com/standardnotes/plugins/compare/@standardnotes/markdown-visual@1.2.1...@standardnotes/markdown-visual@1.2.2) (2022-11-04)
17
+
18
+ **Note:** Version bump only for package @standardnotes/markdown-visual
19
+
20
+ ## [1.2.1](https://github.com/standardnotes/plugins/compare/@standardnotes/markdown-visual@1.2.0...@standardnotes/markdown-visual@1.2.1) (2022-11-04)
21
+
22
+ **Note:** Version bump only for package @standardnotes/markdown-visual
23
+
24
+ # 1.2.0 (2022-11-04)
25
+
26
+ ### Features
27
+
28
+ * add core plugins ([b607787](https://github.com/standardnotes/plugins/commit/b60778762306f5647cb715102eab23083b266718))
29
+
30
+ ## [1.1.5](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.1.4...@standardnotes/markdown-visual@1.1.5) (2022-11-01)
31
+
32
+ **Note:** Version bump only for package @standardnotes/markdown-visual
33
+
34
+ ## [1.1.4](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.1.3...@standardnotes/markdown-visual@1.1.4) (2022-10-27)
35
+
36
+ **Note:** Version bump only for package @standardnotes/markdown-visual
37
+
38
+ ## [1.1.3](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.1.2...@standardnotes/markdown-visual@1.1.3) (2022-10-05)
39
+
40
+ **Note:** Version bump only for package @standardnotes/markdown-visual
41
+
42
+ ## [1.1.2](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.1.1...@standardnotes/markdown-visual@1.1.2) (2022-07-13)
43
+
44
+ ### Bug Fixes
45
+
46
+ * upgrade jest with types to latest version ([09e08ca](https://github.com/standardnotes/app/commit/09e08ca899ba8694cf43292e918c4c204c0d2cb9))
47
+
48
+ ## [1.1.1](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.1.0...@standardnotes/markdown-visual@1.1.1) (2022-06-30)
49
+
50
+ **Note:** Version bump only for package @standardnotes/markdown-visual
51
+
52
+ # [1.1.0](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.12...@standardnotes/markdown-visual@1.1.0) (2022-06-29)
53
+
54
+ ### Features
55
+
56
+ * deprecated editors ([#1166](https://github.com/standardnotes/app/issues/1166)) ([60ca415](https://github.com/standardnotes/app/commit/60ca4150446f9a14bb6a31416686c6d07a7d0cd9))
57
+
58
+ ## [1.0.12](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.12-alpha.0...@standardnotes/markdown-visual@1.0.12) (2022-06-23)
59
+
60
+ **Note:** Version bump only for package @standardnotes/markdown-visual
61
+
62
+ ## [1.0.12-alpha.0](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.11...@standardnotes/markdown-visual@1.0.12-alpha.0) (2022-06-23)
63
+
64
+ **Note:** Version bump only for package @standardnotes/markdown-visual
65
+
66
+ ## [1.0.11](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.11-alpha.1...@standardnotes/markdown-visual@1.0.11) (2022-06-22)
67
+
68
+ **Note:** Version bump only for package @standardnotes/markdown-visual
69
+
70
+ ## [1.0.11-alpha.1](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.11-alpha.0...@standardnotes/markdown-visual@1.0.11-alpha.1) (2022-06-22)
71
+
72
+ ### Bug Fixes
73
+
74
+ * components scripts ([#1136](https://github.com/standardnotes/app/issues/1136)) ([e80b4d0](https://github.com/standardnotes/app/commit/e80b4d0ffad495c758b593c30e1c4c754dda9b7e))
75
+
76
+ ## [1.0.11-alpha.0](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.10...@standardnotes/markdown-visual@1.0.11-alpha.0) (2022-06-21)
77
+
78
+ ### Bug Fixes
79
+
80
+ * markdown visual font size ([#1127](https://github.com/standardnotes/app/issues/1127)) ([f4b9b5b](https://github.com/standardnotes/app/commit/f4b9b5b566e8d4104de71a87ee041cdc77c3ce6c))
81
+
82
+ ## 1.0.10 (2022-06-16)
83
+
84
+ **Note:** Version bump only for package @standardnotes/markdown-visual
85
+
86
+ ## 1.0.9 (2022-06-16)
87
+
88
+ **Note:** Version bump only for package @standardnotes/markdown-visual
89
+
90
+ ## [1.0.8](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.8-alpha.3...@standardnotes/markdown-visual@1.0.8) (2022-06-16)
91
+
92
+ **Note:** Version bump only for package @standardnotes/markdown-visual
93
+
94
+ ## [1.0.8-alpha.3](https://github.com/standardnotes/app/compare/@standardnotes/markdown-visual@1.0.8-alpha.2...@standardnotes/markdown-visual@1.0.8-alpha.3) (2022-06-16)
95
+
96
+ **Note:** Version bump only for package @standardnotes/markdown-visual
97
+
98
+ ## 1.0.8-alpha.2 (2022-06-16)
99
+
100
+ **Note:** Version bump only for package @standardnotes/markdown-visual
101
+
102
+ ## 1.0.8-alpha.1 (2022-06-16)
103
+
104
+ **Note:** Version bump only for package @standardnotes/markdown-visual
105
+
106
+ ## 1.0.8-alpha.0 (2022-06-15)
107
+
108
+ **Note:** Version bump only for package @standardnotes/markdown-visual
@@ -0,0 +1,2 @@
1
+ const override = require('../cra-app.override')
2
+ module.exports = override
package/package.json CHANGED
@@ -1,84 +1,80 @@
1
1
  {
2
2
  "name": "@standardnotes/markdown-visual",
3
- "version": "1.0.7",
4
- "author": "Johnny Almonte <johnny@standardnotes.com>",
3
+ "version": "1.3.0",
4
+ "author": "Standard Notes.",
5
5
  "description": "A lightweight WYSIWYG markdown editor for Standard Notes, derived from Milkdown.",
6
6
  "keywords": [
7
7
  "Standard Notes",
8
8
  "Standard Notes Extensions"
9
9
  ],
10
- "license": "AGPL-3.0-or-later",
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/standardnotes/markdown-visual.git"
14
- },
15
- "bugs": {
16
- "url": "https://github.com/standardnotes/markdown-visual/issues"
17
- },
18
10
  "sn": {
19
- "main": "build/index.html"
11
+ "name": "Markdown Visual",
12
+ "content_type": "SN|Component",
13
+ "main": "build/index.html",
14
+ "area": "editor-editor",
15
+ "spellcheckControl": true,
16
+ "note_type": "markdown",
17
+ "file_type": "txt"
20
18
  },
21
19
  "publishConfig": {
22
- "access": "public",
23
- "registry": "https://registry.npmjs.org/"
20
+ "access": "public"
24
21
  },
25
22
  "homepage": ".",
26
23
  "scripts": {
27
24
  "analyze": "source-map-explorer 'build/static/js/*.js'",
28
- "start": "react-scripts start",
29
- "build": "react-scripts build",
30
- "test": "react-scripts test",
25
+ "start": "react-app-rewired start",
26
+ "build": "react-app-rewired build",
31
27
  "eject": "react-scripts eject",
32
- "pretty": "prettier --write 'src/**/*.{html,css,scss,js,jsx,ts,tsx,json}' README.md",
33
- "prepare": "husky install",
34
- "prepublishOnly": "npm run build"
28
+ "format": "prettier --write 'src/**/*.{html,css,scss,js,jsx,ts,tsx,json}' README.md",
29
+ "test": "echo \"Error: no test specified\" && exit 0"
30
+ },
31
+ "dependencies": {
32
+ "@standardnotes/editor-kit": "standardnotes/editor-kit#50ffb15c935a297b082eb00ffd031adc05080d7f",
33
+ "@standardnotes/styles": "1.6.1"
35
34
  },
36
35
  "devDependencies": {
37
36
  "@codemirror/lang-markdown": "^0.19.6",
38
- "@milkdown/core": "^5.5.0",
39
- "@milkdown/plugin-clipboard": "^5.5.0",
40
- "@milkdown/plugin-cursor": "^5.5.0",
41
- "@milkdown/plugin-diagram": "^5.5.0",
42
- "@milkdown/plugin-history": "^5.5.0",
43
- "@milkdown/plugin-indent": "^5.5.0",
44
- "@milkdown/plugin-listener": "^5.5.0",
45
- "@milkdown/plugin-math": "^5.5.0",
46
- "@milkdown/plugin-menu": "^5.5.0",
47
- "@milkdown/plugin-prism": "^5.5.0",
48
- "@milkdown/plugin-slash": "^5.5.0",
49
- "@milkdown/plugin-tooltip": "^5.5.0",
50
- "@milkdown/preset-commonmark": "^5.5.0",
51
- "@milkdown/preset-gfm": "^5.5.0",
52
- "@milkdown/prose": "^5.5.0",
53
- "@milkdown/react": "^5.5.0",
54
- "@milkdown/theme-nord": "^5.5.0",
55
- "@standardnotes/editor-kit": "2.2.4",
37
+ "@milkdown/core": "5.5.0",
38
+ "@milkdown/plugin-clipboard": "5.5.0",
39
+ "@milkdown/plugin-cursor": "5.5.0",
40
+ "@milkdown/plugin-diagram": "5.5.0",
41
+ "@milkdown/plugin-history": "5.5.0",
42
+ "@milkdown/plugin-indent": "5.5.0",
43
+ "@milkdown/plugin-listener": "5.5.0",
44
+ "@milkdown/plugin-math": "5.5.0",
45
+ "@milkdown/plugin-menu": "5.5.0",
46
+ "@milkdown/plugin-prism": "5.5.0",
47
+ "@milkdown/plugin-slash": "5.5.0",
48
+ "@milkdown/plugin-tooltip": "5.5.0",
49
+ "@milkdown/preset-commonmark": "5.5.0",
50
+ "@milkdown/preset-gfm": "5.5.0",
51
+ "@milkdown/prose": "5.5.0",
52
+ "@milkdown/react": "5.5.0",
53
+ "@milkdown/theme-nord": "5.5.0",
56
54
  "@testing-library/dom": "^8.11.3",
57
55
  "@testing-library/jest-dom": "^5.16.2",
58
56
  "@testing-library/react": "^12.1.4",
59
57
  "@testing-library/user-event": "^13.5.0",
60
- "@types/jest": "^27.4.1",
58
+ "@types/jest": "^28.1.5",
61
59
  "@types/lodash": "^4.14.179",
62
60
  "@types/marked": "^4.0.2",
63
61
  "@types/node": "^17.0.21",
64
62
  "@types/react": "^17.0.40",
65
63
  "@types/react-dom": "^17.0.13",
66
- "@uiw/react-codemirror": "^4.5.1",
67
- "gh-pages": "^3.2.3",
68
- "husky": "^7.0.4",
64
+ "@uiw/react-codemirror": "4.5.1",
69
65
  "katex": "^0.15.2",
70
- "lint-staged": "^12.3.5",
66
+ "lint-staged": "*",
71
67
  "marked": "^4.0.12",
72
68
  "material-icons": "^1.10.8",
73
- "prettier": "^2.5.1",
69
+ "prettier": "*",
74
70
  "react": "^17.0.2",
71
+ "react-app-rewired": "^2.2.1",
75
72
  "react-dom": "^17.0.2",
76
73
  "react-icons": "^4.3.1",
77
74
  "react-scripts": "^5.0.0",
78
- "sass": "1.49.9",
79
- "sn-stylekit": "5.2.21",
75
+ "sass": "*",
80
76
  "source-map-explorer": "^2.5.2",
81
- "typescript": "4.6.2"
77
+ "typescript": "*"
82
78
  },
83
79
  "eslintConfig": {
84
80
  "extends": [
@@ -106,7 +102,5 @@
106
102
  "prettier --write"
107
103
  ]
108
104
  },
109
- "resolutions": {
110
- "react-error-overlay": "^6.0.10"
111
- }
105
+ "gitHead": "952d7103d2d1b68a46435daab1bec5b35a2d3497"
112
106
  }
File without changes
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta name="description" content="A lightweight WYSIWYG markdown editor, derivated from Milkdown editor" />
9
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
10
+ <!--
11
+ manifest.json provides metadata used when your web app is installed on a
12
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
13
+ -->
14
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
15
+ <!--
16
+ Notice the use of %PUBLIC_URL% in the tags above.
17
+ It will be replaced with the URL of the `public` folder during the build.
18
+ Only files inside the `public` folder can be referenced from the HTML.
19
+
20
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
21
+ work correctly both with client-side routing and a non-root public URL.
22
+ Learn how to configure a non-root public URL by running `npm run build`.
23
+ -->
24
+ <title>Markdown Visual</title>
25
+ </head>
26
+
27
+ <body>
28
+ <noscript>You need to enable JavaScript to run this app.</noscript>
29
+ <div id="root"></div>
30
+ </body>
31
+ </html>
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "Markdown Visual - Dev",
3
+ "note_type": "markdown",
4
+ "file_type": "md",
5
+ "interchangeable": false,
6
+ "spellcheckControl": true,
7
+ "identifier": "org.standardnotes.markdown-visual-dev",
8
+ "content_type": "SN|Component",
9
+ "area": "editor-editor",
10
+ "version": "1.0.0",
11
+ "description": "A lightweight WYSIWYG markdown editor, derivated from Milkdown editor",
12
+ "url": "http://localhost:8001/",
13
+ "marketing_url": "",
14
+ "flags": ["New"]
15
+ }
@@ -0,0 +1,94 @@
1
+ import './styles.scss'
2
+
3
+ import { basicSetup } from '@codemirror/basic-setup'
4
+ import { markdown } from '@codemirror/lang-markdown'
5
+ import CodeMirrorReact, { EditorView, ReactCodeMirrorRef } from '@uiw/react-codemirror'
6
+ import { forwardRef, useImperativeHandle, useRef, useState } from 'react'
7
+
8
+ export type CodeMirrorRef = {
9
+ update: (markdown: string) => void
10
+ }
11
+
12
+ type CodeMirrorProps = {
13
+ onChange: (text: string) => void
14
+ value?: string
15
+ editable: boolean
16
+ spellcheck: boolean
17
+ }
18
+
19
+ const CodeMirror = (
20
+ { onChange, value, editable, spellcheck }: CodeMirrorProps,
21
+ ref: React.ForwardedRef<CodeMirrorRef>,
22
+ ) => {
23
+ const [hasFocus, setFocus] = useState(false)
24
+ const editorRef = useRef<ReactCodeMirrorRef>(null)
25
+ const extensions = [
26
+ basicSetup,
27
+ markdown(),
28
+ EditorView.lineWrapping,
29
+ EditorView.updateListener.of((update) => {
30
+ if (update.focusChanged) {
31
+ setFocus(update.view.hasFocus)
32
+ }
33
+
34
+ if (update.docChanged) {
35
+ const text = update.state.doc.toString()
36
+ onChange(text)
37
+ }
38
+ }),
39
+ ]
40
+
41
+ useImperativeHandle(ref, () => ({
42
+ update: (markdown: string) => {
43
+ /**
44
+ * This will prevent the CodeMirror editor from being updated again when an update
45
+ * is sent back from the Milkdown editor.
46
+ */
47
+ if (hasFocus) {
48
+ return
49
+ }
50
+
51
+ if (!editable || !editorRef.current) {
52
+ return
53
+ }
54
+
55
+ const view = editorRef.current.view
56
+ if (!view) {
57
+ return
58
+ }
59
+
60
+ const { state } = view
61
+ if (!state) {
62
+ return
63
+ }
64
+
65
+ const document = state.doc
66
+ if (!document) {
67
+ return
68
+ }
69
+
70
+ view.dispatch({
71
+ changes: {
72
+ from: 0,
73
+ to: document.toString().length,
74
+ insert: markdown,
75
+ },
76
+ })
77
+ },
78
+ }))
79
+
80
+ return (
81
+ <div className="codemirror-container">
82
+ <CodeMirrorReact
83
+ ref={editorRef}
84
+ extensions={extensions}
85
+ value={value}
86
+ editable={editable}
87
+ spellCheck={spellcheck}
88
+ indentWithTab
89
+ />
90
+ </div>
91
+ )
92
+ }
93
+
94
+ export default forwardRef<CodeMirrorRef, CodeMirrorProps>(CodeMirror)
@@ -0,0 +1,55 @@
1
+ .container {
2
+ .codemirror-container {
3
+ overflow-y: auto;
4
+ max-height: 100%;
5
+
6
+ .cm-theme-light {
7
+ .cm-editor {
8
+ background-color: var(--sn-stylekit-editor-background-color) !important;
9
+ color: var(--sn-stylekit-editor-foreground-color) !important;
10
+ font-family: var(--sn-stylekit-monospace-font);
11
+ -webkit-overflow-scrolling: touch;
12
+ font-size: calc(var(--sn-stylekit-font-size-editor) - 0.3rem);
13
+
14
+ @media only screen and (min-width: 768px) {
15
+ font-size: calc(var(--sn-stylekit-font-size-editor) - 0.1rem);
16
+ }
17
+
18
+ .cm-content {
19
+ caret-color: var(--sn-stylekit-editor-foreground-color) !important;
20
+ }
21
+
22
+ .cm-lineNumbers {
23
+ color: var(--sn-stylekit-neutral-color) !important;
24
+ opacity: 0.5;
25
+ }
26
+
27
+ .cm-cursor {
28
+ border-color: var(--sn-stylekit-info-color) !important;
29
+ }
30
+
31
+ .cm-gutters {
32
+ background-color: var(--sn-stylekit-background-color) !important;
33
+ color: var(--sn-stylekit-editor-foreground-color) !important;
34
+ border-color: var(--sn-stylekit-border-color) !important;
35
+ }
36
+
37
+ .ͼb {
38
+ color: var(--sn-stylekit-info-color) !important;
39
+ }
40
+
41
+ .cm-selectionBackground {
42
+ background: var(--sn-stylekit-info-color) !important;
43
+ }
44
+
45
+ .cm-activeLine {
46
+ background-color: var(--sn-stylekit-secondary-contrast-background-color) !important;
47
+ }
48
+
49
+ .cm-activeLineGutter {
50
+ background-color: var(--sn-stylekit-contrast-background-color) !important;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,62 @@
1
+ import { defaultValueCtx, Editor, editorViewOptionsCtx, rootCtx } from '@milkdown/core'
2
+ import { clipboard } from '@milkdown/plugin-clipboard'
3
+ import { cursor } from '@milkdown/plugin-cursor'
4
+ import { diagram } from '@milkdown/plugin-diagram'
5
+ import { history } from '@milkdown/plugin-history'
6
+ import { indent } from '@milkdown/plugin-indent'
7
+ import { listener, listenerCtx } from '@milkdown/plugin-listener'
8
+ import { math } from '@milkdown/plugin-math'
9
+ import { prism } from '@milkdown/plugin-prism'
10
+ import { slash } from '@milkdown/plugin-slash'
11
+ import { tooltip } from '@milkdown/plugin-tooltip'
12
+ import { gfm } from '@milkdown/preset-gfm'
13
+ import { nord } from '@milkdown/theme-nord'
14
+
15
+ import { menu } from './plugins/advanced-menu'
16
+ import { MenuConfig } from './plugins/advanced-menu/config'
17
+
18
+ export type CreateEditorParams = {
19
+ root: HTMLElement | null
20
+ onChange: (text: string) => void
21
+ value?: string
22
+ menuConfig: MenuConfig
23
+ editable: boolean
24
+ spellcheck: boolean
25
+ }
26
+
27
+ export const createEditor = ({ root, onChange, value, menuConfig, editable, spellcheck }: CreateEditorParams) => {
28
+ const editor = Editor.make()
29
+ .config((ctx) => {
30
+ ctx.set(rootCtx, root)
31
+ value && ctx.set(defaultValueCtx, value)
32
+
33
+ ctx.get(listenerCtx).markdownUpdated((_, markdown) => {
34
+ onChange(markdown)
35
+ })
36
+
37
+ ctx.set(editorViewOptionsCtx, {
38
+ editable: () => editable,
39
+ })
40
+
41
+ root?.setAttribute('spellcheck', JSON.stringify(spellcheck))
42
+ })
43
+ .use(nord)
44
+ .use(clipboard)
45
+ .use(gfm)
46
+ .use(listener)
47
+ .use(math)
48
+ .use(indent)
49
+ .use(prism)
50
+ .use(slash)
51
+ .use(tooltip)
52
+ .use(diagram)
53
+ .use(cursor)
54
+ .use(history)
55
+ .use(
56
+ menu({
57
+ config: menuConfig,
58
+ }),
59
+ )
60
+
61
+ return editor
62
+ }
@@ -0,0 +1,77 @@
1
+ import './styles.scss'
2
+
3
+ import { editorViewCtx, parserCtx } from '@milkdown/core'
4
+ import { Slice } from '@milkdown/prose'
5
+ import { EditorRef, ReactEditor, useEditor } from '@milkdown/react'
6
+ import { forwardRef, useImperativeHandle, useRef } from 'react'
7
+
8
+ import { createEditor, CreateEditorParams } from './editor'
9
+ import { MenuConfig } from './plugins/advanced-menu/config'
10
+
11
+ export type MilkdownRef = {
12
+ update: (markdown: string) => void
13
+ }
14
+
15
+ type MilkdownProps = {
16
+ onChange: CreateEditorParams['onChange']
17
+ value?: CreateEditorParams['value']
18
+ menuConfig: MenuConfig
19
+ editable: CreateEditorParams['editable']
20
+ spellcheck: CreateEditorParams['spellcheck']
21
+ }
22
+
23
+ const Milkdown = (
24
+ { onChange, value, menuConfig, editable, spellcheck }: MilkdownProps,
25
+ ref: React.ForwardedRef<MilkdownRef>,
26
+ ) => {
27
+ const editorRef = useRef<EditorRef>(null)
28
+
29
+ useImperativeHandle(ref, () => ({
30
+ update: (markdown: string) => {
31
+ if (!editable || !editorRef.current) {
32
+ return
33
+ }
34
+
35
+ const editor = editorRef.current.get()
36
+ if (!editor) {
37
+ return
38
+ }
39
+
40
+ editor.action((ctx) => {
41
+ const view = ctx.get(editorViewCtx)
42
+ const parser = ctx.get(parserCtx)
43
+ const document = parser(markdown)
44
+ if (!document) {
45
+ return
46
+ }
47
+
48
+ const state = view.state
49
+ view.dispatch(
50
+ state.tr.replace(0, state.doc.content.size, new Slice(document.content, 0, 0)).setMeta('addToHistory', false),
51
+ )
52
+ })
53
+ },
54
+ }))
55
+
56
+ const editor = useEditor(
57
+ (root) => {
58
+ return createEditor({
59
+ root,
60
+ onChange,
61
+ value,
62
+ menuConfig,
63
+ editable,
64
+ spellcheck,
65
+ })
66
+ },
67
+ [value, onChange, value, menuConfig, editable, spellcheck],
68
+ )
69
+
70
+ return (
71
+ <div className="milkdown-container">
72
+ <ReactEditor ref={editorRef} editor={editor} />
73
+ </div>
74
+ )
75
+ }
76
+
77
+ export default forwardRef<MilkdownRef, MilkdownProps>(Milkdown)
@@ -0,0 +1,3 @@
1
+ # advanced-menu
2
+
3
+ An advanced menu plugin for [Milkdown editor](https://saul-mirone.github.io/milkdown/), which is heavily inspired on [@milkdown/plugin-menu](https://github.com/Saul-Mirone/milkdown/tree/main/packages/plugin-menu).