There are 3 updates, 2 comments.
 
 
XWiki Platform / cid:jira-generated-image-avatar-8f01576d-f59b-4b8b-97a6-442a1b4966df XWIKI-25738 Closed

Support links with generated labels in the BlockNote link modal

 
View issue   ยท   Add comment
 

3 updates

 
cid:jira-generated-image-avatar-bc87cce7-5cba-48f8-81a1-9ca46c25a0ba Changes by Marius Dumitru Florea on 12/Nov/26 11:26
 
Resolution: Fixed
Tests: Integration
Status: Open Closed
 
 

2 comments

 
cid:jira-generated-image-avatar-bc87cce7-5cba-48f8-81a1-9ca46c25a0ba Marius Dumitru Florea on 12/Nov/26 11:25
 

Implemented in 26ba450f88a (not pushed yet). The BlockNote link modal now supports the links whose label is generated from their target:

  • Editing a link with a generated label: the display text field is left empty, with the generated label as placeholder. Changing the link target regenerates the label in the editor (e.g. editing [[Users.Alice]] to point to Users.Bob shows "Bob"), and the link is still saved without a label ([[doc:Users.Bob]]).
  • Typing a display text for such a link: the link is saved with the typed label, even when it's the same as the generated one (e.g. [[Alice>>Users.Alice]]).
  • Submitting a link, created or edited, with an empty display text: the editor shows the label generated from the link target, and the link is saved without a label, so that its label is generated server-side. This applies to the links inserted with the /link quick action ([[doc:Space.Page]] instead of [[Page Title>>doc:Space.Page]]) and to the links created from a text selection whose display text is emptied (the selection is then replaced with the generated label).

A label is considered generated as long as it's the one generated for the link target: if the user changes it directly in the edited content, it's no longer generated. Note that the label generated in the editor (e.g. the page title, the page name or the URL) may differ from the one generated server-side, depending on the configuration: it's only displayed while editing.

No server-side change was needed: the link modal reports whether the display text is generated, and the XWiki integration stores this as the generated label of the link, which the BlockNote syntax parser already discards.

 
cid:jira-generated-image-avatar-bc87cce7-5cba-48f8-81a1-9ca46c25a0ba Marius Dumitru Florea on 12/Nov/26 11:26
 
Implemented in [26ba450f88a|https://github.com/xwiki/xwiki-platform/commit/26ba450f88a] (not pushed yet) . The BlockNote link modal now supports the links whose label is generated from their target:
* *Editing a link with a generated label*: the display text field is left empty, with the generated label as placeholder. Changing the link target regenerates the label in the editor (e.g. editing {{[[Users.Alice]]}} to point to {{Users.Bob}} shows "Bob"), and the link is still saved without a label ({{[[doc:Users.Bob]]}}).
* *Typing a display text for such a link*: the link is saved with the typed label, even when it's the same as the generated one (e.g. {{[[Alice>>Users.Alice]]}}).
* *Submitting a link, created or edited, with an empty display text*: the editor shows the label generated from the link target, and the link is saved without a label, so that its label is generated server-side. This applies to the links inserted with the {{/link}} quick action ({{[[doc:Space.Page]]}} instead of {{[[Page Title>>doc:Space.Page]]}}) and to the links created from a text selection whose display text is emptied (the selection is then replaced with the generated label).

A label is considered generated as long as it's the one generated for the link target: if the user changes it directly in the edited content, it's no longer generated. Note that the label generated in the editor (e.g. the page title, the page name or the URL) may differ from the one generated server-side, depending on the configuration: it's only displayed while editing.

No server-side change was needed: the link modal reports whether the display text is generated, and the XWiki integration stores this as the generated label of the link, which the BlockNote syntax parser already discards.