Просмотр исходного кода

Merge pull request #5340 from weseek/fix/88258-prevent-items-hidden-when-dropped-outside-the-page-tree

fix: 88258 Prevent items hidden when dropped outside the PageTree
Yuki Takei 4 лет назад
Родитель
Сommit
c47233038b
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      packages/app/src/components/Sidebar/PageTree/Item.tsx

+ 5 - 2
packages/app/src/components/Sidebar/PageTree/Item.tsx

@@ -108,9 +108,12 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
   const [{ isDragging }, drag] = useDrag(() => ({
     type: 'PAGE_TREE',
     item: { page },
-    end: () => {
+    end: (item, monitor) => {
       // in order to set d-none to dropped Item
-      setShouldHide(true);
+      const dropResult = monitor.getDropResult();
+      if (dropResult != null) {
+        setShouldHide(true);
+      }
     },
     collect: monitor => ({
       isDragging: monitor.isDragging(),