Skip to content

wopi: Action_InsertLink: accept optional "text" label from the host#15561

Merged
pedropintosilva merged 1 commit into
mainfrom
private/pedro/wopi-add-action-insertlink-text-fallback
Apr 22, 2026
Merged

wopi: Action_InsertLink: accept optional "text" label from the host#15561
pedropintosilva merged 1 commit into
mainfrom
private/pedro/wopi-add-action-insertlink-text-fallback

Conversation

@pedropintosilva
Copy link
Copy Markdown
Contributor

@pedropintosilva pedropintosilva commented Apr 17, 2026

Until now Action_InsertLink only took a "url" argument, and the inserted
hyperlink was labelled with either the user's current selection or the
URL itself when no selection existed. The problem is that the
integrators often pass opaque or at least very lengthly URLs (file
IDs, full path + etc), the result: ugly links in the document where
they could have been set nicely with a title (using the document
name).

Better to, accept an additional optional "text" value so the host can
supply a human-friendly label (typically the filename from its link picker).

The selected text case still works as before:
Existing selection still wins over the optional new text, because the
user explicitly marked the text they want to turn into a link; only
when there is no selection does the host-supplied "text" take over. If
neither is available the URL is still used:
-> Label precedence: selection > host-supplied text > URL.

The change is backward-compatible: hosts that do not send "text" behave
exactly as before.

Signed-off-by: Pedro Pinto Silva pedro.silva@collabora.com
Change-Id: I70a5c0c1a453cc51ff704b30cc47f05eb20bfa72


So, instead getting the following in our document:

https://staging-perf.eu.collaboraonline.com/nextcloud/index.php/f/305801

we would get:

Track-Changes-Example.docx

Until now Action_InsertLink only took a "url" argument, and the inserted
hyperlink was labelled with either the user's current selection or the
URL itself when no selection existed. The problem is that the
integrators often pass opaque or at least very lengthly URLs (file
IDs, full path + etc), the result: ugly links in the document where
they could have been set nicely with a title (using the document
name).

Better to, accept an additional optional "text" value so the host can
supply a human-friendly label (typically the filename from its link picker).

The selected text case still works as before:
Existing selection still wins over the optional new text, because the
user explicitly marked the text they want to turn into a link; only
when there is no selection does the host-supplied "text" take over. If
neither is available the URL is still used:
-> Label precedence: selection > host-supplied text > URL.

The change is backward-compatible: hosts that do not send "text" behave
exactly as before.

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I70a5c0c1a453cc51ff704b30cc47f05eb20bfa72
@pedropintosilva
Copy link
Copy Markdown
Contributor Author

@eszkadev , the tests have passed

Copy link
Copy Markdown
Contributor

@eszkadev eszkadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks ok

@github-project-automation github-project-automation Bot moved this from To Review to To Test in Collabora Online Apr 22, 2026
@pedropintosilva pedropintosilva merged commit 23db04b into main Apr 22, 2026
16 of 17 checks passed
@pedropintosilva pedropintosilva deleted the private/pedro/wopi-add-action-insertlink-text-fallback branch April 22, 2026 13:35
@github-project-automation github-project-automation Bot moved this from To Test to Done in Collabora Online Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants