Merge branch 'master' into improve-references-filter

pull/5982/head
Gabriel Horner 2022-07-13 17:35:22 -04:00 committed by GitHub
commit 9ee2a09601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 15 deletions

View File

@ -68,9 +68,12 @@ async function alias_test(page: Page, page_name: string, search_kws: string[]) {
await page.waitForTimeout(500)
// build target Page with alias
// the target page will contains the content in
// alias_test_content_1,
// alias_test_content_2, and
// alias_test_content_3 sequentialy, to validate the target page state
await page.type('textarea >> nth=0', 'alias:: [[' + alias_name)
await page.press('textarea >> nth=0', 'ArrowRight')
await page.press('textarea >> nth=0', 'ArrowRight')
await page.press('textarea >> nth=0', 'Enter') // Enter for finishing selection
await page.press('textarea >> nth=0', 'Enter') // double Enter for exit property editing
await page.press('textarea >> nth=0', 'Enter') // double Enter for exit property editing
await page.waitForTimeout(500)
@ -81,6 +84,7 @@ async function alias_test(page: Page, page_name: string, search_kws: string[]) {
// create alias ref in origin Page
await newBlock(page)
await page.type('textarea >> nth=0', '[[' + alias_name)
await page.press('textarea >> nth=0', 'Enter') // Enter for finishing selection
await page.waitForTimeout(100)
await page.keyboard.press(hotkeyOpenLink)
@ -157,6 +161,6 @@ async function alias_test(page: Page, page_name: string, search_kws: string[]) {
// TODO: search clicking (alias property)
}
test.skip('page diacritic alias', async ({ page }) => {
test('page diacritic alias', async ({ page }) => {
await alias_test(page, "ü", ["ü", "ü", "Ü"])
})

View File

@ -48,10 +48,12 @@ public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
// NOTE: Event in js {dir path content stat{mtime}}
switch event {
case .Unlink:
self.notifyListeners("watcher", data: ["event": "unlink",
"dir": baseUrl?.description as Any,
"path": url.description,
])
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.notifyListeners("watcher", data: ["event": "unlink",
"dir": self.baseUrl?.description as Any,
"path": url.description,
])
}
case .Add, .Change:
var content: String? = nil
if url.shouldNotifyWithContent() {

View File

@ -82,8 +82,11 @@
(fn [path]
(publish-file-event! dir path "change")))
(.on dir-watcher "unlink"
;; delay 500ms for syncing disks
(fn [path]
(publish-file-event! dir path "unlink")))
(js/setTimeout #(when (not (fs/existsSync path))
(publish-file-event! dir path "unlink"))
500)))
(.on dir-watcher "error"
(fn [path]
(println "Watch error happened: "

View File

@ -441,9 +441,7 @@
[:div.ls-card.content
{:class (when (or preview? modal?)
(str (util/hiccup->class ".flex.flex-col.resize.overflow-y-auto")
(when modal? " modal-cards")))
:on-mouse-down (fn [e]
(util/stop e))}
(when modal? " modal-cards")))}
(let [repo (state/get-current-repo)]
[:div {:style {:margin-top 20}}
(component-block/breadcrumb {} repo root-block-id {})])

View File

@ -101,8 +101,10 @@
(repo-handler/setup-local-repo-if-not-exists!)
:else
(state/set-db-restoring! false))
(state/set-db-restoring! false))))
(p/then
(fn []
(prn "db restored, setting up repo hooks")
(store-schema!)
(state/pub-event! [:modal/nfs-ask-permission])

View File

@ -348,8 +348,9 @@
(state/set-current-repo! repo)
(db/start-db-conn! repo))
(defn setup-local-repo-if-not-exists!
(defn- setup-local-repo-if-not-exists-impl!
[]
;; loop query if js/window.pfs is ready, interval 100ms
(if js/window.pfs
(let [repo config/local-repo]
(p/do! (fs/mkdir-if-not-exists (str "/" repo))
@ -367,7 +368,17 @@
(create-custom-theme repo)
(state/set-db-restoring! false)
(ui-handler/re-render-root!)))
(js/setTimeout setup-local-repo-if-not-exists! 100)))
(p/then (p/delay 100) ;; TODO Junyi remove the string
setup-local-repo-if-not-exists-impl!)))
(defn setup-local-repo-if-not-exists!
[]
;; ensure `(state/set-db-restoring! false)` at exit
(-> (setup-local-repo-if-not-exists-impl!)
(p/timeout 3000)
(p/catch (fn []
(state/set-db-restoring! false)
(prn "setup-local-repo failed! timeout 3000ms")))))
(defn restore-and-setup-repo!
"Restore the db of a graph from the persisted data, and setup. Create a new