@team-monolith/cds 1.117.20 → 1.118.0
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/CdsProvider.d.ts +2 -2
- package/dist/CdsProvider.js +1 -11
- package/dist/i18n/i18n.d.ts +13 -3
- package/dist/i18n/i18n.js +31 -33
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/patterns/LexicalEditor/components/FileSelectInput.js +7 -8
- package/dist/patterns/LexicalEditor/components/UploadFileDialog/UploadFileDialog.js +3 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputComponent.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/FormPlaceholder.js +3 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/SettingForm.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxView.js +15 -14
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectComponent.js +2 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/SettingForm.js +3 -3
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormIconAndLabel.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormLabel.js +5 -3
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormQuestion.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/SettingForm.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/EvaluationComponent.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/iconData.d.ts +2 -1
- package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/iconData.js +4 -5
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SelectComponent.js +2 -1
- package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SettingForm/SettingForm.js +3 -3
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.js +1 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.js +58 -56
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.d.ts +2 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +29 -33
- package/dist/patterns/LexicalEditor/plugins/DragDropPastePlugin/index.js +4 -2
- package/dist/texts.d.ts +3 -1
- package/dist/texts.js +11 -11
- package/package.json +1 -1
|
@@ -17,10 +17,10 @@ import { $isProblemSelectNode, } from "../../nodes/ProblemSelectNode";
|
|
|
17
17
|
import { $isSheetInputNode } from "../../nodes/SheetInputNode";
|
|
18
18
|
import { $isSheetSelectNode, } from "../../nodes/SheetSelectNode";
|
|
19
19
|
import { $isSelfEvaluationNode, } from "../../nodes/SelfEvaluationNode";
|
|
20
|
-
import {
|
|
21
|
-
function getParagraphContextMenuOptions(editor, node) {
|
|
20
|
+
import { useTranslation } from "react-i18next";
|
|
21
|
+
function getParagraphContextMenuOptions(editor, node, t) {
|
|
22
22
|
return [
|
|
23
|
-
new ComponentPickerOption(
|
|
23
|
+
new ComponentPickerOption(t("본문", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
24
24
|
icon: _jsx(TextIcon, {}),
|
|
25
25
|
// eslint-disable-next-line i18next/no-literal-string
|
|
26
26
|
keywords: ["normal", "paragraph", "p", "text", "본문", "단락", "내용"],
|
|
@@ -31,9 +31,9 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
31
31
|
}),
|
|
32
32
|
...[1, 2, 3].map((n) => {
|
|
33
33
|
const titleMap = {
|
|
34
|
-
1:
|
|
35
|
-
2:
|
|
36
|
-
3:
|
|
34
|
+
1: t("큰 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
35
|
+
2: t("중간 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
36
|
+
3: t("작은 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
37
37
|
};
|
|
38
38
|
const iconMap = {
|
|
39
39
|
1: _jsx(H1Icon, {}),
|
|
@@ -49,7 +49,7 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
49
49
|
}),
|
|
50
50
|
});
|
|
51
51
|
}),
|
|
52
|
-
new ComponentPickerOption(
|
|
52
|
+
new ComponentPickerOption(t("일반 목록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
53
53
|
icon: _jsx(ListUnorderedIcon, {}),
|
|
54
54
|
keywords: ["bulleted list", "unordered list", "ul"],
|
|
55
55
|
onSelect: () => {
|
|
@@ -57,7 +57,7 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
57
57
|
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);
|
|
58
58
|
},
|
|
59
59
|
}),
|
|
60
|
-
new ComponentPickerOption(
|
|
60
|
+
new ComponentPickerOption(t("숫자 목록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
61
61
|
icon: _jsx(ListOrderedIcon, {}),
|
|
62
62
|
keywords: ["numbered list", "ordered list", "ol"],
|
|
63
63
|
onSelect: () => {
|
|
@@ -65,7 +65,7 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
65
65
|
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);
|
|
66
66
|
},
|
|
67
67
|
}),
|
|
68
|
-
new ComponentPickerOption(
|
|
68
|
+
new ComponentPickerOption(t("인용 블록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
69
69
|
icon: _jsx(DoubleQuotesLIcon, {}),
|
|
70
70
|
keywords: ["block quote"],
|
|
71
71
|
onSelect: () => editor.update(() => {
|
|
@@ -73,7 +73,7 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
73
73
|
$setBlocksType(selection, () => $createQuoteNode());
|
|
74
74
|
}),
|
|
75
75
|
}),
|
|
76
|
-
new ComponentPickerOption(
|
|
76
|
+
new ComponentPickerOption(t("코드 블록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
77
77
|
icon: _jsx(CodeViewIcon, {}),
|
|
78
78
|
keywords: ["javascript", "python", "js", "codeblock"],
|
|
79
79
|
onSelect: () => editor.update(() => {
|
|
@@ -90,7 +90,7 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
90
90
|
}
|
|
91
91
|
}),
|
|
92
92
|
}),
|
|
93
|
-
new ComponentPickerOption(
|
|
93
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
94
94
|
icon: _jsx(CloseFillIcon, {}),
|
|
95
95
|
keywords: [],
|
|
96
96
|
onSelect: () => {
|
|
@@ -101,13 +101,13 @@ function getParagraphContextMenuOptions(editor, node) {
|
|
|
101
101
|
}),
|
|
102
102
|
];
|
|
103
103
|
}
|
|
104
|
-
function getHeadingContextMenuOptions(editor, node) {
|
|
104
|
+
function getHeadingContextMenuOptions(editor, node, t) {
|
|
105
105
|
return [
|
|
106
106
|
...[1, 2, 3].map((n) => {
|
|
107
107
|
const titleMap = {
|
|
108
|
-
1:
|
|
109
|
-
2:
|
|
110
|
-
3:
|
|
108
|
+
1: t("큰 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
109
|
+
2: t("중간 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
110
|
+
3: t("작은 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
111
111
|
};
|
|
112
112
|
const iconMap = {
|
|
113
113
|
1: _jsx(H1Icon, {}),
|
|
@@ -123,7 +123,7 @@ function getHeadingContextMenuOptions(editor, node) {
|
|
|
123
123
|
}),
|
|
124
124
|
});
|
|
125
125
|
}),
|
|
126
|
-
new ComponentPickerOption(
|
|
126
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
127
127
|
icon: _jsx(CloseFillIcon, {}),
|
|
128
128
|
keywords: [],
|
|
129
129
|
onSelect: () => {
|
|
@@ -134,9 +134,9 @@ function getHeadingContextMenuOptions(editor, node) {
|
|
|
134
134
|
}),
|
|
135
135
|
];
|
|
136
136
|
}
|
|
137
|
-
function getListContextMenuOptions(editor, theme, node) {
|
|
137
|
+
function getListContextMenuOptions(editor, theme, node, t) {
|
|
138
138
|
return [
|
|
139
|
-
new ComponentPickerOption(
|
|
139
|
+
new ComponentPickerOption(t("일반 목록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
140
140
|
icon: _jsx(ListUnorderedIcon, {}),
|
|
141
141
|
keywords: ["bulleted list", "unordered list", "ul"],
|
|
142
142
|
onSelect: () => {
|
|
@@ -144,7 +144,7 @@ function getListContextMenuOptions(editor, theme, node) {
|
|
|
144
144
|
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);
|
|
145
145
|
},
|
|
146
146
|
}),
|
|
147
|
-
new ComponentPickerOption(
|
|
147
|
+
new ComponentPickerOption(t("숫자 목록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
148
148
|
icon: _jsx(ListOrderedIcon, {}),
|
|
149
149
|
keywords: ["numbered list", "ordered list", "ol"],
|
|
150
150
|
onSelect: () => {
|
|
@@ -152,7 +152,7 @@ function getListContextMenuOptions(editor, theme, node) {
|
|
|
152
152
|
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);
|
|
153
153
|
},
|
|
154
154
|
}),
|
|
155
|
-
new ComponentPickerOption(
|
|
155
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
156
156
|
icon: _jsx(CloseFillIcon, {}),
|
|
157
157
|
keywords: [],
|
|
158
158
|
onSelect: () => {
|
|
@@ -163,9 +163,9 @@ function getListContextMenuOptions(editor, theme, node) {
|
|
|
163
163
|
}),
|
|
164
164
|
];
|
|
165
165
|
}
|
|
166
|
-
function getProblemInputContextMenuOptions(node) {
|
|
166
|
+
function getProblemInputContextMenuOptions(node, t) {
|
|
167
167
|
return [
|
|
168
|
-
new ComponentPickerOption(
|
|
168
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
169
169
|
icon: _jsx(CloseFillIcon, {}),
|
|
170
170
|
keywords: [],
|
|
171
171
|
onSelect: () => {
|
|
@@ -174,9 +174,9 @@ function getProblemInputContextMenuOptions(node) {
|
|
|
174
174
|
}),
|
|
175
175
|
];
|
|
176
176
|
}
|
|
177
|
-
function getProblemSelectContextMenuOptions(node) {
|
|
177
|
+
function getProblemSelectContextMenuOptions(node, t) {
|
|
178
178
|
return [
|
|
179
|
-
new ComponentPickerOption(
|
|
179
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
180
180
|
icon: _jsx(CloseFillIcon, {}),
|
|
181
181
|
keywords: [],
|
|
182
182
|
onSelect: () => {
|
|
@@ -185,9 +185,9 @@ function getProblemSelectContextMenuOptions(node) {
|
|
|
185
185
|
}),
|
|
186
186
|
];
|
|
187
187
|
}
|
|
188
|
-
function getSheetInputContextMenuOptions(node) {
|
|
188
|
+
function getSheetInputContextMenuOptions(node, t) {
|
|
189
189
|
return [
|
|
190
|
-
new ComponentPickerOption(
|
|
190
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
191
191
|
icon: _jsx(CloseFillIcon, {}),
|
|
192
192
|
keywords: [],
|
|
193
193
|
onSelect: () => {
|
|
@@ -196,9 +196,9 @@ function getSheetInputContextMenuOptions(node) {
|
|
|
196
196
|
}),
|
|
197
197
|
];
|
|
198
198
|
}
|
|
199
|
-
function getSheetSelectContextMenuOptions(node) {
|
|
199
|
+
function getSheetSelectContextMenuOptions(node, t) {
|
|
200
200
|
return [
|
|
201
|
-
new ComponentPickerOption(
|
|
201
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
202
202
|
icon: _jsx(CloseFillIcon, {}),
|
|
203
203
|
keywords: [],
|
|
204
204
|
onSelect: () => {
|
|
@@ -207,9 +207,9 @@ function getSheetSelectContextMenuOptions(node) {
|
|
|
207
207
|
}),
|
|
208
208
|
];
|
|
209
209
|
}
|
|
210
|
-
function getSelfEvaluationContextMenuOptions(node) {
|
|
210
|
+
function getSelfEvaluationContextMenuOptions(node, t) {
|
|
211
211
|
return [
|
|
212
|
-
new ComponentPickerOption(
|
|
212
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
213
213
|
icon: _jsx(CloseFillIcon, {}),
|
|
214
214
|
keywords: [],
|
|
215
215
|
onSelect: () => {
|
|
@@ -218,9 +218,9 @@ function getSelfEvaluationContextMenuOptions(node) {
|
|
|
218
218
|
}),
|
|
219
219
|
];
|
|
220
220
|
}
|
|
221
|
-
function getImageContextMenuOptions(node) {
|
|
221
|
+
function getImageContextMenuOptions(node, t) {
|
|
222
222
|
return [
|
|
223
|
-
new ComponentPickerOption(
|
|
223
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
224
224
|
icon: _jsx(CloseFillIcon, {}),
|
|
225
225
|
keywords: [],
|
|
226
226
|
onSelect: () => {
|
|
@@ -229,9 +229,9 @@ function getImageContextMenuOptions(node) {
|
|
|
229
229
|
}),
|
|
230
230
|
];
|
|
231
231
|
}
|
|
232
|
-
function getVideoContextMenuOptions(node) {
|
|
232
|
+
function getVideoContextMenuOptions(node, t) {
|
|
233
233
|
return [
|
|
234
|
-
new ComponentPickerOption(
|
|
234
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
235
235
|
icon: _jsx(CloseFillIcon, {}),
|
|
236
236
|
keywords: [],
|
|
237
237
|
onSelect: () => {
|
|
@@ -240,9 +240,9 @@ function getVideoContextMenuOptions(node) {
|
|
|
240
240
|
}),
|
|
241
241
|
];
|
|
242
242
|
}
|
|
243
|
-
function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
243
|
+
function getColoredQuoteContextMenuOptions(editor, theme, node, t) {
|
|
244
244
|
return [
|
|
245
|
-
new ComponentPickerOption(
|
|
245
|
+
new ComponentPickerOption(t("회색"), {
|
|
246
246
|
icon: (_jsx(InputMethodLineIcon, { color: theme.color.container.marbleOnContainer })),
|
|
247
247
|
iconContainerClassName: css `
|
|
248
248
|
background: ${theme.color.container.marbleContainer};
|
|
@@ -254,7 +254,7 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
|
254
254
|
});
|
|
255
255
|
},
|
|
256
256
|
}),
|
|
257
|
-
new ComponentPickerOption(
|
|
257
|
+
new ComponentPickerOption(t("빨간색"), {
|
|
258
258
|
icon: (_jsx(InputMethodLineIcon, { color: theme.color.container.redOnContainer })),
|
|
259
259
|
iconContainerClassName: css `
|
|
260
260
|
background: ${theme.color.container.redContainer};
|
|
@@ -266,7 +266,7 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
|
266
266
|
});
|
|
267
267
|
},
|
|
268
268
|
}),
|
|
269
|
-
new ComponentPickerOption(
|
|
269
|
+
new ComponentPickerOption(t("노란색"), {
|
|
270
270
|
icon: (_jsx(InputMethodLineIcon, { color: theme.color.container.yellowOnContainer })),
|
|
271
271
|
iconContainerClassName: css `
|
|
272
272
|
background: ${theme.color.container.yellowContainer};
|
|
@@ -278,7 +278,7 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
|
278
278
|
});
|
|
279
279
|
},
|
|
280
280
|
}),
|
|
281
|
-
new ComponentPickerOption(
|
|
281
|
+
new ComponentPickerOption(t("파란색"), {
|
|
282
282
|
icon: (_jsx(InputMethodLineIcon, { color: theme.color.container.blueOnContainer })),
|
|
283
283
|
iconContainerClassName: css `
|
|
284
284
|
background: ${theme.color.container.blueContainer};
|
|
@@ -290,7 +290,7 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
|
290
290
|
});
|
|
291
291
|
},
|
|
292
292
|
}),
|
|
293
|
-
new ComponentPickerOption(
|
|
293
|
+
new ComponentPickerOption(t("초록색"), {
|
|
294
294
|
icon: (_jsx(InputMethodLineIcon, { color: theme.color.container.greenOnContainer })),
|
|
295
295
|
iconContainerClassName: css `
|
|
296
296
|
background: ${theme.color.container.greenContainer};
|
|
@@ -302,7 +302,7 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
|
302
302
|
});
|
|
303
303
|
},
|
|
304
304
|
}),
|
|
305
|
-
new ComponentPickerOption(
|
|
305
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
306
306
|
icon: _jsx(CloseFillIcon, {}),
|
|
307
307
|
keywords: [],
|
|
308
308
|
onSelect: () => {
|
|
@@ -313,9 +313,9 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
|
|
|
313
313
|
}),
|
|
314
314
|
];
|
|
315
315
|
}
|
|
316
|
-
function getUploadFileContextMenuOptions(editor, node) {
|
|
316
|
+
function getUploadFileContextMenuOptions(editor, node, t) {
|
|
317
317
|
return [
|
|
318
|
-
new ComponentPickerOption(
|
|
318
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
319
319
|
icon: _jsx(CloseFillIcon, {}),
|
|
320
320
|
keywords: [],
|
|
321
321
|
onSelect: () => {
|
|
@@ -329,48 +329,50 @@ function getUploadFileContextMenuOptions(editor, node) {
|
|
|
329
329
|
export function useContextMenuOptions(props) {
|
|
330
330
|
const { isSheetEnabled, isQuizEnabled, showFileUpload } = props;
|
|
331
331
|
const theme = useTheme();
|
|
332
|
+
const { t } = useTranslation();
|
|
332
333
|
return (editor, node, setImageOpen, setVideoOpen, setFileOpen) => {
|
|
333
334
|
if ($isProblemInputNode(node)) {
|
|
334
|
-
return getProblemInputContextMenuOptions(node);
|
|
335
|
+
return getProblemInputContextMenuOptions(node, t);
|
|
335
336
|
}
|
|
336
337
|
else if ($isProblemSelectNode(node)) {
|
|
337
|
-
return getProblemSelectContextMenuOptions(node);
|
|
338
|
+
return getProblemSelectContextMenuOptions(node, t);
|
|
338
339
|
}
|
|
339
340
|
else if ($isSheetInputNode(node)) {
|
|
340
|
-
return getSheetInputContextMenuOptions(node);
|
|
341
|
+
return getSheetInputContextMenuOptions(node, t);
|
|
341
342
|
}
|
|
342
343
|
else if ($isSheetSelectNode(node)) {
|
|
343
|
-
return getSheetSelectContextMenuOptions(node);
|
|
344
|
+
return getSheetSelectContextMenuOptions(node, t);
|
|
344
345
|
}
|
|
345
346
|
else if ($isSelfEvaluationNode(node)) {
|
|
346
|
-
return getSelfEvaluationContextMenuOptions(node);
|
|
347
|
+
return getSelfEvaluationContextMenuOptions(node, t);
|
|
347
348
|
}
|
|
348
349
|
else if ($isImageNode(node)) {
|
|
349
|
-
return getImageContextMenuOptions(node);
|
|
350
|
+
return getImageContextMenuOptions(node, t);
|
|
350
351
|
}
|
|
351
352
|
else if ($isVideoNode(node)) {
|
|
352
|
-
return getVideoContextMenuOptions(node);
|
|
353
|
+
return getVideoContextMenuOptions(node, t);
|
|
353
354
|
}
|
|
354
355
|
else if (node instanceof ParagraphNode) {
|
|
355
|
-
return getParagraphContextMenuOptions(editor, node);
|
|
356
|
+
return getParagraphContextMenuOptions(editor, node, t);
|
|
356
357
|
}
|
|
357
358
|
else if (node instanceof HeadingNode) {
|
|
358
|
-
return getHeadingContextMenuOptions(editor, node);
|
|
359
|
+
return getHeadingContextMenuOptions(editor, node, t);
|
|
359
360
|
}
|
|
360
361
|
else if (node instanceof ListNode || node instanceof ListItemNode) {
|
|
361
|
-
return getListContextMenuOptions(editor, theme, node);
|
|
362
|
+
return getListContextMenuOptions(editor, theme, node, t);
|
|
362
363
|
}
|
|
363
364
|
else if ($isColoredQuoteNode(node)) {
|
|
364
|
-
return getColoredQuoteContextMenuOptions(editor, theme, node);
|
|
365
|
+
return getColoredQuoteContextMenuOptions(editor, theme, node, t);
|
|
365
366
|
}
|
|
366
367
|
else if ($isFileNode(node)) {
|
|
367
|
-
return getUploadFileContextMenuOptions(editor, node);
|
|
368
|
+
return getUploadFileContextMenuOptions(editor, node, t);
|
|
368
369
|
}
|
|
369
370
|
else {
|
|
370
371
|
return [
|
|
371
372
|
...getBaseOptions({
|
|
372
373
|
editor,
|
|
373
374
|
theme,
|
|
375
|
+
t,
|
|
374
376
|
setImageOpen,
|
|
375
377
|
setVideoOpen,
|
|
376
378
|
isSheetEnabled,
|
|
@@ -378,7 +380,7 @@ export function useContextMenuOptions(props) {
|
|
|
378
380
|
setFileOpen,
|
|
379
381
|
showFileUpload,
|
|
380
382
|
}),
|
|
381
|
-
new ComponentPickerOption(
|
|
383
|
+
new ComponentPickerOption(t("블록 삭제"), {
|
|
382
384
|
icon: _jsx(CloseFillIcon, {}),
|
|
383
385
|
keywords: [],
|
|
384
386
|
onSelect: () => {
|
package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { MenuOption } from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
|
10
10
|
import { LexicalEditor } from "lexical";
|
|
11
11
|
import { ReactElement } from "react";
|
|
12
12
|
import { Theme } from "@emotion/react";
|
|
13
|
+
import { TFunction } from "i18next";
|
|
13
14
|
export declare class ComponentDrawerOption extends MenuOption {
|
|
14
15
|
title: string;
|
|
15
16
|
component: ReactElement;
|
|
@@ -33,6 +34,7 @@ export declare class ComponentPickerOption extends MenuOption {
|
|
|
33
34
|
export declare function getBaseOptions(props: {
|
|
34
35
|
editor: LexicalEditor;
|
|
35
36
|
theme: Theme;
|
|
37
|
+
t: TFunction;
|
|
36
38
|
setImageOpen: (open: boolean) => void;
|
|
37
39
|
setVideoOpen: (open: boolean) => void;
|
|
38
40
|
setFileOpen: (open: boolean) => void;
|
package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js
CHANGED
|
@@ -35,7 +35,6 @@ import { InsertVideoDialog } from "../../components/InsertVideoDialog";
|
|
|
35
35
|
import { INSERT_VIDEO_COMMAND } from "../VideosPlugin";
|
|
36
36
|
import { UploadFileDialog } from "../../components/UploadFileDialog";
|
|
37
37
|
import { UPLOAD_FILE_COMMAND } from "../FilePlugin";
|
|
38
|
-
import { i18n } from "../../../../i18n/i18n";
|
|
39
38
|
import { useTranslation } from "react-i18next";
|
|
40
39
|
import { getTexts } from "../../../../texts";
|
|
41
40
|
// import useModal from "../../hooks/useModal";
|
|
@@ -80,9 +79,9 @@ function getDynamicOptions(editor, queryString) {
|
|
|
80
79
|
}
|
|
81
80
|
return options;
|
|
82
81
|
}
|
|
83
|
-
function getSheetContextOptions(editor, theme) {
|
|
82
|
+
function getSheetContextOptions(editor, theme, t) {
|
|
84
83
|
return [
|
|
85
|
-
new ComponentPickerOption(
|
|
84
|
+
new ComponentPickerOption(t("선택형 입력 칸", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
86
85
|
icon: _jsx(ListRadioIcon, { color: theme.color.foreground.primary }),
|
|
87
86
|
// eslint-disable-next-line i18next/no-literal-string
|
|
88
87
|
keywords: ["sheet select", "선택형 입력"],
|
|
@@ -100,28 +99,24 @@ function getSheetContextOptions(editor, theme) {
|
|
|
100
99
|
allowMultipleAnswers: false,
|
|
101
100
|
}),
|
|
102
101
|
}),
|
|
103
|
-
new ComponentPickerOption(
|
|
102
|
+
new ComponentPickerOption(t("3단계 평가 입력 칸"), {
|
|
104
103
|
icon: _jsx(EmojiStickerLineIcon, { color: theme.color.foreground.primary }),
|
|
105
104
|
// eslint-disable-next-line i18next/no-literal-string
|
|
106
105
|
keywords: ["self evaluation", "3단계 평가 입력"],
|
|
107
106
|
onSelect: () => editor.dispatchCommand(INSERT_SELF_EVALUATION_COMMAND, {
|
|
108
107
|
iconType: "emoji",
|
|
109
|
-
labels: [
|
|
110
|
-
i18n.t("아주 잘했어요!"),
|
|
111
|
-
i18n.t("보통이에요."),
|
|
112
|
-
i18n.t("잘 모르겠어요."),
|
|
113
|
-
],
|
|
108
|
+
labels: [t("아주 잘했어요!"), t("보통이에요."), t("잘 모르겠어요.")],
|
|
114
109
|
evaluations: [
|
|
115
110
|
{
|
|
116
111
|
question: {
|
|
117
|
-
text: getTexts("placeholderEvaluationItem"),
|
|
112
|
+
text: getTexts(t, "placeholderEvaluationItem"),
|
|
118
113
|
},
|
|
119
114
|
selectedLabelIndex: null,
|
|
120
115
|
},
|
|
121
116
|
],
|
|
122
117
|
}),
|
|
123
118
|
}),
|
|
124
|
-
new ComponentPickerOption(
|
|
119
|
+
new ComponentPickerOption(t("단답형 입력 칸", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
125
120
|
icon: _jsx(InputMethodLineIcon, { color: theme.color.foreground.primary }),
|
|
126
121
|
// eslint-disable-next-line i18next/no-literal-string
|
|
127
122
|
keywords: ["sheet short input", "단답형 입력"],
|
|
@@ -131,7 +126,7 @@ function getSheetContextOptions(editor, theme) {
|
|
|
131
126
|
placeholder: "",
|
|
132
127
|
}),
|
|
133
128
|
}),
|
|
134
|
-
new ComponentPickerOption(
|
|
129
|
+
new ComponentPickerOption(t("서술형 입력 칸", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
135
130
|
icon: _jsx(FileList2LineIcon, { color: theme.color.foreground.primary }),
|
|
136
131
|
// eslint-disable-next-line i18next/no-literal-string
|
|
137
132
|
keywords: ["sheet long input", "서술형 입력"],
|
|
@@ -141,7 +136,7 @@ function getSheetContextOptions(editor, theme) {
|
|
|
141
136
|
placeholder: "",
|
|
142
137
|
}),
|
|
143
138
|
}),
|
|
144
|
-
new ComponentDrawerOption(
|
|
139
|
+
new ComponentDrawerOption(t("활동지 메뉴구분선"), (_jsx("div", { css: css `
|
|
145
140
|
width: 100%;
|
|
146
141
|
height: 1px;
|
|
147
142
|
background: ${theme.color.background.neutralAltActive};
|
|
@@ -149,9 +144,9 @@ function getSheetContextOptions(editor, theme) {
|
|
|
149
144
|
` }))),
|
|
150
145
|
];
|
|
151
146
|
}
|
|
152
|
-
function getQuizContextOptions(editor, theme) {
|
|
147
|
+
function getQuizContextOptions(editor, theme, t) {
|
|
153
148
|
return [
|
|
154
|
-
new ComponentPickerOption(
|
|
149
|
+
new ComponentPickerOption(t("주관식 입력 칸", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
155
150
|
icon: _jsx(InputMethodLineIcon, { color: theme.color.foreground.primary }),
|
|
156
151
|
// eslint-disable-next-line i18next/no-literal-string
|
|
157
152
|
keywords: ["problem input", "주관식 입력"],
|
|
@@ -169,7 +164,7 @@ function getQuizContextOptions(editor, theme) {
|
|
|
169
164
|
ignoreWhitespace: true,
|
|
170
165
|
}),
|
|
171
166
|
}),
|
|
172
|
-
new ComponentPickerOption(
|
|
167
|
+
new ComponentPickerOption(t("객관식 입력 칸", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
173
168
|
icon: _jsx(ListRadioIcon, { color: theme.color.foreground.primary }),
|
|
174
169
|
// eslint-disable-next-line i18next/no-literal-string
|
|
175
170
|
keywords: ["problem select", "객관식 입력"],
|
|
@@ -189,7 +184,7 @@ function getQuizContextOptions(editor, theme) {
|
|
|
189
184
|
});
|
|
190
185
|
},
|
|
191
186
|
}),
|
|
192
|
-
new ComponentDrawerOption(
|
|
187
|
+
new ComponentDrawerOption(t("퀴즈 메뉴구분선"), (_jsx("div", { css: css `
|
|
193
188
|
width: 100%;
|
|
194
189
|
height: 1px;
|
|
195
190
|
background: ${theme.color.background.neutralAltActive};
|
|
@@ -198,9 +193,9 @@ function getQuizContextOptions(editor, theme) {
|
|
|
198
193
|
];
|
|
199
194
|
}
|
|
200
195
|
export function getBaseOptions(props) {
|
|
201
|
-
const { editor, theme, setImageOpen, setVideoOpen, setFileOpen, isSheetEnabled, isQuizEnabled, showFileUpload, } = props;
|
|
196
|
+
const { editor, theme, t, setImageOpen, setVideoOpen, setFileOpen, isSheetEnabled, isQuizEnabled, showFileUpload, } = props;
|
|
202
197
|
const baseOptions = [
|
|
203
|
-
new ComponentPickerOption(
|
|
198
|
+
new ComponentPickerOption(t("본문", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
204
199
|
icon: _jsx(TextIcon, {}),
|
|
205
200
|
// eslint-disable-next-line i18next/no-literal-string
|
|
206
201
|
keywords: ["normal", "paragraph", "p", "text", "본문", "단락", "내용"],
|
|
@@ -213,9 +208,9 @@ export function getBaseOptions(props) {
|
|
|
213
208
|
}),
|
|
214
209
|
...[1, 2, 3].map((n) => {
|
|
215
210
|
const titleMap = {
|
|
216
|
-
1:
|
|
217
|
-
2:
|
|
218
|
-
3:
|
|
211
|
+
1: t("큰 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
212
|
+
2: t("중간 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
213
|
+
3: t("작은 제목", { context: "렉시컬 드롭다운 메뉴" }),
|
|
219
214
|
};
|
|
220
215
|
const iconMap = {
|
|
221
216
|
1: _jsx(H1Icon, {}),
|
|
@@ -233,17 +228,17 @@ export function getBaseOptions(props) {
|
|
|
233
228
|
}),
|
|
234
229
|
});
|
|
235
230
|
}),
|
|
236
|
-
new ComponentPickerOption(
|
|
231
|
+
new ComponentPickerOption(t("일반 목록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
237
232
|
icon: _jsx(ListUnorderedIcon, {}),
|
|
238
233
|
keywords: ["bulleted list", "unordered list", "ul"],
|
|
239
234
|
onSelect: () => editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined),
|
|
240
235
|
}),
|
|
241
|
-
new ComponentPickerOption(
|
|
236
|
+
new ComponentPickerOption(t("숫자 목록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
242
237
|
icon: _jsx(ListOrderedIcon, {}),
|
|
243
238
|
keywords: ["numbered list", "ordered list", "ol"],
|
|
244
239
|
onSelect: () => editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined),
|
|
245
240
|
}),
|
|
246
|
-
new ComponentPickerOption(
|
|
241
|
+
new ComponentPickerOption(t("인용 블록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
247
242
|
icon: _jsx(DoubleQuotesLIcon, {}),
|
|
248
243
|
keywords: ["block quote"],
|
|
249
244
|
onSelect: () => editor.update(() => {
|
|
@@ -253,7 +248,7 @@ export function getBaseOptions(props) {
|
|
|
253
248
|
}
|
|
254
249
|
}),
|
|
255
250
|
}),
|
|
256
|
-
new ComponentPickerOption(
|
|
251
|
+
new ComponentPickerOption(t("코드 블록", { context: "렉시컬 드롭다운 메뉴" }), {
|
|
257
252
|
icon: _jsx(CodeViewIcon, {}),
|
|
258
253
|
keywords: ["javascript", "python", "js", "codeblock"],
|
|
259
254
|
onSelect: () => editor.update(() => {
|
|
@@ -272,17 +267,17 @@ export function getBaseOptions(props) {
|
|
|
272
267
|
}
|
|
273
268
|
}),
|
|
274
269
|
}),
|
|
275
|
-
new ComponentPickerOption(
|
|
270
|
+
new ComponentPickerOption(t("구분선"), {
|
|
276
271
|
icon: _jsx(SeparatorIcon, {}),
|
|
277
272
|
keywords: ["horizontal rule", "divider", "hr"],
|
|
278
273
|
onSelect: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined),
|
|
279
274
|
}),
|
|
280
|
-
new ComponentPickerOption(
|
|
275
|
+
new ComponentPickerOption(t("이미지"), {
|
|
281
276
|
icon: _jsx(ImageLineIcon, {}),
|
|
282
277
|
keywords: ["image", "photo", "picture", "file"],
|
|
283
278
|
onSelect: () => setImageOpen(true),
|
|
284
279
|
}),
|
|
285
|
-
new ComponentPickerOption(
|
|
280
|
+
new ComponentPickerOption(t("동영상"), {
|
|
286
281
|
icon: _jsx(VideoLineIcon, {}),
|
|
287
282
|
keywords: ["video", "movie"],
|
|
288
283
|
onSelect: () => setVideoOpen(true),
|
|
@@ -293,15 +288,15 @@ export function getBaseOptions(props) {
|
|
|
293
288
|
const isLabMode = localStorage.getItem("labMode") === "true";
|
|
294
289
|
// isQuizEnabled이거나 devMode이면 퀴즈 컨텍스트 메뉴를 꼭대기에 추가합니다.
|
|
295
290
|
if (isQuizEnabled || isDevMode) {
|
|
296
|
-
baseOptions.unshift(...getQuizContextOptions(editor, theme));
|
|
291
|
+
baseOptions.unshift(...getQuizContextOptions(editor, theme, t));
|
|
297
292
|
}
|
|
298
293
|
// isSheetEnabled이거나 devMode이면 활동지 컨텍스트 메뉴를 꼭대기에 추가합니다.
|
|
299
294
|
if (isSheetEnabled || isDevMode) {
|
|
300
|
-
baseOptions.unshift(...getSheetContextOptions(editor, theme));
|
|
295
|
+
baseOptions.unshift(...getSheetContextOptions(editor, theme, t));
|
|
301
296
|
}
|
|
302
297
|
// devMode || labMode이면 칼럼 컨텍스트 메뉴를 추가합니다. (일부공개)
|
|
303
298
|
if (isDevMode || isLabMode) {
|
|
304
|
-
baseOptions.push(new ComponentPickerOption(
|
|
299
|
+
baseOptions.push(new ComponentPickerOption(t("칼럼"), {
|
|
305
300
|
icon: _jsx(LayoutColumnLineIcon, {}),
|
|
306
301
|
keywords: ["columns", "layout", "grid"],
|
|
307
302
|
onSelect: () => editor.dispatchCommand(INSERT_LAYOUT_COMMAND, "1fr 1fr"),
|
|
@@ -309,7 +304,7 @@ export function getBaseOptions(props) {
|
|
|
309
304
|
}
|
|
310
305
|
// showFileUpload 이면 파일블록을 추가합니다.
|
|
311
306
|
if (showFileUpload || isDevMode) {
|
|
312
|
-
baseOptions.push(new ComponentPickerOption(
|
|
307
|
+
baseOptions.push(new ComponentPickerOption(t("파일 게시"), {
|
|
313
308
|
icon: _jsx(File3LineIcon, {}),
|
|
314
309
|
keywords: ["file", "upload"],
|
|
315
310
|
onSelect: () => setFileOpen(true),
|
|
@@ -333,6 +328,7 @@ export function ComponentPickerMenuPlugin(props) {
|
|
|
333
328
|
const baseOptions = getBaseOptions({
|
|
334
329
|
editor,
|
|
335
330
|
theme,
|
|
331
|
+
t,
|
|
336
332
|
setImageOpen,
|
|
337
333
|
setVideoOpen,
|
|
338
334
|
isSheetEnabled,
|
|
@@ -24,6 +24,7 @@ import { CdsContext } from "../../../../CdsProvider";
|
|
|
24
24
|
import { UPLOAD_FILE_COMMAND } from "../FilePlugin";
|
|
25
25
|
import moment from "moment";
|
|
26
26
|
import { getTexts } from "../../../../texts";
|
|
27
|
+
import { useTranslation } from "react-i18next";
|
|
27
28
|
const ACCEPTABLE_IMAGE_TYPES = [
|
|
28
29
|
"image/",
|
|
29
30
|
"image/heic",
|
|
@@ -42,6 +43,7 @@ export function DragDropPastePlugin() {
|
|
|
42
43
|
const cdsContext = useContext(CdsContext);
|
|
43
44
|
const uploadByFile = (_a = cdsContext.lexical) === null || _a === void 0 ? void 0 : _a.uploadByFile;
|
|
44
45
|
const showFileError = (_b = cdsContext.lexical) === null || _b === void 0 ? void 0 : _b.showFileError;
|
|
46
|
+
const { t } = useTranslation();
|
|
45
47
|
// eslint-disable-next-line arrow-body-style
|
|
46
48
|
useEffect(() => {
|
|
47
49
|
return editor.registerCommand(DRAG_DROP_PASTE, (files) => {
|
|
@@ -60,7 +62,7 @@ export function DragDropPastePlugin() {
|
|
|
60
62
|
}
|
|
61
63
|
else {
|
|
62
64
|
if (file.size >= MAX_FILE_SIZE) {
|
|
63
|
-
showFileError === null || showFileError === void 0 ? void 0 : showFileError("upload", getTexts("errorFileTooLarge"));
|
|
65
|
+
showFileError === null || showFileError === void 0 ? void 0 : showFileError("upload", getTexts(t, "errorFileTooLarge"));
|
|
64
66
|
}
|
|
65
67
|
else {
|
|
66
68
|
const result = yield uploadByFile(file);
|
|
@@ -76,6 +78,6 @@ export function DragDropPastePlugin() {
|
|
|
76
78
|
}))();
|
|
77
79
|
return true;
|
|
78
80
|
}, COMMAND_PRIORITY_LOW);
|
|
79
|
-
}, [editor, showFileError, uploadByFile]);
|
|
81
|
+
}, [editor, showFileError, uploadByFile, t]);
|
|
80
82
|
return null;
|
|
81
83
|
}
|
package/dist/texts.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TFunction } from "i18next";
|
|
1
2
|
type TranslationMap = {
|
|
2
3
|
placeholderEnterHere: string;
|
|
3
4
|
errorFileTooLarge: string;
|
|
@@ -7,6 +8,7 @@ type TranslationMap = {
|
|
|
7
8
|
errorRequiredField: string;
|
|
8
9
|
errorDuplicateChoice: (indexes: string) => string;
|
|
9
10
|
errorMaxChoicesExceeded: string;
|
|
11
|
+
multipleChoicesProblem: string;
|
|
10
12
|
};
|
|
11
|
-
export declare function getTexts<K extends keyof TranslationMap>(key: K): TranslationMap[K];
|
|
13
|
+
export declare function getTexts<K extends keyof TranslationMap>(t: TFunction, key: K): TranslationMap[K];
|
|
12
14
|
export {};
|
package/dist/texts.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { i18n } from "./i18n/i18n";
|
|
2
1
|
const TRANSLATION_TEXT = {
|
|
3
|
-
placeholderEnterHere: () =>
|
|
4
|
-
errorFileTooLarge: () =>
|
|
5
|
-
descriptionDefaultInputText: () =>
|
|
6
|
-
exampleEnterHere: () =>
|
|
7
|
-
placeholderEvaluationItem: () =>
|
|
8
|
-
errorRequiredField: () =>
|
|
9
|
-
errorDuplicateChoice: () => (indexes) =>
|
|
10
|
-
errorMaxChoicesExceeded: () =>
|
|
2
|
+
placeholderEnterHere: (t) => t("여기에 입력하세요."),
|
|
3
|
+
errorFileTooLarge: (t) => t("용량이 너무 큽니다. 1GB 이하의 파일을 선택해 주세요."),
|
|
4
|
+
descriptionDefaultInputText: (t) => t("입력 칸에 기본으로 노출되는 텍스트입니다."),
|
|
5
|
+
exampleEnterHere: (t) => t("예) 여기에 입력하세요."),
|
|
6
|
+
placeholderEvaluationItem: (t) => t("평가 항목을 입력하세요."),
|
|
7
|
+
errorRequiredField: (t) => t("필수 입력 항목입니다."),
|
|
8
|
+
errorDuplicateChoice: (t) => (indexes) => t("{{indexes}}번 선택지가 같은 내용입니다.", { indexes }),
|
|
9
|
+
errorMaxChoicesExceeded: (t) => t("선택지는 9개까지 등록이 가능합니다."),
|
|
10
|
+
multipleChoicesProblem: (t) => t("질문에 해당하는 답을 모두 고르는 문제입니다."),
|
|
11
11
|
};
|
|
12
|
-
export function getTexts(key) {
|
|
13
|
-
return TRANSLATION_TEXT[key]();
|
|
12
|
+
export function getTexts(t, key) {
|
|
13
|
+
return TRANSLATION_TEXT[key](t);
|
|
14
14
|
}
|