mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 06:34:34 +00:00
fix: open block for editing after pressing Enter in a text property
This commit is contained in:
@@ -312,12 +312,14 @@
|
||||
|
||||
(defn <create-new-block!
|
||||
[block property value]
|
||||
(p/let [last-block-id (db-property-handler/create-property-text-block! block property value
|
||||
editor-handler/wrap-parse-block
|
||||
(let [{:keys [last-block-id result]} (db-property-handler/create-property-text-block! block property value
|
||||
editor-handler/wrap-parse-block
|
||||
|
||||
{})
|
||||
_ (exit-edit-property)]
|
||||
(editor-handler/edit-block! (db/entity [:block/uuid last-block-id]) :max last-block-id)))
|
||||
{})]
|
||||
(p/do!
|
||||
result
|
||||
(exit-edit-property)
|
||||
(editor-handler/edit-block! (db/entity [:block/uuid last-block-id]) :max last-block-id))))
|
||||
|
||||
(defn <create-new-block-from-template!
|
||||
"`template`: tag block"
|
||||
|
||||
@@ -617,11 +617,12 @@
|
||||
class? (contains? (:block/type block) "class")
|
||||
property-key (:block/original-name property)]
|
||||
(db/transact! repo (if page (cons page blocks) blocks) {:outliner-op :insert-blocks})
|
||||
(when property-key
|
||||
(if (and class? class-schema?)
|
||||
(class-add-property! repo (:block/uuid block) property-key)
|
||||
(set-block-property! repo (:block/uuid block) property-key (:block/uuid first-block) {})))
|
||||
last-block-id))
|
||||
(let [result (when property-key
|
||||
(if (and class? class-schema?)
|
||||
(class-add-property! repo (:block/uuid block) property-key)
|
||||
(set-block-property! repo (:block/uuid block) property-key (:block/uuid first-block) {})))]
|
||||
{:last-block-id last-block-id
|
||||
:result result})))
|
||||
|
||||
(defn property-create-new-block-from-template
|
||||
[block property template]
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
;; add property
|
||||
(db-property-handler/upsert-property! repo k {:type :default} {})
|
||||
(let [property (db/entity [:block/name k])
|
||||
last-block-id (db-property-handler/create-property-text-block! fb property "Block content" editor-handler/wrap-parse-block {})
|
||||
{:keys [last-block-id]} (db-property-handler/create-property-text-block! fb property "Block content" editor-handler/wrap-parse-block {})
|
||||
{:keys [from-block-id from-property-id]} (db-property-handler/get-property-block-created-block [:block/uuid last-block-id])]
|
||||
(is (= from-block-id (:db/id fb)))
|
||||
(is (= from-property-id (:db/id property)))))))
|
||||
|
||||
Reference in New Issue
Block a user