@jvs-milkdown/crepe 1.2.26 → 1.2.27

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.
package/lib/cjs/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var utils$1 = require('@jvs-milkdown/utils');
4
4
  var lodashEs = require('lodash-es');
5
+ var language = require('@codemirror/language');
5
6
  var languageData = require('@codemirror/language-data');
6
7
  var themeOneDark = require('@codemirror/theme-one-dark');
7
8
  var ctx = require('@jvs-milkdown/kit/ctx');
@@ -696,10 +697,21 @@ const importIcon = `
696
697
  </svg>
697
698
  `;
698
699
 
700
+ const mermaidLanguage = language.LanguageDescription.of({
701
+ name: "Mermaid",
702
+ alias: ["mermaid"],
703
+ load: () => {
704
+ const fallback = languageData.languages.find((l) => l.name === "YAML") || languageData.languages.find((l) => l.name === "Markdown");
705
+ return fallback ? fallback.load() : Promise.resolve(null);
706
+ }
707
+ });
708
+ const allLanguages = [mermaidLanguage, ...languageData.languages].sort(
709
+ (a, b) => a.name.localeCompare(b.name)
710
+ );
699
711
  const defaultConfig = {
700
712
  [CrepeFeature.CodeMirror]: {
701
713
  theme: themeOneDark.oneDark,
702
- languages: languageData.languages,
714
+ languages: allLanguages,
703
715
  expandIcon: chevronDownIcon,
704
716
  searchIcon,
705
717
  clearSearchIcon: clearIcon,
@@ -3085,7 +3097,7 @@ const Menu = vue.defineComponent({
3085
3097
  const isTableBlock = (node == null ? void 0 : node.type.name) === "table";
3086
3098
  const isMedia = ((_a = node == null ? void 0 : node.type.name) == null ? void 0 : _a.includes("image")) || isAttachmentBlock || isImageParagraph || (node == null ? void 0 : node.type.name) === "hr" || isTableBlock;
3087
3099
  const showAlign = !isMedia || isImageBlock;
3088
- const isEmpty = node ? node.textContent.length === 0 && node.content.size <= 2 && !isMedia : false;
3100
+ const isEmpty = node ? node.type.name === "paragraph" && node.textContent.length === 0 && node.content.size <= 2 && !isMedia : false;
3089
3101
  const currentAlign = ((_b = node == null ? void 0 : node.attrs) == null ? void 0 : _b.align) || "left";
3090
3102
  const currentIndent = ((_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.indent) || 0;
3091
3103
  const setAlign = (alignValue) => {
@@ -4041,7 +4053,7 @@ class BlockHandleView {
4041
4053
  });
4042
4054
  }
4043
4055
  const isMedia = node.type.name.includes("image") || node.type.name.includes("attachment") || node.type.name === "hr" || node.type.name.includes("math") || hasMediaChild;
4044
- const isEmpty = node.textContent.length === 0 && node.content.size <= 2 && !isMedia;
4056
+ const isEmpty = node.type.name === "paragraph" && node.textContent.length === 0 && node.content.size <= 2 && !isMedia;
4045
4057
  if (isEmpty) {
4046
4058
  __privateGet$5(this, _content$3).classList.add("empty-block");
4047
4059
  } else {
@@ -4192,7 +4204,7 @@ class BlockHandleView {
4192
4204
  });
4193
4205
  }
4194
4206
  const isMedia = node.type.name.includes("image") || node.type.name.includes("attachment") || node.type.name === "hr" || node.type.name.includes("math") || hasMediaChild;
4195
- const isEmpty = node.textContent.length === 0 && node.content.size <= 2 && !isMedia;
4207
+ const isEmpty = node.type.name === "paragraph" && node.textContent.length === 0 && node.content.size <= 2 && !isMedia;
4196
4208
  if (isEmpty) {
4197
4209
  __privateGet$5(this, _content$3).classList.add("empty-block");
4198
4210
  } else {