File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 15791579 " Save incoming(pasted) assets to assets directory.
15801580
15811581 Returns: asset entities"
1582- [repo files & {:keys [pdf-area? last-edit-block]}]
1582+ [repo files & {:keys [pdf-area? last-edit-block save-to-page ]}]
15831583 (p/let [[repo-dir asset-dir-rpath] (assets-handler/ensure-assets-dir! repo)
15841584 today-page-name (date/today )
15851585 today-page-e (db-model/get-journal-page today-page-name)
15921592 blocks (remove nil? blocks*)
15931593 edit-block (or (state/get-edit-block ) last-edit-block)
15941594 insert-to-current-block-page? (and (:block/uuid edit-block) (not pdf-area?))
1595- target (if insert-to-current-block-page?
1595+ target (cond
1596+ insert-to-current-block-page?
15961597 edit-block
1598+ save-to-page
1599+ save-to-page
1600+ :else
15971601 today-page)]
15981602 (when-not target
15991603 (throw (ex-info " invalid target" {:files files
16041608 (ui-outliner-tx/transact!
16051609 {:outliner-op :insert-blocks }
16061610 (outliner-op/insert-blocks! blocks target {:keep-uuid? true
1611+ :bottom? true
16071612 :sibling? (= edit-block target)
16081613 :replace-empty-target? true }))
16091614 (map (fn [b] (db/entity [:block/uuid (:block/uuid b)])) blocks)))))
Original file line number Diff line number Diff line change 55 [cljs-time.local :as tl]
66 [clojure.string :as string]
77 [frontend.date :as date]
8+ [frontend.db :as db]
89 [frontend.db.model :as db-model]
910 [frontend.handler.editor :as editor-handler]
1011 [frontend.mobile.util :as mobile-util]
1112 [frontend.state :as state]
1213 [frontend.util :as util]
1314 [goog.functions :as gfun]
1415 [lambdaisland.glogi :as log]
16+ [logseq.common.config :as common-config]
17+ [logseq.db :as ldb]
1518 [logseq.shui.hooks :as hooks]
1619 [logseq.shui.ui :as shui]
1720 [mobile.init :as init]
6265 {:formatter-str audio-file-format})
6366 " ." ))]
6467 (p/let [file (js/File. [blob] filename #js {:type (.-type blob)})
65- result (editor-handler/db-based-save-assets! (state/get-current-repo )
66- [file]
67- {:last-edit-block @*last-edit-block})
68+ capture? (= " capture" @mobile-state/*tab)
69+ insert-opts (cond->
70+ {:last-edit-block @*last-edit-block}
71+ capture?
72+ (assoc :save-to-page (ldb/get-built-in-page (db/get-db ) common-config/quick-add-page-name)))
73+ result (editor-handler/db-based-save-assets! (state/get-current-repo ) [file] insert-opts)
6874 asset-entity (first result)]
6975 (when (nil? asset-entity)
7076 (log/error ::empty-asset-entity {}))
You can’t perform that action at this time.
0 commit comments