toeverything / blocksuite

🧩 Content editing tech stack for the web - BlockSuite is a toolkit for building editors and collaborative applications.
https://blocksuite.io
Mozilla Public License 2.0
4.25k stars 378 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'getTextNodesFromElement') #2155

Closed BedBear closed 1 year ago

BedBear commented 1 year ago

When I import { SimpleAffineEditor } from '@blocksuite/editor';

It shows

image

My dependencies "@blocksuite/blocks": "^0.0.0-20230418192708-038c287a-nightly", "@blocksuite/editor": "^0.0.0-20230418192708-038c287a-nightly", "@blocksuite/store": "^0.0.0-20230418192708-038c287a-nightly",

affine-bot commented 1 year ago

Hello! Thank you for filing an issue. If this is a bug report, please include relevant logs to help us debug the problem.

BedBear commented 1 year ago

When I install dependencies "@blocksuite/blocks": "^0.5.0-alpha.3", "@blocksuite/editor": "^0.5.0-alpha.3", "@blocksuite/store": "^0.5.0-alpha.3", and import SimpleAffineEditor import { SimpleAffineEditor } from '@blocksuite/editor';

It shows

image
XvHaidong commented 1 year ago

+1

zqran commented 1 year ago

When I install dependencies "@blocksuite/blocks": "^0.5.0-alpha.3", "@blocksuite/editor": "^0.5.0-alpha.3", "@blocksuite/store": "^0.5.0-alpha.3", and import SimpleAffineEditor import { SimpleAffineEditor } from '@blocksuite/editor';

@BedBear I tried to reproduce this bug in the project created by vite, but it didn't reproduce. Can you provide more information?

BedBear commented 1 year ago

When I installed the following version, the problem disappeared. "@blocksuite/blocks": "^0.0.0-20230412114309-05fc8eec-nightly", "@blocksuite/editor": "^0.0.0-20230412114309-05fc8eec-nightly", "@blocksuite/react": "^0.0.0-20230412114309-05fc8eec-nightly",

BedBear commented 1 year ago

When I install dependencies "@blocksuite/blocks": "^0.5.0-alpha.3", "@blocksuite/editor": "^0.5.0-alpha.3", "@blocksuite/store": "^0.5.0-alpha.3", and import SimpleAffineEditor import { SimpleAffineEditor } from '@blocksuite/editor';

@BedBear I tried to reproduce this bug in the project created by vite, but it didn't reproduce. Can you provide more information?

"dependencies": { "@ant-design/icons": "^5.0.1", "@blocksuite/blocks": "^0.0.0-20230418192708-038c287a-nightly", "@blocksuite/editor": "^0.0.0-20230418192708-038c287a-nightly", "@blocksuite/store": "^0.0.0-20230418192708-038c287a-nightly", "@craco/craco": "^7.1.0", "@douyinfe/semi-ui": "^2.32.2", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "antd": "^5.3.2", "date-fns": "^2.29.3", "dexie": "^3.2.3", "history": "^5.3.0", "next": "^13.3.0", "react": "^18.2.0", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", "react-dom": "^18.2.0", "react-router-dom": "^6.10.0", "react-scripts": "5.0.1", "slate": "^0.93.0", "slate-react": "^0.93.0", "web-vitals": "^2.1.4" },

zqran commented 1 year ago

@BedBear

I created a minimal implementation project, you can refer to: https://github.com/zqran/block-suite-simple-editor. Or, you can provide a minimal implementation project in question.

BedBear commented 1 year ago

I used the code from your example and encountered the same error. Even when I commented out the other three lines and only kept the first line import { SimpleAffineEditor } from '@blocksuite/editor';, the error still occurred. I think there may be an issue with the package version "@blocksuite/editor": "^0.0.0-20230418192708-038c287a-nightly". I did not encounter any errors when I used the package version "@blocksuite/editor": "^0.0.0-20230412114309-05fc8eec-nightly".

zqran commented 1 year ago

I used the code from your example and encountered the same error. Even when I commented out the other three lines and only kept the first line import { SimpleAffineEditor } from '@blocksuite/editor';, the error still occurred. I think there may be an issue with the package version "@blocksuite/editor": "^0.0.0-20230418192708-038c287a-nightly". I did not encounter any errors when I used the package version "@blocksuite/editor": "^0.0.0-20230412114309-05fc8eec-nightly".

Since BlockSuite is under heavy development, we recommend you to use the latest nightly version.

zqran commented 1 year ago

@BedBear I will close this issue, if you encounter other problems, please provide more information. Thanks for your feedback.