-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
How to update some blocks, not all. #1074
Comments
Hi @hughfenghen |
@gohabereg Good, thanks~ |
Hi @hughfenghen I've opened a #1075 PR with Block API. However, at the moment we can't provide a method to update a certain block, as data passed to the Tool constructor. So to update it, we need to construct the new Block with updated data and replace the old one. I don't think this approach is the best one, so we need to design a block update flow and describe it with APIs and docs. |
I tried to refactor some code from render method. But when I click Edit from settings part, the edit UI show and hide immediately and show the rendered result. Maybe I should wait for the new feature? scenario: a textarea to edit KaTeX. here is the js file: https://gist.github.com/taurenshaman/3cd1dc489defe2999c27fdcc1140ceea demo: https://taurenshaman.github.io/demo/editor@codexteam+katex.html?v=3 |
Hi @gohabereg. Thanks a lot for the PR! That's exactly what I need. Only one question, how can I use it? I tried to call updated https://stackblitz.com/edit/angular-editorjs-insert?file=src%2Fapp%2Fapp.component.ts |
is there any way to solve this problem |
i need it too |
👀 |
2021-03-20.11.49.39.movIf you update all the blocks, the page will jump, so the user experience is very bad let block_data = await this.editor.save();
block_data = _.cloneDeep(block_data);
let find_index = _.findIndex(block_data.blocks, x => {
return x.data.meta_data._id == a.data.meta_data._id;
});
let old_info = block_data.blocks[find_index];
let new_data = _.cloneDeep(old_info);
new_data.data = _.cloneDeep(a.data);
block_data.blocks[find_index] = new_data;
this.editor.blocks.render(block_data);
Is there any way to execute a plug-in function from the outside? For example, a function of the plug-in is responsible for local updates, rather than re rendering the entire component |
I think this is a good feature request! I approach to use the diff library: https://github.com/kpdecker/jsdiff |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi, i know editor.render() can update all blocks, Is there any way to update only a certain block?
I see from the source that BlockMananger may be able to do it, but it is not a public API.
If editor.js can get or update specific blocks, it may be beneficial for collaborative editing and performance.
The text was updated successfully, but these errors were encountered: