From 211be1b3194cbb3555f25fc54b692a985ecf0c07 Mon Sep 17 00:00:00 2001 From: Sherry Wong Date: Fri, 19 Jul 2024 16:49:53 +0800 Subject: [PATCH 1/2] flow --- .../src/plugins/DraggableBlockPlugin/index.tsx | 2 +- .../flow/LexicalDraggableBlockPlugin.js.flow | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/lexical-playground/src/plugins/DraggableBlockPlugin/index.tsx b/packages/lexical-playground/src/plugins/DraggableBlockPlugin/index.tsx index 3675cb786e2..891932c94d0 100644 --- a/packages/lexical-playground/src/plugins/DraggableBlockPlugin/index.tsx +++ b/packages/lexical-playground/src/plugins/DraggableBlockPlugin/index.tsx @@ -16,7 +16,7 @@ function isOnMenu(element: HTMLElement): boolean { return !!element.closest(`.${DRAGGABLE_BLOCK_MENU_CLASSNAME}`); } -export default function PlaygroundDraggableBlockPlugin({ +export default function DraggableBlockPlugin({ anchorElem = document.body, }: { anchorElem?: HTMLElement; diff --git a/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow b/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow index ef306bb38a6..c8076273664 100644 --- a/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow +++ b/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow @@ -7,4 +7,13 @@ * @flow strict */ -declare export function DraggableBlockPlugin(): React$MixedElement; +type Props = $ReadOnly<{ + anchorElem?: HTMLElement, + menuRef: React.RefObject, + targetLineRef: React.RefObject, + menuComponent: React.Node, + targetLineComponent: React.Node, + isOnMenu: (element: HTMLElement) => boolean, +}>; + +declare export function DraggableBlockPlugin_EXPERIMENTAL(props: Props): React$MixedElement; From 660937ff9e730c02087ab156912bb057d0d92b14 Mon Sep 17 00:00:00 2001 From: Sherry Wong Date: Fri, 19 Jul 2024 19:25:09 +0800 Subject: [PATCH 2/2] fix flow error --- packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow b/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow index c8076273664..e3eea057e2d 100644 --- a/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow +++ b/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow @@ -7,6 +7,8 @@ * @flow strict */ +import * as React from 'react'; + type Props = $ReadOnly<{ anchorElem?: HTMLElement, menuRef: React.RefObject,