Open istarkov opened 4 months ago
So we for notion we have native clipboard format like
{"blocks":[{"blockId":"4e95ebfd-3d5c-43fe-a9f8-56d70ba5aec5","blockSubtree":{"__version__":3,"block":{"4e95ebfd-3d5c-43fe-a9f8-56d70ba5aec5":{"value":{"id":"4e95ebfd-3d5c-43fe-a9f8-56d70ba5aec5","version":16,"type":"image","properties":{"size":[["186.8KB"]],"title":[["f141f4bd-9158-4b53-aa3c-a605854fb3c9 (1).webp"]],"source":[["https://prod-files-secure.s3.us-west-2.amazonaws.com/f9c1da0a-4ec3-499c-b772-ef4bb186af31/acb97f36-4fc5-415b-8823-95abc39aa9d9/f141f4bd-9158-4b53-aa3c-a605854fb3c9_(1).webp"]]},"format":{"block_width":708,"display_source":"https://prod-files-secure.s3.us-west-2.amazonaws.com/f9c1da0a-4ec3-499c-b772-ef4bb186af31/acb97f36-4fc5-415b-8823-95abc39aa9d9/f141f4bd-9158-4b53-aa3c-a605854fb3c9_(1).webp","block_full_width":false,"block_page_width":true,"block_aspect_ratio":1,"block_preserve_scale":true},"created_time":1718535271839,"last_edited_time":1718535919103,"parent_id":"e50b7541-f260-42be-823a-fe47a8f2abf0","parent_table":"block","alive":true,"file_ids":["acb97f36-4fc5-415b-8823-95abc39aa9d9"],"created_by_table":"notion_user","created_by_id":"93cf67dc-ce2a-4709-af8d-7599f2ec78b7","last_edited_by_table":"notion_user","last_edited_by_id":"93cf67dc-ce2a-4709-af8d-7599f2ec78b7","space_id":"f9c1da0a-4ec3-499c-b772-ef4bb186af31"}}}}}],"action":"copy","wasContiguousSelection":true}
and using this data we can create images using following algorihtm
https://github.com/splitbee/react-notion/pull/32/files#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351R46
What for block above gives us working image src
https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff9c1da0a-4ec3-499c-b772-ef4bb186af31%2Facb97f36-4fc5-415b-8823-95abc39aa9d9%2Ff141f4bd-9158-4b53-aa3c-a605854fb3c9_(1).webp?table=block&id=4e95ebfd-3d5c-43fe-a9f8-56d70ba5aec5&userId=&cache=v2
How do you get data copied in that format? I can only see markdown when I copy
It's there as text/_notion-multi-text-production
text/_notion-multi-text-production
Markdown is text/plain
text/plain
So we for notion we have native clipboard format like
and using this data we can create images using following algorihtm
https://github.com/splitbee/react-notion/pull/32/files#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351R46
What for block above gives us working image src
https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Ff9c1da0a-4ec3-499c-b772-ef4bb186af31%2Facb97f36-4fc5-415b-8823-95abc39aa9d9%2Ff141f4bd-9158-4b53-aa3c-a605854fb3c9_(1).webp?table=block&id=4e95ebfd-3d5c-43fe-a9f8-56d70ba5aec5&userId=&cache=v2