@mdxeditor/editor 3.53.0 → 3.53.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.
package/dist/index.d.ts CHANGED
@@ -1204,6 +1204,8 @@ export declare const editorWrapperElementRef$: NodeRef<default_2.RefObject<HTMLD
1204
1204
 
1205
1205
  /* Excluded from this release type: editorWrappers$ */
1206
1206
 
1207
+ /* Excluded from this release type: EMPTY_VALUE */
1208
+
1207
1209
  export declare const EmptyTextNodeIndex: TextNodeIndex;
1208
1210
 
1209
1211
  /* Excluded from this release type: ExportLexicalTreeOptions */
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import { insertJsx$, isMdastJsxNode, jsxPlugin } from "./plugins/jsx/index.js";
18
18
  import { GenericJsxEditor } from "./jsx-editors/GenericJsxEditor.js";
19
19
  import { insertSandpack$, sandpackConfig$, sandpackPlugin } from "./plugins/sandpack/index.js";
20
20
  import { SandpackEditor } from "./plugins/sandpack/SandpackEditor.js";
21
- import { codeBlockLanguages$, codeMirrorAutoLoadLanguageSupport$, codeMirrorExtensions$, codeMirrorPlugin, insertCodeMirror$, normalizeCodeBlockLanguages } from "./plugins/codemirror/index.js";
21
+ import { EMPTY_VALUE, codeBlockLanguages$, codeMirrorAutoLoadLanguageSupport$, codeMirrorExtensions$, codeMirrorPlugin, insertCodeMirror$, normalizeCodeBlockLanguages } from "./plugins/codemirror/index.js";
22
22
  import { COMMON_STATE_CONFIG_EXTENSIONS, CodeMirrorEditor } from "./plugins/codemirror/CodeMirrorEditor.js";
23
23
  import { appendCodeBlockEditorDescriptor$, codeBlockPlugin, defaultCodeBlockLanguage$, insertCodeBlock$ } from "./plugins/codeblock/index.js";
24
24
  import { directivesPlugin, insertDirective$ } from "./plugins/directives/index.js";
@@ -110,6 +110,7 @@ export {
110
110
  DialogButton,
111
111
  DiffSourceToggleWrapper,
112
112
  DirectiveNode,
113
+ EMPTY_VALUE,
113
114
  EmptyTextNodeIndex,
114
115
  FrontmatterNode,
115
116
  GenericDirectiveEditor,
@@ -10,11 +10,10 @@ import { indentWithTab } from "@codemirror/commands";
10
10
  import { basicLight } from "cm6-theme-basic-light";
11
11
  import { basicSetup } from "codemirror";
12
12
  import { $setSelection } from "lexical";
13
- import { codeMirrorExtensions$, codeMirrorAutoLoadLanguageSupport$, codeBlockLanguages$ } from "./index.js";
13
+ import { codeMirrorExtensions$, codeMirrorAutoLoadLanguageSupport$, codeBlockLanguages$, EMPTY_VALUE } from "./index.js";
14
14
  import { useCodeMirrorRef } from "../sandpack/useCodeMirrorRef.js";
15
15
  import { Select } from "../toolbar/primitives/select.js";
16
16
  const COMMON_STATE_CONFIG_EXTENSIONS = [];
17
- const EMPTY_VALUE = "__EMPTY_VALUE__";
18
17
  const CodeMirrorEditor = ({ language, nodeKey, code, focusEmitter }) => {
19
18
  const t = useTranslation();
20
19
  const { parentEditor, lexicalNode } = useCodeBlockEditorContext();
@@ -2,6 +2,7 @@ import { realmPlugin } from "../../RealmWithPlugins.js";
2
2
  import { Cell, Signal, map } from "@mdxeditor/gurx";
3
3
  import { insertCodeBlock$, appendCodeBlockEditorDescriptor$ } from "../codeblock/index.js";
4
4
  import { CodeMirrorEditor } from "./CodeMirrorEditor.js";
5
+ const EMPTY_VALUE = "__EMPTY_VALUE__";
5
6
  function normalizeCodeBlockLanguages(input) {
6
7
  var _a;
7
8
  const items = [];
@@ -28,9 +29,9 @@ function normalizeCodeBlockLanguages(input) {
28
29
  for (const [key, label] of Object.entries(input)) {
29
30
  if (!(label in firstKeyByLabel)) {
30
31
  firstKeyByLabel[label] = key;
31
- items.push({ value: key || "__EMPTY_VALUE__", label });
32
+ items.push({ value: key || EMPTY_VALUE, label });
32
33
  }
33
- keyMap[key] = firstKeyByLabel[label] || "__EMPTY_VALUE__";
34
+ keyMap[key] = firstKeyByLabel[label] || EMPTY_VALUE;
34
35
  }
35
36
  }
36
37
  return { items, keyMap };
@@ -82,13 +83,14 @@ const codeMirrorPlugin = realmPlugin({
82
83
  function buildCodeBlockDescriptor(normalized) {
83
84
  return {
84
85
  match(language, meta) {
85
- return (language ?? "") in normalized.keyMap && !meta;
86
+ return Object.hasOwn(normalized.keyMap, language ?? "") && !meta;
86
87
  },
87
88
  priority: 1,
88
89
  Editor: CodeMirrorEditor
89
90
  };
90
91
  }
91
92
  export {
93
+ EMPTY_VALUE,
92
94
  codeBlockLanguages$,
93
95
  codeMirrorAutoLoadLanguageSupport$,
94
96
  codeMirrorExtensions$,
@@ -2,10 +2,9 @@ import { useCellValues } from "@mdxeditor/gurx";
2
2
  import React__default from "react";
3
3
  import styles from "../../../styles/ui.module.css.js";
4
4
  import { $isCodeBlockNode } from "../../codeblock/CodeBlockNode.js";
5
- import { codeBlockLanguages$ } from "../../codemirror/index.js";
5
+ import { codeBlockLanguages$, EMPTY_VALUE } from "../../codemirror/index.js";
6
6
  import { editorInFocus$, activeEditor$, useTranslation } from "../../core/index.js";
7
7
  import { Select } from "../primitives/select.js";
8
- const EMPTY_VALUE = "__EMPTY_VALUE__";
9
8
  const ChangeCodeMirrorLanguage = () => {
10
9
  const [editorInFocus, theEditor, codeBlockLanguages] = useCellValues(editorInFocus$, activeEditor$, codeBlockLanguages$);
11
10
  const codeBlockNode = $isCodeBlockNode(editorInFocus.rootNode) ? editorInFocus.rootNode : null;
@@ -38,7 +38,7 @@ const SelectContent = ({
38
38
  },
39
39
  position: "popper"
40
40
  },
41
- /* @__PURE__ */ React__default.createElement(RadixSelect.Viewport, { "data-editor-dropdown": true }, children)
41
+ /* @__PURE__ */ React__default.createElement(RadixSelect.Viewport, { "data-editor-dropdown": true, style: { maxHeight: "var(--radix-select-content-available-height)" } }, children)
42
42
  ));
43
43
  };
44
44
  const SelectButtonTrigger = ({
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.53.0",
14
+ "version": "3.53.1",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",