From a7137dc5eb513f8f5e4a34a26f03152f96c90001 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Wed, 21 Aug 2024 19:14:50 +0800 Subject: [PATCH] website: add example. #650 --- www/src/pages/examples/Example650.tsx | 27 +++++++++++++++++++++++++++ www/src/router.tsx | 5 +++++ 2 files changed, 32 insertions(+) create mode 100644 www/src/pages/examples/Example650.tsx diff --git a/www/src/pages/examples/Example650.tsx b/www/src/pages/examples/Example650.tsx new file mode 100644 index 000000000..2b63c18ec --- /dev/null +++ b/www/src/pages/examples/Example650.tsx @@ -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 ( + + + + ); +} diff --git a/www/src/router.tsx b/www/src/router.tsx index f9a2ad589..e2905b989 100644 --- a/www/src/router.tsx +++ b/www/src/router.tsx @@ -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',