Skip to content

Commit

Permalink
Merge github-bendyorke:logseq/logseq into feat/cmdk
Browse files Browse the repository at this point in the history
  • Loading branch information
bendyorke committed Aug 31, 2023
2 parents 24006b3 + 98bff93 commit 0f7f9ad
Show file tree
Hide file tree
Showing 425 changed files with 7,744 additions and 106,528 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling with custom config file
uses: crate-ci/typos@v1.13.10
uses: crate-ci/typos@v1.16.8
with:
config: ./typos.toml

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
stale-issue-label: ':status/automatic-stale'
close-issue-label: ':status/automatic-closing'
# trunk-ignore(yamllint/line-length)
exempt-issue-labels: ':status/hold, :status/WIP, :type/enhancement, type/can-be-reproduced, priority-A'
exempt-issue-labels: 'hold, WIP, :type/enhancement, can-be-reproduced, priority-A, :type/bug, :type/feature-request'
remove-stale-when-updated: true
stale-issue-message: |
Hi There! 👋
Expand Down
2 changes: 1 addition & 1 deletion .projectile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-/resources/static/js/katex.min.js
-/resources/static/js/mhchem.min.js
-/resources/static/js/mldoc.min.js
-/resources/static/js/reveal.min.js
-/resources/static/js/reveal.js
-/resources/static/js/sci.min.js
-/resources/static/js/excalidraw.min.js
-/resources/static/js/react-force-graph.min.js
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 63
versionName "0.9.10"
versionCode 68
versionName "0.9.15"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const config: CapacitorConfig = {
appName: 'Logseq',
bundledWebRuntime: false,
webDir: 'public',
loggingBehavior: 'debug',
plugins: {
SplashScreen: {
launchShowDuration: 500,
Expand Down
13 changes: 6 additions & 7 deletions deps/graph-parser/src/logseq/graph_parser/block.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@
:block/properties-text-values properties-text-values
:block/invalid-properties invalid-properties
:block/pre-block? true
:block/unordered true
:block/macros (extract-macros-from-ast body)
:block/body body}
{:keys [tags refs]}
Expand Down Expand Up @@ -561,12 +560,12 @@
:level (if unordered? (:level block) 1))
block)
block (cond->
(-> (assoc block
:uuid id
:refs ref-pages-in-properties
:format format
:meta pos-meta)
(dissoc :size))
(-> (assoc block
:uuid id
:refs ref-pages-in-properties
:format format
:meta pos-meta)
(dissoc :size :unordered))
(or (seq (:properties properties)) markdown-heading?)
(assoc :properties (with-heading-property (:properties properties) markdown-heading? (:size block))
:properties-text-values (:properties-text-values properties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
;; only increase over time as the docs graph rarely has deletions
(testing "Counts"
(is (= 303 (count files)) "Correct file count")
(is (= 69499 (count (d/datoms db :eavt))) "Correct datoms count")
(is (= 63632 (count (d/datoms db :eavt))) "Correct datoms count")

(is (= 5866
(ffirst
Expand Down
7 changes: 2 additions & 5 deletions deps/graph-parser/src/logseq/graph_parser/whiteboard.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,11 @@
(let [shape? (shape-block? block)
shape (block->shape block)
default-page-ref {:block/name (gp-util/page-name-sanity-lc page-name)}]
(merge (if shape?
(merge (when shape?
(merge
{:block/uuid (uuid (:id shape))}
(with-whiteboard-block-refs shape page-name)
(with-whiteboard-content shape))

;; TODO: remove?
{:block/unordered true})
(with-whiteboard-content shape)))
(when (nil? (:block/parent block)) {:block/parent default-page-ref})
(when (nil? (:block/format block)) {:block/format :markdown}) ;; TODO: read from config
{:block/page default-page-ref})))
6 changes: 3 additions & 3 deletions deps/graph-parser/test/logseq/graph_parser/block_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
(not= (:uuid x) (:block/uuid result))
(= (select-keys result
[:block/properties :block/content :block/properties-text-values :block/properties-order]) (gp-block/block-keywordize y))))
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :unordered true, :content "bar\nid:: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :content "bar\nid:: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
{:properties {},
:content "bar",
:properties-text-values {},
:properties-order []}

{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :org, :meta {:start_pos 51, :end_pos 101}, :macros [], :unordered true, :content "bar\n:id: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :org, :meta {:start_pos 51, :end_pos 101}, :macros [], :content "bar\n:id: 63f199bc-c737-459f-983d-84acfcda14fe", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
{:properties {},
:content "bar",
:properties-text-values {},
:properties-order []}

{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :unordered true, :content "bar\n \n id:: 63f199bc-c737-459f-983d-84acfcda14fe\nblock body", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
{:properties {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :tags [], :format :markdown, :meta {:start_pos 51, :end_pos 101}, :macros [], :content "bar\n \n id:: 63f199bc-c737-459f-983d-84acfcda14fe\nblock body", :properties-text-values {:id "63f199bc-c737-459f-983d-84acfcda14fe"}, :level 1, :uuid #uuid "63f199bc-c737-459f-983d-84acfcda14fe", :properties-order [:id]}
{:properties {},
:content "bar\nblock body",
:properties-text-values {},
Expand Down
6 changes: 3 additions & 3 deletions deps/shui/src/logseq/shui/context.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
:config app-config
;; Until components are converted over, they need to fallback to the old inline function
;; Wrap the old inline function to allow for interception, but fallback to the old inline function
:inline-block (inline->inline-block inline block-config)
:inline-block (inline->inline-block inline block-config)
:map-inline-block (inline->map-inline-block inline block-config)
;; Currently frontend component are provided an object map containin at least the following keys:
;; Currently frontend component are provided an object map containing at least the following keys:
;; These will be passed through in a whitelisted fashion so as to be able to track the dependencies
;; back to the core application
;; TODO: document the following
:block (:block block-config) ;; the db entity of the current block
:block? (:block? block-config)
:blocks-container-id (:blocks-container-id block-config)
:editor-box (:editor-box block-config)
:id (:id block-config)
:id (:id block-config)
:mode? (:mode? block-config)
:query-result (:query-result block-config)
:sidebar? (:sidebar? block-config)
Expand Down
23 changes: 18 additions & 5 deletions docs/dev-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,24 @@ error if it detects an invalid query.

### Translations

Our translations can be configured incorrectly. We can catch some of these
mistakes [as noted here](./contributing-to-translations.md#fix-mistakes).

Punctuation and delimiting characters (e.g. `:`, `:`, `?`) should be part of the translatable string.
Those characters and their position may vary depending on the language.
We use [tongue](https://github.com/tonsky/tongue), a simple and effective
library, for translations. We have a couple bb tasks for working with
translations under `lang:` e.g. `bb lang:list`. See [the translator
guide](./contributing-to-translations.md) for usage.

One useful task for reviewers (us) and contributors alike, is `bb
lang:validate-translations` which catches [common
mistakes](./contributing-to-translations.md#fix-mistakes)). When reviewing
translations here are some things to keep in mind:

* Punctuation and delimiting characters (e.g. `:`, `:`, `?`) should be part of
the translatable string. Those characters and their position may vary depending on the language.
* Translations usually return strings but they can return hiccup vectors with a
fn translation. Hiccup vectors are needed when word order matters for a
translation and formatting is involved. See [this 3 word Turkish
example](https://github.com/logseq/logseq/commit/1d932f07c4a0aad44606da6df03a432fe8421480#r118971415).
* Translations can have arguments for interpolating strings. When they do, be
sure translators are using them correctly.

### Spell Checker

Expand Down
6 changes: 3 additions & 3 deletions docs/develop-logseq-on-mobile.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
```
- Working directory: Logseq root directory
- Run `yarn && yarn app-watch` from the logseq project root directory in terminal.
- Run `npx cap sync ios` in another termimal to copy web assets from public to *ios/App/App/public*, and create *capacitor.config.json* in *ios/App/App*, and update iOS plugins.
- Run `npx cap sync ios` in another terminal to copy web assets from public to *ios/App/App/public*, and create *capacitor.config.json* in *ios/App/App*, and update iOS plugins.
- Connect your iOS device to MacBook.
- Run `npx cap open ios` to open Logseq project in Xcode, and build the app there.

Expand Down Expand Up @@ -70,13 +70,13 @@ or, you can run `bb release:ios-app` to do those steps with one command.
}
```
- Run `yarn && yarn app-watch` from the logseq project root directory in terminal.
- Run `npx cap sync android` in another termimal.
- Run `npx cap sync android` in another terminal.
- Run `npx cap run android` to install app into your device.

or, you can run `bb dev:android-app` to do those steps with one command if you are on macOS.

Then,
- In Android Studio, open **Tools** -> **AVD Manager** to create Android Virtual Device (AVD), and lanuch it in the emulator.
- In Android Studio, open **Tools** -> **AVD Manager** to create Android Virtual Device (AVD), and launch it in the emulator.
- In Android Studio, open **Run** -> **Run** to run Logseq.
- After logseq startup in Android virtual device, repl should be able to connect
- For browser console print and devtool remote debug, open chrome, type url chrome://inspect/#devices, you should see your device there, click inspect
Expand Down
25 changes: 15 additions & 10 deletions docs/develop-logseq-on-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This is a guide on setting up Logseq development dependencies on Windows. Once these dependencies are installed, you can follow the [develop-logseq](develop-logseq.md) docs for build instructions.

## [scoop](https://scoop.sh/)

Scoop provides a `clojure.exe` shim which works in Command Prompt and Powershell windows.

```
scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure
scoop bucket add extras
scoop bucket add java
scoop install java/openjdk clj-deps babashka leiningen nodejs-lts
```

## Winget

Winget is a package manager installed by default on windows.
Expand All @@ -19,6 +30,10 @@ An installer for clojure is available from [casselc/clj-msi](https://github.com/

## [chocolatey](https://chocolatey.org/)

Chocolatey installs Clojure as a PowerShell module and alias, and does not provide `clojure` for `cmd.exe`.

[@andelf has written a wrapper utility](https://github.com/andelf/clojure-cli) which you can install with `cargo install --git https://github.com/andelf/clojure-cli.git` instead.

```
choco install nvm
nvm install 18
Expand All @@ -29,16 +44,6 @@ choco install javaruntime
choco install clojure
```


## [scoop](https://scoop.sh/)

```
scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure
scoop bucket add extras
scoop bucket add java
scoop install java/openjdk clojure clj-deps babashka leiningen nodejs-lts
```

## Troubleshooting

### Configuring a proxy for internet access
Expand Down
13 changes: 9 additions & 4 deletions docs/docker-web-app-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
From v0.5.6, Logseq is also available as a Docker image of Web App.
The Docker image is available at [ghcr.io/logseq/logseq-webapp:latest](https://github.com/logseq/logseq/pkgs/container/logseq-webapp).

**NOTE:** Logseq web app uses [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API) to access the file system. You need a [compatible browser](https://caniuse.com/native-filesystem-api).
Also, an HTTPS connection is required if you are accessing it remotely.
> **Note**
> Logseq web app uses [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API) to access the file system. You need a [compatible browser](https://caniuse.com/native-filesystem-api).
> Also, an HTTPS connection is required if you are accessing it remotely.
## Simple one-line start(local machine)

```shell
docker pull ghcr.io/logseq/logseq-webapp:latest
docker run -d --rm -p 3001:80 ghcr.io/logseq/logseq-webapp:latest
docker run -d --rm -p 127.0.0.1:3001:80 ghcr.io/logseq/logseq-webapp:latest
```

Open the browser and go to http://localhost:3001.
Open the browser and go to <http://localhost:3001>.

## Remote(non-local) access

Expand Down Expand Up @@ -70,6 +71,10 @@ docker pull ghcr.io/logseq/logseq-webapp:latest
docker run -d --rm -p 8443:443 -v `pwd`:/etc/nginx/certs -v ./ssl.conf:/etc/nginx/conf.d/ssl.conf ghcr.io/logseq/logseq-webapp:latest
```

> **Note**
> The above command will expose the web app to the public network, which is not recommended and may cause security issues.
> Please make sure the firewall is configured properly.
### Done!

Open your browser and navigate to `https://192.168.11.95:8443`.
43 changes: 42 additions & 1 deletion e2e-tests/editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,4 +817,45 @@ test.describe('Auto-pair symbols only with text selection', () => {
expect(selection).toBe('Lorem')
})
}
})
})

test('copy blocks should remove all ref-related values', async ({ page, block }) => {
await createRandomPage(page)

await block.mustFill('test')
await page.keyboard.press(modKey + '+c', { delay: 10 })
await block.clickNext()
await page.keyboard.press(modKey + '+v')
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)

await page.keyboard.press('ArrowUp', { delay: 10 })
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await expect(page.locator('.ls-block.selected')).toHaveCount(1)
await page.keyboard.press(modKey + '+c', { delay: 10 })
await block.clickNext()
await page.keyboard.press(modKey + '+v', { delay: 10 })
await block.clickNext() // let 3rd block leave editing state
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)
})

test('undo cut block should recover refs', async ({ page, block }) => {
await createRandomPage(page)

await block.mustFill('test')
await page.keyboard.press(modKey + '+c', { delay: 10 })
await block.clickNext()
await page.keyboard.press(modKey + '+v')
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)

await page.keyboard.press('ArrowUp', { delay: 10 })
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await expect(page.locator('.ls-block.selected')).toHaveCount(1)
await page.keyboard.press(modKey + '+x', { delay: 10 })
await expect(page.locator('.ls-block')).toHaveCount(1)
await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)
await expect(page.locator('.ls-block')).toHaveCount(2)
await expect(page.locator('.open-block-ref-link')).toHaveCount(1)
})
38 changes: 30 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,39 @@ const common = {
() => gulp.src([
'./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**',
'!**/*/i18n-*.js'
])
.pipe(gulp.dest(path.join(outputPath, 'js', 'excalidraw-assets'))),
() => gulp.src('node_modules/katex/dist/katex.min.js')
.pipe(gulp.dest(path.join(outputPath, 'js'))),
() => gulp.src('node_modules/@tabler/icons/iconfont/tabler-icons.min.css')
.pipe(gulp.dest(path.join(outputPath, 'css'))),
]).pipe(gulp.dest(path.join(outputPath, 'js', 'excalidraw-assets'))),
() => gulp.src([
'node_modules/katex/dist/katex.min.js',
'node_modules/katex/dist/contrib/mhchem.min.js',
'node_modules/html2canvas/dist/html2canvas.min.js',
'node_modules/interactjs/dist/interact.min.js',
'node_modules/photoswipe/dist/umd/*.js',
'node_modules/reveal.js/dist/reveal.js',
'node_modules/shepherd.js/dist/js/shepherd.min.js',
'node_modules/marked/marked.min.js',
'node_modules/@highlightjs/cdn-assets/highlight.min.js',
'node_modules/@isomorphic-git/lightning-fs/dist/lightning-fs.min.js',
'packages/amplify/dist/amplify.js'
]).pipe(gulp.dest(path.join(outputPath, 'js'))),
() => gulp.src([
'node_modules/pdfjs-dist/build/pdf.js',
'node_modules/pdfjs-dist/build/pdf.worker.js',
'node_modules/pdfjs-dist/web/pdf_viewer.js'
]).pipe(gulp.dest(path.join(outputPath, 'js', 'pdfjs'))),
() => gulp.src([
'node_modules/pdfjs-dist/cmaps/*.*',
]).pipe(gulp.dest(path.join(outputPath, 'js', 'pdfjs', 'cmaps'))),
() => gulp.src([
'node_modules/@tabler/icons/iconfont/tabler-icons.min.css',
'node_modules/inter-ui/inter.css',
'node_modules/reveal.js/dist/theme/fonts/source-sans-pro/**',
]).pipe(gulp.dest(path.join(outputPath, 'css'))),
() => gulp.src('node_modules/inter-ui/Inter (web)/*.*')
.pipe(gulp.dest(path.join(outputPath, 'css', 'Inter (web)'))),
() => gulp.src([
'node_modules/@tabler/icons/iconfont/fonts/**',
'node_modules/katex/dist/fonts/*.woff2'
])
.pipe(gulp.dest(path.join(outputPath, 'css', 'fonts'))),
]).pipe(gulp.dest(path.join(outputPath, 'css', 'fonts'))),
)(...params)
},

Expand Down
Loading

0 comments on commit 0f7f9ad

Please sign in to comment.