You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy/paste of an asset block (a PDF, for example) pastes nothing. The target block stays empty. I read the code but did not reproduce this in the app, and I am not changing it without a decision, because every fix means choosing who owns the asset file.
What happens: insert-blocks in deps/outliner/src/logseq/outliner/core.cljs removes asset blocks when outliner-op is :paste, or when it inserts a template ((remove ldb/asset?)). It came in with fb9e735934 ("paste query block should create new block"). That commit does not say why assets are dropped. The reason is probably that an asset block cannot be copied as an entity. The file lives at assets/<block uuid>.<type> (asset-file-name in components/block/asset.cljs), so a copy with a new uuid would point to a file that does not exist. When every copied block is an asset, nothing is inserted and the empty target stays empty, which is what the report describes. Templates that contain an asset lose it the same way.
Two things that bear on the choice:
Cut and paste does not go through this path. paste-blocks in handler/editor.cljs moves the recycled blocks with move-blocks!, which keeps their uuid. Only copy and paste (and templates) are affected.
new-asset-block in handler/editor/assets.cljs refuses a file whose checksum already belongs to an asset ("asset already exists"). The app treats one file as one asset block.
Options:
Paste a block that links to the original asset block (:block/link), the way "copy as embed" already does in paste-copied-blocks-or-text. The file stays single and the checksum rule still holds. The pasted block is a live view of the original, so deleting the original asset (delete-asset-of-block!) breaks every pasted copy, and the copy does not carry its own caption.
Paste a reference to the original, either ((uuid)) or a markdown link [title](../assets/<uuid>.<ext>). Images already copy this way since b29088b88c, and this extends it to every type (PDF, audio, video). It is the smallest change, but it is text and not an asset block, so the pasted thing is not tagged Asset and has no asset properties.
Copy the file under a new uuid and create a new asset block with a new checksum entry. The pasted block is independent. This needs file I/O in the worker on every paste, and the checksum dedup would have to allow the copy. It is the most work, and it stores the file twice.
Keep dropping assets, but say so. Show a notice ("asset blocks can't be pasted, use the embed copy") and do not leave an empty block behind. No new behaviour, but PDFs still cannot be copied between pages.
My suggestion is option 1, with option 4's notice for any case it does not cover. Which of these do you want? I will write the fix and its test once it is chosen.
Option 2 is not ideal due to the loss of asset properties.
Option 3 is a viable alternative; however, if the pasted block becomes a new file, will the PDF highlights still be preserved in the new file?
I think Option 1 with the notice you suggested would be great, but I still have a few concerns:
Visual distinction: Will it look distinct enough to indicate it is a copy, helping prevent accidental deletion of the original?
Cut vs. Copy: What happens if I want to "cut" instead of "copy"? Under Option 1, is there still a risk of losing the file?
Batch actions: How would this work if I want to copy or cut multiple files at once?
Thank you for your time and for discussing this with me!
Activity
yuxi-liu-wired commentedon Oct 28, 2026
Copy/paste of an asset block (a PDF, for example) pastes nothing. The target block stays empty. I read the code but did not reproduce this in the app, and I am not changing it without a decision, because every fix means choosing who owns the asset file.
What happens:
insert-blocksindeps/outliner/src/logseq/outliner/core.cljsremoves asset blocks whenoutliner-opis:paste, or when it inserts a template ((remove ldb/asset?)). It came in with fb9e735934 ("paste query block should create new block"). That commit does not say why assets are dropped. The reason is probably that an asset block cannot be copied as an entity. The file lives atassets/<block uuid>.<type>(asset-file-nameincomponents/block/asset.cljs), so a copy with a new uuid would point to a file that does not exist. When every copied block is an asset, nothing is inserted and the empty target stays empty, which is what the report describes. Templates that contain an asset lose it the same way.Two things that bear on the choice:
paste-blocksinhandler/editor.cljsmoves the recycled blocks withmove-blocks!, which keeps their uuid. Only copy and paste (and templates) are affected.new-asset-blockinhandler/editor/assets.cljsrefuses a file whose checksum already belongs to an asset ("asset already exists"). The app treats one file as one asset block.Options:
:block/link), the way "copy as embed" already does inpaste-copied-blocks-or-text. The file stays single and the checksum rule still holds. The pasted block is a live view of the original, so deleting the original asset (delete-asset-of-block!) breaks every pasted copy, and the copy does not carry its own caption.((uuid))or a markdown link[title](../assets/<uuid>.<ext>). Images already copy this way since b29088b88c, and this extends it to every type (PDF, audio, video). It is the smallest change, but it is text and not an asset block, so the pasted thing is not tagged Asset and has no asset properties.My suggestion is option 1, with option 4's notice for any case it does not cover. Which of these do you want? I will write the fix and its test once it is chosen.
judy9910082-svg commentedon Nov 8, 2026
Option 2 is not ideal due to the loss of asset properties.
Option 3 is a viable alternative; however, if the pasted block becomes a new file, will the PDF highlights still be preserved in the new file?
I think Option 1 with the notice you suggested would be great, but I still have a few concerns:
Visual distinction: Will it look distinct enough to indicate it is a copy, helping prevent accidental deletion of the original?
Cut vs. Copy: What happens if I want to "cut" instead of "copy"? Under Option 1, is there still a risk of losing the file?
Batch actions: How would this work if I want to copy or cut multiple files at once?
Thank you for your time and for discussing this with me!