vigetlabs / colonel-kurtz

A Block Editor
MIT License
319 stars 33 forks source link

Preview Mode #162

Open solomonhawk opened 4 years ago

solomonhawk commented 4 years ago

?

nhunzaker commented 4 years ago

We decided that CK shouldn't do a preview mode because it ultimately isn't responsible for rendering content.

Our first attempt used a double-buffered iframe on form change to "live reload" a page whenever something changed. It worked pretty decently:

https://github.com/vigetlabs/active_versioning_workflow/blob/live-preview/app/assets/javascripts/active_versioning/live-preview.js

This can actually be really simple and effective if you do things like restore scroll.

solomonhawk commented 4 years ago

I recall this work and it makes sense to me for CK not to provide a complete solution to this. I was thinking there might be some machinery that makes sense to include inside CK (similar to the solution you shared above) to facilitate easier integration of this feature on projects.