Skip to content

Conversation

@trisix
Copy link

@trisix trisix commented Dec 23, 2025

Fix link tracking checkbox state synchronization in rich text editor

Note: This PR addresses the bug reported in issue #2778. Per CONTRIBUTING.md guidelines, an issue should be opened first to discuss the bug and proposed fix - which has been done in #2778.

Description

This PR fixes a bug in the rich text editor where the "Track link?" checkbox would appear checked but fail to actually track links when users saved without manually toggling the checkbox.

Problem

When inserting links in the TinyMCE rich text editor:

  1. The "Track link?" checkbox appears checked (intended behavior)
  2. User saves the link without toggling the checkbox
  3. The link is NOT tracked - the @TrackLink suffix is not appended to the URL
  4. This creates a confusing UX where the checkbox state doesn't match the actual behavior

Root Cause: The checkbox HTML element was set to checked, but the Vue component's isTrackLink state remained false. The onEditorURLConvert callback relies on isTrackLink to append the tracking suffix.

Solution

RichtextEditor.vue:

  • Sync self.isTrackLink = true when the checkbox is rendered as checked
  • Default "Track link?" checkbox to checked for new links (better UX - tracking enabled by default)
  • Fix logic for detecting existing links vs new links:
    • Existing links with @TrackLink suffix → checkbox checked, tracking preserved
    • Existing links without @TrackLink → checkbox unchecked, no tracking added
    • New links → checkbox checked by default, tracking enabled
      • P.S. This change is based on feedback from our content team, who use listmonk daily. They would like to track all links in emails by default, so please consider this. Thanks!

Testing Steps

  1. Create a new campaign with rich text editor
  2. Insert a new link - verify "Track link?" checkbox is checked by default
  3. Save the link without toggling - verify @TrackLink suffix is appended to URL
  4. Edit an existing tracked link (with @TrackLink) - verify checkbox stays checked and tracking persists
  5. Edit an existing untracked link - verify checkbox is unchecked

Impact

  • Scope: Small, focused bug fix in rich text editor link dialog
  • Performance: No performance impact
  • Stability: Fixes existing broken behavior, no new features added
  • Usability: Improves UX by making checkbox state match actual tracking behavior

Current Testing Results

  • Tested locally; results align with the behavior described in the Testing Steps.

Please let me know if you have any questions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant