@team-monolith/cds 1.4.2 → 1.4.3

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.
@@ -6,7 +6,7 @@ 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)[];
@@ -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,7 +37,7 @@ 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
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
  }
@@ -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,8 @@ const StyledContentEditable = styled(ContentEditable) `
63
61
  display: block;
64
62
  position: relative;
65
63
  outline: 0;
66
- padding: 8px 28px 40px 64px;
64
+ // ComponentAdder 위한 공간
65
+ ${({ isEditable }) => isEditable && "padding-left: 64px;"}
67
66
  min-height: 150px;
68
67
 
69
68
  hr {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,