markdown-text-editor 2.0.0-beta.0 → 2.0.0-beta.2

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 (68) hide show
  1. package/README.md +78 -4
  2. package/dist/markdown-text-editor.css +1 -1
  3. package/dist/markdown-text-editor.es.js +858 -799
  4. package/dist/markdown-text-editor.es.js.map +1 -1
  5. package/dist/markdown-text-editor.min.js +67 -67
  6. package/dist/markdown-text-editor.min.js.map +1 -1
  7. package/dist/markdown-text-editor.umd.js +67 -67
  8. package/dist/markdown-text-editor.umd.js.map +1 -1
  9. package/locale/ar.js +55 -0
  10. package/locale/az.js +55 -0
  11. package/locale/bg.js +55 -0
  12. package/locale/bn.js +55 -0
  13. package/locale/bs.js +55 -0
  14. package/locale/ca.js +55 -0
  15. package/locale/cs.js +55 -0
  16. package/locale/da.js +55 -0
  17. package/locale/de.js +55 -0
  18. package/locale/el.js +55 -0
  19. package/locale/es.js +55 -0
  20. package/locale/et.js +55 -0
  21. package/locale/fa.js +55 -0
  22. package/locale/fi.js +55 -0
  23. package/locale/fil.js +55 -0
  24. package/locale/fr.js +55 -0
  25. package/locale/ga.js +55 -0
  26. package/locale/he.js +55 -0
  27. package/locale/hi.js +55 -0
  28. package/locale/hr.js +55 -0
  29. package/locale/hu.js +55 -0
  30. package/locale/hy.js +55 -0
  31. package/locale/id.js +55 -0
  32. package/locale/is.js +55 -0
  33. package/locale/it.js +55 -0
  34. package/locale/ja.js +55 -0
  35. package/locale/kn.js +55 -0
  36. package/locale/ko.js +55 -0
  37. package/locale/locale.d.ts +10 -0
  38. package/locale/lt.js +55 -0
  39. package/locale/lv.js +55 -0
  40. package/locale/mk.js +55 -0
  41. package/locale/mr.js +55 -0
  42. package/locale/ms.js +55 -0
  43. package/locale/mt.js +55 -0
  44. package/locale/nl.js +55 -0
  45. package/locale/no.js +55 -0
  46. package/locale/pl.js +55 -0
  47. package/locale/pt.js +55 -0
  48. package/locale/ro.js +55 -0
  49. package/locale/ru.js +55 -0
  50. package/locale/sk.js +55 -0
  51. package/locale/sl.js +55 -0
  52. package/locale/sq.js +55 -0
  53. package/locale/sr.js +55 -0
  54. package/locale/sv.js +55 -0
  55. package/locale/sw.js +55 -0
  56. package/locale/ta.js +55 -0
  57. package/locale/te.js +55 -0
  58. package/locale/template.js +62 -0
  59. package/locale/th.js +55 -0
  60. package/locale/tr.js +55 -0
  61. package/locale/uk.js +55 -0
  62. package/locale/ur.js +55 -0
  63. package/locale/uz.js +55 -0
  64. package/locale/vi.js +55 -0
  65. package/locale/zh-hk.js +55 -0
  66. package/locale/zh.js +55 -0
  67. package/package.json +22 -8
  68. package/types/index.d.ts +16 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-text-editor",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.2",
4
4
  "type": "module",
5
5
  "description": "A markdown editor that enhances your textarea instead of replacing it, so form submission, validation and required fields keep working. WYSIWYG hybrid mode, live preview, find and replace, RTL, TypeScript types. Works with any backend.",
6
6
  "funding": "https://ko-fi.com/nezanuha",
@@ -17,12 +17,21 @@
17
17
  "default": "./dist/markdown-text-editor.umd.js"
18
18
  },
19
19
  "./style.css": "./dist/markdown-text-editor.css",
20
+ "./locale/*.js": {
21
+ "types": "./locale/locale.d.ts",
22
+ "default": "./locale/*.js"
23
+ },
24
+ "./locale/*": {
25
+ "types": "./locale/locale.d.ts",
26
+ "default": "./locale/*.js"
27
+ },
20
28
  "./dist/*": "./dist/*",
21
29
  "./package.json": "./package.json"
22
30
  },
23
31
  "files": [
24
32
  "dist/",
25
33
  "types/",
34
+ "locale/",
26
35
  "README.md",
27
36
  "LICENSE"
28
37
  ],
@@ -35,9 +44,11 @@
35
44
  "build": "vite build",
36
45
  "preview": "vite preview",
37
46
  "prepublishOnly": "npm run build",
47
+ "locale:extract": "node scripts/locale-extract.mjs",
48
+ "locale:check": "node scripts/locale-check.mjs",
38
49
  "version": "node scripts/check-changelog.mjs",
39
50
  "postversion": "git push origin HEAD --follow-tags",
40
- "test": "node test/smoke.mjs",
51
+ "test": "node test/smoke.mjs && node scripts/locale-check.mjs",
41
52
  "typecheck": "tsc --noEmit --strict --lib es2020,dom --moduleResolution bundler --module esnext test/types.test.ts"
42
53
  },
43
54
  "publishConfig": {
@@ -78,8 +89,8 @@
78
89
  "url": "https://github.com/nezanuha/markdown-text-editor/issues"
79
90
  },
80
91
  "dependencies": {
81
- "dompurify": "^3.4.16",
82
- "marked": "~18.1.0"
92
+ "dompurify": "^3.4.17",
93
+ "marked": "~18.1.2"
83
94
  },
84
95
  "devDependencies": {
85
96
  "@tailwindcss/postcss": "^4.3.3",
@@ -87,11 +98,14 @@
87
98
  "@tailwindcss/vite": "^4.3.3",
88
99
  "diff": "^9.0.0",
89
100
  "frutjam": "^2.3.0",
90
- "happy-dom": "^20.14.6",
91
- "postcss": "^8.5.29",
101
+ "happy-dom": "^21.0.4",
102
+ "postcss": "^8.5.32",
92
103
  "tailwindcss": "^4.3.3",
93
104
  "typescript": "^7.0.2",
94
- "vite": "^8.3.4"
105
+ "vite": "^8.3.5"
95
106
  },
96
- "types": "./types/index.d.ts"
107
+ "types": "./types/index.d.ts",
108
+ "overrides": {
109
+ "postcss-selector-parser": "^7.1.7"
110
+ }
97
111
  }
package/types/index.d.ts CHANGED
@@ -114,7 +114,7 @@ export type CustomTool = new (editor: MarkdownEditor, config?: any) => {
114
114
  */
115
115
  export interface DeclarativeTool {
116
116
  custom: {
117
- /** Tooltip, and the source of the button's CSS class. Translatable via `labels`. */
117
+ /** Tooltip, and the source of the button's CSS class. Translatable via `locale`. */
118
118
  title: string;
119
119
  /** Inline SVG for the button face. */
120
120
  icon?: string;
@@ -185,11 +185,22 @@ export interface MarkdownEditorOptions {
185
185
 
186
186
  /**
187
187
  * Translations for the editor's own interface, keyed by the English text:
188
- * tooltips, menu items, modal fields and buttons. Anything not listed stays
189
- * in English. CSS class names are unaffected.
188
+ * tooltips, menu items, modal fields, buttons and screen reader names.
189
+ * Anything not listed stays in English. CSS class names are unaffected.
190
190
  *
191
- * @example labels: { Bold: 'Negrita', 'Insert variable': 'Insertar variable' }
191
+ * Takes the strings themselves, not a language code. Import the one you want
192
+ * so nobody pays for the languages they do not use.
193
+ * `locale/template.js` lists every key.
194
+ *
195
+ * @example
196
+ * import es from 'markdown-text-editor/locale/es.js';
197
+ * new MarkdownEditor('#editor', { locale: es });
198
+ *
199
+ * @example locale: { Bold: 'Negrita', '{n} words': '{n} palabras' }
192
200
  */
201
+ locale?: Record<string, string>;
202
+
203
+ /** @deprecated Renamed to `locale` in 2.0.0. Still works. */
193
204
  labels?: Record<string, string>;
194
205
 
195
206
  /**
@@ -258,7 +269,7 @@ export default class MarkdownEditor {
258
269
  /**
259
270
  * Builds a small toolbar bound to another textarea, for a custom tool that
260
271
  * collects rich text in its own dialog. The tools are the real ones, and
261
- * `labels` are inherited. Returns the element; append it where you like.
272
+ * `locale` is inherited. Returns the element; append it where you like.
262
273
  *
263
274
  * No preview button is added, whatever you pass.
264
275
  */