38

I am editing a question and would like to preview my changes prior to saving. I can see how the page will look and can optionally hide this preview.

However, I would like to see the actual changes that I made; that is, the diff with the red struck out parts and the green newly inserted parts (as is shown when you are comparing versions). A side-by-side and side-by-side markdown preview would be helpful too.

To make sure the basic usage doesn't change, we could by default list a normal preview, like it is now. There could be buttons to change to inline differences, side-by-side differences and side-by-side markdown differences. This could look the same as it does when looking at revisions.

This would make it easier to see the changes, hence preventing an additional edit step. This also helps you write the edit summary, so that you don't forget to mention an important change you made.

21
  • 4
    I'm not sure what you mean; what are you looking for that the preview right below the edit box doesn't provide? Commented Mar 18, 2012 at 20:24
  • 4
    I would like to see the diff - with green and red that I can see after I saved the edit
    – false
    Commented Mar 18, 2012 at 20:26
  • 3
    @false: Can you provide the reason you feel this is important? The diff is not what matters, the final outcome is all that does. What do you mean by "to prevent an additional edit step"?
    – user159834
    Commented Mar 18, 2012 at 20:30
  • 10
    Ah, I guess that could be useful, to see if you've accidentally deleted something and forgotten about it Commented Mar 18, 2012 at 20:32
  • 4
    @Madmartigan: If edits are a little bit larger though trivial (like name formatting that otherwise would make the text less readable), this feature would be very useful.
    – false
    Commented Mar 18, 2012 at 20:37
  • 2
    (Nice edit, @Adel!)
    – Arjan
    Commented Mar 18, 2012 at 20:55
  • @Camil As you deleted a duplicate question. I suggest you that instead of deleting, you should vote/flag it to close. So that feature users may get link of this question from your question. :)
    – Himanshu
    Commented Apr 2, 2013 at 7:03
  • 1
    @Camil I agree with what hims056 said, didn't mean for you to delete your post and even upvoted it. Nothing wrong with dupes. Commented Apr 2, 2013 at 7:22
  • @hims056 Sorry, but I can't find the post anymore. Shall I just post a new one?
    – user65560
    Commented Apr 2, 2013 at 8:13
  • @CamilStaps - Nah. Don't post duplicate question once you find the original one. Just remember it in the future. :)
    – Himanshu
    Commented Apr 2, 2013 at 8:15
  • @CamilStaps: Your edit is exactly what I thought of today!
    – false
    Commented Apr 3, 2013 at 8:58
  • 1
    This could do with a pretty picture :)
    – hayd
    Commented Apr 3, 2013 at 9:14
  • 1
    @hayden: Only hand-drawn pictures, please!
    – false
    Commented Apr 3, 2013 at 9:23
  • Also see : Add an option for side-by-side diff before posting an edit
    – guntbert
    Commented Feb 21, 2016 at 12:41
  • Is there any progress on this feature request? Diffing files before a commit is something I do every day. Wikipedia has had this for 15 years. I hate posting an edit without being able to see the diff.
    – isanae
    Commented Dec 22, 2016 at 5:38

1 Answer 1

11

I think this is a good idea. I don't have to explain what the advantages would be; the question covers that enough, I think. There are two things I'd like to do with the answer: giving an optional design and discussing the developer's pain to create this.

The design

It could look like this (I used the Electrical Engineering site for these images):

enter image description here

As you can see, I added some options directly above the preview: inline, side-by-side and side-by-side markdown. This is exactly the same as when you're viewing revisions. Because I added a normal option, you won't lose any features you have now!

Now, let's see how it looks when viewing it with, for example, the side-by-side view:

enter image description here

The developers

I assume the revision change views are done with the pecl Text-Diff package or its newer version. That means the changes are calculated at the server. That means, there are three options (I think):

  • Make or get a JavaScript version of the package. There appears to be something, but I'm not sure. It might always look a bit different then the revisions, but that wouldn't be a huge problem.

  • Continuously use Ajax calls to the server, like every 10 or 15 seconds. I wouldn't recommend it, it would increase the server load a lot, probably.

  • Use an Ajax call, but on demand. So only call the server when someone actually clicks on a side-by-side button. I (and the OP) think this is your best bet, but who am I.

Conclusion

I don't have to say why this is a good idea, the arguments are explained in the question already.

Given my design ideas, the user won't lose the preview option he has now (just the new text). The design idea I gave only adds features, without really changing an existing feature.

I'm not sure how much it will take to integrate the ideas. Since the revision changes are calculated on the server and the standard preview is pure JavaScript (I think), it might get tricky.

5
  • 2
    #3, but only on demand, if it is a diff.
    – false
    Commented Apr 8, 2013 at 17:30
  • 3
    ... and delete automatically the diff if it is no longer current
    – false
    Commented Apr 8, 2013 at 17:31
  • @false useful addition!
    – user65560
    Commented Apr 8, 2013 at 17:31
  • 4
    Pecl extension on a .net webapp? Nope. Commented Jun 7, 2013 at 18:24
  • This needs to happen.
    – elixenide
    Commented Mar 10, 2014 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .