fix: collapsed property shouldn't be displayed

pull/2422/head
Tienson Qin 2021-07-12 11:35:47 +08:00
parent c32459ed75
commit b4040315cd
2 changed files with 19 additions and 14 deletions

View File

@ -895,29 +895,31 @@
(property/insert-property format content key value))
block (outliner-core/block {:block/uuid block-id
:block/properties properties
:block/content content})]
:block/content content})
input-pos (or (state/get-edit-pos) :max)]
(outliner-core/save-node block)
(db/refresh! (state/get-current-repo)
{:key :block/change
:data [(db/pull [:block/uuid block-id])]})
;; update editing input content
(when-let [editing-block (state/get-edit-block)]
(and (= (:block/uuid editing-block) block-id)
(state/set-edit-content! (state/get-edit-input-id) content))))))))
(when (= (:block/uuid editing-block) block-id)
(edit-block! editing-block
input-pos
format
(state/get-edit-input-id)))))))))
(defn remove-block-property!
[block-id key]
(let [key (keyword key)]
(block-property-aux! block-id key nil))
(db/refresh! (state/get-current-repo)
{:key :block/change
:data [(db/pull [:block/uuid block-id])]}))
(block-property-aux! block-id key nil)))
(defn set-block-property!
[block-id key value]
(let [key (keyword key)]
(block-property-aux! block-id key value))
(db/refresh! (state/get-current-repo)
{:key :block/change
:data [(db/pull [:block/uuid block-id])]}))
(block-property-aux! block-id key value)))
(defn set-block-timestamp!
[block-id key value]
@ -2937,7 +2939,8 @@
(remove-block-property! block-id :collapsed))
(defn expand!
[]
[e]
(util/stop e)
(cond
(state/editing?)
(when-let [block-id (:block/uuid (state/get-edit-block))]
@ -2970,7 +2973,8 @@
(expand-block! uuid)))))))))
(defn collapse!
[]
[e]
(util/stop e)
(cond
(state/editing?)
(when-let [block-id (:block/uuid (state/get-edit-block))]

View File

@ -551,7 +551,8 @@
(defn get-edit-pos
[]
(.-selectionStart (get-input)))
(when-let [input (get-input)]
(.-selectionStart input)))
(defn set-selection-start-block!
[start-block]