bustle/mobiledoc-kit

Markup inside cards?

Closed this issue · 4 comments

Is there a proposed solution for markup inside cards? I suppose you could just nest another mobiledoc editor, but is this a viable solution?

Hey @pmelab,

The point of cards is that they're completely content agnostic and you can do whatever you want with them. People have markdown and HTML markup cards for instance, all you need to do is parse whatever content is edited through a markup renderer when the card is in preview mode and for rendering on the frontend.

More information is available here: https://github.com/bustle/mobiledoc-kit/blob/master/CARDS.md

Thanks for the quick answer! But I still don't get it.

Take the frontpage demo of CKEditor as an example:

screen shot 2017-08-06 at 07 22 43

The whole figure would be a card and the caption another rich-text element that just allows em and strong. How does the rich text get into my payload? Do I have to load another editor instance inside my cards edit-form? Or is mobiledoc able to detect "nested" markup areas?

I'm sorry, I couldn't find any examples that are close to this case. Probably I'm missing something.

Hey @pmelab,

The beauty of cards is that you can put anything you want inside them, so you can nest another mobiledoc editor if you wish or something more light weight. People have been known to nest mobiledoc editors inside cards as well as more specific purpose WYSIWYG editors or markdown.

The example above seems pretty simple, just an image with a textarea or input field underneath it, no need to go for a rich text editor, if you just want em or strong support then a simple markdown parser might suffice? Even regex replacing of *em* and **strong** (and maybe []()) could do the trick.

Yes, thats a very simple example, but we've got a couple of more complex ones. Also with the requirement of somehow nest cards within each other. But ...

... so you can nest another mobiledoc editor if you wish or something more light weight ...

... answered my question perfectly, thanks a lot!