close
The Wayback Machine - https://web.archive.org/web/20210605231019/https://github.com/codex-team/editor.js/issues/1684
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

CRUD via block ID #1684

Open
nowakkamil opened this issue May 15, 2021 · 5 comments
Open

CRUD via block ID #1684

nowakkamil opened this issue May 15, 2021 · 5 comments

Comments

@nowakkamil
Copy link

@nowakkamil nowakkamil commented May 15, 2021

Hi,

First of all, I'd like to thank you for creating such a fantastic tool. It has been the core of my bachelor's degree, and I'm profoundly thankful for that. Currently, I've decided to combine CRDT (YJs) with editor.js as my degree thesis, but I'm facing some blockers now.

As the title suggests, I'm interested in having the opportunity to perform CRUD operations based on ID. This is vital, as the ID is the key in the YMap data structure shared across various clients. So, on the update triggered remotely, I have to propagate this update to the editor.js instance and, specifically, swap the block content. This is not possible with the current Core API (Blocks manipulation). It exposes only the getById() [#1667]. I reckon this might be in the nearest roadmap, as the creation, update, and deletion via ID will be the right step towards concurrent editing. Please let me know if this is feasible in the nearest future; I'm currently blocked, and I might have to consider alternatives.

By briefly analysing the codebase, most of the logic already has been implemented, and the Blocks Core API lacks the BlockManager.insert() invocation with id (and replace boolean - ideally used to signify replacement by id and not by index) - for the creation (and update).

Alternatively, as I'm facing time constraints, maybe you could recognise a different (faster) approach, as my thesis is the POC, and time is of significant importance to me. Any ideas would be welcome.

@ChasLui
Copy link

@ChasLui ChasLui commented May 16, 2021

Hi,

First of all, I'd like to thank you for creating such a fantastic tool. It has been the core of my bachelor's degree, and I'm profoundly thankful for that. Currently, I've decided to combine CRDT (YJs) with editor.js as my degree thesis, but I'm facing some blockers now.

As the title suggests, I'm interested in having the opportunity to perform CRUD operations based on ID. This is vital, as the ID is the key in the YMap data structure shared across various clients. So, on the update triggered remotely, I have to propagate this update to the editor.js instance and, specifically, swap the block content. This is not possible with the current Core API (Blocks manipulation). It exposes only the getById() [#1667]. I reckon this might be in the nearest roadmap, as the creation, update, and deletion via ID will be the right step towards concurrent editing. Please let me know if this is feasible in the nearest future; I'm currently blocked, and I might have to consider alternatives.

By briefly analysing the codebase, most of the logic already has been implemented, and the Blocks Core API lacks the BlockManager.insert() invocation with id (and replace boolean - ideally used to signify replacement by id and not by index) - for the creation (and update).

Alternatively, as I'm facing time constraints, maybe you could recognise a different (faster) approach, as my thesis is the POC, and time is of significant importance to me. Any ideas would be welcome.

You can fork and modify of source code, you need to implement

  1. block id
  2. add update(data) method for each Tool, because editorjs only has insert and remove methods, but no update method
    I am currently using Yjs in combination with editorjs to implement a collaborative editor, so I recommend using Yjs and prosemirror solution.
@neSpecc
Copy link
Member

@neSpecc neSpecc commented May 21, 2021

Understand. The Blocks ids is the new feature, so we haven't updated all the API methods for using id instead of indexes yet. But we need to do that.

You can try to implement it and open a PR.

@neSpecc
Copy link
Member

@neSpecc neSpecc commented May 21, 2021

How many time do you have?

@nowakkamil
Copy link
Author

@nowakkamil nowakkamil commented May 22, 2021

Thanks, @ChasLui and @neSpecc, for providing more context. I have been considering ProseMirror as an alternative, and comment from @ChasLui only cemented my decision.

Unfortunately, even after implementing other methods, I'd still need to take care of cursors, which seems to require more effort than implementing methods that use block ID. I wish I could pick this ticket, but I've got only a few weeks left. Consequently, I won't be of any help in the nearest future.

@ChasLui
Copy link

@ChasLui ChasLui commented May 23, 2021

Thanks, @ChasLui and @neSpecc, for providing more context. I have been considering ProseMirror as an alternative, and comment from @ChasLui only cemented my decision.

Unfortunately, even after implementing other methods, I'd still need to take care of cursors, which seems to require more effort than implementing methods that use block ID. I wish I could pick this ticket, but I've got only a few weeks left. Consequently, I won't be of any help in the nearest future.

We have implemented our own selection-based collaborative cursor, but we have also modified a lot of editorjs source code, making it impossible to merge the latest version of editorjs.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants