-
Notifications
You must be signed in to change notification settings - Fork 38
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
[UX] Bring back node preview #3062
Comments
I like how GitHub has a preview tab that doesn't require saving first and is easy to switch back and forth. Is something like that possible? |
This is normal when content of node edited under admin theme, so we have another context of styling. What we expect to show in this preview? |
I'd expect a responsive preview of the whole page (not only the edited content) in the look and feel of the active frontend theme. Maybe the preview page can be displayed in an iFrame. Recently I saw an interesting Drupal responsive preview module but haven't tested it so far: https://www.drupal.org/project/responsive_preview |
@quicksketch @jenlampton was looking at the initial discussion about how D8 got live previews https://www.drupal.org/project/drupal/issues/1510544, where you both commented. We have
Would that work? |
Did it, mostly copying Drupal. |
@jenlampton here's a (cheeky) suggestion. The issue of poor previews in D8 was considered a critical bug. Can we consider no previews at all in Backdrop also a critical bug and fix it for 1.9? |
Nice try @docwilmot ;) We considered the inaccurate previews a critical bug in Backdrop too, which is why we removed them. The critical bug has been solved. Now what we have is a feature request (and one that had been relegated to contrib first too, IIRC?). As soon as we have a solution we can slate it for the next minor release for core. I have a feeling something as important as previews will need to add/change enough about core that @quicksketch will want extensive testing, and it will be classified as a feature. But, Perhaps 1.11?
Ooh! sounds like we maybe close? Jen goes and plays with new preview |
My initial feedback is very positive! The preview works as expected, and in the correct front-end theme! It needs some UX cleanup, but it's a lot closer than I expected :) Nice work @docwilmot!! I'm not sure how much my initial reaction has been colored by past drupal experience (probably a lot) but here's my initial feedback:
edit: switched first and last items for order-of-importance |
Didnt think you'd fall for that.
Ughh, that's like so 2006! 😄 |
One small observation: I was previewing a post (let's say "Post One") and noticed its path |
@olafgrabienski good point, and this was considered, as mentioned in #3062 (comment) above. For a new node, without yet a node ID, we could assign a random unique ID (the initial D8 patch just used But then if you navigated away from the preview, unless you remembered what the unique ID was (unlikely if is This would be a reasonable alternative, as it would make 'previews' more disposable - if you dont like what you see, just This PR probably doesnt help much with the initial alarm but at least a new user would quickly learn, if I navigate away, just go back to Advantages both ways, but less complexity this way I feel. Other opinions welcome though. @klonos? Edit: to your actual point, the only way to get an |
@docwilmot I see the advantage of the current PR and the hurdles regarding the node ID. Actually, I was mainly concerned about conflicts between different editors: What would happen if Editor A adds "Page one" and previews it while in the meantime Editor B adds another page. I guessed that Editor B would also end up in the "Page one" form of Editor A. But I've tested it now in the sandbox site, and everything seems fine: Editor B is able to add a page in its own form. (How does that work, btw?) |
Understood. |
@jenlampton @quicksketch the only way (I can think of) to get a path to use a layout that is not explicitly defined for it (ie programmatically force a different layout) is, coincidentally, to use the new
This should work normally but I'm not sure if our preview URLs of I am actually wondering if special-casing node previews in Layout module would be simpler than all this, plus it really wouldnt do to have the preview layout in the layout list anyway. Or if you had other ideas. |
I haven't tried out the sandbox yet, it sounds rather exciting though. :) Could we simply assign the node an ID when the preview is initiated? In WordPress, drafts are saved automatically as the content is created. I would think that a combination of auto-saving and then just showing the unpublished node page would achieve a nearly perfect preview. Essentially just streamline the normal approach of posting an unpublished node, viewing it, and then publishing it. We currently have some problems in Backdrop that required fields must be entered before the form can be saved. Ideally we'd find a way to correct the dependence on the validation layer to tidy-up the data format, and make it so that content could auto-saved (or previewed) even before it was complete. Full validation of data on input would only be required when publishing the content. |
@quicksketch FWIW the Save Draft module has an option to allow drafts to be saved even if required fields are not entered. Not sure if that is helpful here or not. |
Oh wow, didn't think you'd lean that way after reading that long issue on Drupal. This would essentially be Save Draft in core as @laryn suspects, but with a "Preview" button instead. Not sure the implications. |
Personally, I often just visit the unpublished node page instead of using a preview, so I like this approach very much. |
Had a look at how Wordpress does things. They have revisions in multiple states and the autosave saves in a "preview" state, not as live nodes. We dont have that, and we have no way to let modules know that our "preview" is not a save. I personally dont like the idea of saving nodes before they are ready. Thinking of all the contrib modules which are set to do things when a node is created: messaging modules, ecommerce modules, Rules, and goodness knows what else all firing off when you prview a node. To start having users "saving" nodes without knowing that this is what theyre actually doing seems dangerous to me. This is something which should either follow an update to our revisions system (see https://www.drupal.org/project/drupal/issues/218755?) or in v2.0 when we can warn module builders of such a significant change. My PR begins to provide essentially the same ability to view a node in close to the live state, and we can do it now. |
It was the "close to" problem that got previews removed from core in the first place. We've got to figure out the layout bit in one way or other before this can get in. Maybe we can fake it in another way to generate a node context for layouts to use? For the record, I'm also on the fence about adding auto-save before 2.0 as that does sound like a big change that could have serious implications. |
Note I'm not even defending this PR or suggesting its the right way. I'm open to suggestions. But using the Tempstore approach is what D8 did, and it works well; it is essentially the same node viewed in the required view mode. Thats no where close to the madness of D7 previews.
This is actually what I was asking above about special-casing. We could circumvent all of the custom
That would work. |
Fixed so preview now uses a node layout if available. |
I like where it's going. It works well enough for most people I bet. |
Thanks for having a look. This is a technical preview still. To be done:
But I think this, as you say, is a good enough approach, for now. |
Thanks @herbdool. Theres still this persistently failing date test that doesnt happen locally. I'm sure something like this has come up in the issue queue before, but I cannot remember where. (and I cant fix it if I cant replicate it). Annoying. |
Maybe try disabling Date module locally? The logic for handling date fields changes in the node form depending on whether it is enabled.
Let's continue talking about options for this in #1528, which is a closely related issue. |
It looks like @docwilmot already created the new And for whatever reason, that date failure seems to be caused by these changes. We've got lots of other PRs being updated that don't have these same failures. |
Pushed again |
I'll see if I can suss out the source of the failure. We can't commit this if it's breaking the tests. |
I see the exceptions locally when I test it too. |
Looks like the source of the problem is that our date fields don't handle default values properly when the fields are hidden (not rendered). So for the sake of passing these tests, we just need to make the Created date field visible to the testing user by adding the "administer nodes" permission. We can make a follow-up for that new issue. I'll push a commit to the PR to fix up the tests. |
I had some trouble rebasing the PR and somehow broke it... now it can't be reopened. I made a replacement PR at backdrop/backdrop#2290. |
Tested again and it looks good. |
Great. As this has already been RTBC 3 times, with these issues addressed we're good to go. I think we will need to tidy-up the CSS further, but we already knew that. I've merged backdrop/backdrop#2290 into 1.x for 1.11.0. Thanks everyone! |
We removed node edit previews early on, but haven't agreed on how to re-introduce it. I think this is expected functionality.
Lets decide how to bring it back.
PR: backdrop/backdrop#2174PR: backdrop/backdrop#2290
The text was updated successfully, but these errors were encountered: