Topic on Project:Village Pump

Extension:CodeEditor#Configuration where is the 'MediaWiki JS hook' ?

4
Summary by Wladek92

done; corrected as mw.hook(codeEditor.configure).xxx

Wladek92 (talkcontribs)

Hi all, rereading Extension:CodeEditor#Configuration at section 'JavaScript', it is difficult to understand the text "....by hooking into the [[<tvar|res-loader>ResourceLoader/Default_modules#mediawiki_2</>|MediaWiki JS hook]] <tvar|configure>codeEditor.configure</>."

So can someone reformulate sentence "....by hooking into the ???? " in a more coherent way ? Thanks.

Christian FR (talk) 09:55, 3 April 2020 (UTC)

Ciencia Al Poder (talkcontribs)

I've fixed the link

Wladek92 (talkcontribs)

You are right Jesus but the problem in sentence "It is possible to change the configuration of the ACE editor, by hooking into the MediaWiki JS hook codeEditor.configure." is that if 'MediaWiki JS hook' leads to 'mw.hook' , where this last can lead us to 'codeEditor.configure' ?

Ciencia Al Poder (talkcontribs)

If you look at the example of ResourceLoader/Core_modules#mw.hook, it's mw.hook( 'wikipage.categories' ).add(.... With this example, you're assigning a function to the 'wikipage.categories' hook. In the case of CodeEditor, instead of 'wikipage.categories', you'd put 'codeEditor.configure'.