r55981 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55980‎ | r55981 | r55982 >
Date:17:05, 7 September 2009
Author:dale
Status:deferred (Comments)
Tags:
Comment:
quick hack for addMediaWiz compatibility with usability toolbar
Modified paths:
  • /trunk/phase3/js2/editPage.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/editPage.js
@@ -24,12 +24,21 @@
2525 init:function(){
2626 var _this = this;
2727 //@@todo check for new version of toolbar and via toolbar api:
28 -
29 - //add the add-media-wizard button for old toolbar:
30 - $j('#toolbar').append('<img style="cursor:pointer" id="btn-add-media-wiz" src="' + mv_skin_img_path + 'Button_add_media.png">');
31 - $j('#btn-add-media-wiz').addMediaWiz(
32 - mwAddMediaConfig
33 - );
 28+
 29+ //kind of tricky would be nice to use a "loader" call here to avoid concurancy issues.
 30+ if( typeof $j.wikiEditor != 'undefined' ){
 31+ setTimeout(function(){
 32+ $j('.wikiEditor-ui [rel=file]').addMediaWiz(
 33+ mwAddMediaConfig
 34+ );
 35+ },100 );
 36+ }else{
 37+ //add the add-media-wizard button for old toolbar:
 38+ $j('#toolbar').append('<img style="cursor:pointer" id="btn-add-media-wiz" src="' + mv_skin_img_path + 'Button_add_media.png">');
 39+ $j('#btn-add-media-wiz').addMediaWiz(
 40+ mwAddMediaConfig
 41+ );
 42+ }
3443
3544 //add to new toolbar (need to use api)
3645 /*$j('[rel=insert] tool-file').addMediaWiz(

Comments

#Comment by Catrope (talk | contribs)   17:37, 7 September 2009

Such loader calls do exist, Trevor wrote up an API for adding toolbar buttons, see r54967

#Comment by Mdale (talk | contribs)   18:29, 7 September 2009

There are a few problems with the existing api system which I will coordinate with Trever to get addressed ;)

  • when I call $j('target').wikiEditor('action') I have no guarantee that the toolbar is ready. (since its built out asynchronously. (so even if I was using the toolbar api i would have to put in the delay)
  • there is no "modify" tool api action yet
  • you cant presently remove img based tools (as far as I can tell)
  • adding the tool then requires you to duplicate the configuration (when I just want to override whats there)
    • this is just a proof of concept hack we will fix up integration shortly **

Status & tagging log