Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-24284

Editor adding invalid markup when inserting web link in IE8

XMLWordPrintable

      Steps to reproduce:

      1. Create a new page
      2. Type [ to start autocompleting a link.
      3. Type "Foo".
      4. Using the mouse, click "Insert Link to Create New Page"
      5. Press Enter twice.
      6. Type [ to start autocompleting a link.
      7. Type "Bar".
      8. Using the mouse, click "Insert Web Link".
        NOTE: In javascript-land, this is where the problem starts.
      9. Click the "Advanced" tab.
      10. Type "Some Text".
      11. Click out of the text field. The "Insert" button will become enabled.
        Is this another bug? I don't know.
      12. Click "Insert".

      You will notice some strangeness here:

      The newly inserted "Link" appears to be linked, but it is in fact not linked at all.

      Upon inspecting the source, you will likely have the following:

      <p>
          <a class="createlink confluence-link" href="http://localhost:8080/pages/createpage.action?spaceKey=THINGS&amp;title=Foo" data-space-key="THINGS" data-content-title="Foo">Foo</a>
      </p>
      <p>&nbsp;</p>
      <p>
          <a class="confluence-link createlink" href="http://localhost:8080/pages/createpage.action?spaceKey=THINGS&amp;title=Some+Text&amp;linkCreation=true&amp;fromPageId=327686" shape="" data-content-title="Some Text"></a>
      </p>
      <p>Bar</p>
      <p>
          <a class="confluence-link createlink" href="http://localhost:8080/pages/createpage.action?spaceKey=THINGS&amp;title=Some+Text&amp;linkCreation=true&amp;fromPageId=327686" shape="" data-content-title="Some Text"></a>
      </p>"
      

      What appears to be happening is that, upon auto-completing the second link (tinyMce-autocomplete-settings-links.js, line 70), the link browser is being passed some HTML for the text of the link: <p>Michael</p>.

      When the link is created with the "Advanced" tab, by all accounts the link-browser does the "right thing" – it creates a new link and inserts the aforementioned "text" of the link in the middle.

      It all goes horribly wrong when it attempts to insert it in to the browser, though.

      Because the link browser has created some code to the tune of <a href="..."><p>Michael</p></a>, and we are inserting the link inside another paragraph (via the NodeUtils.replaceNode() javascript function, something – possibly TinyMCE, possibly Confluence's code, but likely IE8 – is converting that in to <p><a href="..."></a></p><p>Michael</p><p><a href="..."></a></p>.

            Unassigned Unassigned
            cdarroch Daz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: