Page MenuHomePhabricator

Usability: Ability to apply functions directly on selected text
Closed, ResolvedPublic

Description

Ability to apply functions directly on selected text
Some participants demonstrated an intuitive expectation to apply functions by first selecting text within the article.

Recommendation
Goal: Align the function insertion workflow more closely with user expectations by enabling functions to be applied to pre-selected text in an article.

Ideas:
When a text is selected by an editor and a function is opened, automatically use the selected text as the input value especially for functions that accept only one input value such as conversion of miles to kilometers.

Event Timeline

Change #1181126 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] VE: selected text will be used as an input value to a function call when inputs = 1

https://gerrit.wikimedia.org/r/1181126

Jdforrester-WMF changed the task status from Open to In Progress.Aug 25 2025, 5:57 PM
Jdforrester-WMF assigned this task to DSmit-WMF.

The selected text is correctly used as input value, but when inserting the function, it's duplicated instead of being applied to the selected text:

selected-text-input-cal.gif (663×419 px, 460 KB)

The selected text is correctly used as input value, but when inserting the function, it's duplicated instead of being applied to the selected text:

selected-text-input-cal.gif (663×419 px, 460 KB)

The challenge is that some functions like conversion functions need the output to be placed beside the input/selected text

I didnt get it technically to replace the text selected. I dont think that is possible, because when opening the function dropdown, the selectednode already loses focus. Maybe there is a way to store that and replace it , probably there is.

But: the editor will lose the double check if what he did with the input is ok. also there are use cases where you do not want to replace the text I think, like functions adding units or so.

DSantamaria changed the task status from In Progress to Open.Nov 13 2025, 4:37 PM
DSmit-WMF changed the task status from Open to In Progress.Nov 21 2025, 10:56 AM

Change #1181126 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] VE: selected text will be used as an input value to a function call when inputs = 1

https://gerrit.wikimedia.org/r/1181126

I didnt get it technically to replace the text selected. I dont think that is possible, because when opening the function dropdown, the selectednode already loses focus. Maybe there is a way to store that and replace it , probably there is.

But: the editor will lose the double check if what he did with the input is ok. also there are use cases where you do not want to replace the text I think, like functions adding units or so.

I agree, this is fine. Thanks!

I managed to make that work aswell. I think its already deployed even!