@haklex/rich-plugin-block-handle 0.32.0 → 0.33.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 (2) hide show
  1. package/dist/index.mjs +8 -4
  2. package/package.json +22 -22
package/dist/index.mjs CHANGED
@@ -266,7 +266,8 @@ function useBlockSelection(editor) {
266
266
  if (topLevelFallbackNodes.length > 1 && topLevelFallbackNodes.length === selectedNodes.length) return getTopLevelNodesByKeys(new Set(topLevelFallbackNodes.map((node) => node.getKey())));
267
267
  return [];
268
268
  }
269
- if (!$isNodeSelection($getSelection())) return getTopLevelNodesByKeys(ownedKeys);
269
+ const selection = $getSelection();
270
+ if (!$isNodeSelection(selection)) return getTopLevelNodesByKeys(ownedKeys);
270
271
  return getTopLevelNodesByKeys(ownedKeys);
271
272
  }, [getTopLevelNodesByKeys]);
272
273
  const replaceBlockSelectionWithDataTransfer = useCallback((dataTransfer) => {
@@ -378,7 +379,8 @@ function useBlockSelection(editor) {
378
379
  if (nestedEditable && nestedEditable !== rootEl) {
379
380
  clearBlockSelectionState();
380
381
  editor.update(() => {
381
- if ($isNodeSelection($getSelection())) $setSelection(null);
382
+ const sel = $getSelection();
383
+ if ($isNodeSelection(sel)) $setSelection(null);
382
384
  });
383
385
  }
384
386
  };
@@ -425,7 +427,8 @@ function useBlockSelection(editor) {
425
427
  const unregShiftDown = editor.registerCommand(KEY_ARROW_DOWN_COMMAND, (event) => {
426
428
  if (!event?.shiftKey) return false;
427
429
  if (blockSelectionKeysRef.current.size === 0 || !focusKeyRef.current) return false;
428
- if (!$isNodeSelection($getSelection())) return false;
430
+ const sel = $getSelection();
431
+ if (!$isNodeSelection(sel)) return false;
429
432
  const children = $getRoot().getChildren();
430
433
  const focusIdx = children.findIndex((c) => c.getKey() === focusKeyRef.current);
431
434
  if (focusIdx === -1 || focusIdx >= children.length - 1) return false;
@@ -440,7 +443,8 @@ function useBlockSelection(editor) {
440
443
  const unregShiftUp = editor.registerCommand(KEY_ARROW_UP_COMMAND, (event) => {
441
444
  if (!event?.shiftKey) return false;
442
445
  if (blockSelectionKeysRef.current.size === 0 || !focusKeyRef.current) return false;
443
- if (!$isNodeSelection($getSelection())) return false;
446
+ const sel = $getSelection();
447
+ if (!$isNodeSelection(sel)) return false;
444
448
  const children = $getRoot().getChildren();
445
449
  const focusIdx = children.findIndex((c) => c.getKey() === focusKeyRef.current);
446
450
  if (focusIdx === -1 || focusIdx <= 0) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-plugin-block-handle",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Block handle plugin with add button and context menu",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,38 +21,38 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@lexical/code-core": "^0.48.0"
24
+ "@lexical/code-core": "^0.49.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@lexical/html": "^0.48.0",
28
- "@lexical/list": "^0.48.0",
29
- "@lexical/react": "^0.48.0",
30
- "@lexical/rich-text": "^0.48.0",
31
- "@lexical/selection": "^0.48.0",
32
- "@types/react": "^19.2.17",
33
- "@types/react-dom": "^19.2.3",
34
- "@vanilla-extract/css": "^1.21.1",
35
- "@vanilla-extract/vite-plugin": "^5.2.5",
36
- "lexical": "^0.48.0",
37
- "lucide-react": "^1.26.0",
27
+ "@lexical/html": "^0.49.0",
28
+ "@lexical/list": "^0.49.0",
29
+ "@lexical/react": "^0.49.0",
30
+ "@lexical/rich-text": "^0.49.0",
31
+ "@lexical/selection": "^0.49.0",
32
+ "@types/react": "^19.2.18",
33
+ "@types/react-dom": "^19.2.4",
34
+ "@vanilla-extract/css": "^1.21.2",
35
+ "@vanilla-extract/vite-plugin": "^5.2.6",
36
+ "lexical": "^0.49.0",
37
+ "lucide-react": "^1.28.0",
38
38
  "react": "^19.2.8",
39
39
  "react-dom": "^19.2.8",
40
40
  "typescript": "^7.0.2",
41
41
  "unplugin-dts": "^1.0.3",
42
- "vite": "^8.1.5"
42
+ "vite": "^8.2.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@lexical/html": "^0.47.0",
46
- "@lexical/list": "^0.47.0",
47
- "@lexical/react": "^0.47.0",
48
- "@lexical/rich-text": "^0.47.0",
49
- "@lexical/selection": "^0.47.0",
50
- "lexical": "^0.47.0",
45
+ "@lexical/html": "^0.49.0",
46
+ "@lexical/list": "^0.49.0",
47
+ "@lexical/react": "^0.49.0",
48
+ "@lexical/rich-text": "^0.49.0",
49
+ "@lexical/selection": "^0.49.0",
50
+ "lexical": "^0.49.0",
51
51
  "lucide-react": "^1.0.0",
52
52
  "react": ">=19",
53
53
  "react-dom": ">=19",
54
- "@haklex/rich-editor-ui": "^0.32.0",
55
- "@haklex/rich-style-token": "^0.32.0"
54
+ "@haklex/rich-editor-ui": "^0.33.0",
55
+ "@haklex/rich-style-token": "^0.33.0"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"