Perfect Preview

Last night, I uploaded a patch for WordPress 1.6 that adds a feature I like to call “Perfect Preview” (patent pending… not). You know how when you clicked “Save and Continue Editing,” on reload, you would see a preview of the post below the editing area? A lot of people didn’t like that it didn’t use the CSS and structural layout of their actual template. They asked me if there was a way to make the preview look just like it would look on the main blog. “Yeah, that probably could be done,” I said, passively. Well, last night I actually did it. I’m embarrassed at how easy it was. See, I didn’t have to do anything special like write code to make sure that you are logged in and can view the draft in the actual blog, because WordPress already does it for me! All I did was rip out the old preview and put in an <iframe /> element that calls the current post being edited. Bam. It works! Now, when you click “Save and Continue Editing” or go in and edit an old draft or previously published post, you’ll see a picture perfect preview. Basically, it is a “window” to the post as it looks on your blog. It got committed to WordPress 1.6 SVN last night.

So, that took me 3 minutes. The only part that took some work, was the quickjump links I added. See, except on the most massive monitors, the preview is going to be down below “the fold,” so you’d have to scroll to it, which is cumbersome. After you “Save and Continue Editing,” you’ll probably want to see what it looks like! So I added a “preview ↓” link at the top right hand corner of the “Write Post” section, and an “edit ↑” link at the top right hand corner of the “Post Preview” section. They line up identically, so that after clicking “preview ↓” you don’t even have to move your mouse… it will already be hovering over the “edit ↑” link, so you just have to click again to return (at least, in KHTML- and Gecko-based browsers… let me know if there are any browsers that have issues with it). There’s only one nagging issue, and that is the height of the preview. I currently have it at 600 pixels, but am thinking that it might be better if it just expands to show the whole page. Let me know your thoughts on this.

WordPress.com appears to be running on a slightly modified fork of WordPress 1.6 (or is a parallel project), so it seems to get all of WordPress 1.6’s improvements quickly. Logging in this morning, I’m happy to see that the Perfect Preview feature is now present for WordPress.com! I have to say, contributing to WordPress is a rewarding experience, but is rather limited or delayed. That is, not very many people are running the latest code from SVN and are updating nightly, so most of my patches won’t be enjoyed by a significant number of people until WordPress 1.6 launches. But now that we have WordPress.com, there is an instant effect. I don’t know how many blogs are on here already, but I’d guess that it’s in the hundreds and will quickly be in the thousands, so it makes me very happy to see that so many people can benefit so quickly from all the hard work that is going into WordPress 1.6 (that is, everyone else’s hard work… I give up as soon as I break a sweat🙂 ).

3 thoughts on “Perfect Preview

  1. Pingback: 665cada84e00

Comments are closed.