Skip to content

Link duplication when space + embed selected #1038

@blissvisitor

Description

@blissvisitor

🐞 Bug: Link duplication when space + embed selected

Summary:
When selecting a combination of whitespace and an embedded expression (e.g., {OBJECTID}), clicking the link icon results in multiple <a> elements being generated in the DOM. This leads to rendering and editing issues in the WYSIWYG editor.

Steps to Reproduce:

  1. Open the text editor.
  2. Insert an embedded expression like {OBJECTID}.
  3. Select the embedded expression plus an adjacent space.
  4. Click the "link" icon and enter a URL.
  5. Inspect the resulting HTML or view in editor.

Expected Behavior:
Only one <a> tag should be created, wrapping both the space and the embed.

Actual Behavior:
Multiple <a> elements are created—one around the space, one around the expression.

Screenshots:

  1. Selection including {OBJECTID} and space:
Image
  1. Generated HTML with multiple <a> tags:

Image

Additional Context:

I called the method.

// selection includes: space + {OBJECTID} + space
editor.formatText(selection.index, selection.length, 'link', 'current_page', 'user');

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