2 Replies Latest reply on Nov 11, 2019 11:09 AM by john_reynolds

    Unnecessary &nbsp addition to HTML code in Jive.

    prashant.mr2@gmail.com Novice

      Hi guys,

       

      I have encountered an issue while updating  my document content in Connect using Jive API. I am using "request.put" and posting some html code(table) to  the content. But once i post/update the content the editor invokes unnecessary '&nbsp' tags on top of the table, which makes it look weird. Does anyone encountered the same issue?

       

      My original code. I am converting this to json and then passing as an argument in request.put.

      <TABLE cellpadding="4" colspan="5" font-size="300" border="1" style="border: 2px solid;,  border-spacing: 3px, background-color:lightblue;">

      <TR>

        <TH>Service</TH>

        <TH>Permissions</TH>

        <TH>Groups</TH>

        <TH>Users</TH>

        <TH>Location</TH>

      </TR>

      <TR>

        <TD style="border: 2px solid;">HADOOP</TD>

        <TD style="border: 2px solid;">read,write,execute</TD>

        <TD style="border: 2px solid;">[u'APP_***_***_***']</TD>

        <TD style="border: 2px solid;">[u'hadoop', u'yarn']</TD>

        <TD style="border: 2px solid;">/*</TD>

      </TR>

       

      Modified code by editor pulled from browser,

       

      <div class="jive-rendered-content">    it adds &nbsp,tags all over here*  &nbsp*************************************************************************************************************************************************************************************************************************************    &nbsp,&nbsp                                                                                                                                                                                                      

      <table border="1" cellpadding="4" colspan="10" font-size="300" style="border: 2px solid;,  border-spacing: 3px, background-color:lightblue;"> <tbody><tr><th>Service</th><th>Permissions</th><th>Groups</th><th>Users</th><th>Location</th> </tr> <tr><td style="border: 2px solid;">HADOOP</td><td style="border: 2px solid;">read,write,execute</td><td style="border: 2px solid;">[u'APP_***_***_***', u'APP_RAN0_hdpdev_eng', u'APP_RAN0_***']</td><td style="border: 2px solid;">[u'hadoop', u'yarn', u'3********']</td><td style="border: 2px solid;">/*</td>

       

      I could see same issue been raised, but could not navigate to resolution.

       

      Any help will be appreciated.

        • Re: Unnecessary &nbsp addition to HTML code in Jive.
          jwd2bc Novice

          I'm seeing this as well...

           

          If I PUT content like this:

           

          <body>
          <h1>Title</h1>
          <p>dog
          
          
          cat</p>
          </body>

           

          It gets transformed into this:

           

          (I can't seem to paste text with   - they get interpreted as spaces here, thus the image.. LOL)

           

          It is as if the HTML that I PUT is being interpreted as if it came from the editor.

          I think I can fix by doing a regex on the content before I PUT: /[\W]+/ /g - replace 1 or more whitespaces w/ a single space, but why is it even doing this.  I'm PUTting HTML, it should honor that, no?

            • Re: Unnecessary &nbsp addition to HTML code in Jive.
              john_reynolds Guru

              Hi John, I would another test here to make sure it's not the RTE

               

              1. Create a Jive Document using an HTML body in the payload of a POST /content API call
              2. Immediately retrieve that content with a GET /content/id API call

               

              If they are the same, then yes ... Jive is saving exactly what you put in.

              If they're not, then Jive is doing some character substitution for compatibility with their RTE

               

              Then do this...

               

              1. Go into Edit Mode for that Document in a browser
              2. Compare the HTML to what you saved originally

               

              If they are the same ... well they probably won't be the same based on what you've noticed

              If they're not, then Jive's RTE is definitely doing some character substitution for compatibility with their RTE that they're not doing upon save