fix: trailing whitespace disappears

pull/11102/head
Tienson Qin 2024-02-29 01:18:39 +08:00
parent 9569bed720
commit f5af62ad15
1 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,8 @@
[frontend.util.cursor :as cursor]
[goog.dom :as gdom]
[frontend.db :as db]
[frontend.handler.block :as block-handler]))
[frontend.handler.block :as block-handler]
[clojure.string :as string]))
(defn did-mount!
[state]
@ -31,11 +32,11 @@
state)
(defn will-remount!
[old-state state]
(let [old-block (:block (first (:rum/args old-state)))
new-block (:block (first (:rum/args state)))
[_old-state state]
(let [new-block (:block (first (:rum/args state)))
repo (state/get-current-repo)]
(when (not= (:block/content old-block) (:block/content new-block))
(when (not= (string/trim (state/get-edit-content))
(string/trim (: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)