Skip to content

Bug: function createLink creates xmlns attribute #1539

@realulim

Description

@realulim

Steps to reproduce:

  1. select a word in your text and use the Trumbowyg toolbar to click on "bold" (or "superscript" or any other button that creates a tag around your word)
  2. click outside the editor, then select the bold word again.
  3. click on the createLink button
  4. In the modal popup you will see that as text for the link something like <b xmlns="http://www.w3.org/1999/xhtml">yourword</b> is proposed

This is due to the fact that the selected range is processed via new XMLSerializer().serializeToString and that will create the xmlns attribute. One way to fix this would be to add the following line as the first line in the createLink function:

text = text.replace(/ xmlns="[^"]+"/, '');

That way the attribute is removed again right after creation. This is not a very elegant solution, but it appears to be the most practical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions