@team-monolith/cds 1.4.2 → 1.4.4

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,10 @@ 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;"}
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}`);
@@ -126,8 +127,7 @@ export function ComponentAdderPlugin(props) {
126
127
  });
127
128
  const { onDragStart, onDragEnd, targetLineRef } = useDraggableBlockMenu(editor, anchorElem, blockElem, setBlockElem);
128
129
  return (_jsxs(_Fragment, { children: [_jsx(InsertImageDialog, { open: open, activeEditor: editor, onClose: () => setOpen(false) }), _jsx(LexicalNodeMenuPlugin, { nodeKey: nodeKey, anchorClassName: cssToClassName `
129
- // TODO 어드민에서 기본 z-index 1이라 추가함. 없앨 수도 있음
130
- z-index: 1;
130
+ z-index: ${ZINDEX.DIALOG + 1};
131
131
  `, options: filteredOptions, menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => anchorElementRef.current && filteredOptions.length
132
132
  ? ReactDOM.createPortal(_jsx(ComponentPickerMenuList, { options: filteredOptions, selectedIndex: selectedIndex, selectOptionAndCleanUp: selectOptionAndCleanUp, setHighlightedIndex: setHighlightedIndex }), anchorElementRef.current)
133
133
  : null, onSelectOption: onSelectOption, onClose: () => {
@@ -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
- // TODO 어드민에서 기본 z-index 1이라 추가함. 없앨 수도 있음
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 })] }));
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.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,