@team-monolith/cds 1.122.2 → 1.122.4

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.
@@ -14,7 +14,6 @@ import styled from "@emotion/styled";
14
14
  import { debounce } from "lodash";
15
15
  import { useTranslation } from "react-i18next";
16
16
  export function InsertImageDialog(props) {
17
- var _a;
18
17
  const { title, open, onClose, imageProps, onChange, onDelete, shouldReset } = props;
19
18
  const theme = useTheme();
20
19
  const { t } = useTranslation();
@@ -52,7 +51,7 @@ export function InsertImageDialog(props) {
52
51
  handleSubmit(onSubmit)();
53
52
  }, disableIconPadding: true, children: [_jsx(StyledAlertDialogTitle, { onClose: handleOnClose, children: title }), _jsx(AlertDialogContent, { children: _jsxs(Inputs, { children: [_jsx(FileSelectInput, { onChange: (value) => {
54
53
  setValue("src", value);
55
- }, fileType: "image" }), _jsx(FormInput, { name: "src", control: control, placeholder: "https://www.pexels.com/photo/n-2848492", size: "medium", label: "URL", fullWidth: true, startIcon: _jsx(LinkIcon, {}) }), previewSrc && (_jsx(ImagePreview, { src: previewSrc, alt: watch("altText"), fallback: _jsx(ImageNotAvailable, {}) })), _jsx(FormInput, { name: "altText", control: control, placeholder: t("삽입하는 이미지에 관한 설명"), size: "medium", label: t("대체 텍스트"), fullWidth: true })] }) }), _jsxs(AlertDialogActions, { children: [_jsx(Button, { type: "submit", fullWidth: true, label: t("삽입하기"), size: "medium", color: "primary", disabled: isDisabled }), onDelete && (_jsx(Button, { color: "danger", size: "medium", fullWidth: true, label: t("삭제하기"), onClick: onDelete }))] })] }, open ? (_a = imageProps === null || imageProps === void 0 ? void 0 : imageProps.src) !== null && _a !== void 0 ? _a : "" : undefined));
54
+ }, fileType: "image" }), _jsx(FormInput, { name: "src", control: control, placeholder: "https://www.pexels.com/photo/n-2848492", size: "medium", label: "URL", fullWidth: true, startIcon: _jsx(LinkIcon, {}) }), previewSrc && (_jsx(ImagePreview, { src: previewSrc, alt: watch("altText"), fallback: _jsx(ImageNotAvailable, {}) })), _jsx(FormInput, { name: "altText", control: control, placeholder: t("삽입하는 이미지에 관한 설명"), size: "medium", label: t("대체 텍스트"), fullWidth: true })] }) }), _jsxs(AlertDialogActions, { children: [_jsx(Button, { type: "submit", fullWidth: true, label: t("삽입하기"), size: "medium", color: "primary", disabled: isDisabled }), onDelete && (_jsx(Button, { color: "danger", size: "medium", fullWidth: true, label: t("삭제하기"), onClick: onDelete }))] })] }));
56
55
  }
57
56
  const StyledAlertDialog = styled(AlertDialog) `
58
57
  gap: 16px;
@@ -212,7 +212,10 @@ export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth,
212
212
  setOpen(true);
213
213
  }, "aria-label": t("이미지 수정하기", {
214
214
  context: "스퀘어버튼, 렉시컬 이미지 도구",
215
- }) })] }), _jsx(InsertImageDialog, { open: open, title: t("이미지 수정하기", {
215
+ }) })] }), _jsx(InsertImageDialog
216
+ // AIDEV-NOTE
217
+ // 내부 폼 상태 초기화를 위해 key를 전달합니다.
218
+ , { open: open, title: t("이미지 수정하기", {
216
219
  context: "제목, 이미지 수정 다이얼로그",
217
220
  }), onClose: () => setOpen(false), imageProps: {
218
221
  src,
@@ -234,7 +237,7 @@ export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth,
234
237
  }
235
238
  node.remove();
236
239
  });
237
- } })] }));
240
+ } }, src)] }));
238
241
  }
239
242
  const EditContainer = styled.div `
240
243
  display: flex;
@@ -10,7 +10,7 @@ import { $insertNodeToNearestRoot, mergeRegister } from "@lexical/utils";
10
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
- import { useImageNodeTransform } from "./imageNodeTransform";
13
+ import { useImageNodeTransform } from "./useImageNodeTransform";
14
14
  const CAN_USE_DOM = typeof window !== "undefined" &&
15
15
  typeof window.document !== "undefined" &&
16
16
  typeof window.document.createElement !== "undefined";
@@ -16,18 +16,12 @@ const DATA_URL_PATTERN = /^data:[^,]+,/i;
16
16
  function isDataUrl(url) {
17
17
  return DATA_URL_PATTERN.test(url);
18
18
  }
19
- function getExtensionFromMimeType(mimeType) {
20
- var _a;
21
- const extension = (_a = mimeType.split("/")[1]) === null || _a === void 0 ? void 0 : _a.split("+")[0];
22
- return extension || "png";
23
- }
24
19
  function convertDataUrlToFile(dataUrl) {
25
20
  return __awaiter(this, void 0, void 0, function* () {
26
21
  try {
27
22
  const response = yield fetch(dataUrl);
28
23
  const blob = yield response.blob();
29
- const extension = getExtensionFromMimeType(blob.type);
30
- const filename = `pasted-image-${Date.now()}.${extension}`;
24
+ const filename = `pasted-image-${Date.now()}`;
31
25
  return new File([blob], filename, { type: blob.type });
32
26
  }
33
27
  catch (_a) {
@@ -65,7 +59,7 @@ export function useImageNodeTransform(editor) {
65
59
  const file = yield convertDataUrlToFile(src);
66
60
  if (!file) {
67
61
  processingNodesRef.current.delete(key);
68
- showFileError === null || showFileError === void 0 ? void 0 : showFileError("upload", t("지원되지 않는 이미지입니다. 파일 업로드를 사용해 주세요."));
62
+ showFileError === null || showFileError === void 0 ? void 0 : showFileError("upload", t("손상된 이미지입니다. 다른 이미지를 사용해 주세요."));
69
63
  editor.update(() => {
70
64
  const currentNode = $getNodeByKey(key);
71
65
  if ($isImageNode(currentNode)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.122.2",
3
+ "version": "1.122.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,