react-notion-x icon indicating copy to clipboard operation
react-notion-x copied to clipboard

Mirror Notion in hiding block_width "0" assets

Open PascalPixel opened this issue 1 year ago • 0 comments
trafficstars

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Sometimes, images that seem 'deleted' in Notion are still in the blocks, but simply have a "block_width" of 0. This diff would hide those blocks to match Notion.

Here is the diff that solved my problem:

diff --git a/node_modules/react-notion-x/build/index.js b/node_modules/react-notion-x/build/index.js
index a18bcfd..1bc6916 100644
--- a/node_modules/react-notion-x/build/index.js
+++ b/node_modules/react-notion-x/build/index.js
@@ -1757,8 +1760,9 @@ var AssetWrapper = ({ blockId, block }) => {
       "notion-asset-wrapper",
       `notion-asset-wrapper-${block.type}`,
       ((_d = value.format) == null ? void 0 : _d.block_full_width) && "notion-asset-wrapper-full",
-    )
+    ),
+    style: ((_d = value.format) == null ? void 0 : _d.block_width) === 0 ? { display: "none" } : undefined,
   }, /* @__PURE__ */ React20.createElement(Asset, {
     block: value,
     zoomable: zoom && !isURL

This issue body was partially generated by patch-package.

PascalPixel avatar Apr 19 '24 12:04 PascalPixel