@team-monolith/cds 0.31.9 → 0.31.11
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/patterns/LexicalEditor/LexicalEditor.d.ts +3 -3
- package/dist/patterns/LexicalEditor/LexicalEditor.js +17 -1
- package/dist/patterns/LexicalEditor/Plugins.d.ts +1 -1
- package/dist/patterns/LexicalEditor/Plugins.js +1 -1
- package/dist/patterns/LexicalEditor/nodes/ImageComponent.js +2 -1
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageDialog.d.ts +2 -1
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUploadedDialogBody.d.ts +2 -1
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUriDialogBody.d.ts +2 -1
- package/dist/patterns/ReactEditorJS/ReactEditorJS.d.ts +2 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
3
3
|
export interface LexicalEditorProps {
|
|
4
4
|
className?: string;
|
|
5
|
-
value
|
|
6
|
-
onChange
|
|
5
|
+
value?: any;
|
|
6
|
+
onChange?: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
7
7
|
/** editable. 수정 모드 / 읽기 모드 여부
|
|
8
8
|
* initialConfig에 전달되므로 마운트 된 이후 수정해도 반영되지 않음
|
|
9
9
|
*/
|
|
@@ -11,4 +11,4 @@ export interface LexicalEditorProps {
|
|
|
11
11
|
/** 외부에서 플러그인을 주입하는 경우 활용함 */
|
|
12
12
|
children?: JSX.Element | string | (JSX.Element | string)[];
|
|
13
13
|
}
|
|
14
|
-
export declare function LexicalEditor(props: LexicalEditorProps):
|
|
14
|
+
export declare function LexicalEditor(props: LexicalEditorProps): JSX.Element;
|
|
@@ -10,6 +10,22 @@ import { HorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
|
10
10
|
import { getTheme } from "./theme";
|
|
11
11
|
import { useTheme } from "@emotion/react";
|
|
12
12
|
import Plugins from "./Plugins";
|
|
13
|
+
function validateValue(value) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (value && typeof value !== "object") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
// value = {
|
|
19
|
+
// root: {
|
|
20
|
+
// children: any[]
|
|
21
|
+
// }
|
|
22
|
+
// }
|
|
23
|
+
// value.root.children must be non-empty array
|
|
24
|
+
if (!((_b = (_a = value === null || value === void 0 ? void 0 : value.root) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
13
29
|
export function LexicalEditor(props) {
|
|
14
30
|
const { className, value, onChange, editable = true, children } = props;
|
|
15
31
|
const theme = useTheme();
|
|
@@ -32,7 +48,7 @@ export function LexicalEditor(props) {
|
|
|
32
48
|
HorizontalRuleNode,
|
|
33
49
|
],
|
|
34
50
|
theme: getTheme(theme),
|
|
35
|
-
editorState: JSON.stringify(value),
|
|
51
|
+
editorState: validateValue(value) ? JSON.stringify(value) : undefined,
|
|
36
52
|
editable: editable,
|
|
37
53
|
};
|
|
38
54
|
return (_jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { className: className, onChange: onChange }), _jsx(_Fragment, { children: children })] })));
|
|
@@ -6,6 +6,6 @@ import { ReactElement } from "react";
|
|
|
6
6
|
import { SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
7
7
|
export interface PluginsProps {
|
|
8
8
|
className?: string;
|
|
9
|
-
onChange
|
|
9
|
+
onChange?: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
10
10
|
}
|
|
11
11
|
export default function Plugins(props: PluginsProps): ReactElement;
|
|
@@ -38,7 +38,7 @@ export default function Plugins(props) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
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) => {
|
|
41
|
-
onChange(editorState.toJSON());
|
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(editorState.toJSON());
|
|
42
42
|
},
|
|
43
43
|
// ignore 하지 않으면 Form에서 수정하지 않았는데 Dirty로 처리됨.
|
|
44
44
|
ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, {}), _jsx(MarkdownShortcutPlugin, { transformers: CODLE_TRANSFORMERS }), _jsx(HistoryPlugin, {})] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem }), _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 })] }));
|
|
@@ -23,7 +23,8 @@ function LazyImage({ altText, className, imageRef, src, width, height, maxWidth,
|
|
|
23
23
|
useSuspenseImage(src);
|
|
24
24
|
return (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
|
|
25
25
|
height,
|
|
26
|
-
|
|
26
|
+
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
27
|
+
maxWidth: `min(${maxWidth}px, 100%)`,
|
|
27
28
|
width,
|
|
28
29
|
}, draggable: "false" }));
|
|
29
30
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { LexicalEditor } from "lexical";
|
|
2
3
|
export interface InsertImageDialogProps {
|
|
3
4
|
open: boolean;
|
|
4
5
|
activeEditor: LexicalEditor;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
}
|
|
7
|
-
export declare function InsertImageDialog(props: InsertImageDialogProps):
|
|
8
|
+
export declare function InsertImageDialog(props: InsertImageDialogProps): JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { InsertImagePayload } from ".";
|
|
2
3
|
export interface InsertImageUploadedDialogBodyProps {
|
|
3
4
|
onClick: (payload: InsertImagePayload) => void;
|
|
4
5
|
}
|
|
5
|
-
export declare function InsertImageUploadedDialogBody(props: InsertImageUploadedDialogBodyProps):
|
|
6
|
+
export declare function InsertImageUploadedDialogBody(props: InsertImageUploadedDialogBodyProps): JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { InsertImagePayload } from ".";
|
|
2
3
|
export interface InsertImageUriDialogBodyProps {
|
|
3
4
|
onClick: (payload: InsertImagePayload) => void;
|
|
4
5
|
}
|
|
5
|
-
export declare function InsertImageUriDialogBody(props: InsertImageUriDialogBodyProps):
|
|
6
|
+
export declare function InsertImageUriDialogBody(props: InsertImageUriDialogBodyProps): JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { EditorCore } from "@react-editor-js/core";
|
|
2
3
|
export interface ReactEditorJSProps {
|
|
3
4
|
className?: string;
|
|
@@ -12,4 +13,4 @@ export interface ReactEditorJSProps {
|
|
|
12
13
|
/** 초기화시 콜백 */
|
|
13
14
|
onInitialize?: (instance: EditorCore) => void;
|
|
14
15
|
}
|
|
15
|
-
export declare function ReactEditorJS(props: ReactEditorJSProps):
|
|
16
|
+
export declare function ReactEditorJS(props: ReactEditorJSProps): JSX.Element;
|