Skip to content

Commit a7137dc

Browse files
committed
website: add example. #650
1 parent 3b02cab commit a7137dc

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

www/src/pages/examples/Example650.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import CodeMirror from '@uiw/react-codemirror';
2+
import { langs } from '@uiw/codemirror-extensions-langs';
3+
import * as events from '@uiw/codemirror-extensions-events';
4+
import { Fragment } from 'react';
5+
6+
/**
7+
* https://github.com/uiwjs/react-codemirror/issues/650
8+
*/
9+
export function Component() {
10+
const extension = events.content({
11+
paste: (event) => {
12+
event.preventDefault();
13+
},
14+
});
15+
return (
16+
<Fragment>
17+
<CodeMirror
18+
value={`console.log('hello')`}
19+
theme="none"
20+
height="400px !important"
21+
width="100%"
22+
style={{ margin: '0 0 23px 0', flex: 1 }}
23+
extensions={[langs.markdown(), extension]}
24+
/>
25+
</Fragment>
26+
);
27+
}

www/src/router.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,11 @@ export const routes: MenuRouteObject[] = [
658658
label: 'How to remove all syntax highlighting?',
659659
lazy: () => import('./pages/examples/Example431'),
660660
},
661+
{
662+
path: '650',
663+
label: 'How To Disable Copy Paste in Editor?',
664+
lazy: () => import('./pages/examples/Example650'),
665+
},
661666
{
662667
path: '674',
663668
label: 'Browser spell checking',

0 commit comments

Comments
 (0)