From dcbb56b00bfbeda0707b5fcb64d971efc8ddfc63 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Sun, 9 Feb 2025 19:21:29 +0800 Subject: [PATCH] ci --- .../editor/plugins/skip-mark-plugin.ts | 9 +++---- .../editor/plugins/suggestion-plugin.tsx | 6 ----- .../default/examples/playground-demo.tsx | 9 ++++--- .../default/plate-ui/block-comments.tsx | 17 ++++-------- .../default/plate-ui/suggestion-card.tsx | 27 +++++++++---------- .../default/plate-ui/suggestion-leaf.tsx | 12 ++++++--- .../plate-ui/suggestion-line-break.tsx | 8 +----- .../plate-ui/suggestion-toolbar-button.tsx | 2 +- .../basic-marks/src/lib/BaseSkipMarkPlugin.ts | 20 +++++++++----- .../basic-marks/src/react/SkipMarkPlugin.ts | 4 +-- 10 files changed, 52 insertions(+), 62 deletions(-) diff --git a/apps/www/src/registry/default/components/editor/plugins/skip-mark-plugin.ts b/apps/www/src/registry/default/components/editor/plugins/skip-mark-plugin.ts index 574f4d6bc..c9b04a0ed 100644 --- a/apps/www/src/registry/default/components/editor/plugins/skip-mark-plugin.ts +++ b/apps/www/src/registry/default/components/editor/plugins/skip-mark-plugin.ts @@ -1,9 +1,6 @@ -import { CodePlugin , - SkipMarkPlugin, -} from "@udecode/plate-basic-marks/react"; -import { CommentsPlugin } from "@udecode/plate-comments/react"; -import { SuggestionPlugin } from "@udecode/plate-suggestion/react"; - +import { CodePlugin, SkipMarkPlugin } from '@udecode/plate-basic-marks/react'; +import { CommentsPlugin } from '@udecode/plate-comments/react'; +import { SuggestionPlugin } from '@udecode/plate-suggestion/react'; export const skipMarkPlugin = SkipMarkPlugin.configure({ options: { diff --git a/apps/www/src/registry/default/components/editor/plugins/suggestion-plugin.tsx b/apps/www/src/registry/default/components/editor/plugins/suggestion-plugin.tsx index 3fbc19470..cfed935fc 100644 --- a/apps/www/src/registry/default/components/editor/plugins/suggestion-plugin.tsx +++ b/apps/www/src/registry/default/components/editor/plugins/suggestion-plugin.tsx @@ -1,13 +1,7 @@ - - - - - import { SuggestionPlugin } from '@udecode/plate-suggestion/react'; import { renderSuggestionBelowNodes } from '@/registry/default/plate-ui/suggestion-line-break'; - export const suggestionPlugin = SuggestionPlugin.extend({ options: { currentUserId: 'testId', diff --git a/apps/www/src/registry/default/examples/playground-demo.tsx b/apps/www/src/registry/default/examples/playground-demo.tsx index fe941bc5d..ac8c92fb7 100644 --- a/apps/www/src/registry/default/examples/playground-demo.tsx +++ b/apps/www/src/registry/default/examples/playground-demo.tsx @@ -100,9 +100,12 @@ export default function PlaygroundDemo({ className }: { className?: string }) { ); return ( - { - console.log(value, 'fj') - }} editor={editor}> + { + console.log(value, 'fj'); + }} + editor={editor} + > diff --git a/apps/www/src/registry/default/plate-ui/block-comments.tsx b/apps/www/src/registry/default/plate-ui/block-comments.tsx index e108dbdbf..de8d760e3 100644 --- a/apps/www/src/registry/default/plate-ui/block-comments.tsx +++ b/apps/www/src/registry/default/plate-ui/block-comments.tsx @@ -136,8 +136,6 @@ const BlockCommentsContent = ({ setOption('uniquePathMap', new Map(map).set(id, blockPath)); }); - - const resolvedSuggestion: ResolvedSuggestion[] = useMemo(() => { const map = getOption('uniquePathMap'); @@ -216,7 +214,7 @@ const BlockCommentsContent = ({ case 'update': { updateProps = { ...updateProps, - ...data. properties, + ...data.properties, }; newText += node.text; @@ -296,9 +294,9 @@ const BlockCommentsContent = ({ return res; }, [blockPath, editor.api, getOption, suggestionNodes]); - const discussions:any[] = [] + const discussions: any[] = []; - const activeDiscussion = -1 + const activeDiscussion = -1; const suggestionsCount = resolvedSuggestion.length; @@ -320,8 +318,6 @@ const BlockCommentsContent = ({ const [_open, setOpen] = React.useState(selected); const open = _open || selected; - - const anchorElement = useMemo(() => { // const domNode = editor.api.toDOMNode(element)!; @@ -335,14 +331,11 @@ const BlockCommentsContent = ({ // return editor.api.toDOMNode(activeNode[0])!; - return document.body + return document.body; // // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - if ( - suggestionsCount + discussions.length === 0 - ) - return <>{children}; + if (suggestionsCount + discussions.length === 0) return <>{children}; return (
diff --git a/apps/www/src/registry/default/plate-ui/suggestion-card.tsx b/apps/www/src/registry/default/plate-ui/suggestion-card.tsx index 97c0ea2fc..3777757f1 100644 --- a/apps/www/src/registry/default/plate-ui/suggestion-card.tsx +++ b/apps/www/src/registry/default/plate-ui/suggestion-card.tsx @@ -20,8 +20,7 @@ import { CheckIcon, XIcon } from 'lucide-react'; import { Button } from './button'; -export interface ResolvedSuggestion extends TResolvedSuggestion { -} +export interface ResolvedSuggestion extends TResolvedSuggestion {} export const LINE_BREAK_SUGGESTION = '__line_break__'; @@ -45,7 +44,6 @@ export const BlockSuggestionCard = ({ isLast: boolean; suggestion: ResolvedSuggestion; }) => { - // const { data: userData } = useQuery( // trpc.user.getUser.queryOptions({ id: suggestion.userId }) // ); @@ -53,16 +51,15 @@ export const BlockSuggestionCard = ({ const { api, editor } = useEditorPlugin(SuggestionPlugin); const accept = (suggestion: ResolvedSuggestion) => { - api.suggestion.withoutSuggestions(()=>{ - acceptSuggestion(editor, suggestion ); - }) + api.suggestion.withoutSuggestions(() => { + acceptSuggestion(editor, suggestion); + }); }; const reject = (suggestion: ResolvedSuggestion) => { - api.suggestion.withoutSuggestions(()=>{ - rejectSuggestion(editor, suggestion ); - }) - + api.suggestion.withoutSuggestions(() => { + rejectSuggestion(editor, suggestion); + }); }; const [hovering, setHovering] = useState(false); @@ -71,14 +68,14 @@ export const BlockSuggestionCard = ({ return (
setHovering(true)} onMouseLeave={() => setHovering(false)} >
{/* */} -

+

{/* {userData?.name} */}

@@ -88,7 +85,7 @@ export const BlockSuggestionCard = ({
-
+
{suggestion.type === 'remove' && ( @@ -136,7 +133,7 @@ export const BlockSuggestionCard = ({ key={index} className="flex items-center text-brand/80" > - with: + with: {text || 'line breaks'}
@@ -185,7 +182,7 @@ export const BlockSuggestionCard = ({ ))} */} {hovering && ( -
+