@team-monolith/cds 1.10.4 → 1.10.6
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/patterns/LexicalEditor/nodes/ProblemSelectNode/ProblemSelectNode.d.ts +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 +7 -14
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +1 -0
- 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
|
@@ -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;
|
|
@@ -19,16 +19,7 @@ export default function SettingForm(props) {
|
|
|
19
19
|
const { control, handleSubmit, watch } = useForm({
|
|
20
20
|
mode: "all",
|
|
21
21
|
defaultValues: {
|
|
22
|
-
selections
|
|
23
|
-
var _a;
|
|
24
|
-
return ({
|
|
25
|
-
isAnswer: selection.isAnswer,
|
|
26
|
-
show: {
|
|
27
|
-
image: (_a = selection.show.image) !== null && _a !== void 0 ? _a : null,
|
|
28
|
-
text: selection.show.text,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}),
|
|
22
|
+
selections,
|
|
32
23
|
},
|
|
33
24
|
});
|
|
34
25
|
const { fields, append, remove } = useFieldArray({
|
|
@@ -46,12 +37,13 @@ export default function SettingForm(props) {
|
|
|
46
37
|
});
|
|
47
38
|
onClose();
|
|
48
39
|
};
|
|
49
|
-
function validateDuplicatedSelection(
|
|
40
|
+
function validateDuplicatedSelection(index) {
|
|
41
|
+
const selections = watch("selections");
|
|
50
42
|
if (index === 0)
|
|
51
43
|
return true;
|
|
52
|
-
const duplicatedIndex =
|
|
44
|
+
const duplicatedIndex = selections
|
|
53
45
|
.slice(0, index)
|
|
54
|
-
.findIndex((
|
|
46
|
+
.findIndex((selection) => selection.show.text === selections[index].show.text);
|
|
55
47
|
if (duplicatedIndex < 0)
|
|
56
48
|
return true;
|
|
57
49
|
return `${duplicatedIndex + 1}번 선택지와 같은 내용입니다.`;
|
|
@@ -64,7 +56,7 @@ export default function SettingForm(props) {
|
|
|
64
56
|
height: 12px;
|
|
65
57
|
` }), "\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
58
|
required: "필수 입력 항목입니다.",
|
|
67
|
-
validate: () => validateDuplicatedSelection(
|
|
59
|
+
validate: () => validateDuplicatedSelection(index),
|
|
68
60
|
}, onDelete: index !== 0
|
|
69
61
|
? () => {
|
|
70
62
|
remove(index);
|
|
@@ -73,6 +65,7 @@ export default function SettingForm(props) {
|
|
|
73
65
|
append({
|
|
74
66
|
isAnswer: false,
|
|
75
67
|
show: {
|
|
68
|
+
image: null,
|
|
76
69
|
text: "",
|
|
77
70
|
},
|
|
78
71
|
value: (fields.length + 1).toString(),
|
|
@@ -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;
|