@team-monolith/cds 1.10.3 → 1.10.5
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/icons/Custom.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +2 -4
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageDialog.js +13 -8
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageUploadedDialogBody.d.ts +0 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageUploadedDialogBody.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageUriDialogBody.d.ts +0 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageUriDialogBody.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/SettingForm.js +5 -4
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageDialog.js +7 -7
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUploadedDialogBody.d.ts +0 -2
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUploadedDialogBody.js +2 -2
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUriDialogBody.d.ts +0 -2
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUriDialogBody.js +2 -2
- package/package.json +1 -1
package/dist/icons/Custom.js
CHANGED
|
@@ -100,5 +100,5 @@ export const CustomPdfColorIcon = forwardRef((props, ref) => {
|
|
|
100
100
|
import customPdfSvgImport from "./custom/pdf.svg";
|
|
101
101
|
export const customPdfSvg = customPdfSvgImport;
|
|
102
102
|
export const CustomPdfIcon = forwardRef((props, ref) => {
|
|
103
|
-
return (_jsx("svg", Object.assign({}, props, { ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { fill: "currentColor",
|
|
103
|
+
return (_jsx("svg", Object.assign({}, props, { ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd", d: "M21 20.8V6.5L15.375 1H5.25C4.65285 1 4.08118 1.23216 3.65931 1.64466C3.23743 2.05716 3 2.61612 3 3.2V20.8C3 21.3829 3.23743 21.9428 3.65931 22.3553C4.08118 22.7678 4.65285 23 5.25 23H18.75C19.3461 23 19.9188 22.7678 20.3407 22.3553C20.7626 21.9428 21 21.3839 21 20.8ZM10.6651 6.80746H12.7437V6.80832C12.8585 6.80832 12.9554 6.89616 12.9599 7.00922C13.0719 9.94434 15.6166 13.0343 18.8043 14.1579C18.9084 14.1944 18.9698 14.3005 18.944 14.4066L18.461 16.4086C18.4352 16.5138 18.332 16.5825 18.2217 16.5695C14.415 16.1077 10.4935 17.6731 6.93308 19.9646C6.83613 20.0272 6.70717 20.0046 6.63868 19.9133L5.40326 18.2618C5.33655 18.1723 5.35078 18.047 5.43706 17.9757C6.74186 16.8982 7.98528 15.1502 8.91562 13.1195C9.84597 11.0932 10.409 8.90248 10.4481 7.01704C10.4508 6.90051 10.546 6.80746 10.6651 6.80746ZM10.8733 14.8066C10.787 14.9788 10.9586 15.1649 11.1428 15.0989C12.0108 14.7884 12.8985 14.5336 13.8013 14.3518C13.9729 14.317 14.0334 14.1083 13.9053 13.9909C13.321 13.4526 12.7927 12.8577 12.3293 12.2168C12.227 12.075 12.0046 12.1055 11.9477 12.269C11.728 12.8986 11.4781 13.5195 11.2024 14.1222C11.0965 14.3527 10.9871 14.5805 10.8733 14.8066Z" }) })));
|
|
104
104
|
});
|
|
@@ -10,7 +10,7 @@ import Switch from "../../../../../components/Switch";
|
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { InsertImageDialog } from "./InsertImageDialog";
|
|
12
12
|
export function FormSelection(props) {
|
|
13
|
-
const { index, control,
|
|
13
|
+
const { index, control, watch, rules, onDelete } = props;
|
|
14
14
|
const [imageOpen, setImageOpen] = useState(false);
|
|
15
15
|
const [inputFocused, setInputFocused] = useState(false);
|
|
16
16
|
return (_jsxs(Container, { children: [_jsx(Index, { children: index + 1 }), _jsxs("div", Object.assign({ css: css `
|
|
@@ -18,9 +18,7 @@ export function FormSelection(props) {
|
|
|
18
18
|
flex: 1;
|
|
19
19
|
flex-direction: column;
|
|
20
20
|
gap: 4px;
|
|
21
|
-
` }, { children: [_jsx(Controller, { name: `selections.${index}.show.image`, control: control, render: ({ field: { value, onChange } }) => (_jsxs(_Fragment, { children: [_jsx(InsertImageDialog, { title: value ? "이미지 바꾸기" : "이미지 삽입하기", open: imageOpen, onClose: () => setImageOpen(false), updateImg: (props) => {
|
|
22
|
-
onChange(props);
|
|
23
|
-
}, deleteButton: value !== null }), value && value.src && (_jsx("img", { src: value.src, alt: value.altText, css: css `
|
|
21
|
+
` }, { children: [_jsx(Controller, { name: `selections.${index}.show.image`, control: control, render: ({ field: { value, onChange } }) => (_jsxs(_Fragment, { children: [_jsx(InsertImageDialog, { title: value ? "이미지 바꾸기" : "이미지 삽입하기", open: imageOpen, onClose: () => setImageOpen(false), updateImg: (props) => onChange(props), deleteButton: Boolean(value) }), value && value.src && (_jsx("img", { src: value.src, alt: value.altText, css: css `
|
|
24
22
|
height: auto;
|
|
25
23
|
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
26
24
|
max-width: min(400px, 100%);
|
package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageDialog.js
CHANGED
|
@@ -25,19 +25,23 @@ export function InsertImageDialog(props) {
|
|
|
25
25
|
const [mode, setMode] = useState(null);
|
|
26
26
|
const inputRef = useRef(null);
|
|
27
27
|
const cdsContext = useContext(CodleDesignSystemContext);
|
|
28
|
-
const { control, setValue, watch, reset } = useForm({
|
|
28
|
+
const { control, setValue, watch, reset, handleSubmit } = useForm({
|
|
29
29
|
defaultValues: { src: "", altText: "" },
|
|
30
30
|
});
|
|
31
|
-
const onClick = (props) => {
|
|
32
|
-
updateImg(props);
|
|
33
|
-
handleOnClose();
|
|
34
|
-
};
|
|
35
31
|
const handleOnClose = () => {
|
|
36
32
|
setMode(null);
|
|
37
33
|
reset();
|
|
38
34
|
onClose();
|
|
39
35
|
};
|
|
40
|
-
|
|
36
|
+
const onSubmit = (data) => {
|
|
37
|
+
updateImg(data);
|
|
38
|
+
handleOnClose();
|
|
39
|
+
};
|
|
40
|
+
return (_jsxs(StyledAlertDialog, Object.assign({ component: "form", icon: _jsx(ImageFillIcon, { color: theme.color.background.primary }), open: open, onClose: handleOnClose, onSubmit: (e) => {
|
|
41
|
+
// nested form 구조라서 submit이벤트 전파를 막습니다.
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
handleSubmit(onSubmit)();
|
|
44
|
+
}, disableIconPadding: true }, { children: [_jsx(StyledAlertDialogTitle, Object.assign({ onClose: handleOnClose }, { children: title })), !mode && (_jsx(AlertDialogContent, { children: _jsxs("div", Object.assign({ css: css `
|
|
41
45
|
display: flex;
|
|
42
46
|
flex-direction: column;
|
|
43
47
|
gap: 16px;
|
|
@@ -57,8 +61,9 @@ export function InsertImageDialog(props) {
|
|
|
57
61
|
setMode("file");
|
|
58
62
|
}
|
|
59
63
|
}) })] })] }), deleteButton && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx(Button, { color: "textDanger", size: "medium", fullWidth: true, label: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C\uD558\uAE30", onClick: () => {
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
updateImg(null);
|
|
65
|
+
handleOnClose();
|
|
66
|
+
} })] }))] })) })), mode === "url" && (_jsx(InsertImageUriDialogBody, { control: control, watch: watch })), mode === "file" && (_jsx(InsertImageUploadedDialogBody, { control: control, watch: watch, setValue: setValue }))] })));
|
|
62
67
|
}
|
|
63
68
|
const StyledAlertDialog = styled(AlertDialog) `
|
|
64
69
|
gap: 16px;
|
|
@@ -4,6 +4,5 @@ export interface InsertImageUploadedDialogBodyProps {
|
|
|
4
4
|
control: Control<ImageProps, any>;
|
|
5
5
|
watch: UseFormWatch<ImageProps>;
|
|
6
6
|
setValue: UseFormSetValue<ImageProps>;
|
|
7
|
-
onClick: (props: ImageProps) => void;
|
|
8
7
|
}
|
|
9
8
|
export declare function InsertImageUploadedDialogBody(props: InsertImageUploadedDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,7 +17,7 @@ import { RefreshLineIcon } from "../../../../../icons";
|
|
|
17
17
|
import Input from "../../../../../components/Input";
|
|
18
18
|
import { Controller, } from "react-hook-form";
|
|
19
19
|
export function InsertImageUploadedDialogBody(props) {
|
|
20
|
-
const { control, watch, setValue
|
|
20
|
+
const { control, watch, setValue } = props;
|
|
21
21
|
const inputRef = useRef(null);
|
|
22
22
|
const cdsContext = useContext(CodleDesignSystemContext);
|
|
23
23
|
const isDisabled = watch("src") === "";
|
|
@@ -33,7 +33,7 @@ export function InsertImageUploadedDialogBody(props) {
|
|
|
33
33
|
if (uploadByFile) {
|
|
34
34
|
setValue("src", yield uploadByFile(file));
|
|
35
35
|
}
|
|
36
|
-
}) }), _jsxs(ImagePreview, { children: ["\uC774\uBBF8\uC9C0 \uBBF8\uB9AC\uBCF4\uAE30", _jsx("img", { src: watch("src"), alt: watch("altText") })] }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled
|
|
36
|
+
}) }), _jsxs(ImagePreview, { children: ["\uC774\uBBF8\uC9C0 \uBBF8\uB9AC\uBCF4\uAE30", _jsx("img", { src: watch("src"), alt: watch("altText") })] }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { type: "submit", fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled }) })] }));
|
|
37
37
|
}
|
|
38
38
|
const Inputs = styled.div `
|
|
39
39
|
display: flex;
|
|
@@ -3,6 +3,5 @@ import { Control, UseFormWatch } from "react-hook-form";
|
|
|
3
3
|
export interface InsertImageUriDialogBodyProps {
|
|
4
4
|
control: Control<ImageProps, any>;
|
|
5
5
|
watch: UseFormWatch<ImageProps>;
|
|
6
|
-
onClick: (props: ImageProps) => void;
|
|
7
6
|
}
|
|
8
7
|
export declare function InsertImageUriDialogBody(props: InsertImageUriDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/InsertImageUriDialogBody.js
CHANGED
|
@@ -6,9 +6,9 @@ import { LinkIcon } from "../../../../../icons";
|
|
|
6
6
|
import Button from "../../../../../components/Button";
|
|
7
7
|
import { Controller } from "react-hook-form";
|
|
8
8
|
export function InsertImageUriDialogBody(props) {
|
|
9
|
-
const { control, watch
|
|
9
|
+
const { control, watch } = props;
|
|
10
10
|
const isDisabled = watch("src") === "";
|
|
11
|
-
return (_jsxs(_Fragment, { children: [" ", _jsx(AlertDialogContent, { children: _jsxs(Inputs, { children: [_jsx(Controller, { name: "src", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "URL", placeholder: "https://www.pexels.com/photo/n-2848492/", color: "default", size: "medium", onChange: onChange, value: value, startIcon: _jsx(LinkIcon, {}) })) }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled
|
|
11
|
+
return (_jsxs(_Fragment, { children: [" ", _jsx(AlertDialogContent, { children: _jsxs(Inputs, { children: [_jsx(Controller, { name: "src", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "URL", placeholder: "https://www.pexels.com/photo/n-2848492/", color: "default", size: "medium", onChange: onChange, value: value, startIcon: _jsx(LinkIcon, {}) })) }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { type: "submit", fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled }) })] }));
|
|
12
12
|
}
|
|
13
13
|
const Inputs = styled.div `
|
|
14
14
|
display: flex;
|
|
@@ -46,12 +46,13 @@ export default function SettingForm(props) {
|
|
|
46
46
|
});
|
|
47
47
|
onClose();
|
|
48
48
|
};
|
|
49
|
-
function validateDuplicatedSelection(
|
|
49
|
+
function validateDuplicatedSelection(index) {
|
|
50
|
+
const selections = watch("selections");
|
|
50
51
|
if (index === 0)
|
|
51
52
|
return true;
|
|
52
|
-
const duplicatedIndex =
|
|
53
|
+
const duplicatedIndex = selections
|
|
53
54
|
.slice(0, index)
|
|
54
|
-
.findIndex((
|
|
55
|
+
.findIndex((selection) => selection.show.text === selections[index].show.text);
|
|
55
56
|
if (duplicatedIndex < 0)
|
|
56
57
|
return true;
|
|
57
58
|
return `${duplicatedIndex + 1}번 선택지와 같은 내용입니다.`;
|
|
@@ -64,7 +65,7 @@ export default function SettingForm(props) {
|
|
|
64
65
|
height: 12px;
|
|
65
66
|
` }), "\uAC1D\uAD00\uC2DD \uC785\uB825 \uCE78"] }), _jsxs(Content, { children: [_jsxs(FormArea, { children: [_jsx(Label, { children: "\uB2F5\uC548" }), fields.map((field, index) => (_jsx(FormSelection, { index: index, control: control, watch: watch, rules: {
|
|
66
67
|
required: "필수 입력 항목입니다.",
|
|
67
|
-
validate: () => validateDuplicatedSelection(
|
|
68
|
+
validate: () => validateDuplicatedSelection(index),
|
|
68
69
|
}, onDelete: index !== 0
|
|
69
70
|
? () => {
|
|
70
71
|
remove(index);
|
|
@@ -26,9 +26,13 @@ export function InsertImageDialog(props) {
|
|
|
26
26
|
const hasModifier = useRef(false);
|
|
27
27
|
const inputRef = useRef(null);
|
|
28
28
|
const cdsContext = useContext(CodleDesignSystemContext);
|
|
29
|
-
const { control, setValue, watch, reset } = useForm({
|
|
29
|
+
const { control, setValue, watch, reset, handleSubmit } = useForm({
|
|
30
30
|
defaultValues: { src: "", altText: "" },
|
|
31
31
|
});
|
|
32
|
+
const onSubmit = (data) => {
|
|
33
|
+
activeEditor.dispatchCommand(INSERT_IMAGE_COMMAND, data);
|
|
34
|
+
handleOnClose();
|
|
35
|
+
};
|
|
32
36
|
useEffect(() => {
|
|
33
37
|
hasModifier.current = false;
|
|
34
38
|
const handler = (e) => {
|
|
@@ -39,16 +43,12 @@ export function InsertImageDialog(props) {
|
|
|
39
43
|
document.removeEventListener("keydown", handler);
|
|
40
44
|
};
|
|
41
45
|
}, [activeEditor]);
|
|
42
|
-
const onClick = (payload) => {
|
|
43
|
-
activeEditor.dispatchCommand(INSERT_IMAGE_COMMAND, payload);
|
|
44
|
-
handleOnClose();
|
|
45
|
-
};
|
|
46
46
|
const handleOnClose = () => {
|
|
47
47
|
setMode(null);
|
|
48
48
|
reset();
|
|
49
49
|
onClose();
|
|
50
50
|
};
|
|
51
|
-
return (_jsxs(StyledAlertDialog, Object.assign({ icon: _jsx(ImageFillIcon, { color: theme.color.background.primary }), open: open, onClose: handleOnClose, disableIconPadding: true }, { children: [_jsx(StyledAlertDialogTitle, Object.assign({ onClose: handleOnClose }, { children: "\uC774\uBBF8\uC9C0 \uC0BD\uC785\uD558\uAE30" })), !mode && (_jsx(AlertDialogContent, { children: _jsxs(Buttons, { children: [_jsxs(ButtonAndDescription, { children: [_jsx(Description, { children: "\uC774\uBBF8\uC9C0 URL\uC744 \uC54C\uACE0 \uC788\uB2E4\uBA74" }), _jsx(Button, { color: "grey", size: "medium", fullWidth: true, label: "URL\uB85C \uC0BD\uC785\uD558\uAE30", startIcon: _jsx(LinkIcon, {}), onClick: () => setMode("url") })] }), _jsxs(ButtonAndDescription, { children: [_jsx(Description, { children: "\uAC16\uACE0 \uC788\uB294 \uC774\uBBF8\uC9C0\uB97C \uC0BD\uC785\uD558\uACE0 \uC2F6\uB2E4\uBA74" }), _jsx(Button, { color: "grey", size: "medium", fullWidth: true, label: "\uD30C\uC77C \uC120\uD0DD\uD558\uAE30", startIcon: _jsx(UploadLineIcon, {}), onClick: () => {
|
|
51
|
+
return (_jsxs(StyledAlertDialog, Object.assign({ component: "form", icon: _jsx(ImageFillIcon, { color: theme.color.background.primary }), open: open, onClose: handleOnClose, onSubmit: handleSubmit(onSubmit), disableIconPadding: true }, { children: [_jsx(StyledAlertDialogTitle, Object.assign({ onClose: handleOnClose }, { children: "\uC774\uBBF8\uC9C0 \uC0BD\uC785\uD558\uAE30" })), !mode && (_jsx(AlertDialogContent, { children: _jsxs(Buttons, { children: [_jsxs(ButtonAndDescription, { children: [_jsx(Description, { children: "\uC774\uBBF8\uC9C0 URL\uC744 \uC54C\uACE0 \uC788\uB2E4\uBA74" }), _jsx(Button, { color: "grey", size: "medium", fullWidth: true, label: "URL\uB85C \uC0BD\uC785\uD558\uAE30", startIcon: _jsx(LinkIcon, {}), onClick: () => setMode("url") })] }), _jsxs(ButtonAndDescription, { children: [_jsx(Description, { children: "\uAC16\uACE0 \uC788\uB294 \uC774\uBBF8\uC9C0\uB97C \uC0BD\uC785\uD558\uACE0 \uC2F6\uB2E4\uBA74" }), _jsx(Button, { color: "grey", size: "medium", fullWidth: true, label: "\uD30C\uC77C \uC120\uD0DD\uD558\uAE30", startIcon: _jsx(UploadLineIcon, {}), onClick: () => {
|
|
52
52
|
var _a;
|
|
53
53
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
54
54
|
} }), _jsx(HiddenInput, { ref: inputRef, type: "file", accept: "image/*", onChange: (event) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -61,7 +61,7 @@ export function InsertImageDialog(props) {
|
|
|
61
61
|
setValue("src", yield uploadByFile(file));
|
|
62
62
|
setMode("file");
|
|
63
63
|
}
|
|
64
|
-
}) })] })] }) })), mode === "url" && (_jsx(InsertImageUriDialogBody, { control: control, watch: watch
|
|
64
|
+
}) })] })] }) })), mode === "url" && (_jsx(InsertImageUriDialogBody, { control: control, watch: watch })), mode === "file" && (_jsx(InsertImageUploadedDialogBody, { control: control, watch: watch, setValue: setValue }))] })));
|
|
65
65
|
}
|
|
66
66
|
const StyledAlertDialog = styled(AlertDialog) `
|
|
67
67
|
gap: 16px;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InsertImagePayload } from ".";
|
|
2
1
|
import { Control, UseFormSetValue, UseFormWatch } from "react-hook-form";
|
|
3
2
|
export interface InsertImageUploadedDialogBodyProps {
|
|
4
3
|
control: Control<{
|
|
@@ -13,6 +12,5 @@ export interface InsertImageUploadedDialogBodyProps {
|
|
|
13
12
|
src: string;
|
|
14
13
|
altText: string;
|
|
15
14
|
}>;
|
|
16
|
-
onClick: (payload: InsertImagePayload) => void;
|
|
17
15
|
}
|
|
18
16
|
export declare function InsertImageUploadedDialogBody(props: InsertImageUploadedDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,7 +17,7 @@ import Input from "../../../../components/Input";
|
|
|
17
17
|
import { RefreshLineIcon } from "../../../../icons";
|
|
18
18
|
import { Controller, } from "react-hook-form";
|
|
19
19
|
export function InsertImageUploadedDialogBody(props) {
|
|
20
|
-
const { control, watch, setValue
|
|
20
|
+
const { control, watch, setValue } = props;
|
|
21
21
|
const inputRef = useRef(null);
|
|
22
22
|
const cdsContext = useContext(CodleDesignSystemContext);
|
|
23
23
|
const isDisabled = watch("src") === "";
|
|
@@ -33,7 +33,7 @@ export function InsertImageUploadedDialogBody(props) {
|
|
|
33
33
|
if (uploadByFile) {
|
|
34
34
|
setValue("src", yield uploadByFile(file));
|
|
35
35
|
}
|
|
36
|
-
}) }), _jsxs(ImagePreview, { children: ["\uC774\uBBF8\uC9C0 \uBBF8\uB9AC\uBCF4\uAE30", _jsx("img", { src: watch("src"), alt: watch("altText") })] }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled
|
|
36
|
+
}) }), _jsxs(ImagePreview, { children: ["\uC774\uBBF8\uC9C0 \uBBF8\uB9AC\uBCF4\uAE30", _jsx("img", { src: watch("src"), alt: watch("altText") })] }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { type: "submit", fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled }) })] }));
|
|
37
37
|
}
|
|
38
38
|
const Inputs = styled.div `
|
|
39
39
|
display: flex;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InsertImagePayload } from ".";
|
|
2
1
|
import { Control, UseFormWatch } from "react-hook-form";
|
|
3
2
|
export interface InsertImageUriDialogBodyProps {
|
|
4
3
|
control: Control<{
|
|
@@ -9,6 +8,5 @@ export interface InsertImageUriDialogBodyProps {
|
|
|
9
8
|
src: string;
|
|
10
9
|
altText: string;
|
|
11
10
|
}>;
|
|
12
|
-
onClick: (payload: InsertImagePayload) => void;
|
|
13
11
|
}
|
|
14
12
|
export declare function InsertImageUriDialogBody(props: InsertImageUriDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,9 +6,9 @@ import { LinkIcon } from "../../../../icons";
|
|
|
6
6
|
import Button from "../../../../components/Button";
|
|
7
7
|
import { Controller } from "react-hook-form";
|
|
8
8
|
export function InsertImageUriDialogBody(props) {
|
|
9
|
-
const { control, watch
|
|
9
|
+
const { control, watch } = props;
|
|
10
10
|
const isDisabled = watch("src") === "";
|
|
11
|
-
return (_jsxs(_Fragment, { children: [" ", _jsx(AlertDialogContent, { children: _jsxs(Inputs, { children: [_jsx(Controller, { name: "src", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "URL", placeholder: "https://www.pexels.com/photo/n-2848492/", color: "default", size: "medium", onChange: onChange, value: value, startIcon: _jsx(LinkIcon, {}) })) }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled
|
|
11
|
+
return (_jsxs(_Fragment, { children: [" ", _jsx(AlertDialogContent, { children: _jsxs(Inputs, { children: [_jsx(Controller, { name: "src", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "URL", placeholder: "https://www.pexels.com/photo/n-2848492/", color: "default", size: "medium", onChange: onChange, value: value, startIcon: _jsx(LinkIcon, {}) })) }), _jsx(Controller, { name: "altText", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { fullWidth: true, label: "\uB300\uCCB4 \uD14D\uC2A4\uD2B8", placeholder: "\uC0BD\uC785\uD558\uB294 \uC774\uBBF8\uC9C0\uC5D0 \uAD00\uD55C \uC124\uBA85", color: "default", size: "medium", onChange: onChange, value: value })) })] }) }), _jsx(AlertDialogActions, { children: _jsx(Button, { type: "submit", fullWidth: true, label: "\uC0BD\uC785\uD558\uAE30", size: "medium", color: "primary", disabled: isDisabled }) })] }));
|
|
12
12
|
}
|
|
13
13
|
const Inputs = styled.div `
|
|
14
14
|
display: flex;
|