@jvs-milkdown/crepe 1.2.0 → 1.2.1

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 (75) hide show
  1. package/lib/cjs/builder.js +55 -2
  2. package/lib/cjs/builder.js.map +1 -1
  3. package/lib/cjs/feature/block-edit/index.js +73 -5
  4. package/lib/cjs/feature/block-edit/index.js.map +1 -1
  5. package/lib/cjs/feature/code-mirror/index.js +65 -3
  6. package/lib/cjs/feature/code-mirror/index.js.map +1 -1
  7. package/lib/cjs/feature/cursor/index.js +55 -2
  8. package/lib/cjs/feature/cursor/index.js.map +1 -1
  9. package/lib/cjs/feature/image-block/index.js +76 -8
  10. package/lib/cjs/feature/image-block/index.js.map +1 -1
  11. package/lib/cjs/feature/latex/index.js +55 -2
  12. package/lib/cjs/feature/latex/index.js.map +1 -1
  13. package/lib/cjs/feature/link-tooltip/index.js +55 -2
  14. package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
  15. package/lib/cjs/feature/list-item/index.js +55 -2
  16. package/lib/cjs/feature/list-item/index.js.map +1 -1
  17. package/lib/cjs/feature/placeholder/index.js +55 -2
  18. package/lib/cjs/feature/placeholder/index.js.map +1 -1
  19. package/lib/cjs/feature/table/index.js +55 -2
  20. package/lib/cjs/feature/table/index.js.map +1 -1
  21. package/lib/cjs/feature/toolbar/index.js +73 -5
  22. package/lib/cjs/feature/toolbar/index.js.map +1 -1
  23. package/lib/cjs/index.js +451 -30
  24. package/lib/cjs/index.js.map +1 -1
  25. package/lib/esm/builder.js +55 -2
  26. package/lib/esm/builder.js.map +1 -1
  27. package/lib/esm/feature/block-edit/index.js +73 -5
  28. package/lib/esm/feature/block-edit/index.js.map +1 -1
  29. package/lib/esm/feature/code-mirror/index.js +65 -3
  30. package/lib/esm/feature/code-mirror/index.js.map +1 -1
  31. package/lib/esm/feature/cursor/index.js +55 -2
  32. package/lib/esm/feature/cursor/index.js.map +1 -1
  33. package/lib/esm/feature/image-block/index.js +76 -8
  34. package/lib/esm/feature/image-block/index.js.map +1 -1
  35. package/lib/esm/feature/latex/index.js +55 -2
  36. package/lib/esm/feature/latex/index.js.map +1 -1
  37. package/lib/esm/feature/link-tooltip/index.js +55 -2
  38. package/lib/esm/feature/link-tooltip/index.js.map +1 -1
  39. package/lib/esm/feature/list-item/index.js +55 -2
  40. package/lib/esm/feature/list-item/index.js.map +1 -1
  41. package/lib/esm/feature/placeholder/index.js +55 -2
  42. package/lib/esm/feature/placeholder/index.js.map +1 -1
  43. package/lib/esm/feature/table/index.js +55 -2
  44. package/lib/esm/feature/table/index.js.map +1 -1
  45. package/lib/esm/feature/toolbar/index.js +73 -5
  46. package/lib/esm/feature/toolbar/index.js.map +1 -1
  47. package/lib/esm/index.js +452 -31
  48. package/lib/esm/index.js.map +1 -1
  49. package/lib/theme/common/code-mirror.css +13 -0
  50. package/lib/theme/common/image-block.css +321 -22
  51. package/lib/theme/common/reset.css +3 -0
  52. package/lib/theme/common/toolbar.css +27 -2
  53. package/lib/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +4 -4
  55. package/src/core/locale.ts +55 -0
  56. package/src/feature/block-edit/menu/config.ts +19 -3
  57. package/src/feature/code-mirror/index.ts +3 -0
  58. package/src/feature/fixed-toolbar/component.tsx +31 -2
  59. package/src/feature/fixed-toolbar/config.ts +18 -3
  60. package/src/feature/fixed-toolbar/document-header.tsx +8 -4
  61. package/src/feature/fixed-toolbar/index.ts +18 -1
  62. package/src/feature/fixed-toolbar/menu-bar.tsx +83 -2
  63. package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +244 -0
  64. package/src/feature/fixed-toolbar/view-menu-state.ts +9 -0
  65. package/src/feature/image-block/index.ts +11 -1
  66. package/src/icons/border.ts +5 -0
  67. package/src/icons/close.ts +3 -0
  68. package/src/icons/crop.ts +6 -0
  69. package/src/icons/index.ts +5 -0
  70. package/src/icons/keyboard.ts +3 -0
  71. package/src/icons/word-wrap.ts +6 -0
  72. package/src/theme/common/code-mirror.css +13 -0
  73. package/src/theme/common/image-block.css +364 -23
  74. package/src/theme/common/reset.css +3 -0
  75. package/src/theme/common/toolbar.css +30 -2
@@ -15,6 +15,7 @@ import { slashFactory } from '@jvs-milkdown/kit/plugin/slash';
15
15
  import { imageBlockSchema } from '@jvs-milkdown/kit/component/image-block';
16
16
  import { findNodeInSelection } from '@jvs-milkdown/kit/prose';
17
17
  import { lift, toggleMark } from '@jvs-milkdown/kit/prose/commands';
18
+ import { wrapInList } from '@jvs-milkdown/kit/prose/schema-list';
18
19
  import katex from 'katex';
19
20
  import { toggleLinkCommand } from '@jvs-milkdown/kit/component/link-tooltip';
20
21
  import { Decoration, DecorationSet } from '@jvs-milkdown/kit/prose/view';
@@ -43,12 +44,17 @@ const zhCN = {
43
44
  "view.docBackground": "\u6587\u6863\u80CC\u666F\u8272",
44
45
  "view.title": "\u663E\u793A\u6807\u9898",
45
46
  "view.cover": "\u663E\u793A\u5C01\u9762",
47
+ "view.editorWidth": "\u5185\u5BB9\u5BBD\u5EA6",
48
+ "view.widthDefault": "\u9ED8\u8BA4",
49
+ "view.widthWide": "\u8F83\u5BBD",
50
+ "view.widthFull": "\u5168\u5BBD",
46
51
  // code-mirror
47
52
  "codeMirror.searchPlaceholder": "\u641C\u7D22\u8BED\u8A00",
48
53
  "codeMirror.noResultText": "\u65E0\u7ED3\u679C",
49
54
  "codeMirror.previewToggleOptionEdit": "\u7F16\u8F91",
50
55
  "codeMirror.previewToggleOptionHide": "\u9690\u85CF",
51
56
  "codeMirror.previewLabel": "\u9884\u89C8",
57
+ "codeMirror.wrapText": "\u81EA\u52A8\u6362\u884C",
52
58
  // link-tooltip
53
59
  "linkTooltip.pasteLink": "\u7C98\u8D34\u94FE\u63A5...",
54
60
  // image-block
@@ -146,7 +152,29 @@ const zhCN = {
146
152
  "latex.escToExit": "\u6309 ESC \u5B8C\u6210\u8F93\u5165",
147
153
  "latex.helpDoc": "\u67E5\u770B\u5E2E\u52A9\u6587\u6863",
148
154
  "latex.emptyPlaceholder": "\u6DFB\u52A0 LaTeX \u516C\u5F0F",
149
- "latex.inputPlaceholder": "\u8BF7\u8F93\u5165\u516C\u5F0F"
155
+ "latex.inputPlaceholder": "\u8BF7\u8F93\u5165\u516C\u5F0F",
156
+ // shortcuts
157
+ "shortcuts.title": "\u952E\u76D8\u5FEB\u6377\u952E",
158
+ "shortcuts.formatting": "\u6587\u672C\u683C\u5F0F",
159
+ "shortcuts.bold": "\u52A0\u7C97",
160
+ "shortcuts.italic": "\u659C\u4F53",
161
+ "shortcuts.underline": "\u4E0B\u5212\u7EBF",
162
+ "shortcuts.strikethrough": "\u5220\u9664\u7EBF",
163
+ "shortcuts.inlineCode": "\u884C\u5185\u4EE3\u7801",
164
+ "shortcuts.highlight": "\u9AD8\u4EAE",
165
+ "shortcuts.paragraph": "\u6BB5\u843D",
166
+ "shortcuts.heading": "\u6807\u9898",
167
+ "shortcuts.block": "\u5757\u7EA7\u5143\u7D20",
168
+ "shortcuts.codeBlock": "\u4EE3\u7801\u5757",
169
+ "shortcuts.blockquote": "\u5F15\u7528",
170
+ "shortcuts.orderedList": "\u6709\u5E8F\u5217\u8868",
171
+ "shortcuts.bulletList": "\u65E0\u5E8F\u5217\u8868",
172
+ "shortcuts.indent": "\u589E\u52A0\u7F29\u8FDB",
173
+ "shortcuts.outdent": "\u51CF\u5C11\u7F29\u8FDB",
174
+ "shortcuts.hardBreak": "\u6362\u884C",
175
+ "shortcuts.history": "\u5386\u53F2\u8BB0\u5F55",
176
+ "shortcuts.undo": "\u64A4\u9500",
177
+ "shortcuts.redo": "\u91CD\u505A"
150
178
  };
151
179
  const enUS = {
152
180
  "handle.add": "Add content",
@@ -167,11 +195,16 @@ const enUS = {
167
195
  "view.docBackground": "Document Background",
168
196
  "view.title": "Show Title",
169
197
  "view.cover": "Show Cover",
198
+ "view.editorWidth": "Content Width",
199
+ "view.widthDefault": "Default",
200
+ "view.widthWide": "Wide",
201
+ "view.widthFull": "Full Width",
170
202
  "codeMirror.searchPlaceholder": "Search language",
171
203
  "codeMirror.noResultText": "No result",
172
204
  "codeMirror.previewToggleOptionEdit": "Edit",
173
205
  "codeMirror.previewToggleOptionHide": "Hide",
174
206
  "codeMirror.previewLabel": "Preview",
207
+ "codeMirror.wrapText": "Wrap",
175
208
  "linkTooltip.pasteLink": "Paste link...",
176
209
  "imageBlock.inlineUploadButton": "Upload",
177
210
  "imageBlock.inlineUploadPlaceholder": "or paste link",
@@ -261,7 +294,28 @@ const enUS = {
261
294
  "latex.escToExit": "Press ESC to finish",
262
295
  "latex.helpDoc": "Help Doc",
263
296
  "latex.emptyPlaceholder": "Add LaTeX",
264
- "latex.inputPlaceholder": "Please enter formula"
297
+ "latex.inputPlaceholder": "Please enter formula",
298
+ "shortcuts.title": "Keyboard Shortcuts",
299
+ "shortcuts.formatting": "Text Formatting",
300
+ "shortcuts.bold": "Bold",
301
+ "shortcuts.italic": "Italic",
302
+ "shortcuts.underline": "Underline",
303
+ "shortcuts.strikethrough": "Strikethrough",
304
+ "shortcuts.inlineCode": "Inline Code",
305
+ "shortcuts.highlight": "Highlight",
306
+ "shortcuts.paragraph": "Paragraph",
307
+ "shortcuts.heading": "Heading",
308
+ "shortcuts.block": "Block Elements",
309
+ "shortcuts.codeBlock": "Code Block",
310
+ "shortcuts.blockquote": "Blockquote",
311
+ "shortcuts.orderedList": "Ordered List",
312
+ "shortcuts.bulletList": "Bullet List",
313
+ "shortcuts.indent": "Indent",
314
+ "shortcuts.outdent": "Outdent",
315
+ "shortcuts.hardBreak": "Hard Break",
316
+ "shortcuts.history": "History",
317
+ "shortcuts.undo": "Undo",
318
+ "shortcuts.redo": "Redo"
265
319
  };
266
320
  const translationsCtx = createSlice(
267
321
  {
@@ -1736,10 +1790,24 @@ function getGroups$1(filter, config, ctx) {
1736
1790
  return;
1737
1791
  }
1738
1792
  convertHeadingToParagraphIfNeeded(ctx2);
1739
- commands.call(wrapInBlockTypeCommand.key, {
1740
- nodeType: listItem,
1741
- attrs: { checked: false }
1793
+ const result = wrapInList(bulletList)(view.state, (tr) => {
1794
+ tr.doc.nodesBetween(
1795
+ tr.mapping.map(from),
1796
+ tr.mapping.map(to),
1797
+ (node, pos) => {
1798
+ if (node.type === listItem) {
1799
+ tr.setNodeMarkup(pos, void 0, {
1800
+ ...node.attrs,
1801
+ checked: false,
1802
+ listType: "bullet",
1803
+ label: "\u2022"
1804
+ });
1805
+ }
1806
+ }
1807
+ );
1808
+ view.dispatch(tr);
1742
1809
  });
1810
+ if (result) return;
1743
1811
  }
1744
1812
  });
1745
1813
  }