@team-monolith/cds 1.119.3 → 1.119.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/@types/emotion.d.ts +160 -160
- package/README.md +37 -37
- package/dist/CdsProvider.js +4 -4
- package/dist/components/AlertDialog/AlertDialog.js +54 -54
- package/dist/components/AlertDialog/AlertDialogActions.js +7 -7
- package/dist/components/AlertDialog/AlertDialogContent.js +8 -8
- package/dist/components/AlertDialog/AlertDialogTitle.js +34 -34
- package/dist/components/AnimatedButton.js +32 -32
- package/dist/components/Banner.js +51 -51
- package/dist/components/Book/Book.js +174 -174
- package/dist/components/Button.js +179 -179
- package/dist/components/CheckboxInput.js +148 -148
- package/dist/components/FileTypeAlertDialog.js +4 -4
- package/dist/components/Input.js +53 -53
- package/dist/components/InputBase.js +72 -72
- package/dist/components/Modal.js +4 -4
- package/dist/components/OverflowTooltip.js +4 -4
- package/dist/components/Pagination.js +56 -56
- package/dist/components/PinInput.js +64 -64
- package/dist/components/Popover.js +27 -27
- package/dist/components/RadioInput.js +73 -73
- package/dist/components/SquareButton.js +109 -109
- package/dist/components/Switch.js +69 -69
- package/dist/components/SwitchButton.js +107 -107
- package/dist/components/Tag.js +72 -72
- package/dist/components/Tooltip.js +19 -19
- package/dist/foundation/breakpoints.js +16 -16
- package/dist/icons/custom/colored/ai-helper.svg +4 -4
- package/dist/icons/custom/colored/ai-quiz-color.svg +20 -20
- package/dist/icons/custom/colored/badge-color.svg +4 -4
- package/dist/icons/custom/colored/badge-gold.svg +11 -11
- package/dist/icons/custom/colored/badge-green.svg +11 -11
- package/dist/icons/custom/colored/badge-silver.svg +11 -11
- package/dist/icons/custom/colored/basic-plus.svg +31 -31
- package/dist/icons/custom/colored/basic.svg +3 -3
- package/dist/icons/custom/colored/board-color.svg +5 -5
- package/dist/icons/custom/colored/cast-cloudy-color.svg +6 -6
- package/dist/icons/custom/colored/cast-partly-color.svg +7 -7
- package/dist/icons/custom/colored/cast-rainbow-color.svg +13 -13
- package/dist/icons/custom/colored/cast-sunny-color.svg +4 -4
- package/dist/icons/custom/colored/clap-bronze.svg +8 -8
- package/dist/icons/custom/colored/clap-gold.svg +8 -8
- package/dist/icons/custom/colored/clap-silver.svg +8 -8
- package/dist/icons/custom/colored/class.svg +13 -13
- package/dist/icons/custom/colored/codap-color.svg +13 -13
- package/dist/icons/custom/colored/ebook-color.svg +5 -5
- package/dist/icons/custom/colored/embedded-color.svg +38 -38
- package/dist/icons/custom/colored/emo-clap-color.svg +252 -252
- package/dist/icons/custom/colored/emo-good-color.svg +68 -68
- package/dist/icons/custom/colored/emo-great-color.svg +67 -67
- package/dist/icons/custom/colored/emo-heart-color.svg +239 -239
- package/dist/icons/custom/colored/emo-hundred-color.svg +194 -194
- package/dist/icons/custom/colored/emo-neutral-color.svg +76 -76
- package/dist/icons/custom/colored/emo-stars-color.svg +121 -121
- package/dist/icons/custom/colored/emo-thumbup-color.svg +238 -238
- package/dist/icons/custom/colored/empty.svg +1 -1
- package/dist/icons/custom/colored/entry-color.svg +4 -4
- package/dist/icons/custom/colored/filename-all-color.svg +4 -4
- package/dist/icons/custom/colored/filename-doc-color.svg +5 -5
- package/dist/icons/custom/colored/filename-hwp-color.svg +6 -6
- package/dist/icons/custom/colored/filename-img-color.svg +6 -6
- package/dist/icons/custom/colored/filename-mp4-color.svg +5 -5
- package/dist/icons/custom/colored/filename-pdf-color.svg +12 -12
- package/dist/icons/custom/colored/filename-ppt-color.svg +6 -6
- package/dist/icons/custom/colored/filename-xls-color.svg +5 -5
- package/dist/icons/custom/colored/filename-zip-color.svg +5 -5
- package/dist/icons/custom/colored/google.svg +13 -13
- package/dist/icons/custom/colored/hand-fill.svg +4 -4
- package/dist/icons/custom/colored/judge-color.svg +6 -6
- package/dist/icons/custom/colored/makecode-color.svg +4 -4
- package/dist/icons/custom/colored/master.svg +12 -12
- package/dist/icons/custom/colored/material.svg +6 -6
- package/dist/icons/custom/colored/medal-bronze.svg +9 -9
- package/dist/icons/custom/colored/medal-gold.svg +9 -9
- package/dist/icons/custom/colored/medal-silver.svg +9 -9
- package/dist/icons/custom/colored/pro.svg +4 -4
- package/dist/icons/custom/colored/problem.svg +7 -7
- package/dist/icons/custom/colored/python-color.svg +4 -4
- package/dist/icons/custom/colored/quiz-color.svg +12 -12
- package/dist/icons/custom/colored/resource-color.svg +13 -13
- package/dist/icons/custom/colored/scratch-color.svg +6 -6
- package/dist/icons/custom/colored/type-helper.svg +9 -9
- package/dist/icons/custom/colored/whale.svg +7 -7
- package/dist/icons/custom/colored/worksheet-color.svg +5 -5
- package/dist/icons/custom/default/ai-quiz.svg +8 -8
- package/dist/icons/custom/default/badge.svg +4 -4
- package/dist/icons/custom/default/board.svg +5 -5
- package/dist/icons/custom/default/cast-cloudy.svg +3 -3
- package/dist/icons/custom/default/cast-partly.svg +4 -4
- package/dist/icons/custom/default/cast-rainbow.svg +12 -12
- package/dist/icons/custom/default/cast-sunny.svg +3 -3
- package/dist/icons/custom/default/codap.svg +11 -11
- package/dist/icons/custom/default/ebook.svg +3 -3
- package/dist/icons/custom/default/embedded.svg +4 -4
- package/dist/icons/custom/default/emo-clap.svg +6 -6
- package/dist/icons/custom/default/emo-good.svg +12 -12
- package/dist/icons/custom/default/emo-great.svg +12 -12
- package/dist/icons/custom/default/emo-heart.svg +5 -5
- package/dist/icons/custom/default/emo-hundred.svg +3 -3
- package/dist/icons/custom/default/emo-neutral.svg +14 -14
- package/dist/icons/custom/default/emo-stars.svg +14 -14
- package/dist/icons/custom/default/emo-thumbup.svg +3 -3
- package/dist/icons/custom/default/entry.svg +4 -4
- package/dist/icons/custom/default/fab.svg +10 -10
- package/dist/icons/custom/default/grant-alt.svg +5 -5
- package/dist/icons/custom/default/grant.svg +4 -4
- package/dist/icons/custom/default/hand-line.svg +3 -3
- package/dist/icons/custom/default/judge.svg +3 -3
- package/dist/icons/custom/default/makecode.svg +5 -5
- package/dist/icons/custom/default/pdf.svg +3 -3
- package/dist/icons/custom/default/python.svg +7 -7
- package/dist/icons/custom/default/quiz.svg +4 -4
- package/dist/icons/custom/default/resource.svg +11 -11
- package/dist/icons/custom/default/scratch.svg +3 -3
- package/dist/icons/custom/default/scroll-alt.svg +5 -5
- package/dist/icons/custom/default/scroll-fill.svg +4 -4
- package/dist/icons/custom/default/scroll-line.svg +5 -5
- package/dist/icons/custom/default/symbol.svg +4 -4
- package/dist/icons/custom/default/worksheet.svg +4 -4
- package/dist/icons/custom/svgrColoredTemplate.js +26 -26
- package/dist/icons/custom/svgrDefaultTemplate.js +26 -26
- package/dist/patterns/Accordion.js +20 -20
- package/dist/patterns/Dropdown/DropdownItem/DropdownItem.js +60 -60
- package/dist/patterns/Dropdown/DropdownMenu/DropdownMenu.js +27 -27
- package/dist/patterns/Dropdown/DropdownMenu/style.js +19 -19
- package/dist/patterns/LexicalEditor/Plugins.js +38 -37
- package/dist/patterns/LexicalEditor/components/FileSelectInput.js +23 -23
- package/dist/patterns/LexicalEditor/components/InsertImageDialog/ImagePreview.js +4 -4
- package/dist/patterns/LexicalEditor/components/InsertImageDialog/InsertImageDialog.js +15 -15
- package/dist/patterns/LexicalEditor/components/InsertVideoDialog/InsertVideoDialog.js +17 -17
- package/dist/patterns/LexicalEditor/components/UploadFileDialog/UploadFileDialog.js +2 -2
- package/dist/patterns/LexicalEditor/hr.svg +3 -3
- package/dist/patterns/LexicalEditor/nodes/FileNode/FileComponent.js +44 -44
- package/dist/patterns/LexicalEditor/nodes/FileNode/FileDownloadButton.js +25 -25
- package/dist/patterns/LexicalEditor/nodes/ImageNode/ImageComponent.js +8 -8
- package/dist/patterns/LexicalEditor/nodes/ImageNode/ImageResizer.js +60 -60
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputComponent.js +19 -19
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SegmentedInput.js +49 -49
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/FormSolution.js +7 -7
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/SettingForm.js +73 -73
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/TextTypeDropdown.js +5 -5
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/TextInput.js +7 -7
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxComponent.js +69 -69
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxEdit.js +3 -3
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxView.js +15 -15
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectComponent.js +28 -28
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +54 -54
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/SettingForm.js +61 -61
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/Evaluation.js +75 -75
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormIconAndLabel.js +17 -17
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormLabel.js +7 -7
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormQuestion.js +28 -28
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/SettingForm.js +52 -52
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/EvaluationComponent.js +7 -7
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.js +25 -25
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.js +53 -53
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SelectBox/SelectBoxComponent.js +54 -54
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SelectBox/SelectBoxView.js +5 -5
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SelectComponent.js +21 -21
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SettingForm/FormSelection.js +42 -42
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SettingForm/SettingForm.js +71 -71
- package/dist/patterns/LexicalEditor/nodes/VideoNode/VideoComponent.js +6 -6
- package/dist/patterns/LexicalEditor/nodes/index.d.ts +3 -0
- package/dist/patterns/LexicalEditor/nodes/index.js +3 -0
- package/dist/patterns/LexicalEditor/nodes/nodes.d.ts +4 -2
- package/dist/patterns/LexicalEditor/nodes/nodes.js +6 -0
- package/dist/patterns/LexicalEditor/nodes/toggleNodes/ToggleContainerNode.d.ts +32 -0
- package/dist/patterns/LexicalEditor/nodes/toggleNodes/ToggleContainerNode.js +131 -0
- package/dist/patterns/LexicalEditor/nodes/toggleNodes/ToggleContentNode.d.ts +23 -0
- package/dist/patterns/LexicalEditor/nodes/toggleNodes/ToggleContentNode.js +88 -0
- package/dist/patterns/LexicalEditor/nodes/toggleNodes/ToggleTitleNode.d.ts +24 -0
- package/dist/patterns/LexicalEditor/nodes/toggleNodes/ToggleTitleNode.js +105 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdder.js +51 -51
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.js +11 -11
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/menu.svg +7 -7
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/plus.svg +2 -2
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.js +76 -12
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuItem.js +32 -32
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuList.js +32 -32
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +38 -17
- package/dist/patterns/LexicalEditor/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +49 -49
- package/dist/patterns/LexicalEditor/plugins/FloatingTextFormatToolbarPlugin/FloatingTextFormatPopup.js +36 -36
- package/dist/patterns/LexicalEditor/plugins/ParagraphPlaceholderPlugin/index.js +11 -2
- package/dist/patterns/LexicalEditor/plugins/TogglePlugin/index.d.ts +9 -0
- package/dist/patterns/LexicalEditor/plugins/TogglePlugin/index.js +198 -0
- package/dist/patterns/LexicalEditor/theme.d.ts +6 -0
- package/dist/patterns/LexicalEditor/theme.js +281 -243
- package/dist/patterns/LexicalEditor/utils/toggleUtils.d.ts +9 -0
- package/dist/patterns/LexicalEditor/utils/toggleUtils.js +18 -0
- package/dist/patterns/SegmentedControl/SegmentedControlButton.js +10 -10
- package/dist/patterns/SegmentedControl/SegmentedControlGroup.js +8 -8
- package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.js +2 -2
- package/dist/patterns/Tabs.js +43 -43
- package/dist/patterns/ToggleButtonGroup/ToggleButton.js +40 -40
- package/dist/patterns/ToggleButtonGroup/ToggleButtonGroup.js +11 -11
- package/dist/utils/hover.js +12 -12
- package/dist/utils/reset.js +19 -19
- package/dist/utils/visuallyHidden.js +10 -10
- package/package.json +109 -109
package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SettingForm/SettingForm.js
CHANGED
|
@@ -58,9 +58,9 @@ export function SettingForm(props) {
|
|
|
58
58
|
return true;
|
|
59
59
|
return getTexts(t, "errorDuplicateChoice")(duplicatedIndexes.map((i) => i + 1).join(","));
|
|
60
60
|
}
|
|
61
|
-
return (_jsxs(Form, { onSubmit: handleSubmit(onSettingSubmit), children: [_jsxs(Title, { children: [_jsx(ListRadioIcon, { css: css `
|
|
62
|
-
width: 12px;
|
|
63
|
-
height: 12px;
|
|
61
|
+
return (_jsxs(Form, { onSubmit: handleSubmit(onSettingSubmit), children: [_jsxs(Title, { children: [_jsx(ListRadioIcon, { css: css `
|
|
62
|
+
width: 12px;
|
|
63
|
+
height: 12px;
|
|
64
64
|
` }), t("선택형 입력 칸", { context: "렉시컬 도구 설정창" })] }), _jsxs(Content, { children: [_jsxs(Left, { children: [_jsxs(FormArea, { children: [_jsx(Label, { children: t("선택지") }), fields.map((field, index) => (_jsx(FormSelection, { index: index, control: control, rules: {
|
|
65
65
|
validate: {
|
|
66
66
|
validateRequired,
|
|
@@ -82,82 +82,82 @@ export function SettingForm(props) {
|
|
|
82
82
|
},
|
|
83
83
|
value: uid(),
|
|
84
84
|
});
|
|
85
|
-
}, disabled: fields.length >= 9 })] }), _jsxs(Right, { children: [_jsxs(FormArea, { children: [_jsx(Label, { children: t("다중 선택 허용 여부") }), _jsx(FormAllowMultipleAnswers, { control: control })] }), watch("allowMultipleAnswers") && (_jsxs(Alert, { children: [_jsx(AlarmWarningFillIcon, { css: css `
|
|
86
|
-
min-width: 14px;
|
|
87
|
-
width: 14px;
|
|
88
|
-
height: 14px;
|
|
85
|
+
}, disabled: fields.length >= 9 })] }), _jsxs(Right, { children: [_jsxs(FormArea, { children: [_jsx(Label, { children: t("다중 선택 허용 여부") }), _jsx(FormAllowMultipleAnswers, { control: control })] }), watch("allowMultipleAnswers") && (_jsxs(Alert, { children: [_jsx(AlarmWarningFillIcon, { css: css `
|
|
86
|
+
min-width: 14px;
|
|
87
|
+
width: 14px;
|
|
88
|
+
height: 14px;
|
|
89
89
|
` }), t("다중 선택을 허용한 문제에는 여러 선택지를 고를 수 있다는 안내가 제공됩니다.")] }))] })] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), bold: true, type: "submit" })] })] }));
|
|
90
90
|
}
|
|
91
|
-
const Form = styled.form(({ theme }) => css `
|
|
92
|
-
display: flex;
|
|
93
|
-
width: 620px;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
border-radius: 6px;
|
|
96
|
-
border: 1px solid ${theme.color.background.neutralAltActive};
|
|
97
|
-
background: ${theme.color.background.neutralBase};
|
|
98
|
-
box-shadow: ${shadows.shadow08};
|
|
91
|
+
const Form = styled.form(({ theme }) => css `
|
|
92
|
+
display: flex;
|
|
93
|
+
width: 620px;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
border-radius: 6px;
|
|
96
|
+
border: 1px solid ${theme.color.background.neutralAltActive};
|
|
97
|
+
background: ${theme.color.background.neutralBase};
|
|
98
|
+
box-shadow: ${shadows.shadow08};
|
|
99
99
|
`);
|
|
100
|
-
const Title = styled.div(({ theme }) => css `
|
|
101
|
-
display: flex;
|
|
102
|
-
padding: 8px 12px;
|
|
103
|
-
gap: 4px;
|
|
104
|
-
align-items: center;
|
|
105
|
-
color: ${theme.color.foreground.neutralBase};
|
|
106
|
-
/* Default/Label/12px-Md */
|
|
107
|
-
font-family: ${theme.fontFamily.ui};
|
|
108
|
-
font-size: 12px;
|
|
109
|
-
font-style: normal;
|
|
110
|
-
font-weight: 500;
|
|
111
|
-
line-height: 16px; /* 133.333% */
|
|
100
|
+
const Title = styled.div(({ theme }) => css `
|
|
101
|
+
display: flex;
|
|
102
|
+
padding: 8px 12px;
|
|
103
|
+
gap: 4px;
|
|
104
|
+
align-items: center;
|
|
105
|
+
color: ${theme.color.foreground.neutralBase};
|
|
106
|
+
/* Default/Label/12px-Md */
|
|
107
|
+
font-family: ${theme.fontFamily.ui};
|
|
108
|
+
font-size: 12px;
|
|
109
|
+
font-style: normal;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
line-height: 16px; /* 133.333% */
|
|
112
112
|
`);
|
|
113
|
-
const Content = styled.div(({ theme }) => css `
|
|
114
|
-
display: flex;
|
|
115
|
-
border-top: 1px solid ${theme.color.background.neutralAltActive};
|
|
116
|
-
border-bottom: 1px solid ${theme.color.background.neutralAltActive};
|
|
113
|
+
const Content = styled.div(({ theme }) => css `
|
|
114
|
+
display: flex;
|
|
115
|
+
border-top: 1px solid ${theme.color.background.neutralAltActive};
|
|
116
|
+
border-bottom: 1px solid ${theme.color.background.neutralAltActive};
|
|
117
117
|
`);
|
|
118
|
-
const Left = styled.div `
|
|
119
|
-
flex: 1;
|
|
120
|
-
display: flex;
|
|
121
|
-
flex-direction: column;
|
|
122
|
-
gap: 12px;
|
|
123
|
-
padding: 12px;
|
|
118
|
+
const Left = styled.div `
|
|
119
|
+
flex: 1;
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
gap: 12px;
|
|
123
|
+
padding: 12px;
|
|
124
124
|
`;
|
|
125
|
-
const Right = styled.div `
|
|
126
|
-
width: 240px;
|
|
127
|
-
display: flex;
|
|
128
|
-
flex-direction: column;
|
|
129
|
-
gap: 12px;
|
|
130
|
-
padding: 12px;
|
|
125
|
+
const Right = styled.div `
|
|
126
|
+
width: 240px;
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
gap: 12px;
|
|
130
|
+
padding: 12px;
|
|
131
131
|
`;
|
|
132
|
-
const FormArea = styled.div `
|
|
133
|
-
display: flex;
|
|
134
|
-
flex-direction: column;
|
|
135
|
-
gap: 8px;
|
|
132
|
+
const FormArea = styled.div `
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
gap: 8px;
|
|
136
136
|
`;
|
|
137
|
-
const Label = styled.div(({ theme }) => css `
|
|
138
|
-
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
139
|
-
/* Default/Label/12px-Md */
|
|
140
|
-
font-family: ${theme.fontFamily.ui};
|
|
141
|
-
font-size: 12px;
|
|
142
|
-
font-style: normal;
|
|
143
|
-
font-weight: 500;
|
|
144
|
-
line-height: 16px; /* 133.333% */
|
|
137
|
+
const Label = styled.div(({ theme }) => css `
|
|
138
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
139
|
+
/* Default/Label/12px-Md */
|
|
140
|
+
font-family: ${theme.fontFamily.ui};
|
|
141
|
+
font-size: 12px;
|
|
142
|
+
font-style: normal;
|
|
143
|
+
font-weight: 500;
|
|
144
|
+
line-height: 16px; /* 133.333% */
|
|
145
145
|
`);
|
|
146
|
-
const Buttons = styled.div `
|
|
147
|
-
display: flex;
|
|
148
|
-
padding: 12px;
|
|
149
|
-
justify-content: flex-end;
|
|
150
|
-
align-items: center;
|
|
151
|
-
gap: 8px;
|
|
146
|
+
const Buttons = styled.div `
|
|
147
|
+
display: flex;
|
|
148
|
+
padding: 12px;
|
|
149
|
+
justify-content: flex-end;
|
|
150
|
+
align-items: center;
|
|
151
|
+
gap: 8px;
|
|
152
152
|
`;
|
|
153
|
-
const Alert = styled.div(({ theme }) => css `
|
|
154
|
-
display: flex;
|
|
155
|
-
gap: 4px;
|
|
156
|
-
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
157
|
-
/* Default/Label/12px-Md */
|
|
158
|
-
font-family: ${theme.fontFamily.ui};
|
|
159
|
-
font-size: 12px;
|
|
160
|
-
font-style: normal;
|
|
161
|
-
font-weight: 500;
|
|
162
|
-
line-height: 16px; /* 133.333% */
|
|
153
|
+
const Alert = styled.div(({ theme }) => css `
|
|
154
|
+
display: flex;
|
|
155
|
+
gap: 4px;
|
|
156
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
157
|
+
/* Default/Label/12px-Md */
|
|
158
|
+
font-family: ${theme.fontFamily.ui};
|
|
159
|
+
font-size: 12px;
|
|
160
|
+
font-style: normal;
|
|
161
|
+
font-weight: 500;
|
|
162
|
+
line-height: 16px; /* 133.333% */
|
|
163
163
|
`);
|
|
@@ -11,9 +11,9 @@ import { InsertVideoDialog } from "../../components/InsertVideoDialog";
|
|
|
11
11
|
import ReactPlayer from "react-player";
|
|
12
12
|
import { css } from "@emotion/react";
|
|
13
13
|
function VideoPlayer(props) {
|
|
14
|
-
return (_jsx(ReactPlayer, { css: css `
|
|
15
|
-
background: black;
|
|
16
|
-
max-width: 1200px;
|
|
14
|
+
return (_jsx(ReactPlayer, { css: css `
|
|
15
|
+
background: black;
|
|
16
|
+
max-width: 1200px;
|
|
17
17
|
`, width: "100%", url: props.url, controls: true, config: {
|
|
18
18
|
file: {
|
|
19
19
|
hlsOptions: {
|
|
@@ -47,7 +47,7 @@ export function VideoComponent({ src, nodeKey, }) {
|
|
|
47
47
|
}
|
|
48
48
|
return (_jsxs(_Fragment, { children: [_jsxs(EditContainer, { children: [_jsx(VideoPlayer, { url: src }), _jsx(SquareButton, { size: "small", color: "icon", icon: _jsx(Settings3FillIcon, {}), onClick: () => setOpen(true), "aria-label": "\uB3D9\uC601\uC0C1 \uC218\uC815\uD558\uAE30" })] }), _jsx(InsertVideoDialog, { open: open, title: "\uB3D9\uC601\uC0C1 \uC218\uC815\uD558\uAE30", onClose: () => setOpen(false), videoProps: { src }, onChange: handleChange, onDelete: handleDelete })] }));
|
|
49
49
|
}
|
|
50
|
-
const EditContainer = styled.div `
|
|
51
|
-
display: flex;
|
|
52
|
-
gap: 4px;
|
|
50
|
+
const EditContainer = styled.div `
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 4px;
|
|
53
53
|
`;
|
|
@@ -10,3 +10,6 @@ export * from "./SheetSelectNode";
|
|
|
10
10
|
export * from "./LayoutContainerNode";
|
|
11
11
|
export * from "./LayoutItemNode";
|
|
12
12
|
export * from "./nodes";
|
|
13
|
+
export * from "./toggleNodes/ToggleContainerNode";
|
|
14
|
+
export * from "./toggleNodes/ToggleTitleNode";
|
|
15
|
+
export * from "./toggleNodes/ToggleContentNode";
|
|
@@ -10,3 +10,6 @@ export * from "./SheetSelectNode";
|
|
|
10
10
|
export * from "./LayoutContainerNode";
|
|
11
11
|
export * from "./LayoutItemNode";
|
|
12
12
|
export * from "./nodes";
|
|
13
|
+
export * from "./toggleNodes/ToggleContainerNode";
|
|
14
|
+
export * from "./toggleNodes/ToggleTitleNode";
|
|
15
|
+
export * from "./toggleNodes/ToggleContentNode";
|
|
@@ -3,19 +3,21 @@ import { ColoredQuoteNode } from "./ColoredQuoteNode";
|
|
|
3
3
|
import { ImageNode } from "./ImageNode";
|
|
4
4
|
import { VideoNode } from "./VideoNode";
|
|
5
5
|
import { LayoutContainerNode } from "./LayoutContainerNode";
|
|
6
|
-
import { LayoutItemNode } from "./LayoutItemNode";
|
|
7
6
|
import { ProblemInputNode } from "./ProblemInputNode";
|
|
8
7
|
import { ProblemSelectNode } from "./ProblemSelectNode";
|
|
9
8
|
import { SelfEvaluationNode } from "./SelfEvaluationNode";
|
|
10
9
|
import { SheetInputNode } from "./SheetInputNode";
|
|
11
10
|
import { SheetSelectNode } from "./SheetSelectNode";
|
|
11
|
+
import { ToggleContainerNode } from "./toggleNodes/ToggleContainerNode";
|
|
12
|
+
import { ToggleTitleNode } from "./toggleNodes/ToggleTitleNode";
|
|
13
|
+
import { ToggleContentNode } from "./toggleNodes/ToggleContentNode";
|
|
12
14
|
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
13
15
|
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
14
16
|
import { ListItemNode, ListNode } from "@lexical/list";
|
|
15
17
|
import { CodeHighlightNode, CodeNode } from "@lexical/code";
|
|
16
18
|
import { LinkNode } from "@lexical/link";
|
|
17
19
|
import { FileNode } from "./FileNode";
|
|
18
|
-
export declare const nodes: (typeof ColoredQuoteNode | typeof QuoteNode | typeof ImageNode | typeof VideoNode | typeof FileNode | typeof ProblemInputNode | typeof ProblemSelectNode | typeof SelfEvaluationNode | typeof SheetInputNode | typeof SheetSelectNode | typeof LayoutContainerNode | typeof
|
|
20
|
+
export declare const nodes: (typeof ColoredQuoteNode | typeof QuoteNode | typeof ImageNode | typeof VideoNode | typeof FileNode | typeof ProblemInputNode | typeof ProblemSelectNode | typeof SelfEvaluationNode | typeof SheetInputNode | typeof SheetSelectNode | typeof LayoutContainerNode | typeof ToggleContentNode | typeof ToggleTitleNode | typeof ToggleContainerNode | typeof HeadingNode | typeof ListNode | typeof ListItemNode | typeof CodeNode | typeof CodeHighlightNode | typeof TableNode | typeof TableCellNode | typeof TableRowNode | typeof LinkNode | typeof HorizontalRuleNode | {
|
|
19
21
|
replace: typeof QuoteNode;
|
|
20
22
|
with: () => ColoredQuoteNode;
|
|
21
23
|
})[];
|
|
@@ -9,6 +9,9 @@ import { ProblemSelectNode } from "./ProblemSelectNode";
|
|
|
9
9
|
import { SelfEvaluationNode } from "./SelfEvaluationNode";
|
|
10
10
|
import { SheetInputNode } from "./SheetInputNode";
|
|
11
11
|
import { SheetSelectNode } from "./SheetSelectNode";
|
|
12
|
+
import { ToggleContainerNode } from "./toggleNodes/ToggleContainerNode";
|
|
13
|
+
import { ToggleTitleNode } from "./toggleNodes/ToggleTitleNode";
|
|
14
|
+
import { ToggleContentNode } from "./toggleNodes/ToggleContentNode";
|
|
12
15
|
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
13
16
|
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
14
17
|
import { ListItemNode, ListNode } from "@lexical/list";
|
|
@@ -39,6 +42,9 @@ export const nodes = [
|
|
|
39
42
|
SheetSelectNode,
|
|
40
43
|
SheetInputNode,
|
|
41
44
|
SelfEvaluationNode,
|
|
45
|
+
ToggleContainerNode,
|
|
46
|
+
ToggleTitleNode,
|
|
47
|
+
ToggleContentNode,
|
|
42
48
|
{
|
|
43
49
|
replace: QuoteNode,
|
|
44
50
|
with: () => new ColoredQuoteNode("grey"),
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { DOMConversionMap, DOMConversionOutput, DOMExportOutput, EditorConfig, ElementNode, LexicalEditor, LexicalNode, NodeKey, RangeSelection, SerializedElementNode, Spread } from "lexical";
|
|
9
|
+
type SerializedToggleContainerNode = Spread<{
|
|
10
|
+
open: boolean;
|
|
11
|
+
}, SerializedElementNode>;
|
|
12
|
+
export declare function $convertToggleContainerElement(domNode: HTMLDetailsElement): DOMConversionOutput | null;
|
|
13
|
+
export declare class ToggleContainerNode extends ElementNode {
|
|
14
|
+
__open: boolean;
|
|
15
|
+
constructor(open: boolean, key?: NodeKey);
|
|
16
|
+
static getType(): string;
|
|
17
|
+
static clone(node: ToggleContainerNode): ToggleContainerNode;
|
|
18
|
+
isShadowRoot(): boolean;
|
|
19
|
+
collapseAtStart(_selection: RangeSelection): boolean;
|
|
20
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
21
|
+
updateDOM(prevNode: this, dom: HTMLDivElement): boolean;
|
|
22
|
+
static importDOM(): DOMConversionMap<HTMLDetailsElement> | null;
|
|
23
|
+
static importJSON(serializedNode: SerializedToggleContainerNode): ToggleContainerNode;
|
|
24
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
25
|
+
exportJSON(): SerializedToggleContainerNode;
|
|
26
|
+
setOpen(open: boolean): void;
|
|
27
|
+
getOpen(): boolean;
|
|
28
|
+
toggleOpen(): void;
|
|
29
|
+
}
|
|
30
|
+
export declare function $createToggleContainerNode(isOpen: boolean): ToggleContainerNode;
|
|
31
|
+
export declare function $isToggleContainerNode(node: LexicalNode | null | undefined): node is ToggleContainerNode;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
// https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/CollapsiblePlugin/CollapsibleContainerNode.ts
|
|
9
|
+
// details, summary 구조의 타이틀(summary) 클릭 시 토글 기능의 방지를 위해
|
|
10
|
+
// CHROME 브라우저를 포함한 모든 브라우저에서 div 요소로 그려지도록 수정했습니다.
|
|
11
|
+
import { addClassNamesToElement } from "@lexical/utils";
|
|
12
|
+
import { $getSiblingCaret, $isElementNode, $rewindSiblingCaret, ElementNode, isHTMLElement, } from "lexical";
|
|
13
|
+
import { setDomHiddenUntilFound } from "../../utils/toggleUtils";
|
|
14
|
+
import { DATA_LEXICAL_TOGGLE_ICON_BUTTON } from "./ToggleTitleNode";
|
|
15
|
+
export function $convertToggleContainerElement(domNode) {
|
|
16
|
+
// open 속성이 없으면 기본값 false
|
|
17
|
+
const isOpen = "open" in domNode ? domNode.open : false;
|
|
18
|
+
const node = $createToggleContainerNode(isOpen);
|
|
19
|
+
return {
|
|
20
|
+
node,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export class ToggleContainerNode extends ElementNode {
|
|
24
|
+
constructor(open, key) {
|
|
25
|
+
super(key);
|
|
26
|
+
this.__open = open;
|
|
27
|
+
}
|
|
28
|
+
static getType() {
|
|
29
|
+
return "toggle-container";
|
|
30
|
+
}
|
|
31
|
+
static clone(node) {
|
|
32
|
+
return new ToggleContainerNode(node.__open, node.__key);
|
|
33
|
+
}
|
|
34
|
+
isShadowRoot() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
collapseAtStart(_selection) {
|
|
38
|
+
// Unwrap the ToggleContainerNode by replacing it with the children
|
|
39
|
+
// of its children (ToggleTitleNode, ToggleContentNode)
|
|
40
|
+
const nodesToInsert = [];
|
|
41
|
+
for (const child of this.getChildren()) {
|
|
42
|
+
if ($isElementNode(child)) {
|
|
43
|
+
nodesToInsert.push(...child.getChildren());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const caret = $rewindSiblingCaret($getSiblingCaret(this, "previous"));
|
|
47
|
+
caret.splice(1, nodesToInsert);
|
|
48
|
+
// Merge the first child of the ToggleTitleNode with the
|
|
49
|
+
// previous sibling of the ToggleContainerNode
|
|
50
|
+
if (nodesToInsert.length === 0)
|
|
51
|
+
return true;
|
|
52
|
+
const firstChild = nodesToInsert[0];
|
|
53
|
+
firstChild.selectStart().deleteCharacter(true);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
// IS_CHROME 분기 제거
|
|
57
|
+
createDOM(config) {
|
|
58
|
+
const dom = document.createElement("div");
|
|
59
|
+
if (this.__open) {
|
|
60
|
+
dom.setAttribute("open", "");
|
|
61
|
+
}
|
|
62
|
+
addClassNamesToElement(dom, config.theme.toggle.container);
|
|
63
|
+
return dom;
|
|
64
|
+
}
|
|
65
|
+
// IS_CHROME 분기 제거
|
|
66
|
+
updateDOM(prevNode, dom) {
|
|
67
|
+
const currentOpen = this.__open;
|
|
68
|
+
if (prevNode.__open !== currentOpen) {
|
|
69
|
+
const contentDom = dom.children[1];
|
|
70
|
+
if (!isHTMLElement(contentDom)) {
|
|
71
|
+
throw new Error("Expected contentDom to be an HTMLElement");
|
|
72
|
+
}
|
|
73
|
+
if (currentOpen) {
|
|
74
|
+
dom.setAttribute("open", "");
|
|
75
|
+
contentDom.hidden = false;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
dom.removeAttribute("open");
|
|
79
|
+
setDomHiddenUntilFound(contentDom);
|
|
80
|
+
}
|
|
81
|
+
// 토글 버튼 클릭 또는 타이틀 영역의 엔터 키 입력으로 토글되는 경우
|
|
82
|
+
// ToggleTitleNode의 아이콘 버튼의 aria-expanded 속성 업데이트
|
|
83
|
+
const titleDom = dom.children[0];
|
|
84
|
+
if (!isHTMLElement(titleDom)) {
|
|
85
|
+
throw new Error("Expected titleDom to be an HTMLElement");
|
|
86
|
+
}
|
|
87
|
+
const iconButton = titleDom.querySelector(`[${DATA_LEXICAL_TOGGLE_ICON_BUTTON}]`);
|
|
88
|
+
if (iconButton) {
|
|
89
|
+
iconButton.setAttribute("aria-expanded", currentOpen.toString());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
static importDOM() {
|
|
95
|
+
return {
|
|
96
|
+
details: (_domNode) => ({
|
|
97
|
+
conversion: $convertToggleContainerElement,
|
|
98
|
+
priority: 1,
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
static importJSON(serializedNode) {
|
|
103
|
+
return $createToggleContainerNode(serializedNode.open).updateFromJSON(serializedNode);
|
|
104
|
+
}
|
|
105
|
+
// className 적용을 위한 editor 파라미터 추가
|
|
106
|
+
exportDOM(editor) {
|
|
107
|
+
const element = document.createElement("details");
|
|
108
|
+
addClassNamesToElement(element, editor._config.theme.toggle.container);
|
|
109
|
+
element.setAttribute("open", this.__open.toString());
|
|
110
|
+
return { element };
|
|
111
|
+
}
|
|
112
|
+
exportJSON() {
|
|
113
|
+
return Object.assign(Object.assign({}, super.exportJSON()), { open: this.__open });
|
|
114
|
+
}
|
|
115
|
+
setOpen(open) {
|
|
116
|
+
const writable = this.getWritable();
|
|
117
|
+
writable.__open = open;
|
|
118
|
+
}
|
|
119
|
+
getOpen() {
|
|
120
|
+
return this.getLatest().__open;
|
|
121
|
+
}
|
|
122
|
+
toggleOpen() {
|
|
123
|
+
this.setOpen(!this.getOpen());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export function $createToggleContainerNode(isOpen) {
|
|
127
|
+
return new ToggleContainerNode(isOpen);
|
|
128
|
+
}
|
|
129
|
+
export function $isToggleContainerNode(node) {
|
|
130
|
+
return node instanceof ToggleContainerNode;
|
|
131
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { DOMConversionMap, DOMConversionOutput, DOMExportOutput, EditorConfig, ElementNode, LexicalEditor, LexicalNode, SerializedElementNode } from "lexical";
|
|
9
|
+
type SerializedToggleContentNode = SerializedElementNode;
|
|
10
|
+
export declare function $convertToggleContentElement(_domNode: HTMLElement): DOMConversionOutput | null;
|
|
11
|
+
export declare class ToggleContentNode extends ElementNode {
|
|
12
|
+
static getType(): string;
|
|
13
|
+
static clone(node: ToggleContentNode): ToggleContentNode;
|
|
14
|
+
createDOM(config: EditorConfig, editor: LexicalEditor): HTMLElement;
|
|
15
|
+
updateDOM(_prevNode: this, _dom: HTMLElement): boolean;
|
|
16
|
+
static importDOM(): DOMConversionMap | null;
|
|
17
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
18
|
+
static importJSON(serializedNode: SerializedToggleContentNode): ToggleContentNode;
|
|
19
|
+
isShadowRoot(): boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function $createToggleContentNode(): ToggleContentNode;
|
|
22
|
+
export declare function $isToggleContentNode(node: LexicalNode | null | undefined): node is ToggleContentNode;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
// https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/CollapsiblePlugin/CollapsibleContentNode.ts
|
|
9
|
+
import { addClassNamesToElement } from "@lexical/utils";
|
|
10
|
+
import { ElementNode, } from "lexical";
|
|
11
|
+
import { $isToggleContainerNode } from "./ToggleContainerNode";
|
|
12
|
+
import { domOnBeforeMatch, setDomHiddenUntilFound, } from "../../utils/toggleUtils";
|
|
13
|
+
const DATA_LEXICAL_TOGGLE_CONTENT = "data-lexical-toggle-content";
|
|
14
|
+
export function $convertToggleContentElement(_domNode) {
|
|
15
|
+
const node = $createToggleContentNode();
|
|
16
|
+
return {
|
|
17
|
+
node,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export class ToggleContentNode extends ElementNode {
|
|
21
|
+
static getType() {
|
|
22
|
+
return "toggle-content";
|
|
23
|
+
}
|
|
24
|
+
static clone(node) {
|
|
25
|
+
return new ToggleContentNode(node.__key);
|
|
26
|
+
}
|
|
27
|
+
// IS_CHROME 분기 제거
|
|
28
|
+
createDOM(config, editor) {
|
|
29
|
+
const dom = document.createElement("div");
|
|
30
|
+
addClassNamesToElement(dom, config.theme.toggle.content);
|
|
31
|
+
editor.getEditorState().read(() => {
|
|
32
|
+
const containerNode = this.getParentOrThrow();
|
|
33
|
+
if (!$isToggleContainerNode(containerNode)) {
|
|
34
|
+
throw new Error("Expected parent node to be a ToggleContainerNode");
|
|
35
|
+
}
|
|
36
|
+
if (!containerNode.__open) {
|
|
37
|
+
setDomHiddenUntilFound(dom);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
domOnBeforeMatch(dom, () => {
|
|
41
|
+
editor.update(() => {
|
|
42
|
+
const containerNode = this.getParentOrThrow().getLatest();
|
|
43
|
+
if (!$isToggleContainerNode(containerNode)) {
|
|
44
|
+
throw new Error("Expected parent node to be a ToggleContainerNode");
|
|
45
|
+
}
|
|
46
|
+
if (!containerNode.__open) {
|
|
47
|
+
containerNode.toggleOpen();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return dom;
|
|
52
|
+
}
|
|
53
|
+
updateDOM(_prevNode, _dom) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
static importDOM() {
|
|
57
|
+
return {
|
|
58
|
+
div: (domNode) => {
|
|
59
|
+
if (!domNode.hasAttribute(DATA_LEXICAL_TOGGLE_CONTENT)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
conversion: $convertToggleContentElement,
|
|
64
|
+
priority: 2,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// className 적용을 위한 editor 파라미터 추가
|
|
70
|
+
exportDOM(editor) {
|
|
71
|
+
const element = document.createElement("div");
|
|
72
|
+
addClassNamesToElement(element, editor._config.theme.toggle.content);
|
|
73
|
+
element.setAttribute(DATA_LEXICAL_TOGGLE_CONTENT, "true");
|
|
74
|
+
return { element };
|
|
75
|
+
}
|
|
76
|
+
static importJSON(serializedNode) {
|
|
77
|
+
return $createToggleContentNode().updateFromJSON(serializedNode);
|
|
78
|
+
}
|
|
79
|
+
isShadowRoot() {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function $createToggleContentNode() {
|
|
84
|
+
return new ToggleContentNode();
|
|
85
|
+
}
|
|
86
|
+
export function $isToggleContentNode(node) {
|
|
87
|
+
return node instanceof ToggleContentNode;
|
|
88
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { DOMConversionOutput, EditorConfig, ElementNode, LexicalEditor, LexicalNode, RangeSelection } from "lexical";
|
|
9
|
+
export declare const DATA_LEXICAL_TOGGLE_ICON_BUTTON = "data-lexical-toggle-icon-button";
|
|
10
|
+
export declare function $convertToggleTitleElement(_domNode: HTMLElement): DOMConversionOutput | null;
|
|
11
|
+
/** @noInheritDoc */
|
|
12
|
+
export declare class ToggleTitleNode extends ElementNode {
|
|
13
|
+
/** @internal */
|
|
14
|
+
$config(): import("lexical").StaticNodeConfigRecord<"toggle-title", {
|
|
15
|
+
$transform(node: ToggleTitleNode): void;
|
|
16
|
+
extends: typeof ElementNode;
|
|
17
|
+
importDOM: import("lexical").DOMConversionMap<HTMLElement>;
|
|
18
|
+
}>;
|
|
19
|
+
createDOM(config: EditorConfig, editor: LexicalEditor): HTMLElement;
|
|
20
|
+
updateDOM(_prevNode: this, _dom: HTMLElement): boolean;
|
|
21
|
+
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ElementNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function $createToggleTitleNode(): ToggleTitleNode;
|
|
24
|
+
export declare function $isToggleTitleNode(node: LexicalNode | null | undefined): node is ToggleTitleNode;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
// https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/CollapsiblePlugin/CollapsibleTitleNode.ts
|
|
9
|
+
import { addClassNamesToElement } from "@lexical/utils";
|
|
10
|
+
import { $createParagraphNode, $isElementNode, buildImportMap, ElementNode, } from "lexical";
|
|
11
|
+
import { $isToggleContainerNode } from "./ToggleContainerNode";
|
|
12
|
+
import { $isToggleContentNode } from "./ToggleContentNode";
|
|
13
|
+
export const DATA_LEXICAL_TOGGLE_ICON_BUTTON = "data-lexical-toggle-icon-button";
|
|
14
|
+
export function $convertToggleTitleElement(_domNode) {
|
|
15
|
+
const node = $createToggleTitleNode();
|
|
16
|
+
return {
|
|
17
|
+
node,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** @noInheritDoc */
|
|
21
|
+
export class ToggleTitleNode extends ElementNode {
|
|
22
|
+
/** @internal */
|
|
23
|
+
$config() {
|
|
24
|
+
return this.config("toggle-title", {
|
|
25
|
+
$transform(node) {
|
|
26
|
+
if (node.isEmpty()) {
|
|
27
|
+
node.remove();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
extends: ElementNode,
|
|
31
|
+
importDOM: buildImportMap({
|
|
32
|
+
summary: () => ({
|
|
33
|
+
conversion: $convertToggleTitleElement,
|
|
34
|
+
priority: 1,
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// IS_CHROME 분기를 제거하여 모든 브라우저에서 클릭 시 토글 이벤트를 수동으로 처리
|
|
40
|
+
createDOM(config, editor) {
|
|
41
|
+
const dom = document.createElement("summary");
|
|
42
|
+
addClassNamesToElement(dom, config.theme.toggle.title);
|
|
43
|
+
// 토글 동작을 아이콘 버튼에만 적용하도록 iconBtn 요소를 추가
|
|
44
|
+
const iconBtn = document.createElement("div");
|
|
45
|
+
addClassNamesToElement(iconBtn, config.theme.toggle.iconBtn);
|
|
46
|
+
iconBtn.setAttribute("aria-label", "Toggle content");
|
|
47
|
+
iconBtn.setAttribute("contenteditable", "false");
|
|
48
|
+
iconBtn.setAttribute(DATA_LEXICAL_TOGGLE_ICON_BUTTON, "true");
|
|
49
|
+
editor.getEditorState().read(() => {
|
|
50
|
+
const containerNode = this.getParent();
|
|
51
|
+
if ($isToggleContainerNode(containerNode)) {
|
|
52
|
+
iconBtn.setAttribute("aria-expanded", containerNode.getOpen().toString());
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
iconBtn.setAttribute("aria-expanded", "false");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
iconBtn.addEventListener("click", () => {
|
|
59
|
+
editor.update(() => {
|
|
60
|
+
const toggleContainer = this.getLatest().getParentOrThrow();
|
|
61
|
+
if (!$isToggleContainerNode(toggleContainer)) {
|
|
62
|
+
throw new Error("Expected parent node to be a ToggleContainerNode");
|
|
63
|
+
}
|
|
64
|
+
toggleContainer.toggleOpen();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
dom.appendChild(iconBtn);
|
|
68
|
+
return dom;
|
|
69
|
+
}
|
|
70
|
+
updateDOM(_prevNode, _dom) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
insertNewAfter(_, restoreSelection = true) {
|
|
74
|
+
const containerNode = this.getParentOrThrow();
|
|
75
|
+
if (!$isToggleContainerNode(containerNode)) {
|
|
76
|
+
throw new Error("ToggleTitleNode expects to be child of ToggleContainerNode");
|
|
77
|
+
}
|
|
78
|
+
if (containerNode.getOpen()) {
|
|
79
|
+
const contentNode = this.getNextSibling();
|
|
80
|
+
if (!$isToggleContentNode(contentNode)) {
|
|
81
|
+
throw new Error("ToggleTitleNode expects to have ToggleContentNode sibling");
|
|
82
|
+
}
|
|
83
|
+
const firstChild = contentNode.getFirstChild();
|
|
84
|
+
if ($isElementNode(firstChild)) {
|
|
85
|
+
return firstChild;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const paragraph = $createParagraphNode();
|
|
89
|
+
contentNode.append(paragraph);
|
|
90
|
+
return paragraph;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const paragraph = $createParagraphNode();
|
|
95
|
+
containerNode.insertAfter(paragraph, restoreSelection);
|
|
96
|
+
return paragraph;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export function $createToggleTitleNode() {
|
|
101
|
+
return new ToggleTitleNode();
|
|
102
|
+
}
|
|
103
|
+
export function $isToggleTitleNode(node) {
|
|
104
|
+
return node instanceof ToggleTitleNode;
|
|
105
|
+
}
|