There are 3 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-443f6107-6a08-4c31-a53c-ad6e9c31b7dc XWIKI-25741 Closed

Can't create a link to the current page or to one of its sections from the BlockNote link modal

 
View issue   ยท   Add comment
 

3 updates

 
cid:jira-generated-image-avatar-05f7173c-9d9f-4497-862f-f0e27a8efbb4 Changes by Marius Dumitru Florea on 12/Nov/26 13:48
 
Resolution: Fixed
Tests: Unit,Integration
Status: Open Closed
 
 

1 comment

 
cid:jira-generated-image-avatar-05f7173c-9d9f-4497-862f-f0e27a8efbb4 Marius Dumitru Florea on 12/Nov/26 13:48
 

Fixed in 4a69c3e9b37. The BlockNote link modal now supports links to the current page and to its sections, by leaving the page reference empty (the page reference field now says so: "Leave empty to link to the current page."):

  • With an anchor and/or a query string: the link is saved with an empty reference, e.g. [[label>>||anchor="HSection"]].
  • With neither: the link points to the current page itself, e.g. [[label>>]].
  • With an empty display text: the link label is generated from the current page (its name, as the server generates the labels, whatever the anchor), and the link is saved without a label, e.g. [[||queryString="a=b" anchor="HSection"]] or [[]].
  • Editing such a link: the page reference field stays empty and the query string and anchor are shown, so that the reference is saved back empty, rather than as a reference to the current page by name.

In the editor, these links point to the URL of the current page (plus the query string and the anchor). This required passing the link context to LinkTargetType#toURL and LinkTargetType#getDefaultLabel, as for fromReference / toReference. Relative link URLs such as #section or ?key=value are now also kept as is when the editor stores the link id in them (they used to become /#section).