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/components/block.cljs b/src/main/frontend/components/block.cljs index 521669686..4bc2d4015 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -2715,7 +2715,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)) @@ -2724,7 +2724,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)) @@ -2767,7 +2768,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 @@ -3182,7 +3183,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))) 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 diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 11cd14e70..f4bae4f23 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)]) @@ -1288,21 +1289,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)))))))) @@ -2904,7 +2907,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/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") 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))))) diff --git a/src/test/frontend/modules/outliner/core_test.cljs b/src/test/frontend/modules/outliner/core_test.cljs index 59a2b1c6a..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] @@ -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)