@milkdown/crepe 7.15.5 → 7.17.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 (41) hide show
  1. package/lib/cjs/feature/block-edit/index.js.map +1 -1
  2. package/lib/cjs/feature/code-mirror/index.js +27 -22
  3. package/lib/cjs/feature/code-mirror/index.js.map +1 -1
  4. package/lib/cjs/feature/cursor/index.js +1 -1
  5. package/lib/cjs/feature/cursor/index.js.map +1 -1
  6. package/lib/cjs/feature/latex/index.js +2 -2
  7. package/lib/cjs/feature/latex/index.js.map +1 -1
  8. package/lib/cjs/feature/toolbar/index.js.map +1 -1
  9. package/lib/cjs/index.js +30 -25
  10. package/lib/cjs/index.js.map +1 -1
  11. package/lib/esm/feature/block-edit/index.js.map +1 -1
  12. package/lib/esm/feature/code-mirror/index.js +27 -22
  13. package/lib/esm/feature/code-mirror/index.js.map +1 -1
  14. package/lib/esm/feature/cursor/index.js +2 -2
  15. package/lib/esm/feature/cursor/index.js.map +1 -1
  16. package/lib/esm/feature/latex/index.js +2 -2
  17. package/lib/esm/feature/latex/index.js.map +1 -1
  18. package/lib/esm/feature/toolbar/index.js.map +1 -1
  19. package/lib/esm/index.js +31 -26
  20. package/lib/esm/index.js.map +1 -1
  21. package/lib/tsconfig.tsbuildinfo +1 -1
  22. package/lib/types/feature/block-edit/handle/component.d.ts +2 -1
  23. package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
  24. package/lib/types/feature/block-edit/handle/index.d.ts +0 -8
  25. package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
  26. package/lib/types/feature/block-edit/menu/index.d.ts +2 -1
  27. package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
  28. package/lib/types/feature/code-mirror/index.d.ts +2 -15
  29. package/lib/types/feature/code-mirror/index.d.ts.map +1 -1
  30. package/lib/types/feature/toolbar/config.d.ts +5 -1
  31. package/lib/types/feature/toolbar/config.d.ts.map +1 -1
  32. package/lib/types/utils/group-builder.d.ts +1 -1
  33. package/lib/types/utils/group-builder.d.ts.map +1 -1
  34. package/package.json +3 -6
  35. package/src/feature/block-edit/handle/component.tsx +1 -1
  36. package/src/feature/block-edit/handle/index.ts +1 -1
  37. package/src/feature/block-edit/menu/index.ts +1 -1
  38. package/src/feature/code-mirror/index.ts +6 -23
  39. package/src/feature/cursor/index.ts +2 -2
  40. package/src/feature/latex/index.ts +2 -2
  41. package/src/utils/group-builder.ts +1 -1
package/lib/cjs/index.js CHANGED
@@ -1558,34 +1558,39 @@ const codeMirror = (editor, config = {}) => {
1558
1558
  if (config.extensions) {
1559
1559
  extensions.push(...config.extensions);
1560
1560
  }
1561
- ctx.update(codeBlock.codeBlockConfig.key, (defaultConfig) => ({
1562
- extensions,
1563
- languages,
1564
- expandIcon: config.expandIcon || chevronDownIcon,
1565
- searchIcon: config.searchIcon || searchIcon,
1566
- clearSearchIcon: config.clearSearchIcon || clearIcon,
1567
- searchPlaceholder: config.searchPlaceholder || "Search language",
1568
- copyText: config.copyText || "Copy",
1569
- copyIcon: config.copyIcon || copyIcon,
1570
- onCopy: config.onCopy || (() => {
1571
- }),
1572
- noResultText: config.noResultText || "No result",
1573
- renderLanguage: config.renderLanguage || defaultConfig.renderLanguage,
1574
- renderPreview: config.renderPreview || defaultConfig.renderPreview,
1575
- previewToggleButton: (previewOnlyMode) => {
1576
- var _a, _b;
1577
- const icon = ((_a = config.previewToggleIcon) == null ? void 0 : _a.call(config, previewOnlyMode)) || (previewOnlyMode ? editIcon : visibilityOffIcon);
1578
- const text = ((_b = config.previewToggleText) == null ? void 0 : _b.call(config, previewOnlyMode)) || (previewOnlyMode ? "Edit" : "Hide");
1579
- return [icon, text].map((v) => v.trim()).join(" ");
1580
- },
1581
- previewLabel: config.previewLabel || defaultConfig.previewLabel
1582
- }));
1561
+ ctx.update(codeBlock.codeBlockConfig.key, (defaultConfig) => {
1562
+ var _a;
1563
+ return {
1564
+ extensions,
1565
+ languages,
1566
+ expandIcon: config.expandIcon || chevronDownIcon,
1567
+ searchIcon: config.searchIcon || searchIcon,
1568
+ clearSearchIcon: config.clearSearchIcon || clearIcon,
1569
+ searchPlaceholder: config.searchPlaceholder || "Search language",
1570
+ copyText: config.copyText || "Copy",
1571
+ copyIcon: config.copyIcon || copyIcon,
1572
+ onCopy: config.onCopy || (() => {
1573
+ }),
1574
+ noResultText: config.noResultText || "No result",
1575
+ renderLanguage: config.renderLanguage || defaultConfig.renderLanguage,
1576
+ renderPreview: config.renderPreview || defaultConfig.renderPreview,
1577
+ previewToggleButton: (previewOnlyMode) => {
1578
+ var _a2, _b;
1579
+ const icon = ((_a2 = config.previewToggleIcon) == null ? void 0 : _a2.call(config, previewOnlyMode)) || (previewOnlyMode ? editIcon : visibilityOffIcon);
1580
+ const text = ((_b = config.previewToggleText) == null ? void 0 : _b.call(config, previewOnlyMode)) || (previewOnlyMode ? "Edit" : "Hide");
1581
+ return [icon, text].map((v) => v.trim()).join(" ");
1582
+ },
1583
+ previewLabel: config.previewLabel || defaultConfig.previewLabel,
1584
+ previewLoading: config.previewLoading || defaultConfig.previewLoading,
1585
+ previewOnlyByDefault: (_a = config.previewOnlyByDefault) != null ? _a : defaultConfig.previewOnlyByDefault
1586
+ };
1587
+ });
1583
1588
  }).use(codeBlock.codeBlockComponent);
1584
1589
  };
1585
1590
 
1586
1591
  const cursor = (editor, config) => {
1587
1592
  editor.config(crepeFeatureConfig(CrepeFeature.Cursor)).config((ctx) => {
1588
- ctx.update(cursor$1.dropCursorConfig.key, () => {
1593
+ ctx.update(cursor$1.dropIndicatorConfig.key, () => {
1589
1594
  var _a, _b;
1590
1595
  return {
1591
1596
  class: "crepe-drop-cursor",
@@ -1949,12 +1954,12 @@ const latex = (editor, config) => {
1949
1954
  }
1950
1955
  ctx.update(codeBlock.codeBlockConfig.key, (prev) => ({
1951
1956
  ...prev,
1952
- renderPreview: (language, content) => {
1957
+ renderPreview: (language, content, applyPreview) => {
1953
1958
  if (language.toLowerCase() === "latex" && content.length > 0) {
1954
1959
  return renderLatex(content, config == null ? void 0 : config.katexOptions);
1955
1960
  }
1956
1961
  const renderPreview = prev.renderPreview;
1957
- return renderPreview(language, content);
1962
+ return renderPreview(language, content, applyPreview);
1958
1963
  }
1959
1964
  }));
1960
1965
  ctx.set(inlineLatexTooltip.key, {