Skip to content

Commit

Permalink
Merge branch 'master' into feat/custom-children-list-style
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 committed Apr 12, 2023
2 parents f96b94e + 7b1c377 commit a98e612
Show file tree
Hide file tree
Showing 94 changed files with 2,053 additions and 1,204 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.logseq.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 54
versionName "0.9.1"
versionCode 55
versionName "0.9.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
2 changes: 1 addition & 1 deletion bb.edn
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@
{:paths ["src/main"]
;; Ignore namespaces that won't be helpful to document initially
;; e.g. frontend.components.onboarding -> "Onboarding fns"
:ignore-regex "^(frontend.components|frontend.extensions|frontend.modules|frontend.mobile)"}}}
:ignore-regex "^(frontend.components|frontend.extensions|frontend.modules|frontend.mobile|logseq.sdk)"}}}
3 changes: 2 additions & 1 deletion deps/publishing/src/logseq/publishing/html.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ necessary db filtering"
}(window.location))"]
;; TODO: should make this configurable
[:script {:src "static/js/main.js"}]
[:script {:src "static/js/highlight.min.js"}]
[:script {:src "static/js/interact.min.js"}]
[:script {:src "static/js/highlight.min.js"}]
[:script {:src "static/js/katex.min.js"}]
[:script {:src "static/js/html2canvas.min.js"}]
[:script {:src "static/js/code-editor.js"}]])))))

(defn build-html
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/headings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@playwright/test'
import { test } from './fixtures'
import { createRandomPage, editFirstBlock, newInnerBlock } from './utils'

test('set heading to 1 using', async ({ page }) => {
test('set heading to 1', async ({ page }) => {
await createRandomPage(page)

await page.type('textarea >> nth=0', 'foo')
Expand Down
51 changes: 51 additions & 0 deletions e2e-tests/history.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { expect } from '@playwright/test'
import { test } from './fixtures'
import { createRandomPage, modKey, searchAndJumpToPage, renamePage, randomString } from './utils'

test('undo/redo on a page should work as expected', async ({ page, block }) => {
const page1 = await createRandomPage(page)

await block.mustType('text 1')
await page.waitForTimeout(500) // Wait for 500ms autosave period to expire
await expect(page.locator('text="text 1"')).toHaveCount(1)

await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)
await expect(page.locator('text="text 1"')).toHaveCount(0)

await page.keyboard.press(modKey + '+Shift+z')
await page.waitForTimeout(100)
await expect(page.locator('text="text 1"')).toHaveCount(1)
})

test('should navigate to corresponding page on undo', async ({ page, block }) => {
const page1 = await createRandomPage(page)

await block.mustType('text 1')
await page.waitForTimeout(500) // Wait for 500ms autosave period to expire

const page2 = await createRandomPage(page)

await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)
expect(await page.innerText('.page-title .title')).toBe(page1)

await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)
await expect(page.locator('text="text 1"')).toHaveCount(0)
})


test('undo/redo of a renamed page should be preserved', async ({ page, block }) => {
const page1 = await createRandomPage(page)

await block.mustType('text 1')
await page.waitForTimeout(500) // Wait for 500ms autosave period to expire

await renamePage(page, randomString(10))

await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)

await expect(page.locator('text="text 1"')).toHaveCount(0)
})
15 changes: 3 additions & 12 deletions e2e-tests/page-rename.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { expect, Page } from '@playwright/test'
import { test } from './fixtures'
import { IsMac, createPage, randomLowerString, newInnerBlock, randomString, lastBlock } from './utils'
import { createPage, randomLowerString, randomString, renamePage } from './utils'

/***
* Test rename feature
***/

async function rename_page(page: Page, new_name: string) {
await page.click('.ls-page-title .page-title')
await page.waitForSelector('input[type="text"]')
await page.fill('input[type="text"]', '')
await page.type('.title input', new_name)
await page.keyboard.press('Enter')
await page.click('.ui__confirm-modal button')
}

async function page_rename_test(page: Page, original_page_name: string, new_page_name: string) {
const rand = randomString(10)
let original_name = original_page_name + rand
Expand All @@ -23,7 +14,7 @@ async function page_rename_test(page: Page, original_page_name: string, new_page
await createPage(page, original_name)

// Rename page in UI
await rename_page(page, new_name)
await renamePage(page, new_name)

expect(await page.innerText('.page-title .title')).toBe(new_name)

Expand Down Expand Up @@ -53,7 +44,7 @@ async function homepage_rename_test(page: Page, original_page_name: string, new_

expect(await page.locator('.home-nav span.flex-1').innerText()).toBe(original_name);

await rename_page(page, new_name)
await renamePage(page, new_name)

expect(await page.locator('.home-nav span.flex-1').innerText()).toBe(new_name);

Expand Down
15 changes: 15 additions & 0 deletions e2e-tests/util/page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Page } from '@playwright/test'

export async function activateNewPage(page: Page) {
await page.click('.ls-block >> nth=0')
await page.waitForTimeout(500)
}

export async function renamePage(page: Page, new_name: string) {
await page.click('.ls-page-title .page-title')
await page.waitForSelector('input[type="text"]')
await page.fill('input[type="text"]', '')
await page.type('.title input', new_name)
await page.keyboard.press('Enter')
await page.click('.ui__confirm-modal button')
}
6 changes: 1 addition & 5 deletions e2e-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { modKey } from './util/basic'
// Criteria: If the same selector is shared in multiple functions, they should be in the same file
export * from './util/basic'
export * from './util/search-modal'
export * from './util/page'

/**
* Locate the last block in the inner editor
Expand Down Expand Up @@ -154,11 +155,6 @@ export async function loadLocalGraph(page: Page, path: string): Promise<void> {
console.log('Graph loaded for ' + path)
}

export async function activateNewPage(page: Page) {
await page.click('.ls-block >> nth=0')
await page.waitForTimeout(500)
}

export async function editFirstBlock(page: Page) {
await page.click('.ls-block .block-content >> nth=0')
}
Expand Down
14 changes: 14 additions & 0 deletions libs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.0.15]

### Added
- Support a plug-in flag for the plugin slash commands item
- Support api of `logseq.App.setCurrentGraphConfigs: (configs: {}) => Promise<void>`
- Support hook of `logseq.App.onTodayJournalCreated: IUserHook<{ title: string }`
- Support more template-related APIs
- Support auto-check updates for the installed plugins from Marketplace

### Fixed
- Select and Input elements rendered using provideUI via `onMacroRendererSlotted` don't function [#8374](https://github.com/logseq/logseq/issues/8374)
- `logseq.Editor.getPageBlocksTree` does not work when page uuid is passed in as param [#4920](https://github.com/logseq/logseq/issues/4920)


## [0.0.14]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion libs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@logseq/libs",
"version": "0.0.14",
"version": "0.0.15",
"description": "Logseq SDK libraries",
"main": "dist/lsplugin.user.js",
"typings": "index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions libs/src/LSPlugin.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
PluginLogger,
} from './helpers'
import * as pluginHelpers from './helpers'
import DOMPurify from 'dompurify'
import Debug from 'debug'
import {
LSPluginCaller,
Expand Down Expand Up @@ -1606,6 +1607,7 @@ function setupPluginCore(options: any) {
debug('=== 🔗 Setup Logseq Plugin System 🔗 ===')

window.LSPluginCore = pluginCore
window.DOMPurify = DOMPurify
}

export { PluginLocal, pluginHelpers, setupPluginCore }
24 changes: 22 additions & 2 deletions libs/src/LSPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ export interface IPluginSearchServiceHooks {

onIndiceInit: (graph: string) => Promise<SearchIndiceInitStatus>
onIndiceReset: (graph: string) => Promise<void>
onBlocksChanged: (graph: string, changes: { added: Array<SearchBlockItem>, removed: Array<EntityID> }) => Promise<void>
onBlocksChanged: (graph: string, changes: {
added: Array<SearchBlockItem>,
removed: Array<EntityID>
}) => Promise<void>
onGraphRemoved: (graph: string, opts?: {}) => Promise<any>
}

Expand Down Expand Up @@ -425,9 +428,11 @@ export interface IAppProxy {

// graph
getCurrentGraph: () => Promise<AppGraphInfo | null>
getCurrentGraphConfigs: () => Promise<any>
getCurrentGraphConfigs: (...keys: string[]) => Promise<any>
setCurrentGraphConfigs: (configs: {}) => Promise<void>
getCurrentGraphFavorites: () => Promise<Array<string> | null>
getCurrentGraphRecent: () => Promise<Array<string> | null>
getCurrentGraphTemplates: () => Promise<Record<string, BlockEntity> | null>

// router
pushState: (
Expand All @@ -441,6 +446,13 @@ export interface IAppProxy {
query?: Record<string, any>
) => void

// templates
getTemplate: (name: string) => Promise<BlockEntity | null>
existTemplate: (name: string) => Promise<Boolean>
createTemplate: (target: BlockUUID, name: string, opts?: { overwrite: boolean }) => Promise<any>
removeTemplate: (name: string) => Promise<any>
insertTemplate: (target: BlockUUID, name: string) => Promise<any>

// ui
queryElementById: (id: string) => Promise<string | boolean>

Expand Down Expand Up @@ -481,6 +493,7 @@ export interface IAppProxy {
onGraphAfterIndexed: IUserHook<{ repo: string }>
onThemeModeChanged: IUserHook<{ mode: 'dark' | 'light' }>
onThemeChanged: IUserHook<Partial<{ name: string, mode: string, pid: string, url: string }>>
onTodayJournalCreated: IUserHook<{ title: string }>

/**
* provide ui slot to specific block with UUID
Expand Down Expand Up @@ -894,6 +907,13 @@ export interface IAssetsProxy {
* @added 0.0.10
*/
makeSandboxStorage(): IAsyncStorage

/**
* make assets scheme url based on current graph
* @added 0.0.15
* @param path
*/
makeUrl(path: string): Promise<string>
}

export interface ILSPluginThemeManager {
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
</script>
<script defer src="/static/js/highlight.min.js"></script>
<script defer src="/static/js/interact.min.js"></script>
<script defer src="/static/js/marked.min.js"></script>
<script defer src="/static/js/html2canvas.min.js"></script>
<script defer src="/static/js/main.js"></script>
<script defer src="/static/js/amplify.js"></script>
<script defer src="/static/js/tabler.min.js"></script>
Expand Down
5 changes: 5 additions & 0 deletions resources/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -921,4 +921,9 @@ html.is-mobile {
@apply grid grid-flow-col auto-cols-max;
place-items: center;
}

/* fixes an html2canvas issue */
img {
@apply inline-block;
}
}
2 changes: 2 additions & 0 deletions resources/electron.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
</script>
<script defer src="./js/highlight.min.js"></script>
<script defer src="./js/interact.min.js"></script>
<script defer src="./js/marked.min.js"></script>
<script defer src="./js/html2canvas.min.js"></script>
<script defer src="./js/lsplugin.core.js"></script>
<script defer src="./js/main.js"></script>
<script defer src="./js/amplify.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
</script>
<script defer src="./js/highlight.min.js"></script>
<script defer src="./js/interact.min.js"></script>
<script defer src="./js/marked.min.js"></script>
<script defer src="./js/html2canvas.min.js"></script>
<script defer src="./js/lsplugin.core.js"></script>
<script defer src="./js/main.js"></script>
<script defer src="./js/amplify.js"></script>
Expand Down
20 changes: 20 additions & 0 deletions resources/js/html2canvas.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/js/lsplugin.core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Logseq",
"productName": "Logseq",
"version": "0.9.1",
"version": "0.9.2",
"main": "electron.js",
"author": "Logseq",
"license": "AGPL-3.0",
Expand Down
Loading

0 comments on commit a98e612

Please sign in to comment.