Skip to content

Conversation

@i-just
Copy link
Contributor

@i-just i-just commented Feb 28, 2025

Description

Remove all of the element type link options from the button menu and move them into the link modal for consistency with Link fields in Craft 5.3.

  • removes the split view from the link button (no more “Link to an entry”, “Link to a category”, “Insert link”, etc. options)

Before:
Screenshot 2025-02-28 at 14 57 28

After:
Screenshot 2025-02-28 at 14 56 46

  • adds an element-type dropdown to the link balloon
Screenshot 2025-03-06 at 09 15 39
  • when configuring the CKEditor field, you can choose which additional fields should be available for the field (title, aria-label, class, id, target, rel, url suffix)
Screenshot 2025-02-28 at 14 59 00
  • the additional fields are then shown when adding/editing a link
Screenshot 2025-03-06 at 09 12 03 Screenshot 2025-03-06 at 09 12 13
  • when you choose to have an aria-label field available, the HTML Purifier config is automatically adjusted to allow for that attribute)
  • when you choose to have the relation field available, the HTML Purifier config is automatically adjusted (and overwritten, if one exists already) to allow any value for the rel attribute

Additional notes:

TODO:

  • have rel values added by “open in new tab” decorator show in the form; potentially, the same might be needed for other values from decorators, like classes
  • adjust the focus order of elements in the balloon
  • UI?
  • discuss add the query to the parsed URL html-field#17

Related issues

PT-2002
PT-2330

@linear
Copy link

linear bot commented Feb 28, 2025

@i-just i-just marked this pull request as ready for review March 24, 2025 13:32
@i-just i-just requested a review from brandonkelly as a code owner March 24, 2025 13:32
@brandonkelly
Copy link
Member

brandonkelly commented Apr 21, 2025

Noticing a couple issues with this:

  • URL Suffix values don’t persist for non-element links.
    • Create a URL link and give it a URL suffix like ?foo=bar, and save the entry. The URL suffix value is no longer present in the modal.
  • Advanced fields aren’t retained when switching link types.
    • Create a URL link and fill in each of the advanced fields. Save, then change the link type to Entry and choose an entry. Each of the advanced fields are now empty.
  • URL Suffix values result in extra ? in URL
    • Create an Entry link, select an entry, and set the URL Suffix to ?foo=bar. Then press the Source button and note that the href attribute ends in ??foo=bar.

@i-just
Copy link
Contributor Author

i-just commented Apr 24, 2025

Thanks, @brandonkelly! I updated to CKE 45.0.0 and actioned the first two items. I cannot reproduce the last one, though.

@brandonkelly brandonkelly merged commit b1b0ed3 into 5.x Apr 28, 2025
6 checks passed
@brandonkelly brandonkelly deleted the feature/pt-2002-links branch April 28, 2025 22:47
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.

3 participants