mindrevolution / umbraco-editorjs

Editor.js for Umbraco 8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How much contribution is too much?

leekelleher opened this issue · comments

Hi @esn303!

I enjoyed our discussions at CG19, and after seeing your recent appearance on umbraCoffee, I've been exploring your Editor.js property-editor implementation.

As I was going through the code, I started making tweaks... and then got carried away - changing namespaces, filename, restructuring things.

I fear that it would be overwhelming to send it over as a single pull request.
Which is the reason for my question, how far would you like any collaboration to be?

From playing around with Editor.js and looking at the configuration for each block, it is tempting to really "go to town" on it. It would be crazy powerful. 🚀

For now, I've push my experimental changes up to my fork, in a develop branch.
https://github.com/leekelleher/umbraco-editorjs/tree/develop

Feel free to take a look (if you have time) ... I'm happy to cherry pick anything (everything) from it and send them as bite-size pull requests.

Cheers!

Further experimenting... this time on the frontend, with partial-views.

Using Bootstrap 4, I added partial-views for each of the default blocks...
https://github.com/leekelleher/umbraco-editorjs/commit/78e1e9bc6cbcf64e917ec32388ac94ce92b8aa44

I didn't commit my main doctype/template, but here's the gist of it...

@{
    var editorjs = Model.Value<Our.Umbraco.EditorJs.ValueConverters.EditorJsModel>("editorJs");
}
<div class="container">
    @foreach (var item in editorjs.Blocks)
    {
        <div class="row">
            <div class="col">
                @Html.Partial($"Blocks/{item.Type}", item)
            </div>
        </div>
    }
</div>

This could then follow a similar convention to what we have with the Grid partial-views, to make compatible with other CSS frameworks.

For Bootstrap 4, I used the CDN version...

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

In terms of the ValueConverter. You had mentioned that the idea of leveraging IPublishedElement, unfortunately I can't see how that would work, given that we'd need a DocType to be associated with each Block type. The way I currently have it - EditorJsModel has 2 properties, Type and Data, which appears to be the standard schema for Editor.js blocks. Then it'd be up to each individual block's partial-view to handle it's own data as it needs to.

I'm sure there could be ways to further strongly-type them, but currently feels (to me) a little prematurely idealistic.

@esn303 I did more work on the editor last week. All the latest is up on my fork: https://github.com/leekelleher/umbraco-editorjs/tree/develop

Thank you for the commit rights, it is appreciated! ⭐️
I generally prefer working with branches/pull-requests, so that everyone (e.g. maintainers), are on-board with any decisions. Which is why I haven't pushed anything over yet.

Let me know how you'd like to progress on this. I'm happy to schedule a demo, to talk you through my changes/ideas.

Hey Lee,
thanks for all your work so far. 👍 I am back at work tomorrow and will reach out after I have caught up with everything you did.

Closing this ticket off.

I guess the answer to my original question is... CONTRIBUTION ALL THE THINGS!

33twve