lotion
lotion copied to clipboard
Set block's unique id for comment and history
Hi, Thanks for your great open-source project 😍. I have a challenge with this editor, maybe you can help me.
I want to set and save the block's unique id in DB for some features like comments or the block's history. Do you have any idea about that? Notice that text or structure changes shouldn't change id.
Thanks.
To create a history I think that you can use command pattern. https://refactoring.guru/design-patterns/command this way we create less dependency between storing and the features, and can handle this as different and independent features
https://github.com/Dashibase/lotion/issues/9 check this talking about history
Thanks, but i don't mean real-time history or browser history, I want to save comments and text changes history in the database and I need unique if for blocks.
If I understand @faridfr correctly, what you are essentially requesting is for lotion to include a unique id in the blocks right?
For example,
current json
{
"type": "H1",
"details": {
"value": "Get Started"
}
},
{
"type": "DIVIDER",
"details": {}
},
{
"type": "TEXT",
"details": {
"value": "👋 Welcome! This is a private page for you to play around with."
}
},
to be updated to something like
{
"id": "uniqueId1",
"type": "H1",
"details": {
"value": "Get Started"
}
},
{
"id": "uniqueId2",
"type": "DIVIDER",
"details": {}
},
{
"id": "uniqueId3",
"type": "TEXT",
"details": {
"value": "👋 Welcome! This is a private page for you to play around with."
}
},
Exactly @lyqht , Of course, we must be aware that the changes on the blocks should not change their ID, because of losing comments and other features on the blocks.