Browse Source

Merge remote-tracking branch 'upstream/master' into whiteboards

Peng Xiao 3 years ago
parent
commit
5d35e21e8b

+ 37 - 36
e2e-tests/editor.spec.ts

@@ -143,41 +143,41 @@ test(
   })
 
 test('copy & paste block ref and replace its content', async ({ page, block }) => {
-    await createRandomPage(page)
+  await createRandomPage(page)
 
-    await block.mustFill('Some random text')
-    // FIXME: copy instantly will make content disappear
-    await page.waitForTimeout(1000)
-    if (IsMac) {
-        await page.keyboard.press('Meta+c')
-    } else {
-        await page.keyboard.press('Control+c')
-    }
+  await block.mustFill('Some random text')
+  // FIXME: copy instantly will make content disappear
+  await page.waitForTimeout(1000)
+  if (IsMac) {
+    await page.keyboard.press('Meta+c')
+  } else {
+    await page.keyboard.press('Control+c')
+  }
 
-    await page.press('textarea >> nth=0', 'Enter')
-    if (IsMac) {
-        await page.keyboard.press('Meta+v')
-    } else {
-        await page.keyboard.press('Control+v')
-    }
-    await page.keyboard.press('Enter')
+  await page.press('textarea >> nth=0', 'Enter')
+  if (IsMac) {
+    await page.keyboard.press('Meta+v')
+  } else {
+    await page.keyboard.press('Control+v')
+  }
+  await page.keyboard.press('Enter')
 
-    const blockRef = page.locator('.block-ref >> text="Some random text"');
+  const blockRef = page.locator('.block-ref >> text="Some random text"');
 
-    // Check if the newly created block-ref has the same referenced content
-    await expect(blockRef).toHaveCount(1);
+  // Check if the newly created block-ref has the same referenced content
+  await expect(blockRef).toHaveCount(1);
 
-    // Move cursor into the block ref
-    for (let i = 0; i < 4; i++) {
-        await page.press('textarea >> nth=0', 'ArrowLeft')
-}
+  // Move cursor into the block ref
+  for (let i = 0; i < 4; i++) {
+    await page.press('textarea >> nth=0', 'ArrowLeft')
+  }
 
-    // Trigger replace-block-reference-with-content-at-point
-    if (IsMac) {
-        await page.keyboard.press('Meta+Shift+r')
-    } else {
-        await page.keyboard.press('Control+Shift+v')
-    }
+  // Trigger replace-block-reference-with-content-at-point
+  if (IsMac) {
+    await page.keyboard.press('Meta+Shift+r')
+  } else {
+    await page.keyboard.press('Control+Shift+v')
+  }
 })
 
 test('copy and paste block after editing new block #5962', async ({ page, block }) => {
@@ -204,9 +204,9 @@ test('copy and paste block after editing new block #5962', async ({ page, block
 
   // Quickly paste the copied block
   if (IsMac) {
-      await page.keyboard.press('Meta+v')
+    await page.keyboard.press('Meta+v')
   } else {
-      await page.keyboard.press('Control+v')
+    await page.keyboard.press('Control+v')
   }
 
   await expect(page.locator('text="Typed block"')).toHaveCount(1);
@@ -216,13 +216,13 @@ test('undo and redo after starting an action should not destroy text #6267', asy
   await createRandomPage(page)
 
   // Get one piece of undo state onto the stack
-  await block.mustFill('text1 ')
-  await page.waitForTimeout(550) // Wait for 500ms autosave period to expire
+  await block.mustType('text1 ')
+  await page.waitForTimeout(500) // Wait for 500ms autosave period to expire
 
   // Then type more, start an action prompt, and undo
-  await page.keyboard.type('text2 ')
+  await page.keyboard.type('text2 ', { delay: 50 })
   for (const char of '[[') {
-    await page.keyboard.type(char)
+    await page.keyboard.type(char, { delay: 50 })
   }
   await expect(page.locator(`[data-modal-name="page-search"]`)).toBeVisible()
   if (IsMac) {
@@ -461,7 +461,8 @@ test('pressing backspace and remaining inside of brackets should NOT close autoc
     await page.keyboard.press('Backspace')
     await page.waitForTimeout(100)
     await autocompleteMenu.expectVisible(modalName)
-  }})
+  }
+})
 test('press escape when autocomplete menu is open, should close autocomplete menu only #6270', async ({ page, block }) => {
   for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['/', 'commands']]) {
     await createRandomPage(page)

+ 1 - 3
e2e-tests/hotkey.spec.ts

@@ -5,10 +5,8 @@ import { createRandomPage, newBlock, lastBlock, IsMac, IsLinux } from './utils'
 test('open search dialog', async ({ page }) => {
   if (IsMac) {
     await page.keyboard.press('Meta+k')
-  } else if (IsLinux) {
-    await page.keyboard.press('Control+k')
   } else {
-    expect(false, "TODO: test on Windows and other platforms").toBeTruthy()
+    await page.keyboard.press('Control+k')
   }
 
   await page.waitForSelector('[placeholder="Search or create page"]')

+ 39 - 41
e2e-tests/logseq-url.spec.ts

@@ -2,46 +2,44 @@ import { expect } from '@playwright/test'
 import { test } from './fixtures'
 import { createRandomPage, lastBlock, IsMac, IsLinux } from './utils'
 
-test(
-  "Logseq URLs (same graph)",
-  async ({ page, block }) => {
-    let paste_key = IsMac ? 'Meta+v' : 'Control+v'
-    // create a page with identify block
-    let identify_text = "URL redirect target"
-    let page_title = await createRandomPage(page)
-    await block.mustFill(identify_text)
+test("Logseq URLs (same graph)", async ({ page, block }) => {
+  let paste_key = IsMac ? 'Meta+v' : 'Control+v'
+  // create a page with identify block
+  let identify_text = "URL redirect target"
+  let page_title = await createRandomPage(page)
+  await block.mustFill(identify_text)
 
-    // paste current page's URL to another page, then redirect throught the URL
-    await page.click('.ui__dropdown-trigger')
-    await page.locator("text=Copy page URL").click()
-    await createRandomPage(page)
-    await block.mustFill("") // to enter editing mode
-    await page.keyboard.press(paste_key)
-    let cursor_locator = page.locator('textarea >> nth=0')
-    expect(await cursor_locator.inputValue()).toContain("page=" + page_title)
-    await cursor_locator.press("Enter")
-    if (!IsLinux) { // FIXME: support Logseq URL on Linux (XDG)
-        page.locator('a.external-link >> nth=0').click()
-        await page.waitForNavigation()
-        await page.waitForTimeout(500)
-        cursor_locator = await lastBlock(page)
-        expect(await cursor_locator.inputValue()).toBe(identify_text)
-    }
+  // paste current page's URL to another page, then redirect throught the URL
+  await page.click('.ui__dropdown-trigger')
+  await page.locator("text=Copy page URL").click()
+  await createRandomPage(page)
+  await block.mustFill("") // to enter editing mode
+  await page.keyboard.press(paste_key)
+  let cursor_locator = page.locator('textarea >> nth=0')
+  expect(await cursor_locator.inputValue()).toContain("page=" + page_title)
+  await cursor_locator.press("Enter")
+  if (IsMac) { // FIXME: support Logseq URL on Linux (XDG)
+    page.locator('a.external-link >> nth=0').click()
+    await page.waitForNavigation()
+    await page.waitForTimeout(500)
+    cursor_locator = await lastBlock(page)
+    expect(await cursor_locator.inputValue()).toBe(identify_text)
+  }
 
-    // paste the identify block's URL to another page, then redirect throught the URL
-    await page.click('span.bullet >> nth=0', { button: "right" })
-    await page.locator("text=Copy block URL").click()
-    await createRandomPage(page)
-    await block.mustFill("") // to enter editing mode
-    await page.keyboard.press(paste_key)
-    cursor_locator = page.locator('textarea >> nth=0')
-    expect(await cursor_locator.inputValue()).toContain("block-id=")
-    await cursor_locator.press("Enter")
-    if (!IsLinux) { // FIXME: support Logseq URL on Linux (XDG)
-        page.locator('a.external-link >> nth=0').click()
-        await page.waitForNavigation()
-        await page.waitForTimeout(500)
-        cursor_locator = await lastBlock(page)
-        expect(await cursor_locator.inputValue()).toBe(identify_text)
-    }
-})
+  // paste the identify block's URL to another page, then redirect throught the URL
+  await page.click('span.bullet >> nth=0', { button: "right" })
+  await page.locator("text=Copy block URL").click()
+  await createRandomPage(page)
+  await block.mustFill("") // to enter editing mode
+  await page.keyboard.press(paste_key)
+  cursor_locator = page.locator('textarea >> nth=0')
+  expect(await cursor_locator.inputValue()).toContain("block-id=")
+  await cursor_locator.press("Enter")
+  if (IsMac) { // FIXME: support Logseq URL on Linux (XDG)
+    page.locator('a.external-link >> nth=0').click()
+    await page.waitForNavigation()
+    await page.waitForTimeout(500)
+    cursor_locator = await lastBlock(page)
+    expect(await cursor_locator.inputValue()).toBe(identify_text)
+  }
+})

+ 2 - 0
src/main/frontend/dicts.cljc

@@ -4083,6 +4083,7 @@
         :right-side-bar/all-pages "Bütün sayfalar"
         :right-side-bar/flashcards "Bilgi kartları"
         :right-side-bar/new-page "Yeni sayfa"
+        :right-side-bar/show-journals "Günlükleri Göster"
         :left-side-bar/journals "Günlük"
         :left-side-bar/new-page "Yeni sayfa"
         :left-side-bar/nav-favorites "Sık kullanılanlar"
@@ -4131,6 +4132,7 @@
         :page/created-at "Oluşturulma Zamanı"
         :page/updated-at "Güncellenme Zamanı"
         :page/backlinks "Geri Bağlantılar"
+        :linked-references/filter-search "Bağlantılı sayfalarda ara"
         :editor/block-search "Blok ara"
         :editor/image-uploading "Karşıya yükleniyor"
         :draw/invalid-file "Bu geçersiz excalidraw dosyası yüklenemedi"

+ 5 - 13
src/main/frontend/handler/editor.cljs

@@ -1771,19 +1771,11 @@
 (defn close-autocomplete-if-outside
   [input]
   (when (and input
-             (state/get-editor-action)
-             (not (wrapped-by? input page-ref/left-brackets page-ref/right-brackets)))
-    (let [value (gobj/get input "value")
-          pos (state/get-editor-last-pos)
-          current-pos (cursor/pos input)
-          between (gp-util/safe-subs value (min pos current-pos) (max pos current-pos))]
-      (when (and between
-                 (or
-                  (string/includes? between "[")
-                  (string/includes? between "]")
-                  (string/includes? between "(")
-                  (string/includes? between ")")))
-        (state/clear-editor-action!)))))
+             (contains? #{:page-search :page-search-hashtag :block-search} (state/get-editor-action))
+             (not (wrapped-by? input page-ref/left-brackets page-ref/right-brackets))
+             (not (wrapped-by? input block-ref/left-parens block-ref/right-parens))
+             (not (wrapped-by? input "#" "")))
+    (state/clear-editor-action!)))
 
 (defn resize-image!
   [block-id metadata full_text size]

+ 1 - 0
src/main/frontend/modules/shortcut/dicts.cljc

@@ -1331,6 +1331,7 @@
              :command.graph/remove                   "Bir grafiği kaldır"
              :command.graph/add                      "Grafik ekle"
              :command.graph/save                     "Mevcut grafiği diske kaydet"
+             :command.graph/re-index                 "Mevcut grafiği yeniden oluştur"
              :command.command/run                    "Git komutunu çalıştır"
              :command.go/home                        "Ana sayfaya git"
              :command.go/all-pages                   "Bütün sayfalara git"