@team-monolith/cds 1.119.3 → 1.119.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +10 -1
- 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
|
@@ -164,57 +164,57 @@ export function FloatingLinkEditor(props) {
|
|
|
164
164
|
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
165
165
|
}, children: _jsx(DeleteBinLineIcon, {}) })] })] })) }));
|
|
166
166
|
}
|
|
167
|
-
const Container = styled.div `
|
|
168
|
-
position: absolute;
|
|
169
|
-
top: 0;
|
|
170
|
-
left: 0;
|
|
171
|
-
z-index: 10;
|
|
172
|
-
will-change: transform;
|
|
173
|
-
|
|
174
|
-
display: flex;
|
|
175
|
-
padding: 0px 4px;
|
|
176
|
-
align-items: center;
|
|
177
|
-
gap: 4px;
|
|
178
|
-
|
|
179
|
-
border-radius: 8px;
|
|
180
|
-
// 메뉴가 활성화되지 않아도 클릭한 영역을 따라 다니도록 개발되었습니다.
|
|
181
|
-
// border가 있으면 활성화되지 않은 상태에서도 노출되므로 border를 제거합니다.
|
|
182
|
-
/* border: 1px solid #e8e8eb; */
|
|
183
|
-
background: ${({ theme }) => theme.color.background.neutralBase};
|
|
184
|
-
box-shadow: 0px 3px 15px -3px rgba(13, 20, 33, 0.13);
|
|
185
|
-
|
|
186
|
-
width: 400px;
|
|
167
|
+
const Container = styled.div `
|
|
168
|
+
position: absolute;
|
|
169
|
+
top: 0;
|
|
170
|
+
left: 0;
|
|
171
|
+
z-index: 10;
|
|
172
|
+
will-change: transform;
|
|
173
|
+
|
|
174
|
+
display: flex;
|
|
175
|
+
padding: 0px 4px;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: 4px;
|
|
178
|
+
|
|
179
|
+
border-radius: 8px;
|
|
180
|
+
// 메뉴가 활성화되지 않아도 클릭한 영역을 따라 다니도록 개발되었습니다.
|
|
181
|
+
// border가 있으면 활성화되지 않은 상태에서도 노출되므로 border를 제거합니다.
|
|
182
|
+
/* border: 1px solid #e8e8eb; */
|
|
183
|
+
background: ${({ theme }) => theme.color.background.neutralBase};
|
|
184
|
+
box-shadow: 0px 3px 15px -3px rgba(13, 20, 33, 0.13);
|
|
185
|
+
|
|
186
|
+
width: 400px;
|
|
187
187
|
`;
|
|
188
|
-
const Buttons = styled.div `
|
|
189
|
-
display: flex;
|
|
190
|
-
align-items: center;
|
|
191
|
-
gap: 4px;
|
|
188
|
+
const Buttons = styled.div `
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
gap: 4px;
|
|
192
192
|
`;
|
|
193
|
-
const Button = styled.button `
|
|
194
|
-
// reset
|
|
195
|
-
border: none;
|
|
196
|
-
outline: none;
|
|
197
|
-
background: none;
|
|
198
|
-
cursor: pointer;
|
|
199
|
-
|
|
200
|
-
padding: 8px 4px;
|
|
201
|
-
|
|
202
|
-
svg {
|
|
203
|
-
width: 18px;
|
|
204
|
-
height: 18px;
|
|
205
|
-
}
|
|
193
|
+
const Button = styled.button `
|
|
194
|
+
// reset
|
|
195
|
+
border: none;
|
|
196
|
+
outline: none;
|
|
197
|
+
background: none;
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
|
|
200
|
+
padding: 8px 4px;
|
|
201
|
+
|
|
202
|
+
svg {
|
|
203
|
+
width: 18px;
|
|
204
|
+
height: 18px;
|
|
205
|
+
}
|
|
206
206
|
`;
|
|
207
|
-
const Link = styled.a `
|
|
208
|
-
width: 100%;
|
|
209
|
-
padding: 0px 8px;
|
|
210
|
-
|
|
211
|
-
/* Default/Paragraph/16px-Rg */
|
|
212
|
-
font-family: ${({ theme }) => theme.fontFamily.ui};
|
|
213
|
-
font-size: 16px;
|
|
214
|
-
font-style: normal;
|
|
215
|
-
font-weight: 400;
|
|
216
|
-
line-height: 24px; /* 150% */
|
|
207
|
+
const Link = styled.a `
|
|
208
|
+
width: 100%;
|
|
209
|
+
padding: 0px 8px;
|
|
210
|
+
|
|
211
|
+
/* Default/Paragraph/16px-Rg */
|
|
212
|
+
font-family: ${({ theme }) => theme.fontFamily.ui};
|
|
213
|
+
font-size: 16px;
|
|
214
|
+
font-style: normal;
|
|
215
|
+
font-weight: 400;
|
|
216
|
+
line-height: 24px; /* 150% */
|
|
217
217
|
`;
|
|
218
|
-
const StyledInput = styled(Input) `
|
|
219
|
-
margin: 4px 0px;
|
|
218
|
+
const StyledInput = styled(Input) `
|
|
219
|
+
margin: 4px 0px;
|
|
220
220
|
`;
|
|
@@ -19,41 +19,41 @@ export const FloatingTextFormatPopup = forwardRef(function FloatingTextFormatPop
|
|
|
19
19
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
20
20
|
}, active: Boolean(isCode), "aria-label": "Insert code block", children: _jsx(CodeFillIcon, {}) }), _jsx(IconButton, { type: "button", onClick: insertLink, active: Boolean(isLink), "aria-label": "Insert link", children: _jsx(LinkIcon, {}) })] })) }));
|
|
21
21
|
});
|
|
22
|
-
const Container = styled.div `
|
|
23
|
-
position: absolute;
|
|
24
|
-
top: 0;
|
|
25
|
-
left: 0;
|
|
26
|
-
z-index: 10;
|
|
27
|
-
will-change: transform;
|
|
28
|
-
|
|
29
|
-
display: inline-flex;
|
|
30
|
-
padding: 0px 4px;
|
|
31
|
-
align-items: flex-start;
|
|
32
|
-
gap: 4px;
|
|
33
|
-
|
|
34
|
-
border-radius: 8px;
|
|
35
|
-
border: 1px solid #e8e8eb;
|
|
36
|
-
background: ${({ theme }) => theme.color.background.neutralBase};
|
|
37
|
-
box-shadow: 0px 3px 15px -3px rgba(13, 20, 33, 0.13);
|
|
22
|
+
const Container = styled.div `
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
left: 0;
|
|
26
|
+
z-index: 10;
|
|
27
|
+
will-change: transform;
|
|
28
|
+
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
padding: 0px 4px;
|
|
31
|
+
align-items: flex-start;
|
|
32
|
+
gap: 4px;
|
|
33
|
+
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
border: 1px solid #e8e8eb;
|
|
36
|
+
background: ${({ theme }) => theme.color.background.neutralBase};
|
|
37
|
+
box-shadow: 0px 3px 15px -3px rgba(13, 20, 33, 0.13);
|
|
38
38
|
`;
|
|
39
|
-
const IconButton = styled.button `
|
|
40
|
-
border: none;
|
|
41
|
-
outline: none;
|
|
42
|
-
|
|
43
|
-
display: flex;
|
|
44
|
-
padding: 8px 4px;
|
|
45
|
-
align-items: center;
|
|
46
|
-
gap: 4px;
|
|
47
|
-
|
|
48
|
-
background: #fff;
|
|
49
|
-
|
|
50
|
-
svg {
|
|
51
|
-
width: 18px;
|
|
52
|
-
height: 18px;
|
|
53
|
-
${({ theme, active }) => active && `color: ${theme.color.foreground.primary};`}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&:hover {
|
|
57
|
-
background: ${({ theme }) => theme.color.background.neutralAlt};
|
|
58
|
-
}
|
|
39
|
+
const IconButton = styled.button `
|
|
40
|
+
border: none;
|
|
41
|
+
outline: none;
|
|
42
|
+
|
|
43
|
+
display: flex;
|
|
44
|
+
padding: 8px 4px;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 4px;
|
|
47
|
+
|
|
48
|
+
background: #fff;
|
|
49
|
+
|
|
50
|
+
svg {
|
|
51
|
+
width: 18px;
|
|
52
|
+
height: 18px;
|
|
53
|
+
${({ theme, active }) => active && `color: ${theme.color.foreground.primary};`}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
background: ${({ theme }) => theme.color.background.neutralAlt};
|
|
58
|
+
}
|
|
59
59
|
`;
|
|
@@ -3,6 +3,8 @@ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext
|
|
|
3
3
|
import { $getSelection, $isParagraphNode, $isRangeSelection } from "lexical";
|
|
4
4
|
import { css as cssToClassName } from "@emotion/css";
|
|
5
5
|
import { useTheme } from "@emotion/react";
|
|
6
|
+
import { $isToggleTitleNode } from "../../nodes";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
6
8
|
const getPlaceholderClassName = (theme) => cssToClassName `
|
|
7
9
|
&::before {
|
|
8
10
|
position: absolute;
|
|
@@ -17,6 +19,7 @@ export const ParagraphPlaceholderPlugin = ({ placeholder, }) => {
|
|
|
17
19
|
const theme = useTheme();
|
|
18
20
|
const placeholderClassName = useMemo(() => getPlaceholderClassName(theme), [theme]);
|
|
19
21
|
useEffect(() => {
|
|
22
|
+
const { t } = useTranslation();
|
|
20
23
|
const removeUpdateListener = editor.registerUpdateListener(({ editorState }) => {
|
|
21
24
|
editorState.read(() => {
|
|
22
25
|
// 기존에 있던 placeholder를 제거합니다.
|
|
@@ -36,10 +39,16 @@ export const ParagraphPlaceholderPlugin = ({ placeholder, }) => {
|
|
|
36
39
|
const focusedNode = selection.focus.getNode();
|
|
37
40
|
if (!$isParagraphNode(focusedNode) || !focusedNode.isEmpty())
|
|
38
41
|
return;
|
|
42
|
+
const parentNode = focusedNode.getParent();
|
|
43
|
+
// 토글 제목 노드인 경우, / 명령어를 사용하지 않으므로
|
|
44
|
+
// 기존 placeholder 값을 "토글 제목"으로 고정합니다.
|
|
45
|
+
const placeholderText = $isToggleTitleNode(parentNode)
|
|
46
|
+
? t("토글 제목")
|
|
47
|
+
: placeholder;
|
|
39
48
|
const el = editor.getElementByKey(focusedNode.getKey());
|
|
40
49
|
if (el instanceof HTMLParagraphElement) {
|
|
41
50
|
paragraphRef.current = el;
|
|
42
|
-
paragraphRef.current.setAttribute("data-placeholder",
|
|
51
|
+
paragraphRef.current.setAttribute("data-placeholder", placeholderText);
|
|
43
52
|
paragraphRef.current.classList.add(placeholderClassName);
|
|
44
53
|
}
|
|
45
54
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export declare const INSERT_TOGGLE_COMMAND: import("lexical").LexicalCommand<void>;
|
|
9
|
+
export declare function TogglePlugin(): null;
|
|
@@ -0,0 +1,198 @@
|
|
|
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/index.ts
|
|
9
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
10
|
+
import { $setBlocksType } from "@lexical/selection";
|
|
11
|
+
import { $findMatchingParent, $insertNodeToNearestRoot, mergeRegister, } from "@lexical/utils";
|
|
12
|
+
import { $createParagraphNode, $getSelection, $isElementNode, $isParagraphNode, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_LOW, createCommand, INSERT_PARAGRAPH_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, } from "lexical";
|
|
13
|
+
import { useEffect } from "react";
|
|
14
|
+
import { $createToggleContainerNode, $createToggleTitleNode, $createToggleContentNode, $isToggleContainerNode, $isToggleTitleNode, $isToggleContentNode, ToggleContainerNode, ToggleTitleNode, ToggleContentNode, } from "../../nodes";
|
|
15
|
+
export const INSERT_TOGGLE_COMMAND = createCommand("INSERT_TOGGLE_COMMAND");
|
|
16
|
+
export function TogglePlugin() {
|
|
17
|
+
const [editor] = useLexicalComposerContext();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!editor.hasNodes([
|
|
20
|
+
ToggleContainerNode,
|
|
21
|
+
ToggleTitleNode,
|
|
22
|
+
ToggleContentNode,
|
|
23
|
+
])) {
|
|
24
|
+
throw new Error("TogglePlugin: ToggleContainerNode, ToggleTitleNode, or ToggleContentNode not registered on editor");
|
|
25
|
+
}
|
|
26
|
+
const $onEscapeUp = () => {
|
|
27
|
+
var _a;
|
|
28
|
+
const selection = $getSelection();
|
|
29
|
+
if ($isRangeSelection(selection) &&
|
|
30
|
+
selection.isCollapsed() &&
|
|
31
|
+
selection.anchor.offset === 0) {
|
|
32
|
+
const container = $findMatchingParent(selection.anchor.getNode(), $isToggleContainerNode);
|
|
33
|
+
if ($isToggleContainerNode(container)) {
|
|
34
|
+
const parent = container.getParent();
|
|
35
|
+
if (parent !== null &&
|
|
36
|
+
parent.getFirstChild() === container &&
|
|
37
|
+
selection.anchor.key === ((_a = container.getFirstDescendant()) === null || _a === void 0 ? void 0 : _a.getKey())) {
|
|
38
|
+
container.insertBefore($createParagraphNode());
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
};
|
|
44
|
+
const $onEscapeDown = () => {
|
|
45
|
+
const selection = $getSelection();
|
|
46
|
+
if ($isRangeSelection(selection) && selection.isCollapsed()) {
|
|
47
|
+
const container = $findMatchingParent(selection.anchor.getNode(), $isToggleContainerNode);
|
|
48
|
+
if ($isToggleContainerNode(container)) {
|
|
49
|
+
const parent = container.getParent();
|
|
50
|
+
if (parent !== null && parent.getLastChild() === container) {
|
|
51
|
+
const titleParagraph = container.getFirstDescendant();
|
|
52
|
+
const contentParagraph = container.getLastDescendant();
|
|
53
|
+
if ((contentParagraph !== null &&
|
|
54
|
+
selection.anchor.key === contentParagraph.getKey() &&
|
|
55
|
+
selection.anchor.offset ===
|
|
56
|
+
contentParagraph.getTextContentSize()) ||
|
|
57
|
+
(titleParagraph !== null &&
|
|
58
|
+
selection.anchor.key === titleParagraph.getKey() &&
|
|
59
|
+
selection.anchor.offset === titleParagraph.getTextContentSize())) {
|
|
60
|
+
container.insertAfter($createParagraphNode());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
67
|
+
return mergeRegister(
|
|
68
|
+
// Structure enforcing transformers for each node type. In case nesting structure is not
|
|
69
|
+
// "Container > Title + Content" it'll unwrap nodes and convert it back
|
|
70
|
+
// to regular content.
|
|
71
|
+
editor.registerNodeTransform(ToggleContentNode, (node) => {
|
|
72
|
+
const parent = node.getParent();
|
|
73
|
+
if (!$isToggleContainerNode(parent)) {
|
|
74
|
+
const children = node.getChildren();
|
|
75
|
+
for (const child of children) {
|
|
76
|
+
node.insertBefore(child);
|
|
77
|
+
}
|
|
78
|
+
node.remove();
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
/**
|
|
82
|
+
* ToggleTitleNode 변경 시 내부 요소는 ParagraphNode만 허용하도록
|
|
83
|
+
* 각 자식 요소를 순회하면서 내부 텍스트를 ParagraphNode로 호이스트합니다.
|
|
84
|
+
*/
|
|
85
|
+
editor.registerNodeTransform(ToggleTitleNode, (node) => {
|
|
86
|
+
const parent = node.getParent();
|
|
87
|
+
if (!$isToggleContainerNode(parent)) {
|
|
88
|
+
node.replace($createParagraphNode().append(...node.getChildren()));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
let paragraph = node.getFirstChild();
|
|
92
|
+
if (!$isParagraphNode(paragraph)) {
|
|
93
|
+
const p = $createParagraphNode();
|
|
94
|
+
if (paragraph) {
|
|
95
|
+
paragraph.insertBefore(p);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
node.append(p);
|
|
99
|
+
}
|
|
100
|
+
paragraph = p;
|
|
101
|
+
}
|
|
102
|
+
// AIDEV-NOTE:
|
|
103
|
+
// paragraph의 타입이 LexicalNode인 경우 append 메서드가 없기 때문에
|
|
104
|
+
// $isParagraphNode 체크를 통해 타입 가드를 수행합니다.
|
|
105
|
+
if (!$isParagraphNode(paragraph)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const hoistTexts = (n) => {
|
|
109
|
+
if ($isTextNode(n)) {
|
|
110
|
+
paragraph.append(n);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if ($isElementNode(n)) {
|
|
114
|
+
const children = n.getChildren();
|
|
115
|
+
for (const c of children) {
|
|
116
|
+
hoistTexts(c);
|
|
117
|
+
}
|
|
118
|
+
if (n !== paragraph && n.getChildrenSize() === 0) {
|
|
119
|
+
n.remove();
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
let child = node.getFirstChild();
|
|
125
|
+
while (child) {
|
|
126
|
+
const next = child.getNextSibling();
|
|
127
|
+
if (child !== paragraph) {
|
|
128
|
+
hoistTexts(child);
|
|
129
|
+
if ($isElementNode(child) && child.getChildrenSize() === 0) {
|
|
130
|
+
child.remove();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
child = next;
|
|
134
|
+
}
|
|
135
|
+
if (paragraph.getParent() !== node) {
|
|
136
|
+
node.append(paragraph);
|
|
137
|
+
}
|
|
138
|
+
}), editor.registerNodeTransform(ToggleContainerNode, (node) => {
|
|
139
|
+
const children = node.getChildren();
|
|
140
|
+
if (children.length !== 2 ||
|
|
141
|
+
!$isToggleTitleNode(children[0]) ||
|
|
142
|
+
!$isToggleContentNode(children[1])) {
|
|
143
|
+
for (const child of children) {
|
|
144
|
+
node.insertBefore(child);
|
|
145
|
+
}
|
|
146
|
+
node.remove();
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
// When toggle is the last child pressing down/right arrow will insert paragraph
|
|
150
|
+
// below it to allow adding more content. It's similar what $insertBlockNode
|
|
151
|
+
// (mainly for decorators), except it'll always be possible to continue adding
|
|
152
|
+
// new content even if trailing paragraph is accidentally deleted
|
|
153
|
+
editor.registerCommand(KEY_ARROW_DOWN_COMMAND, $onEscapeDown, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_RIGHT_COMMAND, $onEscapeDown, COMMAND_PRIORITY_LOW),
|
|
154
|
+
// When toggle is the first child pressing up/left arrow will insert paragraph
|
|
155
|
+
// above it to allow adding more content. It's similar what $insertBlockNode
|
|
156
|
+
// (mainly for decorators), except it'll always be possible to continue adding
|
|
157
|
+
// new content even if leading paragraph is accidentally deleted
|
|
158
|
+
editor.registerCommand(KEY_ARROW_UP_COMMAND, $onEscapeUp, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_LEFT_COMMAND, $onEscapeUp, COMMAND_PRIORITY_LOW),
|
|
159
|
+
// Enter goes from Title to Content rather than a new line inside Title
|
|
160
|
+
editor.registerCommand(INSERT_PARAGRAPH_COMMAND, () => {
|
|
161
|
+
var _a;
|
|
162
|
+
const selection = $getSelection();
|
|
163
|
+
if ($isRangeSelection(selection)) {
|
|
164
|
+
const titleNode = $findMatchingParent(selection.anchor.getNode(), (node) => $isToggleTitleNode(node));
|
|
165
|
+
if ($isToggleTitleNode(titleNode)) {
|
|
166
|
+
const container = titleNode.getParent();
|
|
167
|
+
if (container && $isToggleContainerNode(container)) {
|
|
168
|
+
if (!container.getOpen()) {
|
|
169
|
+
container.toggleOpen();
|
|
170
|
+
}
|
|
171
|
+
(_a = titleNode.getNextSibling()) === null || _a === void 0 ? void 0 : _a.selectEnd();
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}, COMMAND_PRIORITY_LOW), editor.registerCommand(INSERT_TOGGLE_COMMAND, () => {
|
|
178
|
+
editor.update(() => {
|
|
179
|
+
const title = $createToggleTitleNode();
|
|
180
|
+
const paragraph = $createParagraphNode();
|
|
181
|
+
const selection = $getSelection();
|
|
182
|
+
if ($isRangeSelection(selection)) {
|
|
183
|
+
// 선택된 블록이 있는 경우 기존 블록을 토글 블록으로 변환하여 불필요한 줄바꿈 생성 방지
|
|
184
|
+
$setBlocksType(selection, () =>
|
|
185
|
+
// 생성된 토글 블록의 open 속성은 기본값 false (노션 동작을 따름)
|
|
186
|
+
$createToggleContainerNode(false).append(title.append(paragraph), $createToggleContentNode().append($createParagraphNode())));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// 선택된 블록이 없는 경우 레퍼런스 코드의 동작을 따름
|
|
190
|
+
$insertNodeToNearestRoot($createToggleContainerNode(false).append(title.append(paragraph), $createToggleContentNode().append($createParagraphNode())));
|
|
191
|
+
}
|
|
192
|
+
paragraph.select();
|
|
193
|
+
});
|
|
194
|
+
return true;
|
|
195
|
+
}, COMMAND_PRIORITY_LOW));
|
|
196
|
+
}, [editor]);
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
@@ -36,4 +36,10 @@ export declare function getTheme(theme: Theme, editable: boolean): {
|
|
|
36
36
|
layoutContainer: string;
|
|
37
37
|
layoutItem: string | false;
|
|
38
38
|
selfEvaluation: string;
|
|
39
|
+
toggle: {
|
|
40
|
+
container: string;
|
|
41
|
+
title: string;
|
|
42
|
+
iconBtn: string;
|
|
43
|
+
content: string;
|
|
44
|
+
};
|
|
39
45
|
};
|