@team-monolith/cds 1.9.5 → 1.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
3
3
|
export interface LexicalEditorProps {
|
|
4
4
|
className?: string;
|
|
5
|
+
contentEditableClassName?: string;
|
|
5
6
|
value?: any;
|
|
6
7
|
onChange?: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
7
8
|
/** editable. 수정 모드 / 읽기 모드 여부
|
|
@@ -30,7 +30,7 @@ function validateValue(value) {
|
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
export function LexicalEditor(props) {
|
|
33
|
-
const { className, value, onChange, editable = true, freezeProblemNode, children, } = props;
|
|
33
|
+
const { className, contentEditableClassName, value, onChange, editable = true, freezeProblemNode, children, } = props;
|
|
34
34
|
const theme = useTheme();
|
|
35
35
|
const initialConfig = {
|
|
36
36
|
namespace: "CodleLexicalEditor",
|
|
@@ -63,5 +63,5 @@ export function LexicalEditor(props) {
|
|
|
63
63
|
editorState: validateValue(value) ? JSON.stringify(value) : undefined,
|
|
64
64
|
editable: editable,
|
|
65
65
|
};
|
|
66
|
-
return (_jsx(LexicalCustomConfigContext.Provider, Object.assign({ value: { freezeProblemNode: freezeProblemNode !== null && freezeProblemNode !== void 0 ? freezeProblemNode : false } }, { children: _jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { className: className, onChange: onChange }), _jsx(_Fragment, { children: children })] })) })));
|
|
66
|
+
return (_jsx(LexicalCustomConfigContext.Provider, Object.assign({ value: { freezeProblemNode: freezeProblemNode !== null && freezeProblemNode !== void 0 ? freezeProblemNode : false } }, { children: _jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { className: className, contentEditableClassName: contentEditableClassName, onChange: onChange }), _jsx(_Fragment, { children: children })] })) })));
|
|
67
67
|
}
|
|
@@ -6,6 +6,7 @@ import { ReactElement } from "react";
|
|
|
6
6
|
import { SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
7
7
|
export interface PluginsProps {
|
|
8
8
|
className?: string;
|
|
9
|
+
contentEditableClassName?: string;
|
|
9
10
|
onChange?: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
10
11
|
}
|
|
11
12
|
export default function Plugins(props: PluginsProps): ReactElement;
|
|
@@ -30,7 +30,7 @@ import styled from "@emotion/styled";
|
|
|
30
30
|
import ProblemInputPlugin from "./plugins/ProblemInputPlugin";
|
|
31
31
|
import ProblemSelectPlugin from "./plugins/ProblemSelectPlugin";
|
|
32
32
|
export default function Plugins(props) {
|
|
33
|
-
const { className, onChange } = props;
|
|
33
|
+
const { className, contentEditableClassName, onChange } = props;
|
|
34
34
|
const isEditable = useLexicalEditable();
|
|
35
35
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
36
36
|
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
@@ -39,7 +39,7 @@ export default function Plugins(props) {
|
|
|
39
39
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
return (_jsxs(_Fragment, { children: [_jsx(RichTextPlugin, { contentEditable: _jsx(ScrollArea, Object.assign({ className: className }, { children: _jsx(FloatingAnchor, Object.assign({ ref: onRef }, { children: _jsx(StyledContentEditable, { isEditable: isEditable }) })) })), placeholder: null, ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: (editorState) => {
|
|
42
|
+
return (_jsxs(_Fragment, { children: [_jsx(RichTextPlugin, { contentEditable: _jsx(ScrollArea, Object.assign({ className: className }, { children: _jsx(FloatingAnchor, Object.assign({ ref: onRef }, { children: _jsx(StyledContentEditable, { className: contentEditableClassName, isEditable: isEditable }) })) })), placeholder: null, ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: (editorState) => {
|
|
43
43
|
onChange === null || onChange === void 0 ? void 0 : onChange(editorState.toJSON());
|
|
44
44
|
},
|
|
45
45
|
// ignore 하지 않으면 Form에서 수정하지 않았는데 Dirty로 처리됨.
|