none
Insert codeblock no longer formats code as cleanly as v.3 - re-edit causes additional line breaks to be inserted.

    Question

  • I attempted to add a block of example code by clicking on the 'insert code block' and pasting in this javascript.

    //Remove close opportunity menu option if grossprofit field is empty
    
    
    
    var GrossProfit = crmForm.all.new_grossprofit.DataValue;
    
    
    
    if (!(GrossProfit)) {
    
    
    
      var CloseOpportunity = document.getElementById("_MIcomplete");   CloseOpportunity.style.display="none";
    
    
    
    }
    
    
    
    
    
    
    
    
    I previewed it in the insert code block window and then inserted it - When it came in it was it TINY text without the color coding that I expected. (the color didn't show up until the post was saved.)

    After saving it I had to re-edit to fix some spacing problems that showed up - each time I saved / re-edited additional breaks were added between each line of code.

    Any improvements on this functionality (or return to v3 style of handling codeblocks) would be appreciated.
    Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell
    Sunday, March 29, 2009 11:08 AM

Answers

  • Yes, the "tiny" issue will be fixed this week.

    For the other issue, let me explain what we're doing now. When you use the Code Tool, we allow preview, when you actually insert from there we insert a <pre lang="xxx"> where lang is the source code language. So in the editor, and in the DB we store the PRE/unformatted data. When the page is rendered, we format those code blocks with all of the markup. This has the advantage that if we want to improve the styling/formatting of a block of code all we need do is update the formatter. In the previous versions, the formatted markup was stored which made it difficult to work with for many reasons.

    That leaves the Edit issue, we intend to fix that in an upcoming release. Current thinking is, when you edit a post that has code we first need to make an ajax call to get the unformatted post and then bring up the editor.

    As a workaround right now, if you want the unfomatted post html you can actually right click on edit and open in new tab/window which will bring up a simple textarea edit page. Not great, but workable :)
    Rob J, Forums Dev
    http://twitter.com/robjoh
    Sunday, March 29, 2009 4:15 PM

All replies

  • Yes, the "tiny" issue will be fixed this week.

    For the other issue, let me explain what we're doing now. When you use the Code Tool, we allow preview, when you actually insert from there we insert a <pre lang="xxx"> where lang is the source code language. So in the editor, and in the DB we store the PRE/unformatted data. When the page is rendered, we format those code blocks with all of the markup. This has the advantage that if we want to improve the styling/formatting of a block of code all we need do is update the formatter. In the previous versions, the formatted markup was stored which made it difficult to work with for many reasons.

    That leaves the Edit issue, we intend to fix that in an upcoming release. Current thinking is, when you edit a post that has code we first need to make an ajax call to get the unformatted post and then bring up the editor.

    As a workaround right now, if you want the unfomatted post html you can actually right click on edit and open in new tab/window which will bring up a simple textarea edit page. Not great, but workable :)
    Rob J, Forums Dev
    http://twitter.com/robjoh
    Sunday, March 29, 2009 4:15 PM
  • Code blocks used to have alternating row background colours (white/light grey) which made reading the code much easier... am I right in thinking that feature has disappeared?
    Sunday, March 29, 2009 4:39 PM
  • Thanks - sounds good. - I'll use the workaround, but will look forward to the fix.


    Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell
    Sunday, March 29, 2009 6:15 PM