Skip to content

Commit

Permalink
fix: min-width: 400px applied to the .yoopta-editor (#178)
Browse files Browse the repository at this point in the history
* fix: min-width: 400px applied to the .yoopta-editor class, which prevented the editor from being resized below 400px in width.
---------

Co-authored-by: Henry Tran <[email protected]>
  • Loading branch information
henryttran and Henryytran authored Jun 6, 2024
1 parent 1507041 commit e3cac22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 14 additions & 2 deletions packages/core/editor/src/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ type Props = {
className?: string;
placeholder?: string;
width?: number | string;
paddingBottom?: number | string;
children: ReactNode;
};

const getEditorStyles = (styles: CSSProperties) => ({
paddingBottom: 150,
width: styles.width || 400,
paddingBottom: styles.paddingBottom || 100,
...styles,
});

Expand All @@ -41,7 +43,16 @@ const DEFAULT_STATE: State = {
startedIndexToSelect: null,
};

const Editor = ({ placeholder, marks, className, selectionBoxRoot, width, children, autoFocus = true }: Props) => {
const Editor = ({
placeholder,
marks,
className,
selectionBoxRoot,
width,
paddingBottom,
children,
autoFocus = true,
}: Props) => {
const editor = useYooptaEditor();
const isReadOnly = useYooptaReadOnly();
const yooptaEditorRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -329,6 +340,7 @@ const Editor = ({ placeholder, marks, className, selectionBoxRoot, width, childr
userSelect: selectionBox.selection ? 'none' : 'auto',
pointerEvents: selectionBox.selection ? 'none' : 'auto',
width,
paddingBottom,
});

return (
Expand Down
1 change: 0 additions & 1 deletion packages/core/editor/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pre {
}

.yoopta-editor {
min-width: 400px;
height: auto;
}

Expand Down

0 comments on commit e3cac22

Please sign in to comment.