@team-monolith/cds 0.31.3 → 0.31.7
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 +2 -2
- package/dist/patterns/LexicalEditor/LexicalEditor.js +2 -2
- package/dist/patterns/LexicalEditor/Plugins.d.ts +1 -0
- package/dist/patterns/LexicalEditor/Plugins.js +7 -6
- package/dist/patterns/LexicalEditor/index.d.ts +1 -0
- package/dist/patterns/LexicalEditor/index.js +1 -0
- package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.js +10 -3
- package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +2 -2
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageDialog.d.ts +1 -2
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUploadedDialogBody.d.ts +1 -2
- package/dist/patterns/LexicalEditor/plugins/ImagesPlugin/InsertImageUriDialogBody.d.ts +1 -2
- package/dist/patterns/ReactEditorJS/ReactEditorJS.d.ts +1 -2
- package/package.json +1 -1
|
@@ -6,9 +6,9 @@ export interface LexicalEditorProps {
|
|
|
6
6
|
onChange: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
7
7
|
/** editable. 수정 모드 / 읽기 모드 여부
|
|
8
8
|
* initialConfig에 전달되므로 마운트 된 이후 수정해도 반영되지 않음
|
|
9
|
-
|
|
9
|
+
*/
|
|
10
10
|
editable?: boolean;
|
|
11
11
|
/** 외부에서 플러그인을 주입하는 경우 활용함 */
|
|
12
12
|
children?: JSX.Element | string | (JSX.Element | string)[];
|
|
13
13
|
}
|
|
14
|
-
export declare function LexicalEditor(props: LexicalEditorProps): JSX.Element;
|
|
14
|
+
export declare function LexicalEditor(props: LexicalEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,7 +11,7 @@ import { getTheme } from "./theme";
|
|
|
11
11
|
import { useTheme } from "@emotion/react";
|
|
12
12
|
import Plugins from "./Plugins";
|
|
13
13
|
export function LexicalEditor(props) {
|
|
14
|
-
const { value, onChange, editable = true, children } = props;
|
|
14
|
+
const { className, value, onChange, editable = true, children } = props;
|
|
15
15
|
const theme = useTheme();
|
|
16
16
|
const initialConfig = {
|
|
17
17
|
namespace: "CodleLexicalEditor",
|
|
@@ -35,5 +35,5 @@ export function LexicalEditor(props) {
|
|
|
35
35
|
editorState: JSON.stringify(value),
|
|
36
36
|
editable: editable,
|
|
37
37
|
};
|
|
38
|
-
return (_jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { onChange: onChange }), _jsx(_Fragment, { children: children })] })));
|
|
38
|
+
return (_jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [_jsx(Plugins, { className: className, onChange: onChange }), _jsx(_Fragment, { children: children })] })));
|
|
39
39
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { ReactElement } from "react";
|
|
6
6
|
import { SerializedEditorState, SerializedLexicalNode } from "lexical";
|
|
7
7
|
export interface PluginsProps {
|
|
8
|
+
className?: string;
|
|
8
9
|
onChange: (blocks: SerializedEditorState<SerializedLexicalNode>) => void;
|
|
9
10
|
}
|
|
10
11
|
export default function Plugins(props: PluginsProps): ReactElement;
|
|
@@ -28,7 +28,7 @@ import useLexicalEditable from "@lexical/react/useLexicalEditable";
|
|
|
28
28
|
import ListMaxIndentLevelPlugin from "./plugins/ListMaxIndentLevelPlugin";
|
|
29
29
|
import styled from "@emotion/styled";
|
|
30
30
|
export default function Plugins(props) {
|
|
31
|
-
const { onChange } = props;
|
|
31
|
+
const { className, onChange } = props;
|
|
32
32
|
const isEditable = useLexicalEditable();
|
|
33
33
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
34
34
|
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
@@ -37,9 +37,9 @@ export default function Plugins(props) {
|
|
|
37
37
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
return (_jsxs(_Fragment, { children: [_jsx(RichTextPlugin, { contentEditable: _jsx(ScrollArea, { children: _jsx(FloatingAnchor, Object.assign({ ref: onRef }, { children: _jsx(StyledContentEditable, {}) })) }), placeholder: _jsx("div", { children: "\uB0B4\uC6A9\uC744 \uC785\uB825 \uD574 \uC8FC\uC138\uC694." }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: (editorState) => {
|
|
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: _jsx("div", { children: "\uB0B4\uC6A9\uC744 \uC785\uB825 \uD574 \uC8FC\uC138\uC694." }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: (editorState) => {
|
|
41
41
|
onChange(editorState.toJSON());
|
|
42
|
-
} }), _jsx(
|
|
42
|
+
} }), _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 })] }));
|
|
43
43
|
}
|
|
44
44
|
const ScrollArea = styled.div `
|
|
45
45
|
min-height: 150px;
|
|
@@ -49,12 +49,10 @@ const ScrollArea = styled.div `
|
|
|
49
49
|
outline: 0;
|
|
50
50
|
z-index: 0;
|
|
51
51
|
overflow: auto;
|
|
52
|
-
resize: vertical;
|
|
53
52
|
`;
|
|
54
53
|
const FloatingAnchor = styled.div `
|
|
55
54
|
flex: auto;
|
|
56
55
|
position: relative;
|
|
57
|
-
resize: vertical;
|
|
58
56
|
z-index: -1;
|
|
59
57
|
`;
|
|
60
58
|
const StyledContentEditable = styled(ContentEditable) `
|
|
@@ -63,7 +61,10 @@ const StyledContentEditable = styled(ContentEditable) `
|
|
|
63
61
|
display: block;
|
|
64
62
|
position: relative;
|
|
65
63
|
outline: 0;
|
|
66
|
-
|
|
64
|
+
// ComponentAdder 를 위한 공간
|
|
65
|
+
${({ isEditable }) => isEditable && "padding-left: 64px;"}
|
|
66
|
+
// ScrollArea에서 스크롤이 발생해도 64px 더 아래로 내릴 수 있도록 합니다.
|
|
67
|
+
padding-bottom: 64px;
|
|
67
68
|
min-height: 150px;
|
|
68
69
|
|
|
69
70
|
hr {
|
|
@@ -28,6 +28,7 @@ import ComponentAdder from "./ComponentAdder";
|
|
|
28
28
|
import styled from "@emotion/styled";
|
|
29
29
|
import { getContextMenuOptions } from "./getContextMenuOptions";
|
|
30
30
|
import { InsertImageDialog } from "../ImagesPlugin/InsertImageDialog";
|
|
31
|
+
import { ZINDEX } from "../../../../utils/zIndex";
|
|
31
32
|
export const COMPONENT_ADDER_MENU_CLASSNAME = "component-adder-menu";
|
|
32
33
|
function isOnMenu(element) {
|
|
33
34
|
return !!element.closest(`.${COMPONENT_ADDER_MENU_CLASSNAME}`);
|
|
@@ -74,7 +75,14 @@ export function ComponentAdderPlugin(props) {
|
|
|
74
75
|
const nodes = selection.getNodes();
|
|
75
76
|
const isAllNodesNotMatched = nodes.every((node) => {
|
|
76
77
|
const nodeAndParents = [node, ...node.getParents()];
|
|
77
|
-
|
|
78
|
+
const maybeTopNode = nodeAndParents[nodeAndParents.length - 2];
|
|
79
|
+
// 선택된 노드 자체가 Root Node라면
|
|
80
|
+
// maybeTopNode가 undefined가 됩니다.
|
|
81
|
+
// 다른 노드를 선택한 것으로 간주하고 true(not matched)를 반환합니다.
|
|
82
|
+
if (!maybeTopNode) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return maybeTopNode.getKey() !== nodeKey;
|
|
78
86
|
});
|
|
79
87
|
if (isAllNodesNotMatched) {
|
|
80
88
|
setQuery("");
|
|
@@ -119,8 +127,7 @@ export function ComponentAdderPlugin(props) {
|
|
|
119
127
|
});
|
|
120
128
|
const { onDragStart, onDragEnd, targetLineRef } = useDraggableBlockMenu(editor, anchorElem, blockElem, setBlockElem);
|
|
121
129
|
return (_jsxs(_Fragment, { children: [_jsx(InsertImageDialog, { open: open, activeEditor: editor, onClose: () => setOpen(false) }), _jsx(LexicalNodeMenuPlugin, { nodeKey: nodeKey, anchorClassName: cssToClassName `
|
|
122
|
-
|
|
123
|
-
z-index: 1;
|
|
130
|
+
z-index: ${ZINDEX.DIALOG + 1};
|
|
124
131
|
`, options: filteredOptions, menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => anchorElementRef.current && filteredOptions.length
|
|
125
132
|
? ReactDOM.createPortal(_jsx(ComponentPickerMenuList, { options: filteredOptions, selectedIndex: selectedIndex, selectOptionAndCleanUp: selectOptionAndCleanUp, setHighlightedIndex: setHighlightedIndex }), anchorElementRef.current)
|
|
126
133
|
: null, onSelectOption: onSelectOption, onClose: () => {
|
package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js
CHANGED
|
@@ -22,6 +22,7 @@ import { css as cssToClassName } from "@emotion/css";
|
|
|
22
22
|
import { ComponentPickerMenuList } from "./ComponentPickerMenuList";
|
|
23
23
|
import { InsertImageDialog } from "../ImagesPlugin/InsertImageDialog";
|
|
24
24
|
import { TextIcon, H1Icon, H2Icon, H3Icon, ListUnorderedIcon, ListOrderedIcon, DoubleQuotesLIcon, CodeViewIcon, SeparatorIcon, ImageLineIcon, } from "../../../../icons";
|
|
25
|
+
import { ZINDEX } from "../../../../utils/zIndex";
|
|
25
26
|
// import useModal from "../../hooks/useModal";
|
|
26
27
|
// import catTypingGif from "../../images/cat-typing.gif";
|
|
27
28
|
// import { INSERT_IMAGE_COMMAND, InsertImageDialog } from "../ImagesPlugin";
|
|
@@ -166,8 +167,7 @@ export function ComponentPickerMenuPlugin() {
|
|
|
166
167
|
});
|
|
167
168
|
}, [editor]);
|
|
168
169
|
return (_jsxs(_Fragment, { children: [_jsx(InsertImageDialog, { open: open, activeEditor: editor, onClose: () => setOpen(false) }), _jsx(LexicalTypeaheadMenuPlugin, { onQueryChange: setQueryString, onSelectOption: onSelectOption, triggerFn: checkForTriggerMatch, options: options, anchorClassName: cssToClassName `
|
|
169
|
-
|
|
170
|
-
z-index: 1;
|
|
170
|
+
z-index: ${ZINDEX.DIALOG + 1};
|
|
171
171
|
`, menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => anchorElementRef.current && options.length
|
|
172
172
|
? ReactDOM.createPortal(_jsx(ComponentPickerMenuList, { options: options, selectedIndex: selectedIndex, selectOptionAndCleanUp: selectOptionAndCleanUp, setHighlightedIndex: setHighlightedIndex }), anchorElementRef.current)
|
|
173
173
|
: null })] }));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LexicalEditor } from "lexical";
|
|
3
2
|
export interface InsertImageDialogProps {
|
|
4
3
|
open: boolean;
|
|
5
4
|
activeEditor: LexicalEditor;
|
|
6
5
|
onClose: () => void;
|
|
7
6
|
}
|
|
8
|
-
export declare function InsertImageDialog(props: InsertImageDialogProps): JSX.Element;
|
|
7
|
+
export declare function InsertImageDialog(props: InsertImageDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { InsertImagePayload } from ".";
|
|
3
2
|
export interface InsertImageUploadedDialogBodyProps {
|
|
4
3
|
onClick: (payload: InsertImagePayload) => void;
|
|
5
4
|
}
|
|
6
|
-
export declare function InsertImageUploadedDialogBody(props: InsertImageUploadedDialogBodyProps): JSX.Element;
|
|
5
|
+
export declare function InsertImageUploadedDialogBody(props: InsertImageUploadedDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { InsertImagePayload } from ".";
|
|
3
2
|
export interface InsertImageUriDialogBodyProps {
|
|
4
3
|
onClick: (payload: InsertImagePayload) => void;
|
|
5
4
|
}
|
|
6
|
-
export declare function InsertImageUriDialogBody(props: InsertImageUriDialogBodyProps): JSX.Element;
|
|
5
|
+
export declare function InsertImageUriDialogBody(props: InsertImageUriDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { EditorCore } from "@react-editor-js/core";
|
|
3
2
|
export interface ReactEditorJSProps {
|
|
4
3
|
className?: string;
|
|
@@ -13,4 +12,4 @@ export interface ReactEditorJSProps {
|
|
|
13
12
|
/** 초기화시 콜백 */
|
|
14
13
|
onInitialize?: (instance: EditorCore) => void;
|
|
15
14
|
}
|
|
16
|
-
export declare function ReactEditorJS(props: ReactEditorJSProps): JSX.Element;
|
|
15
|
+
export declare function ReactEditorJS(props: ReactEditorJSProps): import("react/jsx-runtime").JSX.Element;
|