Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

preview post extension_

245

Comments

  • imho live preview is the way to go. it's a pretty simple javascript and saves us the hassle of going back and forth all the time. :)
  • For text only comments at least, this wouldn't require touching the PHP at all. All it needs it a fancy javascript to latch onto the coments box onload, and then onchange it needs to (after creating the comment space if needed) changing the characters as needed. This is easy peasy (in my mind at least). I'll even take a crack at it myself sometime this week. Of course, getting the live preview for Html, Markdown, or any other funky kinds of formatting would be trickier...
  • Actually you get HTML preview for free! Just have the javascript tack the typed letters into a div as is and the browser will render the HTML immediately. You're right though that it gets a bit tricker when you want to filter HTML (the preview would not exactly match what actually gets posted) or when you want to parse markdown or somesuch. Me, personally, would be happy with a simple HTML preview for now because I primarily want to see where my lines wrap so I can do at least a bit of formatting :)
  • Lemme add my vote for a preview extension that supports not only text, but also html and markdown and bbcode etc
  • i think he meant if you edit your post to fix a typo or whatever within 30 seconds after it's posted, the post doesn't get the "edited" stamp. but if you edit it after the grace period expires, it does get the "edited" stamp.
    this is how basecamp handles things. seems effective to me. of course I also fall in the crowd of "never preview" and I'd hate to see the inherent simplicity of this forum fall to the wayside. of course that's why the extension system exists, but all the same I feel it's unnecessary.
  • Just to let you guys know, Im working on a live comment preview at this very moment. I have it working on replying to discussions - Just trying to sort it out for when you are creating a discussion. This probably wont be as simple an extension as the others though, just becuase a couple of attributes need to be added to the textarea tags to get it to work. You can see it working on my board ( http://bored.36-degrees.co.uk ) for replies (please dont fill my board with test posts!). It treats html as intended, but obviously not textile or markdown.
  • stuart, nice preview - but on FF for pc here, some hidden text saying 'Ads by Google' flashes up everytime I key in a letter! (That's the first time you add a reply, doesn't seem to happen if editing an existing message)
  • ok, cheers for that 3stripe, those Ads are oming out in about ten seconds, I could earn more being a rent boy, and that wouldn't be a lot. I've sorted out gettingit to work on the new discussion, just need to remember how now so I can let other do it!
  • Would somebody like to test this out for me, make sure I hav the instructions right and that it actually works. Cheers http://www.36-degrees.co.uk/assets/Live/
  • edited July 2005
    It works like a charm!
  • wocked, I'll add it to teh Wiki shortly.
  • Coo, the only thing that's kind of icky is that new updates will overwrite it. If you could make the extension edit the controls file for the user, it would be more everlasting.
  • I agree, but I'm really a designer, not a programmer. I wouldn't know where to start doing that!
  • There is a slight problem with the LP plugin. When the user presses enter to add another paragraph, LP just lumps it all into one paragraph.
  • This is something which is just going to have to be im afraid, unless anyone else has a way to parse linebreaks correctly. It will display them correctly when you use a BR tag using HTML input, but when it's plain ext, it lumps it all together as you described. In an ideal world it would be able to display HTML, plain text, Markdown and Textile correctly, but the processes for these come after the posting, so you cant see that before you actually submit the comment.
  • ithcyithcy New
    edited July 2006
    fantastic.

    to fix linebreaks, replace Live.js with this:

    function ReloadTextDiv() { var NewText = document.getElementById("DynamicText").value; var regex=/\r?\n/g; NewText=NewText.replace(regex,"<br />\n"); var DivElement = document.getElementById("TextDisplay"); DivElement.innerHTML = NewText; }
  • (i haven't tested that in safari/opera but it should work)
  • Works perfectly in Firefox. Thanks tons.
  • I'll add those changes to the file linked from the wiki, cheers itchy. Seems like this was a popular request, glad its working well.
  • edited August 2005

    I fiddled with this, and yes it works. It would be nice if it previewed Markdown and such, but I realize that this would make things a whole lot more complicated. One problem, and unless I'm blind no one has pointed this out -- since you're adding an id to the , it breaks toggling between small and large input boxes. The function that needs some work is ToggleCommentBox(), and it should handle both the original setup for this form, and the new one with Live Preview installed. I'll take a look at it myself, but Javascript is not my forte.

Sign In or Register to comment.