From a94fe72bd1912909a33ee4a0659e8e1590b55b94 Mon Sep 17 00:00:00 2001 From: Czy <651525974@qq.com> Date: Mon, 17 Mar 2025 10:26:29 +0800 Subject: [PATCH] fix: unexpected table selection behavior (#5821) --- docs/walkthroughs/05-executing-commands.md | 4 +++- site/examples/js/tables.jsx | 8 +++++++- site/examples/ts/tables.tsx | 8 +++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/walkthroughs/05-executing-commands.md b/docs/walkthroughs/05-executing-commands.md index de09d1ace..b02330d1d 100644 --- a/docs/walkthroughs/05-executing-commands.md +++ b/docs/walkthroughs/05-executing-commands.md @@ -53,7 +53,9 @@ const App = () => { Transforms.setNodes( editor, { type: match ? null : 'code' }, - { match: n => Element.isElement(n) && Editor.isBlock(editor, n) } + { + match: n => Element.isElement(n) && Editor.isBlock(editor, n), + } ) break } diff --git a/site/examples/js/tables.jsx b/site/examples/js/tables.jsx index 955581cc5..9e670dbc3 100644 --- a/site/examples/js/tables.jsx +++ b/site/examples/js/tables.jsx @@ -8,6 +8,7 @@ import { } from 'slate' import { withHistory } from 'slate-history' import { Editable, Slate, withReact } from 'slate-react' +import { css } from '@emotion/css' const TablesExample = () => { const renderElement = useCallback(props => , []) @@ -83,7 +84,12 @@ const Element = ({ attributes, children, element }) => { switch (element.type) { case 'table': return ( - +
{children}
) diff --git a/site/examples/ts/tables.tsx b/site/examples/ts/tables.tsx index 75458ab2c..30cc5e570 100644 --- a/site/examples/ts/tables.tsx +++ b/site/examples/ts/tables.tsx @@ -16,6 +16,7 @@ import { withReact, } from 'slate-react' import { CustomEditor } from './custom-types.d' +import { css } from '@emotion/css' const TablesExample = () => { const renderElement = useCallback( @@ -114,7 +115,12 @@ const Element = ({ attributes, children, element }: RenderElementProps) => { switch (element.type) { case 'table': return ( - +
{children}
)