Page MenuHomePhabricator

Ability to make breaks in the edit toolbar
Closed, DeclinedPublic

Description

Author: onekopaka

Description:
Patch by DanB created on his behalf

From mediawiki-l@lists.wikimedia.org:
In our wiki, we have many toolbar buttons on the edit page, so we want to split them into multiple lines at designated spots. My hacked solution is below -- is there a better way?

To implement this, I hacked function mwInsertEditButton in skins/common/wikibits.js, so an imageFile value of "<br>" causes a real <br> to be inserted into the toolbar. I added this code as the first lines of mwInsertEditButton :

if (item.imageFile == '<br>') {
        parent.appendChild(document.createElement("br"));
        return true;
}

Is there a better way to accomplish this task without modifying core code?

Thanks,
DanB

This patch seems good, and an svn patch is attached


Version: 1.13.x
Severity: enhancement

attachment Wikibits.js.diff ignored as obsolete

Details

Reference
bz14121

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:09 PM
bzimport set Reference to bz14121.

Note that this code is now in skins/common/edit.js (formerly wikibits.js).

Please provide an updated unified diff.

Created attachment 5187
Diff against -r39564

Uploaded new diff

attachment diff.39564 ignored as obsolete

Would someone please commit this patch? It is so small and useful, and it's been ready (and tested locally) for 9 months.

I will upload a new unified diff.

Created attachment 5853
Unified diff against trunk rev 47722

Attached:

Any chance this simple patch could see the light of day?
Thanks.

You may close this ticket. The "br" functionality can be implemented without a core code change, by overriding mwInsertEditButton in MediaWiki:common.js.

Solution:

var orig_mwInsertEditButton = window.mwInsertEditButton;
window.mwInsertEditButton = function(parent, item) {

if (item.imageFile == '<br>') {
   parent.appendChild(document.createElement("br"));
   return true;
}
return orig_mwInsertEditButton(parent, item);

}