mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 19:06:21 +00:00
feat: add image resize support
This commit is contained in:
@@ -2178,3 +2178,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) {})))
|
||||
|
||||
Reference in New Issue
Block a user