Merge branch 'master' into gesture-support-on-block

pull/5088/head
llcc 2022-05-25 15:16:45 +08:00 committed by GitHub
commit db1777efa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 30 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "com.logseq.app" applicationId "com.logseq.app"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 23 versionCode 24
versionName "0.6.10" versionName "0.7.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions { aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.

View File

@ -1,6 +1,6 @@
{ {
"name": "Logseq", "name": "Logseq",
"version": "0.6.10", "version": "0.7.0",
"main": "electron.js", "main": "electron.js",
"author": "Logseq", "author": "Logseq",
"license": "AGPL-3.0", "license": "AGPL-3.0",

View File

@ -2715,7 +2715,7 @@
(state/remove-custom-query-component! query) (state/remove-custom-query-component! query)
(db/remove-custom-query! (state/get-current-repo) query)) (db/remove-custom-query! (state/get-current-repo) query))
state)} 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) (let [dsl-query? (:dsl-query? config)
query-atom (:query-atom state) query-atom (:query-atom state)
current-block-uuid (or (:block/uuid (:block config)) current-block-uuid (or (:block/uuid (:block config))
@ -2724,7 +2724,8 @@
;; exclude the current one, otherwise it'll loop forever ;; exclude the current one, otherwise it'll loop forever
remove-blocks (if current-block-uuid [current-block-uuid] nil) remove-blocks (if current-block-uuid [current-block-uuid] nil)
query-result (and query-atom (rum/react query-atom)) 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"))) (and (string? query) (string/ends-with? (string/trim query) "table")))
transformed-query-result (when query-result transformed-query-result (when query-result
(db/custom-query-result-transform query-result remove-blocks q)) (db/custom-query-result-transform query-result remove-blocks q))
@ -2767,7 +2768,7 @@
(str (count transformed-query-result) " results")]] (str (count transformed-query-result) " results")]]
(fn [] (fn []
[:div [: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))} [:div.flex.flex-row.align-items.mt-2 {:on-mouse-down (fn [e] (util/stop e))}
(when-not page-list? (when-not page-list?
[:div.flex.flex-row [:div.flex.flex-row
@ -3182,7 +3183,6 @@
*navigating-block (::navigating-block state) *navigating-block (::navigating-block state)
navigating-block (rum/react *navigating-block) navigating-block (rum/react *navigating-block)
navigating-block-entity (db/entity [:block/uuid navigating-block]) navigating-block-entity (db/entity [:block/uuid navigating-block])
block (first blocks)
navigated? (and navigated? (and
navigating-block navigating-block
(not= (:db/id (:block/parent (::initial-block state))) (not= (:db/id (:block/parent (::initial-block state)))

View File

@ -248,7 +248,7 @@
:on-click #(when-not has-other-pending? :on-click #(when-not has-other-pending?
(plugin-handler/check-or-update-marketplace-plugin (plugin-handler/check-or-update-marketplace-plugin
(assoc item :only-check (not new-version)) (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? (if installing-or-updating?
(t :plugin/updating) (t :plugin/updating)
@ -780,7 +780,7 @@
(if-let [n (state/get-next-selected-coming-update)] (if-let [n (state/get-next-selected-coming-update)]
(plugin-handler/check-or-update-marketplace-plugin (plugin-handler/check-or-update-marketplace-plugin
(assoc n :only-check false) (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))) (plugin-handler/close-updates-downloading)))
:disabled :disabled

View File

@ -590,6 +590,7 @@
edit-block? true}}] edit-block? true}}]
(when (or page block-uuid) (when (or page block-uuid)
(let [before? (if page false before?) (let [before? (if page false before?)
sibling? (boolean sibling?)
sibling? (if before? true (if page false sibling?)) sibling? (if before? true (if page false sibling?))
block (if page block (if page
(db/entity [:block/name (util/page-name-sanity-lc page)]) (db/entity [:block/name (util/page-name-sanity-lc page)])
@ -1288,21 +1289,23 @@
db-content (:block/content db-block) db-content (:block/content db-block)
db-content-without-heading (and db-content db-content-without-heading (and db-content
(gp-util/safe-subs db-content (:block/level db-block))) (gp-util/safe-subs db-content (:block/level db-block)))
value (or (:block/content current-block) value (if (= (:block/uuid current-block) (:block/uuid block))
(and elem (gobj/get elem "value")))] (:block/content current-block)
(cond (and elem (gobj/get elem "value")))]
force? (when value
(save-block-aux! db-block value opts) (cond
force?
(save-block-aux! db-block value opts)
(and skip-properties? (and skip-properties?
(db-model/top-block? block) (db-model/top-block? block)
(when elem (thingatpt/properties-at-point elem))) (when elem (thingatpt/properties-at-point elem)))
nil nil
(and block value db-content-without-heading (and block value db-content-without-heading
(not= (string/trim db-content-without-heading) (not= (string/trim db-content-without-heading)
(string/trim value))) (string/trim value)))
(save-block-aux! db-block value opts))) (save-block-aux! db-block value opts))))
(catch js/Error error (catch js/Error error
(log/error :save-block-failed error)))))))) (log/error :save-block-failed error))))))))

View File

@ -1,3 +1,3 @@
(ns frontend.version) (ns frontend.version)
(defonce version "0.6.10") (defonce version "0.7.0")

View File

@ -454,11 +454,27 @@
(let [{:keys [before sibling isPageBlock properties]} (bean/->clj opts) (let [{:keys [before sibling isPageBlock properties]} (bean/->clj opts)
page-name (and isPageBlock block-uuid-or-page-name) page-name (and isPageBlock block-uuid-or-page-name)
block-uuid (if isPageBlock nil (uuid 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! new-block (editor-handler/api-insert-new-block!
content content
{:block-uuid block-uuid {:block-uuid block-uuid'
:sibling? sibling :sibling? sibling?
:before? before :before? before?
:page page-name :page page-name
:properties properties})] :properties properties})]
(bean/->js (normalize-keyword-for-json new-block))))) (bean/->js (normalize-keyword-for-json new-block)))))

View File

@ -390,7 +390,7 @@
(recur (conj result next) next))) (recur (conj result next) next)))
result))))) result)))))
(deftest ^:long random-inserts #_(deftest ^:long random-inserts
(testing "Random inserts" (testing "Random inserts"
(transact-random-tree!) (transact-random-tree!)
(let [c1 (get-blocks-count) (let [c1 (get-blocks-count)
@ -402,7 +402,7 @@
(let [total (get-blocks-count)] (let [total (get-blocks-count)]
(is (= total (+ c1 @*random-count))))))) (is (= total (+ c1 @*random-count)))))))
(deftest ^:long random-deletes #_(deftest ^:long random-deletes
(testing "Random deletes" (testing "Random deletes"
(transact-random-tree!) (transact-random-tree!)
(dotimes [_i 100] (dotimes [_i 100]
@ -412,7 +412,7 @@
(outliner-tx/transact! {:graph test-db} (outliner-tx/transact! {:graph test-db}
(outliner-core/delete-blocks! blocks {}))))))) (outliner-core/delete-blocks! blocks {})))))))
(deftest ^:long random-moves #_(deftest ^:long random-moves
(testing "Random moves" (testing "Random moves"
(transact-random-tree!) (transact-random-tree!)
(let [c1 (get-blocks-count) (let [c1 (get-blocks-count)