Krinkle has uploaded a new change for review.

Change subject: mw.toolbar: Clean up the API of the classic toolbar.
......................................................................

mw.toolbar: Clean up the API of the classic toolbar.

* Several methods were added here recently during 1.20 development
  that should not have been public methods.

* Also in the creation of this new module (replacing the old
  mwCustomEditButtons) a design flaw was made. Instead of using
  a key-value pair object, the signature was changed to a tentacle
  function with 7 (for callers, unnamed) arguments.

* Changed it back with the compatibility fix the other way around.
  So everything is backwards compatible.

* Moved to local scope:
 - buttons queue
 - $toolbar
 - insertButton
 These were recently introduced during 1.20 development but not
 meant to be public. When used too early or too late from outside
 the module it will break or be ignored (e.g. $toolbar is false
 before dom ready, and buttons queue is ignored after domready).

 Scripts should (and do) only use the addButton API.

* Kept:
 - addButton
 - insertTags
 - init (empty b/c function, was already there)

* Improved:
 - addButton: Now takes an object as well, just like
   mwCustomEditButtons used to do.

* Fixes:
 - Clear queue array after it has been used. Though in practice
   it should never happen that it is iterated over twice, just in
   case.
 - Added comment to init() function explaining where it is used.
 - Updated closure arguments per code conventions.
 - Made it a position-top module so that it actually can be used
   before the document is ready.

* Example usages tested:
<code>
// Legacy way from wikibits.js:
// Has to be done before document ready
window.mwCustomEditButtons[window.mwCustomEditButtons.length] = {
  imageFile: 'http://placehold.it/23x22',
  speedTip: 'tool tip',
  tagOpen: 'x-',
  tagClose: '-y'
};

// mw.toolbar: List of arguments
mw.toolbar.addButton( 'http://placehold.it/23x22', 'tooltip', 'x-', '-y' );

// mw.toolbar: Object
mw.toolbar.addButton({
  imageFile: 'http://placehold.it/23x22',
  speedTip: 'tool tip',
  tagOpen: 'x-',
  tagClose: '-y'
});
</code>

Change-Id: Id19819707c937c2c3144ad8177b75baa46f5073c
---
M resources/Resources.php
M resources/mediawiki.action/mediawiki.action.edit.js
2 files changed, 74 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/16238/1
--
To view, visit https://gerrit.wikimedia.org/r/16238
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id19819707c937c2c3144ad8177b75baa46f5073c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to