Uploaded image for project: 'jboss.org'
  1. jboss.org
  2. ORG-870

Editor should not insert non-breaking spaces in code blocks (SBS bug)

XMLWordPrintable

    • Medium
    • Hide

      To reproduce:

      1. Create a document.
      2. Click HTML
      3. Paste this code (make sure it's formatted, if JIRA strips the formatting)

      <pre>public class PersonBean {
         private String name;
      
         public String getName() {
            return name;
         }
      
         public void setName(String name) {
            if (name != null && name.length() > 25) {
               name = name.substring(0, 25);
            }
            else {
               this.name = name;
            }
         }
      }</pre>
      

      4. Click "Show Full Editor"
      5. Highlight code and syntax highlight Java
      6. Click HTML
      7. Observe this mess:

      <pre class="jive_text_macro jive_macro_code" jivemacro="code" ___default_attr="java">public class PersonBean {
      &nbsp;&nbsp; private String name;
      
      &nbsp;&nbsp; public String getName() {
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return name;
      &nbsp;&nbsp; }
      
      &nbsp;&nbsp; public void setName(String name) {
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (name != null &amp;&amp; name.length() &gt; 25) {
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = name.substring(0, 25);
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.name = name;
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
      &nbsp;&nbsp; }
      }</pre>
      

      It takes me many times longer to do anything because I have to deal with this garbage.

      Show
      To reproduce: 1. Create a document. 2. Click HTML 3. Paste this code (make sure it's formatted, if JIRA strips the formatting) <pre>public class PersonBean { private String name; public String getName() { return name; } public void setName(String name) { if (name != null && name.length() > 25) { name = name.substring(0, 25); } else { this.name = name; } } }</pre> 4. Click "Show Full Editor" 5. Highlight code and syntax highlight Java 6. Click HTML 7. Observe this mess: <pre class="jive_text_macro jive_macro_code" jivemacro="code" ___default_attr="java">public class PersonBean { &nbsp;&nbsp; private String name; &nbsp;&nbsp; public String getName() { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return name; &nbsp;&nbsp; } &nbsp;&nbsp; public void setName(String name) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (name != null &amp;&amp; name.length() &gt; 25) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = name.substring(0, 25); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.name = name; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp; } }</pre> It takes me many times longer to do anything because I have to deal with this garbage.

      The editor is adding non-breaking space entities ( ) inside my code blocks (within <pre> tags). It should not be messing with the content of these code blocks. All code has indentation and therefore is going to end up getting littered with these characters, making it impossible to revise.

              lkrzyzan@redhat.com Libor Krzyzanek
              dan.j.allen Dan Allen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: