Page MenuHomePhabricator

Allow arbitrary HTML for buttons
Closed, ResolvedPublic2 Estimated Story PointsFeature


Currently, a tool in a toolbar can be of type button (ButtonWidget), toggle (ToggleButtonWidget), or select (custom picklist). This limits what can be added to a toolbar, for example it is not possible to add a ButtonGroupWidget for a button with context menu (as is needed for T285712), or a ComboBoxWidget for entering custom data.

To fix this, it is proposed to add a new type: 'element' value and element={string|jQuery|HTMLElement} key, with which to add arbitrary HTML as toolbar items. The element would still get a wrapper such as <div class="tool">โ€ฆ</div>.

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJul 16 2021, 2:41 AM
Samwilson added a subscriber: DLynch.

@DLynch how does this sound?

This is no longer required for CommTech's work on Wikimedia OCR (we ended up just inserting the HTML with jQuery).

The task is still valid though.

Aklapper changed the subtype of this task from "Task" to "Feature Request".

Change 760697 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Add 'element' type for toolbar tools

Change 760697 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Add 'element' type for toolbar tools

Samwilson claimed this task.
Samwilson set the point value for this task to 2.

Change 767266 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Allow tool.element to be a function

Change 767266 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Allow tool.element to be a function

This was merged last week, but I'm assuming we'll save the QA phase for when we make use of the new functionality? As it stands now, there's nothing to test without doing some coding of your own.

Yes, I agree, no need for QA or anything here. Let's mark as done and revisit (again!) as required.