From 61806c12ed2aff8ec1670cfbc114c8bbc8da3322 Mon Sep 17 00:00:00 2001 From: Darwis Date: Tue, 24 May 2022 21:10:10 +0700 Subject: [PATCH 1/7] add option to hide and show table view control from advance query (#5352) * add option to hide and show table view control from advance query * hide table control if there is custom :view function --- src/main/frontend/components/block.cljs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index b8c78ea4a..e8bb510db 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -2686,7 +2686,7 @@ (state/remove-custom-query-component! query) (db/remove-custom-query! (state/get-current-repo) query)) state)} - [state config {:keys [title query view collapsed? children? breadcrumb-show?] :as q}] + [state config {:keys [title query view collapsed? children? breadcrumb-show? table-view?] :as q}] (let [dsl-query? (:dsl-query? config) query-atom (:query-atom state) current-block-uuid (or (:block/uuid (:block config)) @@ -2695,7 +2695,8 @@ ;; exclude the current one, otherwise it'll loop forever remove-blocks (if current-block-uuid [current-block-uuid] nil) query-result (and query-atom (rum/react query-atom)) - table? (or (get-in current-block [:block/properties :query-table]) + table? (or table-view? + (get-in current-block [:block/properties :query-table]) (and (string? query) (string/ends-with? (string/trim query) "table"))) transformed-query-result (when query-result (db/custom-query-result-transform query-result remove-blocks q)) @@ -2738,7 +2739,7 @@ (str (count transformed-query-result) " results")]] (fn [] [:div - (when current-block + (when (and current-block (not view-f) (nil? table-view?)) [:div.flex.flex-row.align-items.mt-2 {:on-mouse-down (fn [e] (util/stop e))} (when-not page-list? [:div.flex.flex-row @@ -3217,3 +3218,4 @@ :else (blocks-container blocks config))]) + \ No newline at end of file From bca255531ccafe22b7f8edbe3d3d8afd4c345515 Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Tue, 24 May 2022 11:01:33 -0400 Subject: [PATCH 2/7] Remove unused binding from recent commit --- src/main/frontend/components/block.cljs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index e8bb510db..01797d41b 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -3154,7 +3154,6 @@ *navigating-block (::navigating-block state) navigating-block (rum/react *navigating-block) navigating-block-entity (db/entity [:block/uuid navigating-block]) - block (first blocks) navigated? (and navigating-block (not= (:db/id (:block/parent (::initial-block state))) @@ -3218,4 +3217,3 @@ :else (blocks-container blocks config))]) - \ No newline at end of file From 877a5d8042f5fcb1b36d00c1b08269568f4cf4c8 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 24 May 2022 23:13:19 +0800 Subject: [PATCH 3/7] fix: Error + Data Loss with message block with id already exists. close #5414 This also adds the support to insert a block as the first child. Example: logseq.api.insert_block("628ce7a2-02db-4aa1-a99a-2e6398297780", "foo", {sibling: false, before: true}) --- src/main/frontend/handler/editor.cljs | 31 +++++++++++++++------------ src/main/logseq/api.cljs | 22 ++++++++++++++++--- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index b3253cf34..b9359a1c9 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -590,6 +590,7 @@ edit-block? true}}] (when (or page block-uuid) (let [before? (if page false before?) + sibling? (boolean sibling?) sibling? (if before? true (if page false sibling?)) block (if page (db/entity [:block/name (util/page-name-sanity-lc page)]) @@ -1290,21 +1291,23 @@ db-content (:block/content db-block) db-content-without-heading (and db-content (gp-util/safe-subs db-content (:block/level db-block))) - value (or (:block/content current-block) - (and elem (gobj/get elem "value")))] - (cond - force? - (save-block-aux! db-block value opts) + value (if (= (:block/uuid current-block) (:block/uuid block)) + (:block/content current-block) + (and elem (gobj/get elem "value")))] + (when value + (cond + force? + (save-block-aux! db-block value opts) - (and skip-properties? - (db-model/top-block? block) - (when elem (thingatpt/properties-at-point elem))) - nil + (and skip-properties? + (db-model/top-block? block) + (when elem (thingatpt/properties-at-point elem))) + nil - (and block value db-content-without-heading - (not= (string/trim db-content-without-heading) - (string/trim value))) - (save-block-aux! db-block value opts))) + (and block value db-content-without-heading + (not= (string/trim db-content-without-heading) + (string/trim value))) + (save-block-aux! db-block value opts)))) (catch js/Error error (log/error :save-block-failed error)))))))) @@ -2906,7 +2909,7 @@ (and (gp-util/url? text) (not (string/blank? (util/get-selected-text)))) (html-link-format! text) - + (and (text/block-ref? text) (wrapped-by? input "((" "))")) (commands/simple-insert! (state/get-edit-input-id) (text/get-block-ref text) nil) diff --git a/src/main/logseq/api.cljs b/src/main/logseq/api.cljs index 4d2878dd6..a8812aa61 100644 --- a/src/main/logseq/api.cljs +++ b/src/main/logseq/api.cljs @@ -454,11 +454,27 @@ (let [{:keys [before sibling isPageBlock properties]} (bean/->clj opts) page-name (and isPageBlock block-uuid-or-page-name) block-uuid (if isPageBlock nil (uuid block-uuid-or-page-name)) + block-uuid' (if (and (not sibling) before block-uuid) + (let [block (db/entity [:block/uuid block-uuid]) + first-child (db-model/get-by-parent-&-left (db/get-db) + (:db/id block) + (:db/id block))] + (if first-child + (:block/uuid first-child) + block-uuid)) + block-uuid) + insert-at-first-child? (not= block-uuid' block-uuid) + [sibling? before?] (if insert-at-first-child? + [true true] + [sibling before]) + before? (if (and (false? sibling?) before? (not insert-at-first-child?)) + false + before?) new-block (editor-handler/api-insert-new-block! content - {:block-uuid block-uuid - :sibling? sibling - :before? before + {:block-uuid block-uuid' + :sibling? sibling? + :before? before? :page page-name :properties properties})] (bean/->js (normalize-keyword-for-json new-block))))) From ab662fa67d5442a2be3fc5ec8112efc50684b714 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 24 May 2022 23:31:26 +0800 Subject: [PATCH 4/7] chore: disable random-moves testing for now --- src/test/frontend/modules/outliner/core_test.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/frontend/modules/outliner/core_test.cljs b/src/test/frontend/modules/outliner/core_test.cljs index 59a2b1c6a..cad864163 100644 --- a/src/test/frontend/modules/outliner/core_test.cljs +++ b/src/test/frontend/modules/outliner/core_test.cljs @@ -412,7 +412,7 @@ (outliner-tx/transact! {:graph test-db} (outliner-core/delete-blocks! blocks {}))))))) -(deftest ^:long random-moves +#_(deftest ^:long random-moves (testing "Random moves" (transact-random-tree!) (let [c1 (get-blocks-count) From 2bd87d5d915d702b96edcfed5450793d5f462ac8 Mon Sep 17 00:00:00 2001 From: charlie Date: Tue, 24 May 2022 22:49:49 +0800 Subject: [PATCH 5/7] fix(plugin): page crash when checking plugin updates with some network issues #5222 --- src/main/frontend/components/plugins.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/frontend/components/plugins.cljs b/src/main/frontend/components/plugins.cljs index ee57ca1ab..a562d3e3d 100644 --- a/src/main/frontend/components/plugins.cljs +++ b/src/main/frontend/components/plugins.cljs @@ -248,7 +248,7 @@ :on-click #(when-not has-other-pending? (plugin-handler/check-or-update-marketplace-plugin (assoc item :only-check (not new-version)) - (fn [e] (notification/show! e :error))))} + (fn [^js e] (notification/show! (.toString e) :error))))} (if installing-or-updating? (t :plugin/updating) @@ -780,7 +780,7 @@ (if-let [n (state/get-next-selected-coming-update)] (plugin-handler/check-or-update-marketplace-plugin (assoc n :only-check false) - (fn [^js e] (notification/show! e :error))) + (fn [^js e] (notification/show! (.toString e) :error))) (plugin-handler/close-updates-downloading))) :disabled From e2359c61f023c31dae951e9d0c90a8d26f3d2f03 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 24 May 2022 23:41:31 +0800 Subject: [PATCH 6/7] chore: disable random-inserts and random-deletes tests --- src/test/frontend/modules/outliner/core_test.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/frontend/modules/outliner/core_test.cljs b/src/test/frontend/modules/outliner/core_test.cljs index cad864163..668e584f1 100644 --- a/src/test/frontend/modules/outliner/core_test.cljs +++ b/src/test/frontend/modules/outliner/core_test.cljs @@ -390,7 +390,7 @@ (recur (conj result next) next))) result))))) -(deftest ^:long random-inserts +#_(deftest ^:long random-inserts (testing "Random inserts" (transact-random-tree!) (let [c1 (get-blocks-count) @@ -402,7 +402,7 @@ (let [total (get-blocks-count)] (is (= total (+ c1 @*random-count))))))) -(deftest ^:long random-deletes +#_(deftest ^:long random-deletes (testing "Random deletes" (transact-random-tree!) (dotimes [_i 100] From df12a700169a380e648c67d10480d7fcdf56cfec Mon Sep 17 00:00:00 2001 From: Andelf Date: Tue, 24 May 2022 23:38:44 +0800 Subject: [PATCH 7/7] chore(release): bump version 0.7.0 --- android/app/build.gradle | 4 ++-- resources/package.json | 2 +- src/main/frontend/version.cljs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 84a6447f1..70304797d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.logseq.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 23 - versionName "0.6.10" + versionCode 24 + versionName "0.7.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/resources/package.json b/resources/package.json index 542f39654..4f86529a3 100644 --- a/resources/package.json +++ b/resources/package.json @@ -1,6 +1,6 @@ { "name": "Logseq", - "version": "0.6.10", + "version": "0.7.0", "main": "electron.js", "author": "Logseq", "license": "AGPL-3.0", diff --git a/src/main/frontend/version.cljs b/src/main/frontend/version.cljs index e12ef4845..15092d815 100644 --- a/src/main/frontend/version.cljs +++ b/src/main/frontend/version.cljs @@ -1,3 +1,3 @@ (ns frontend.version) -(defonce version "0.6.10") +(defonce version "0.7.0")