mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 02:16:30 +00:00
Merge remote-tracking branch 'origin/master' into zotero/poc
This commit is contained in:
@@ -822,24 +822,25 @@
|
||||
(let [block (db/entity [:block/uuid block-id])]
|
||||
(seq (:block/_parent block)))))]
|
||||
(when-not (and has-children? left-has-children?)
|
||||
(let [block-parent (gdom/getElement block-parent-id)
|
||||
sibling-block (util/get-prev-block-non-collapsed block-parent)]
|
||||
(delete-block-aux! block delete-children?)
|
||||
(when (and repo sibling-block)
|
||||
(when-let [sibling-block-id (dom/attr sibling-block "blockid")]
|
||||
(when-let [block (db/pull repo '[*] [:block/uuid (uuid sibling-block-id)])]
|
||||
(let [original-content (util/trim-safe (:block/content block))
|
||||
new-value (str original-content " " (string/triml value))
|
||||
tail-len (count (string/triml value))
|
||||
pos (max
|
||||
(if original-content
|
||||
(utf8/length (utf8/encode original-content))
|
||||
0)
|
||||
0)]
|
||||
(edit-block! block pos format id
|
||||
{:custom-content new-value
|
||||
:tail-len tail-len
|
||||
:move-cursor? false}))))))))))))
|
||||
(when block-parent-id
|
||||
(let [block-parent (gdom/getElement block-parent-id)
|
||||
sibling-block (util/get-prev-block-non-collapsed block-parent)]
|
||||
(delete-block-aux! block delete-children?)
|
||||
(when (and repo sibling-block)
|
||||
(when-let [sibling-block-id (dom/attr sibling-block "blockid")]
|
||||
(when-let [block (db/pull repo '[*] [:block/uuid (uuid sibling-block-id)])]
|
||||
(let [original-content (util/trim-safe (:block/content block))
|
||||
new-value (str original-content " " (string/triml value))
|
||||
tail-len (count (string/triml value))
|
||||
pos (max
|
||||
(if original-content
|
||||
(utf8/length (utf8/encode original-content))
|
||||
0)
|
||||
0)]
|
||||
(edit-block! block pos format id
|
||||
{:custom-content new-value
|
||||
:tail-len tail-len
|
||||
:move-cursor? false})))))))))))))
|
||||
(state/set-editor-op! nil)))
|
||||
|
||||
(defn- get-end-block-parent
|
||||
@@ -925,6 +926,22 @@
|
||||
(let [key (keyword key)]
|
||||
(block-property-aux! block-id key value)))
|
||||
|
||||
(defn set-block-query-properties!
|
||||
[block-id all-properties key add?]
|
||||
(when-let [block (db/entity [:block/uuid block-id])]
|
||||
(let [query-properties (-> (get-in block [:block/properties :query-properties] "")
|
||||
(common-handler/safe-read-string "Failed to parse query properties"))
|
||||
query-properties (if (seq query-properties)
|
||||
query-properties
|
||||
all-properties)
|
||||
query-properties (if add?
|
||||
(distinct (conj query-properties key))
|
||||
(remove #{key} query-properties))
|
||||
query-properties (vec query-properties)]
|
||||
(if (seq query-properties)
|
||||
(set-block-property! block-id :query-properties (str query-properties))
|
||||
(remove-block-property! block-id :query-properties)))))
|
||||
|
||||
(defn set-block-timestamp!
|
||||
[block-id key value]
|
||||
(let [key (string/lower-case key)
|
||||
|
||||
Reference in New Issue
Block a user