Преглед изворни кода

fix: disable editing after collapse/expand through block controls

Tienson Qin пре 3 година
родитељ
комит
d27ec18a65
2 измењених фајлова са 4 додато и 3 уклоњено
  1. 3 3
      e2e-tests/editor.spec.ts
  2. 1 0
      src/main/frontend/components/block.cljs

+ 3 - 3
e2e-tests/editor.spec.ts

@@ -77,9 +77,6 @@ test('disappeared children #4814', async ({ page }) => {
     await enterNextBlock(page)
     await enterNextBlock(page)
   }
   }
 
 
-  // edit the first block
-  await editFirstBlock(page)
-
   // collapse
   // collapse
   await page.click('.block-control >> nth=0')
   await page.click('.block-control >> nth=0')
 
 
@@ -87,6 +84,9 @@ test('disappeared children #4814', async ({ page }) => {
   await page.click('.block-control >> nth=0')
   await page.click('.block-control >> nth=0')
 
 
   await page.waitForSelector('.ls-block >> nth=6') // 7 blocks
   await page.waitForSelector('.ls-block >> nth=6') // 7 blocks
+
+  // Ensures there's no active editor
+  await expect(page.locator('.editor-inner')).toHaveCount(0, {timeout: 500})
 })
 })
 
 
 // FIXME: ClipboardItem is not defined when running with this test
 // FIXME: ClipboardItem is not defined when running with this test

+ 1 - 0
src/main/frontend/components/block.cljs

@@ -1415,6 +1415,7 @@
       {:id (str "control-" uuid)
       {:id (str "control-" uuid)
        :on-click (fn [event]
        :on-click (fn [event]
                    (util/stop event)
                    (util/stop event)
+                   (state/clear-edit!)
                    (if ref?
                    (if ref?
                      (state/toggle-collapsed-block! uuid)
                      (state/toggle-collapsed-block! uuid)
                      (if collapsed?
                      (if collapsed?