Merge remote-tracking branch 'origin/master' into feat/support-remove-image

# Conflicts:
#	src/main/frontend/components/block.cljs
This commit is contained in:
charlie
2021-01-15 17:47:00 +08:00
7 changed files with 122 additions and 40 deletions

View File

@@ -2209,3 +2209,13 @@
(save-current-block-when-idle! {:check-idle? false})
(when (string/starts-with? repo "https://") ; git repo
(repo-handler/auto-push!))))
(defn resize-image!
[block-id metadata full_text size]
(let [new-meta (merge metadata size)
image-part (first (string/split full_text #"\{"))
new-full-text (str image-part (pr-str new-meta))
block (db/pull [:block/uuid block-id])
value (:block/content block)
new-value (string/replace value full_text new-full-text)]
(save-block-aux! block new-value (:block/format block) {})))