@team-monolith/cds 1.67.2 → 1.68.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/{CodleDesignSystemProvider.d.ts → CdsProvider.d.ts} +4 -4
- package/dist/{CodleDesignSystemProvider.js → CdsProvider.js} +3 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/patterns/LexicalEditor/LexicalEditor.js +1 -1
- package/dist/patterns/LexicalEditor/Plugins.js +2 -2
- package/dist/patterns/LexicalEditor/components/FileSelectInput.js +2 -2
- package/dist/patterns/LexicalEditor/convertToMarkdown.js +2 -2
- package/dist/patterns/LexicalEditor/plugins/FloatingTextFormatToolbarPlugin/index.js +1 -1
- package/dist/patterns/LexicalEditor/plugins/MarkdownTransformers/index.d.ts +1 -1
- package/dist/patterns/LexicalEditor/plugins/MarkdownTransformers/index.js +3 -3
- package/package.json +1 -1
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import { Theme } from "@emotion/react";
|
|
3
3
|
export declare const light: Theme;
|
|
4
4
|
export declare const dark: Theme;
|
|
5
|
-
interface
|
|
5
|
+
interface CdsContext {
|
|
6
6
|
theme?: Theme;
|
|
7
7
|
lexical?: {
|
|
8
8
|
uploadByFile: (file: File) => Promise<string>;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
12
|
-
export
|
|
11
|
+
export declare const CdsContext: import("react").Context<CdsContext>;
|
|
12
|
+
export declare function CdsProvider(props: {
|
|
13
13
|
children: React.ReactNode;
|
|
14
14
|
fontFamily?: string;
|
|
15
|
-
} &
|
|
15
|
+
} & CdsContext): React.ReactElement;
|
|
16
16
|
export {};
|
|
@@ -267,9 +267,8 @@ export const dark = {
|
|
|
267
267
|
},
|
|
268
268
|
},
|
|
269
269
|
};
|
|
270
|
-
export const
|
|
271
|
-
|
|
272
|
-
export default function (props) {
|
|
270
|
+
export const CdsContext = createContext({});
|
|
271
|
+
export function CdsProvider(props) {
|
|
273
272
|
const muiTheme = createTheme({
|
|
274
273
|
typography: {
|
|
275
274
|
fontFamily: props.fontFamily,
|
|
@@ -287,5 +286,5 @@ export default function (props) {
|
|
|
287
286
|
body {
|
|
288
287
|
font-family: ${FONT.pretendard};
|
|
289
288
|
}
|
|
290
|
-
` }), _jsx(MuiThemeProvider, Object.assign({ theme: muiTheme }, { children: _jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsx(
|
|
289
|
+
` }), _jsx(MuiThemeProvider, Object.assign({ theme: muiTheme }, { children: _jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsx(CdsContext.Provider, Object.assign({ value: props }, { children: props.children })) })) }))] }));
|
|
291
290
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,8 +34,7 @@ export * from "./components/Tooltip";
|
|
|
34
34
|
export { default as color } from "./foundation/color";
|
|
35
35
|
export { default as shadows } from "./foundation/shadows";
|
|
36
36
|
export * from "./foundation/breakpoints";
|
|
37
|
-
export
|
|
38
|
-
export * from "./CodleDesignSystemProvider";
|
|
37
|
+
export * from "./CdsProvider";
|
|
39
38
|
export * from "./icons";
|
|
40
39
|
export * from "./icons/Custom";
|
|
41
40
|
export * from "./utils/hover";
|
package/dist/index.js
CHANGED
|
@@ -34,8 +34,7 @@ export * from "./components/Tooltip";
|
|
|
34
34
|
export { default as color } from "./foundation/color";
|
|
35
35
|
export { default as shadows } from "./foundation/shadows";
|
|
36
36
|
export * from "./foundation/breakpoints";
|
|
37
|
-
export
|
|
38
|
-
export * from "./CodleDesignSystemProvider";
|
|
37
|
+
export * from "./CdsProvider";
|
|
39
38
|
export * from "./icons";
|
|
40
39
|
export * from "./icons/Custom";
|
|
41
40
|
export * from "./utils/hover";
|
|
@@ -40,7 +40,7 @@ export function LexicalEditor(props) {
|
|
|
40
40
|
const { className, contentEditableClassName, value, onChange, editable = true, showQuizSolution = false, freezeProblemNode = false, isSheetEnabled = false, isQuizEnabled = false, children, } = props;
|
|
41
41
|
const theme = useTheme();
|
|
42
42
|
const initialConfig = {
|
|
43
|
-
namespace: "
|
|
43
|
+
namespace: "CustomLexicalEditor",
|
|
44
44
|
onError: (error) => console.error(error),
|
|
45
45
|
nodes,
|
|
46
46
|
// 마운트 된 이후 editable 수정해도 theme에 반영되지 않음 유의
|
|
@@ -10,7 +10,7 @@ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
|
10
10
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
11
11
|
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
12
12
|
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
13
|
-
import {
|
|
13
|
+
import { CUSTOM_TRANSFORMERS } from "./plugins/MarkdownTransformers";
|
|
14
14
|
import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
15
15
|
import { TabIndentationPlugin } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
16
16
|
import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
@@ -47,7 +47,7 @@ export default function Plugins(props) {
|
|
|
47
47
|
onChange === null || onChange === void 0 ? void 0 : onChange(editorState.toJSON());
|
|
48
48
|
},
|
|
49
49
|
// ignore 하지 않으면 Form에서 수정하지 않았는데 Dirty로 처리됨.
|
|
50
|
-
ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(MarkdownShortcutPlugin, { transformers:
|
|
50
|
+
ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(MarkdownShortcutPlugin, { transformers: CUSTOM_TRANSFORMERS }), _jsx(HistoryPlugin, {})] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(LexicalClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {}), _jsx(SheetSelectPlugin, {}), _jsx(SheetInputPlugin, {}), _jsx(SelfEvaluationPlugin, {})] }));
|
|
51
51
|
}
|
|
52
52
|
const ScrollArea = styled.div `
|
|
53
53
|
min-height: 150px;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useContext, useRef } from "react";
|
|
12
|
-
import { Button,
|
|
12
|
+
import { Button, CdsContext } from "../../..";
|
|
13
13
|
import { UploadLineIcon } from "../../../icons";
|
|
14
14
|
import styled from "@emotion/styled";
|
|
15
15
|
/**
|
|
@@ -20,7 +20,7 @@ import styled from "@emotion/styled";
|
|
|
20
20
|
export function FileSelectInput(props) {
|
|
21
21
|
const { onChange, accept } = props;
|
|
22
22
|
const inputRef = useRef(null);
|
|
23
|
-
const cdsContext = useContext(
|
|
23
|
+
const cdsContext = useContext(CdsContext);
|
|
24
24
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { fullWidth: true, color: "grey", size: "medium", label: "\uD30C\uC77C \uC120\uD0DD\uD558\uAE30", onClick: () => {
|
|
25
25
|
var _a;
|
|
26
26
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createEditor } from "lexical";
|
|
2
2
|
import { $convertToMarkdownString } from "@lexical/markdown";
|
|
3
|
-
import {
|
|
3
|
+
import { CUSTOM_TRANSFORMERS } from "./plugins/MarkdownTransformers";
|
|
4
4
|
import { nodes } from "./nodes";
|
|
5
5
|
export function convertToMarkdown(serializedLexical, transformers) {
|
|
6
6
|
// Create a Lexical editor instance
|
|
@@ -15,7 +15,7 @@ export function convertToMarkdown(serializedLexical, transformers) {
|
|
|
15
15
|
// Convert the Lexical editor state to Markdown string
|
|
16
16
|
let markdown = "";
|
|
17
17
|
editor.update(() => {
|
|
18
|
-
markdown = $convertToMarkdownString(transformers !== null && transformers !== void 0 ? transformers :
|
|
18
|
+
markdown = $convertToMarkdownString(transformers !== null && transformers !== void 0 ? transformers : CUSTOM_TRANSFORMERS);
|
|
19
19
|
});
|
|
20
20
|
return markdown;
|
|
21
21
|
}
|
|
@@ -21,7 +21,7 @@ function TextFormatFloatingToolbar({ editor, anchorElem, isLink, isBold, isItali
|
|
|
21
21
|
const popupCharStylesEditorRef = useRef(null);
|
|
22
22
|
const insertLink = useCallback(() => {
|
|
23
23
|
if (!isLink) {
|
|
24
|
-
editor.dispatchCommand(TOGGLE_LINK_COMMAND, "https://
|
|
24
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, "https://example.com/");
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
@@ -10,5 +10,5 @@ export declare const HR: ElementTransformer;
|
|
|
10
10
|
export declare const IMAGE: TextMatchTransformer;
|
|
11
11
|
export declare const TABLE: ElementTransformer;
|
|
12
12
|
export declare const IMAGE_LLM: TextMatchTransformer;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const CUSTOM_TRANSFORMERS: Array<Transformer>;
|
|
14
14
|
export declare const LLM_TRANSFORMERS: Array<Transformer>;
|
|
@@ -71,7 +71,7 @@ export const TABLE = {
|
|
|
71
71
|
for (const cell of row.getChildren()) {
|
|
72
72
|
// It's TableCellNode so it's just to make flow happy
|
|
73
73
|
if ($isTableCellNode(cell)) {
|
|
74
|
-
rowOutput.push($convertToMarkdownString(
|
|
74
|
+
rowOutput.push($convertToMarkdownString(CUSTOM_TRANSFORMERS, cell).replace(/\n/g, "\\n"));
|
|
75
75
|
if (cell.__headerState === TableCellHeaderStates.ROW) {
|
|
76
76
|
isHeaderRow = true;
|
|
77
77
|
}
|
|
@@ -164,7 +164,7 @@ function getTableColumnsSize(table) {
|
|
|
164
164
|
const createTableCell = (textContent) => {
|
|
165
165
|
textContent = textContent.replace(/\\n/g, "\n");
|
|
166
166
|
const cell = $createTableCellNode(TableCellHeaderStates.NO_STATUS);
|
|
167
|
-
$convertFromMarkdownString(textContent,
|
|
167
|
+
$convertFromMarkdownString(textContent, CUSTOM_TRANSFORMERS, cell);
|
|
168
168
|
return cell;
|
|
169
169
|
};
|
|
170
170
|
const mapToTableCells = (textContent) => {
|
|
@@ -211,7 +211,7 @@ export const IMAGE_LLM = {
|
|
|
211
211
|
trigger: ")",
|
|
212
212
|
type: "text-match",
|
|
213
213
|
};
|
|
214
|
-
export const
|
|
214
|
+
export const CUSTOM_TRANSFORMERS = [
|
|
215
215
|
TABLE,
|
|
216
216
|
HR,
|
|
217
217
|
IMAGE,
|