mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
Merge branch 'master' into feat/db
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { test as base, expect, ConsoleMessage, Locator } from '@playwright/test';
|
||||
import { ElectronApplication, Page, BrowserContext, _electron as electron } from 'playwright'
|
||||
import { loadLocalGraph, openLeftSidebar, randomString } from './utils';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { test } from './fixtures'
|
||||
import { expect } from '@playwright/test'
|
||||
import { callPageAPI } from './utils'
|
||||
|
||||
test('block related apis',
|
||||
async ({ page }) => {
|
||||
@@ -91,21 +92,6 @@ test('block related apis',
|
||||
// await page.pause()
|
||||
})
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param method
|
||||
* @param args
|
||||
*/
|
||||
export async function callPageAPI(page, method, ...args) {
|
||||
return await page.evaluate(([method, args]) => {
|
||||
const hasNs = method.indexOf('.') !== -1
|
||||
const ns = hasNs ? method.split('.') : method
|
||||
// @ts-ignore
|
||||
const ctx = hasNs ? window.logseq.sdk[ns[0].toLowerCase()] : window.logseq.api
|
||||
return ctx[hasNs ? ns[1] : method]?.(...args)
|
||||
}, [method, args])
|
||||
}
|
||||
|
||||
/**
|
||||
* load local tests plugin
|
||||
*/
|
||||
@@ -127,4 +113,4 @@ export async function loadLocalE2eTestsPlugin(page) {
|
||||
'plugin/selected-unpacked-pkg', `${__dirname}/plugin`)
|
||||
await page.keyboard.press('Escape')
|
||||
await page.keyboard.press('Escape')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect } from '@playwright/test'
|
||||
import { test } from './fixtures'
|
||||
import { callPageAPI, loadLocalE2eTestsPlugin } from './logseq-api.spec'
|
||||
import {loadLocalE2eTestsPlugin } from './logseq-api.spec'
|
||||
import { callPageAPI } from './utils'
|
||||
|
||||
test.skip('enabled plugin system default', async ({ page }) => {
|
||||
const callAPI = callPageAPI.bind(null, page)
|
||||
|
||||
@@ -303,3 +303,15 @@ export async function getCursorPos(page: Page): Promise<number | null> {
|
||||
|
||||
return cursorPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param method
|
||||
* @param args
|
||||
*/
|
||||
export async function callPageAPI(page, method, ...args) {
|
||||
return await page.evaluate(([method, args]) => {
|
||||
// @ts-ignore
|
||||
return window.logseq.api[method]?.(...args)
|
||||
}, [method, args])
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"devDependencies": {
|
||||
"@axe-core/playwright": "=4.4.4",
|
||||
"@capacitor/cli": "^5.0.0",
|
||||
"@playwright/test": "=1.31.0",
|
||||
"@playwright/test": "=1.44.0",
|
||||
"@tailwindcss/aspect-ratio": "0.4.2",
|
||||
"@tailwindcss/forms": "0.5.3",
|
||||
"@tailwindcss/typography": "0.5.7",
|
||||
@@ -19,7 +19,7 @@
|
||||
"gulp-clean-css": "^4.3.0",
|
||||
"ip": "1.1.9",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"playwright": "=1.31.0",
|
||||
"playwright": "=1.44.0",
|
||||
"postcss": "8.4.17",
|
||||
"postcss-cli": "10.0.0",
|
||||
"postcss-functions": "^4.0.2",
|
||||
@@ -120,7 +120,7 @@
|
||||
"d3-force": "3.0.0",
|
||||
"diff": "5.0.0",
|
||||
"dompurify": "2.4.0",
|
||||
"electron": "27.1.3",
|
||||
"electron": "28.3.1",
|
||||
"electron-dl": "3.3.0",
|
||||
"emoji-mart": "^5.5.2",
|
||||
"fs": "0.0.1-security",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"electron:make-linux-arm64": "electron-forge make --platform=linux --arch=arm64",
|
||||
"electron:make-macos-arm64": "electron-forge make --platform=darwin --arch=arm64",
|
||||
"electron:publish:github": "electron-forge publish",
|
||||
"rebuild:all": "electron-rebuild -v 27.1.3 -f",
|
||||
"rebuild:all": "electron-rebuild -v 28.3.1 -f",
|
||||
"postinstall": "install-app-deps"
|
||||
},
|
||||
"config": {
|
||||
@@ -55,12 +55,12 @@
|
||||
"@electron-forge/maker-squirrel": "^7.3.1",
|
||||
"@electron-forge/maker-zip": "^7.3.1",
|
||||
"@electron/rebuild": "3.2.10",
|
||||
"electron": "27.1.3",
|
||||
"electron": "28.3.1",
|
||||
"electron-builder": "^22.11.7",
|
||||
"electron-forge-maker-appimage": "https://github.com/logseq/electron-forge-maker-appimage.git"
|
||||
},
|
||||
"resolutions": {
|
||||
"**/electron": "27.1.3",
|
||||
"**/electron": "28.3.1",
|
||||
"**/node-abi": "3.51.0",
|
||||
"**/node-gyp": "9.0.0"
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
(defn- get-computed-bg-color
|
||||
[]
|
||||
;; window.getComputedStyle(document.body, null).getPropertyValue('background-color');
|
||||
(let [styles (js/window.getComputedStyle (js/document.querySelector "#app-container"))
|
||||
(let [styles (js/window.getComputedStyle js/document.body)
|
||||
bg-color (gobj/get styles "background-color")
|
||||
;; convert rgb(r,g,b) to #rrggbb
|
||||
rgb2hex (fn [rgb]
|
||||
@@ -215,9 +215,9 @@
|
||||
%))
|
||||
(string/join)
|
||||
(str "#")))]
|
||||
(when (string/starts-with? bg-color "rgb(")
|
||||
(when (string/starts-with? bg-color "rgb")
|
||||
(let [rgb (-> bg-color
|
||||
(string/replace #"^rgb\(" "")
|
||||
(string/replace #"^rgb[^\d]+" "")
|
||||
(string/replace #"\)$" "")
|
||||
(string/split #","))
|
||||
rgb (take 3 rgb)]
|
||||
@@ -227,26 +227,27 @@
|
||||
#?(:cljs
|
||||
(defn set-android-theme
|
||||
[]
|
||||
(when (mobile-util/native-android?)
|
||||
(when-let [bg-color (try (get-computed-bg-color)
|
||||
(catch :default _
|
||||
nil))]
|
||||
(.setNavigationBarColor NavigationBar (clj->js {:color bg-color}))
|
||||
(.setBackgroundColor StatusBar (clj->js {:color bg-color}))))))
|
||||
(let [f #(when (mobile-util/native-android?)
|
||||
(when-let [bg-color (try (get-computed-bg-color)
|
||||
(catch :default _
|
||||
nil))]
|
||||
(.setNavigationBarColor NavigationBar (clj->js {:color bg-color}))
|
||||
(.setBackgroundColor StatusBar (clj->js {:color bg-color}))))]
|
||||
(js/setTimeout f 32))))
|
||||
|
||||
#?(:cljs
|
||||
(defn set-theme-light
|
||||
[]
|
||||
(p/do!
|
||||
(.setStyle StatusBar (clj->js {:style (.-Light Style)}))
|
||||
(set-android-theme))))
|
||||
(.setStyle StatusBar (clj->js {:style (.-Light Style)}))
|
||||
(set-android-theme))))
|
||||
|
||||
#?(:cljs
|
||||
(defn set-theme-dark
|
||||
[]
|
||||
(p/do!
|
||||
(.setStyle StatusBar (clj->js {:style (.-Dark Style)}))
|
||||
(set-android-theme))))
|
||||
(.setStyle StatusBar (clj->js {:style (.-Dark Style)}))
|
||||
(set-android-theme))))
|
||||
|
||||
(defn find-first
|
||||
[pred coll]
|
||||
|
||||
@@ -2179,10 +2179,10 @@ electron-wix-msi@^5.1.3:
|
||||
optionalDependencies:
|
||||
"@bitdisaster/exe-icon-extractor" "^1.0.10"
|
||||
|
||||
electron@*, electron@27.1.3:
|
||||
version "27.1.3"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-27.1.3.tgz#3fd6decda95c1dd0a7e51a9ac77ee0ba37b7c5c6"
|
||||
integrity sha512-7eD8VMhhlL5J531OOawn00eMthUkX1e3qN5Nqd7eMK8bg5HxQBrn8bdPlvUEnCano9KhrVwaDnGeuzWoDOGpjQ==
|
||||
electron@*, electron@28.3.1:
|
||||
version "28.3.1"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-28.3.1.tgz#babb3ff8e246336e9cd1c1966f16a55ba723ea06"
|
||||
integrity sha512-aF9fONuhVDJlctJS7YOw76ynxVAQdfIWmlhRMKits24tDcdSL0eMHUS0wWYiRfGWbQnUKB6V49Rf17o32f4/fg==
|
||||
dependencies:
|
||||
"@electron/get" "^2.0.0"
|
||||
"@types/node" "^18.11.18"
|
||||
|
||||
43
yarn.lock
43
yarn.lock
@@ -793,15 +793,12 @@
|
||||
eventemitter3 "^3.1.0"
|
||||
url "^0.11.0"
|
||||
|
||||
"@playwright/test@=1.31.0":
|
||||
version "1.31.0"
|
||||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.31.0.tgz#bde42ca06804164be54893525110adda946248d6"
|
||||
integrity sha512-Ys5s/06Dg9g3zAIdCIb/UOBYim3U7Zjb3DvC6XBtnRmnglH5O47iwYzmtxXu9fhSyzI2Jn28apkXIOD81GgCdw==
|
||||
"@playwright/test@=1.44.0":
|
||||
version "1.44.0"
|
||||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.0.tgz#ac7a764b5ee6a80558bdc0fcbc525fcb81f83465"
|
||||
integrity sha512-rNX5lbNidamSUorBhB4XZ9SQTjAqfe5M+p37Z8ic0jPFBMo5iCtQz1kRWkEMg+rYOKSlVycpQmpqjSFq7LXOfg==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
playwright-core "1.31.0"
|
||||
optionalDependencies:
|
||||
fsevents "2.3.2"
|
||||
playwright "1.44.0"
|
||||
|
||||
"@popperjs/core@^2.11.5", "@popperjs/core@^2.9.0":
|
||||
version "2.11.8"
|
||||
@@ -2700,10 +2697,10 @@ electron-to-chromium@^1.4.526:
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.528.tgz#7c900fd73d9d2e8bb0dab0e301f25f0f4776ef2c"
|
||||
integrity sha512-UdREXMXzLkREF4jA8t89FQjA8WHI6ssP38PMY4/4KhXFQbtImnghh4GkCgrtiZwLKUKVD2iTVXvDVQjfomEQuA==
|
||||
|
||||
electron@27.1.3:
|
||||
version "27.1.3"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-27.1.3.tgz#3fd6decda95c1dd0a7e51a9ac77ee0ba37b7c5c6"
|
||||
integrity sha512-7eD8VMhhlL5J531OOawn00eMthUkX1e3qN5Nqd7eMK8bg5HxQBrn8bdPlvUEnCano9KhrVwaDnGeuzWoDOGpjQ==
|
||||
electron@28.3.1:
|
||||
version "28.3.1"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-28.3.1.tgz#babb3ff8e246336e9cd1c1966f16a55ba723ea06"
|
||||
integrity sha512-aF9fONuhVDJlctJS7YOw76ynxVAQdfIWmlhRMKits24tDcdSL0eMHUS0wWYiRfGWbQnUKB6V49Rf17o32f4/fg==
|
||||
dependencies:
|
||||
"@electron/get" "^2.0.0"
|
||||
"@types/node" "^18.11.18"
|
||||
@@ -5844,22 +5841,24 @@ pixi.js@6.2.0:
|
||||
"@pixi/ticker" "6.2.0"
|
||||
"@pixi/utils" "6.2.0"
|
||||
|
||||
playwright-core@1.31.0:
|
||||
version "1.31.0"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.31.0.tgz#dbd184771535e76c6743ef5c082def5564f07e85"
|
||||
integrity sha512-/KquBjS5DcASCh8cGeNVHuC0kyb7c9plKTwaKxgOGtxT7+DZO2fjmFvPDBSXslEIK5CeOO/2kk5rOCktFXKEdA==
|
||||
|
||||
playwright-core@1.38.1:
|
||||
version "1.38.1"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.38.1.tgz#75a3c470aa9576b7d7c4e274de3d79977448ba08"
|
||||
integrity sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==
|
||||
|
||||
playwright@=1.31.0:
|
||||
version "1.31.0"
|
||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.31.0.tgz#c34de492c79b65dfa1a3e45c5bded785f0badc6c"
|
||||
integrity sha512-cFn1ie3bdYw/9/Ty3842CfPSRSy+ZWPjEhrxWgC+jL/CUjq5RKVJZwUbXV1UKBQU1Vo0NetsokXmk9EEZiqVHQ==
|
||||
playwright-core@1.44.0:
|
||||
version "1.44.0"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.0.tgz#316c4f0bca0551ffb88b6eb1c97bc0d2d861b0d5"
|
||||
integrity sha512-ZTbkNpFfYcGWohvTTl+xewITm7EOuqIqex0c7dNZ+aXsbrLj0qI8XlGKfPpipjm0Wny/4Lt4CJsWJk1stVS5qQ==
|
||||
|
||||
playwright@1.44.0, playwright@=1.44.0:
|
||||
version "1.44.0"
|
||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.44.0.tgz#22894e9b69087f6beb639249323d80fe2b5087ff"
|
||||
integrity sha512-F9b3GUCLQ3Nffrfb6dunPOkE5Mh68tR7zN32L4jCk4FjQamgesGay7/dAAe1WaMEGV04DkdJfcJzjoCKygUaRQ==
|
||||
dependencies:
|
||||
playwright-core "1.31.0"
|
||||
playwright-core "1.44.0"
|
||||
optionalDependencies:
|
||||
fsevents "2.3.2"
|
||||
|
||||
"playwright@>= 1.0.0":
|
||||
version "1.38.1"
|
||||
|
||||
Reference in New Issue
Block a user