@mdxeditor/editor 0.21.0 → 0.21.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.
@@ -2,7 +2,7 @@ import { createEmptyHistoryState } from "@lexical/react/LexicalHistoryPlugin.js"
2
2
  import { $isHeadingNode } from "@lexical/rich-text";
3
3
  import { $setBlocksType } from "@lexical/selection";
4
4
  import { $findMatchingParent, $wrapNodeInElement, $insertNodeToNearestRoot } from "@lexical/utils";
5
- import { createCommand, SELECTION_CHANGE_COMMAND, $getRoot, COMMAND_PRIORITY_CRITICAL, BLUR_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND, $isRootOrShadowRoot, $getSelection, $isRangeSelection, $insertNodes, $createParagraphNode, ParagraphNode, TextNode } from "lexical";
5
+ import { createCommand, SELECTION_CHANGE_COMMAND, $getRoot, COMMAND_PRIORITY_CRITICAL, BLUR_COMMAND, KEY_DOWN_COMMAND, FORMAT_TEXT_COMMAND, $isRootOrShadowRoot, $getSelection, $isRangeSelection, $insertNodes, $createParagraphNode, ParagraphNode, TextNode } from "lexical";
6
6
  import { exportMarkdownFromLexical } from "../../exportMarkdownFromLexical.js";
7
7
  import { importMarkdownToLexical } from "../../importMarkdownToLexical.js";
8
8
  import { LexicalLinebreakVisitor } from "./LexicalLinebreakVisitor.js";
@@ -197,14 +197,18 @@ const coreSystem = system((r) => {
197
197
  KEY_DOWN_COMMAND,
198
198
  (event) => {
199
199
  const { keyCode, ctrlKey, metaKey } = event;
200
- if (keyCode === 65 && controlOrMeta(metaKey, ctrlKey)) {
200
+ let shouldOverride = false;
201
+ theRootEditor.getEditorState().read(() => {
202
+ var _a;
203
+ shouldOverride = ((_a = $getRoot().getFirstChild()) == null ? void 0 : _a.getType()) === "frontmatter";
204
+ });
205
+ if (keyCode === 65 && controlOrMeta(metaKey, ctrlKey) && shouldOverride) {
201
206
  event.preventDefault();
207
+ event.stopImmediatePropagation();
202
208
  theRootEditor.update(() => {
203
209
  var _a;
204
- const root = $getRoot();
205
- const skipFirstChild = ((_a = root.getFirstChild()) == null ? void 0 : _a.getType()) === "frontmatter";
206
- root.select(skipFirstChild ? 1 : 0, root.getChildrenSize());
207
210
  const rootElement = theRootEditor.getRootElement();
211
+ (_a = window.getSelection()) == null ? void 0 : _a.selectAllChildren(rootElement);
208
212
  rootElement.focus({
209
213
  preventScroll: true
210
214
  });
@@ -213,7 +217,7 @@ const coreSystem = system((r) => {
213
217
  }
214
218
  return false;
215
219
  },
216
- COMMAND_PRIORITY_LOW
220
+ COMMAND_PRIORITY_CRITICAL
217
221
  );
218
222
  });
219
223
  const composerChildren = r.node([]);
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "private": false,
10
10
  "sideEffects": false,
11
11
  "type": "module",
12
- "version": "0.21.0",
12
+ "version": "0.21.1",
13
13
  "description": "React component for rich text markdown editing",
14
14
  "scripts": {
15
15
  "build": "vite build",