-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for Plain PHP or Laravel #32
Comments
Yes, absolutely! The editor itself is agnostic of any backend. It uses an "adapter" to implement "communication" with a backend. In fact, you could even use blökkli without a backend to just render blocks (without having an editor at all). While obviously not really useful, it should help a bit understanding how it's all set up. Check out the docs about the data structure that blökkli expects: https://docs.blokk.li/data-structure/components.html With these examples you could already render a flat list of blocks on a page. The concept for nested blocks is described here: https://docs.blokk.li/data-structure/nested-blocks.html Now, to actually "connect" your backend, you would have to write an adapter. There are quite a lot of adapter methods obviously (basically any interaction in the editor that mutates some kind of data requires an adapter method). This is done by creating a file called There is an example of a minimal adapter in the repository: https://github.com/blokkli/editor/blob/main/playground-minimal/app/blokkli.editAdapter.ts and a quick description of it in the docs: https://docs.blokk.li/adapter/minimal-example.html The good thing is is that each adapter method that mutates some kind of data is expected to return the entire mutated state afterwards. Through Vue's reactivity this is then updates accordingly in the editor. So once you have a minimum adapter implemented, adding support for additional features should be pretty trivial (on the blökkli side). What will be more complicated is to handle all of that in the backend; specifically things like undo/redo (though that is also optional, you could directly mutate them in the backend and save them immediately). So the editor itself does not actually do any undo or redo. It just renders an undo button and then calls the adapter method that does the undo and is expected to return the state with the undo applied. This example only implements methods that would allow you to add new blocks or move existing blocks. The logic to actually add or move a block would then be implemented by your backend. The adapter methods would basically only issue API calls. The docs around the adapters are not quite there yet, especially for the more complex things (such as reusable blocks / library). |
Thanks I am checking it, |
I love the editor. I want to know if is it possible to use in plain PHP as backend.
The text was updated successfully, but these errors were encountered: