Skip to content
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

Preview does not show changes in article, unless the changes were saved before #36901

Open
phunsoft opened this issue Jan 31, 2022 · 18 comments
Open

Comments

@phunsoft
Copy link

Steps to reproduce the issue

  1. Write and save an article. Backend or frontend diesn't matter for this step
  2. Edit the article in the backend. DON'T save yet.
  3. Hit "Preview" button.

Expected result

The preview should show the changed article, despite the fact the changes haeve not been saved yet.

Actual result

The preview shows the last saved state of the article

System information (as much as possible)

Joomla 4.0.6
Linux 3.10.0-1160.49.1.el7.x86_64 #1 SMP
Template: Cassiopeia

Additional comments

@niharikamahajan02
Copy link
Contributor

I think it's better to save the article before clicking preview button.

@phunsoft
Copy link
Author

phunsoft commented Jan 31, 2022 via email

@richard67
Copy link
Member

If a "save" is required for "preview" to work, "preview" is useless.

@phunsoft You can save the article with unpublished state so people visiting cannot see it, but in the preview you can. I would not call this useless.

@brianteeman
Copy link
Contributor

@richard67 you can only do that if you are also logged in at the front end with permissions set to view unpublished articles

@richard67
Copy link
Member

@brianteeman I see ... not very comfortable, it seems. So this is a valid issue? But technically I have problems to imagine how we could show a preview without the article having been saved.

@brianteeman
Copy link
Contributor

Its a valid issue for me. Have the same problem obviously with the accessibility checker. @roland-d did try to resolve this before but it didnt complete

@niharikamahajan02
Copy link
Contributor

@brianteeman I see ... not very comfortable, it seems. So this is a valid issue? But technically I have problems to imagine how we could show a preview without the article having been saved.

yes that was a point I was also thinking about.

@niharikamahajan02
Copy link
Contributor

Is having a save as copy button going to help?

@richard67
Copy link
Member

Well, that I can't imagine how it can be done doesn't mean it can't be done.

Save as copy won't help here.

@niharikamahajan02
Copy link
Contributor

Ohkk . If it is a valid issue , I would think of a way to solve it then .

@phunsoft
Copy link
Author

If a "save" is required for "preview" to work, "preview" is useless.

@phunsoft You can save the article with unpublished state so people visiting cannot see it, but in the preview you can. I would not call this useless.

Well, if I unpublish the article, it becomes invisible to the public. I don't want to unpublish a published article, be it only temporaily. The odds will be a user needs this very information just at this point in time.

If it is not possible to implement a real preview with reasonable effort, then the preview button should be removed. Still better than what we have now. IMHO.

@phunsoft
Copy link
Author

Is having a save as copy button going to help?

Even more clumsy. I'd need to publish in some category only the editor has access to, look at the article, and if ok, change the category, unpublish the old article, then rename the new one, and finally modify menu entries.

@simbus82
Copy link
Contributor

simbus82 commented Feb 1, 2022

If a "save" is required for "preview" to work, "preview" is useless.

I understand very well what the OP says, and it's right. Do you ever used the preview tab here in Github?

image

This is what a "preview" has to do. I need a preview BEFORE saving. But in Joomla we can use versioning to obtain this, but semantically and from UX side the "preview" in Joomla is simply wrong.

@brianteeman
Copy link
Contributor

But in Joomla we can use versioning to obtain this,

No you cant

@brianteeman
Copy link
Contributor

. Do you ever used the preview tab here in Github?

Not really comparable

@simbus82
Copy link
Contributor

simbus82 commented Feb 1, 2022

@brianteeman, I think you didn't understand.

It is objective that the Joomla preview is a "fake preview" compared to any other system that includes some preview logic (and the Github example is striking, I see what will be rendered without saving anything).

I said that it can be done with versioning, on the user side: it's a fact that users uses the preview as a tool to "evaluate" whether what will be edited (not saved), will be correct or not.
With versioning I can go back after an edit, so in the absence of a real preview I can save a version, check the preview, and if I don't like it, go back to the previous version. This is exactly what the preview function should do, show something real BEFORE saving.

I was just providing a workaround for the end user, defending a conceptual error of the Joomla preview.
I didn't say that "at the development level" versioning is good for something to technically improve the preview.

@dgrammatiko
Copy link
Contributor

dgrammatiko commented Feb 1, 2022

But technically I have problems to imagine how we could show a preview without the article having been saved.

it's totally viable:

  • get the FormData from the current form
  • validate the data, if not valid return an error message
  • POST the data as JSON to the a new (the code that needs to be written) controller function
  • do a server side validation of the data and if ok then pass the data to the model and then the view

That should enable previews for non saved forms

caveats: The link IS NOT shareable as it's a POST and the data is passed as JSON...

BTW if the controller function is in place the versioning could also be done as rendered diffs instead of the funky form diff...

@phunsoft
Copy link
Author

phunsoft commented Feb 2, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants