feat: change cursor when drag
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
AsyncBlock,
|
||||
BlockEditor,
|
||||
SelectEventTypes,
|
||||
SelectionInfo,
|
||||
SelectionSettingsMap,
|
||||
@@ -202,3 +203,21 @@ export const useOnSelectStartWith = (
|
||||
};
|
||||
}, [editor, cb, blockId]);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* hooks run when drag state change
|
||||
* @export
|
||||
*/
|
||||
export const useIsOnDrag = (editor: BlockEditor) => {
|
||||
const editorInstance = editor;
|
||||
const [isOnDrag, setIsOnDrag] = useState(false);
|
||||
useEffect(() => {
|
||||
const callback = (isDrag: boolean) => setIsOnDrag(isDrag);
|
||||
editorInstance.dragDropManager.onDragStateChange(callback);
|
||||
return () => {
|
||||
editorInstance.dragDropManager.offDragStateChange(callback);
|
||||
};
|
||||
}, [editorInstance]);
|
||||
return isOnDrag;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user