Skip to content

Commit

Permalink
fix: avoid paste bleeding in code mirror
Browse files Browse the repository at this point in the history
Fixes #130
  • Loading branch information
petyosi committed Oct 24, 2023
1 parent 47f3027 commit 674c455
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plugins/codemirror/CodeMirrorEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export const CodeMirrorEditor = ({ language, nodeKey, code, focusEmitter }: Code
const [readOnly] = corePluginHooks.useEmitterValues('readOnly')
const { setCode } = useCodeBlockEditorContext()

React.useEffect(() => {
codeMirrorRef.current?.getCodemirror()?.dom.addEventListener('paste', (e) => {
e.stopPropagation()
})
}, [codeMirrorRef])

return (
<div
className={styles.sandpackWrapper}
Expand Down

0 comments on commit 674c455

Please sign in to comment.