@team-monolith/cds 1.81.1 → 1.82.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.
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
9
- import { $wrapNodeInElement, mergeRegister } from "@lexical/utils";
10
- import { $createParagraphNode, $createRangeSelection, $getSelection, $insertNodes, $isNodeSelection, $isRootOrShadowRoot, $setSelection, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, createCommand, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, } from "lexical";
9
+ import { $insertNodeToNearestRoot, mergeRegister } from "@lexical/utils";
10
+ import { $createRangeSelection, $getSelection, $isNodeSelection, $setSelection, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, createCommand, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, } from "lexical";
11
11
  import { useEffect } from "react";
12
12
  import { $createImageNode, $isImageNode, ImageNode, } from "../../nodes";
13
13
  const CAN_USE_DOM = typeof window !== "undefined" &&
@@ -23,10 +23,12 @@ export function ImagesPlugin({ captionsEnabled, }) {
23
23
  }
24
24
  return mergeRegister(editor.registerCommand(INSERT_IMAGE_COMMAND, (payload) => {
25
25
  const imageNode = $createImageNode(payload);
26
- $insertNodes([imageNode]);
27
- if ($isRootOrShadowRoot(imageNode.getParentOrThrow())) {
28
- $wrapNodeInElement(imageNode, $createParagraphNode).selectEnd();
29
- }
26
+ // lexical의 원본코드에서는 이미지 노드를 텍스트 노드 안에 삽입하고 있었습니다.
27
+ // 때문에 이미지 노드 아래에 불필요한 텍스트 라인이 생성됩니다.
28
+ // before: images/2025-01-06-15-16-05.png
29
+ // 이를 막기 위해 다른 커스텀 노드처럼 노드를 직접 삽입합니다.
30
+ // after: images/2025-01-06-15-14-39.png
31
+ $insertNodeToNearestRoot(imageNode);
30
32
  return true;
31
33
  }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(DRAGSTART_COMMAND, (event) => {
32
34
  return onDragStart(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.81.1",
3
+ "version": "1.82.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,