Skip to content

Commit

Permalink
Merge pull request #418 from beda-software/patch-mdeditor-toolbar-z-i…
Browse files Browse the repository at this point in the history
…ndex

PATCH: set z-index of MDEditor toolbar to 0
  • Loading branch information
alexlipovka authored Jan 7, 2025
2 parents 0fa0ec3 + daa9fdb commit b4ca80b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useEffect, useRef } from 'react';
import { useTheme } from 'styled-components';

import '@mdxeditor/editor/style.css';
import { S } from './styles';

interface MarkDownEditorProps {
markdownString: string;
Expand All @@ -36,13 +37,7 @@ export function MarkDownEditor({ markdownString = '', readOnly = false, onChange

// TODO Add a button to add link and make a custom modal to enter the link
// https://mdxeditor.dev/editor/api/functions/linkDialogPlugin
const plugins = [
headingsPlugin(),
listsPlugin(),
quotePlugin(),
linkPlugin(),
markdownShortcutPlugin(),
];
const plugins = [headingsPlugin(), listsPlugin(), quotePlugin(), linkPlugin(), markdownShortcutPlugin()];

if (!readOnly) {
plugins.push(
Expand All @@ -64,15 +59,17 @@ export function MarkDownEditor({ markdownString = '', readOnly = false, onChange
}

return (
<MDXEditor
className={theme.mode === 'dark' ? 'dark-theme' : ''}
ref={mdxEditorRef}
readOnly={readOnly}
markdown={markdownString}
onChange={onChange}
contentEditableClassName="MarkDownEditorContent"
plugins={plugins}
/>
<S.MDXEditorWrapper>
<MDXEditor
className={theme.mode === 'dark' ? 'dark-theme' : ''}
ref={mdxEditorRef}
readOnly={readOnly}
markdown={markdownString}
onChange={onChange}
contentEditableClassName="MarkDownEditorContent"
plugins={plugins}
/>
</S.MDXEditorWrapper>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styled from 'styled-components';

export const S = {
MDXEditorWrapper: styled.div`
.mdxeditor-toolbar {
z-index: 0;
}
`,
};

0 comments on commit b4ca80b

Please sign in to comment.