How to enable Attachment post type in Gutenberg editor for blocks?

Đã có trọn bộ đề thi thử THPT Quốc Gia 2022 các môn: vip.dethihsg247.com

I would like to make the native Attachment posts to be accessible by various Gutenberg Blocks. (To appear & be selectable in dropdown menus, etc.)
Is that possible?

The nearest answer i found is this. However that is not working for me by some reason. I was thinking, maybe because Attachment is a native post type and not a custom one (added by some plugins), and maybe that makes difference somewhere?

Here is my current code attempt (in functions.php)

Any ideas? Thanks!

Update: i got a bit of info on wordpress.org forums, pointing out some directions:

“Attachments are available through the API by using the “media” path.
The issue is more in what functions are used to query for lists of
posts. Most such functions simply don’t include attachments in their
query. Success would depend on whether “attachment” can be added to
the query’s post type arg through a filter or not.”

Xin chào các bạn và quý Thầy Cô. Hãy nhập từ khóa mình muốn vào ô tìm kiếm trên Website để tìm kiếm mọi thứ hoặc trên google các bạn hãy nhập từ khóa + dethihsg247.com để tìm kiếm các bài viết của chúng tôi nhé.
  • Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
  • Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
  • Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.

Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com