Skip to content

Commit

Permalink
website: add example. #650
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 21, 2024
1 parent 3b02cab commit a7137dc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
27 changes: 27 additions & 0 deletions www/src/pages/examples/Example650.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import CodeMirror from '@uiw/react-codemirror';
import { langs } from '@uiw/codemirror-extensions-langs';
import * as events from '@uiw/codemirror-extensions-events';
import { Fragment } from 'react';

/**
* https://github.com/uiwjs/react-codemirror/issues/650
*/
export function Component() {
const extension = events.content({
paste: (event) => {
event.preventDefault();
},
});
return (
<Fragment>
<CodeMirror
value={`console.log('hello')`}
theme="none"
height="400px !important"
width="100%"
style={{ margin: '0 0 23px 0', flex: 1 }}
extensions={[langs.markdown(), extension]}
/>
</Fragment>
);
}
5 changes: 5 additions & 0 deletions www/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,11 @@ export const routes: MenuRouteObject[] = [
label: 'How to remove all syntax highlighting?',
lazy: () => import('./pages/examples/Example431'),
},
{
path: '650',
label: 'How To Disable Copy Paste in Editor?',
lazy: () => import('./pages/examples/Example650'),
},
{
path: '674',
label: 'Browser spell checking',
Expand Down

0 comments on commit a7137dc

Please sign in to comment.