craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.2k stars 617 forks source link

Inserting Matrix-like Blocks Within a WYSIWYG Editor #3238

Open jasonmorehead opened 5 years ago

jasonmorehead commented 5 years ago

Without a doubt, Matrix is one of Craft's killer features, and is incredibly useful as a way to organize a site's content -- especially from a developer standpoint. And though I think it's still pretty elegant from a writer/editor standpoint, I think it could even be a bit more elegant.

I've been thinking about this in light of my own blog, which runs on Craft using Matrix blocks. A sample entry might consist of the following blocks:

But say I want to insert an image block in the middle of the first text block. Right now, I'd have to create an additional text block in the correct position, and then cut and paste the text from the first text block into the new one. Then I can add an image block between them.

This isn't a huge deal, but as I frequently edit and rearrange blocks in the course of creating an entry -- especially one that's longer and more involved -- having to cut up my text into blocks in the UI can become a bit of a chore.

But with this approach, I'd simply insert an image block between the paragraphs (since each paragraph would essentially be a self-contained block). I'd still have all of the benefits of the current Matrix approach (e.g., complete control over front-end markup, granular control via Matrix block fields), but a more straightforward and elegant writing experience, as well.

I realize this could get messy because Matrix blocks can have WYSIWYG fields, and then the question becomes whether those WYSIWYG fields also have the ability to contain content blocks within them. So maybe this is just limited to one level.

And FWIW, I don't see this as quite the same feature as nested Matrix fields (#812) or hierarchical Matrix fields (#827). There are some similarities, but I see this as more like Statamic's "Bard" fieldtype, the recently released Ghost 2.0, or even CKEditor's Block toolbar (i.e., an extended editor interface) than anything else.

brandonkelly commented 5 years ago

And FWIW, I don't see this as quite the same feature as nested Matrix fields (#812) or hierarchical Matrix fields (#827). There are some similarities, but I see this as more like Statamic's "Bard" fieldtype, the recently released Ghost 2.0, or even CKEditor's Block toolbar (i.e., an extended editor interface) than anything else.

Yep. We’re definitely inspired by those fields (as well as Gutenburg).