-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Feature possibilities to merge blocks of different types #2564
Feature possibilities to merge blocks of different types #2564
Conversation
I like the idea of this feature. |
Hey @neSpecc, I updated the code to use the conversion config (this make a lot of sense in fact), should I add test cases for this? |
…ub.com/OnepilotHQ/editor.js into feature/merge-block-of-different-types
Cool. Yes, tests are needed |
@neSpecc I added only one test, but I don't see what more I can test 🤔 On another note, I think this feature could be considered breaking changes for some users, maybe a flag on the editor config should be toggled to make it work just in case? |
@neSpecc Hey any update on this PR? |
…dex-team#2564 Feature possibilities to merge blocks of different types codex-team#2564
…ub.com/OnepilotHQ/editor.js into feature/merge-block-of-different-types
@neSpecc I've made the changes, and also updated the change log |
Can you give me some indication on how to reproduce the issue, on my side, the caret seems to be at the right place Screen.Recording.2024-03-23.at.23.17.50.mov |
Try merging blocks of different types. For example |
Hey, @GuillaumeOnepilot. Would you open your branch for pushing? I have resolved issues with caret (Safari-related): partially in Paragraph tool editor-js/paragraph#86, partially in editor. Also, we noticed that there was no sanitising on merge, so I've added it as well. |
@neSpecc For some reason, the allow edit from maintainer checkbox just doesn't show up |
It's strange. Do you have enough rights in the fork repo? |
I made the fork but it's under my company organisation, let me check but I'm pretty sure that I'm a admin |
I don't see anything on the fork that could help me, do you know by any chance what should I change ? |
I've recreated a PR based on your commits with adding mine. |
Shipped by #2671 |
For some context, I have a need for potential custom blocks to accept other different types of blocks to be merged in them (think Notion behavior), here is an example from Notion:
Screen.Recording.2023-12-16.at.21.51.38.mov
My solution is to add a new static property which contains the block's type that can be merged inside the target block, I also added the type to the merge functions in case some blocks would want to make conditional merging.
Here is the result of my implementation (which I agree is a bit weird, in some sense because who would want to merge a paragraph into a title, but who knows):
Screen.Recording.2023-12-16.at.21.56.30.mov
and with my specific use case (custom blocks):
Screen.Recording.2023-12-16.at.22.02.21.mov