fix: copy with parent+child blocks loses the parent block

fixed LOG-3056
pull/11102/head
Tienson Qin 2024-02-27 23:29:11 +08:00
parent 270eb7e2da
commit 38f3cef2c5
2 changed files with 14 additions and 8 deletions

View File

@ -2080,12 +2080,11 @@
:else
true)]
(when has-unsaved-edits
(ui-outliner-tx/transact!
{:outliner-op :save-block}
(outliner-save-block! editing-block)))
(p/let [result (ui-outliner-tx/transact!
(p/let [_ (when has-unsaved-edits
(ui-outliner-tx/transact!
{:outliner-op :save-block}
(outliner-save-block! editing-block)))
result (ui-outliner-tx/transact!
{:outliner-op :insert-blocks
:additional-tx revert-cut-txs}
(when target-block'

View File

@ -5,7 +5,8 @@
[frontend.util :as util]
[frontend.util.cursor :as cursor]
[goog.dom :as gdom]
[frontend.db :as db]))
[frontend.db :as db]
[frontend.handler.block :as block-handler]))
(defn did-mount!
[state]
@ -30,7 +31,13 @@
state)
(defn will-remount!
[_old-state state]
[old-state state]
(let [old-block (:block (first (:rum/args old-state)))
new-block (:block (first (:rum/args state)))
repo (state/get-current-repo)]
(when (not= (:block/content old-block) (:block/content new-block))
(util/set-change-value (state/get-input)
(block-handler/sanity-block-content repo (get new-block :block/format :markdown) (:block/content new-block)))))
(keyboards-handler/esc-save! state)
state)