Skip to content

Commit

Permalink
Fix: Disable rendering AceEditor component when card is flipped to ba…
Browse files Browse the repository at this point in the history
…ckside
  • Loading branch information
nelsonni committed Feb 8, 2024
1 parent 9beed40 commit 8b00e4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/renderer/src/components/Card/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const getCardTypeContent = (card: Card | undefined) => {
return (
<Editor
id={card.metafile}
flipped={card.flipped}
expanded={card.expanded}
/>
);
Expand Down
13 changes: 2 additions & 11 deletions packages/renderer/src/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,10 @@ import {metafileUpdated} from '/@/store/slices/metafiles';
* loaded into this component.
* @param props - Prop object for editable content in a specific file.
* @param props.id - The UUID for the metafile used to represent the contents of this component.
* @param props.flipped - An optional toggle for enabling the reverse side of the card; defaults to false.
* @param props.expanded - An optional toggle for enabling fullscreen mode in the editor; defaults to false.
* @returns {React.Component} A React function component.
*/
const Editor = ({
id,
flipped = false,
expanded = false,
}: {
id: UUID;
flipped?: boolean;
expanded?: boolean;
}) => {
const Editor = ({id, expanded = false}: {id: UUID; expanded?: boolean}) => {
const metafile = useAppSelector(state => metafileSelectors.selectById(state, id));
const [editorRef] = useState(React.createRef<AceEditor>());
const mode = metafile?.filetype?.toLowerCase() ?? 'text';
Expand All @@ -60,7 +51,7 @@ const Editor = ({

return (
<>
{isEditorMetafile(metafile) && !flipped ? (
{isEditorMetafile(metafile) ? (
<AceEditor
{...editorProps}
name={id + '-editor'}
Expand Down

0 comments on commit 8b00e4f

Please sign in to comment.