Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of the decorators that were removed in the latest version of 0.17? #8447

Closed
xiaogonggong-w opened this issue Sep 24, 2024 · 3 comments

Comments

@xiaogonggong-w
Copy link

xiaogonggong-w commented Sep 24, 2024

image
Missing @coustomElement ('page-editor')

@doouding
Copy link
Member

doouding commented Sep 24, 2024

All the customElement decorators are removed because it is hard to tell which lit component is actually used during tree-shaking process. So we replace it with the effect function for each component to register component manually, so now if you actually need the component you should import the correspond effect function and execute it.

@xiaogonggong-w
Copy link
Author

All the customElement decorators are removed because it is hard to tell which lit component is actually used during tree-shaking process. So we replace it with the effect function for each component to register component manually, so now if you actually need the component you should import the correspond effect function and execute it.所有的 customElement 装饰器都被删除了,因为很难判断在 tree-shaking 过程中实际使用了哪个 lit 组件。所以我们为每个组件替换 effect 函数来手动注册组件,所以现在如果你真的需要这个组件,你应该导入对应的 effect 函数并执行它。

After I manually registered the effects function, I found that the doc-title could be rendered, but the page-editor would throw an error.
image

This is a demo of reproduction. https://github.com/xiaogonggong-w/blocksuite-demo

@doodlewind
Copy link
Member

You need to call the effects before initializing editors:

import { effects as blocksEffects } from '@blocksuite/blocks/effects';
import { effects as presetsEffects } from '@blocksuite/presets/effects';

blocksEffects();
presetsEffects();

// init editor container now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants