Skip to content

Commit

Permalink
Remove Scroll Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
WebDevSimplified committed Jun 15, 2023
1 parent afeef91 commit d79d7a2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 68 deletions.
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-scroll-sync": "^0.11.0",
"rehype-raw": "^6.1.1",
"remark-gfm": "^3.0.1",
"specificity": "^0.4.1"
Expand Down
85 changes: 39 additions & 46 deletions src/blogComponents/markdownEditor/MarkdownEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useState } from "react"
import ReactMarkdown from "react-markdown"
import { ScrollSync, ScrollSyncPane } from "react-scroll-sync"
import remarkGfm from "remark-gfm"
import rehypeRaw from "rehype-raw"
import "github-markdown-css/github-markdown-dark.css"
Expand All @@ -14,56 +13,50 @@ export default function MarkdownEditor({
const [value, setValue] = useState(initialValue)
return (
<div style={{ height }}>
<ScrollSync>
<div
className={isFullWidth ? "full-width-article-element" : ""}
style={{
display: "flex",
alignItems: "stretch",
height,
marginTop: "1rem",
}}
>
<textarea
value={value}
onChange={e => setValue(e.target.value)}
style={{
resize: "none",
flexGrow: 0,
flexShrink: 0,
fontSize: "inherit",
padding: "1rem",
overflowY: "auto",
width: "50%",
borderRadius: 0,
}}
/>
<div
className={isFullWidth ? "full-width-article-element" : ""}
className="markdown-body"
style={{
display: "flex",
alignItems: "stretch",
height,
marginTop: "1rem",
border: "1px solid var(--theme-text-lighter)",
borderLeft: "none",
width: "50%",
flexGrow: 0,
flexShrink: 0,
padding: "1rem",
overflowY: "auto",
color: "var(--color-white)",
}}
>
<ScrollSyncPane>
<textarea
value={value}
onChange={e => setValue(e.target.value)}
style={{
resize: "none",
flexGrow: 0,
flexShrink: 0,
fontSize: "inherit",
padding: "1rem",
overflowY: "auto",
width: "50%",
borderRadius: 0,
}}
/>
</ScrollSyncPane>
<ScrollSyncPane>
<div
className="markdown-body"
style={{
border: "1px solid var(--theme-text-lighter)",
borderLeft: "none",
width: "50%",
flexGrow: 0,
flexShrink: 0,
padding: "1rem",
overflowY: "auto",
color: "var(--color-white)",
}}
>
<ReactMarkdown
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm]}
>
{value}
</ReactMarkdown>
</div>
</ScrollSyncPane>
<ReactMarkdown
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm]}
>
{value}
</ReactMarkdown>
</div>
</ScrollSync>
</div>
</div>
)
}

0 comments on commit d79d7a2

Please sign in to comment.