Page MenuHomePhabricator

jsduck: @example for mediawiki.widgets not working
Open, Needs TriagePublic

Description

The live examples for mw.widgets.DateInputWidget.js and DateTimeInputWidget.js aren’t working. This is because their respective files aren’t loaded in maintenance/jsduck/eg-iframe.html. The DateInputWidget for example would need:

<script src="modules/lib/moment/moment.js"></script>
<script src="modules/src/mediawiki.widgets/mw.widgets.CalendarWidget.js"></script>
<script src="modules/src/mediawiki.widgets/mw.widgets.DateInputWidget.js"></script>

It would also need its styles, which are in Less, so will need to converted first, in the postdoc npm script.

The same would apply to mw.widgets.CategoryCapsuleItemWidget and others (once examples are added to them).


Apart from these, there are only two other @examples in MediaWiki core, which are in mediawiki/mediawiki.js which is being included. All of OOUI is also included in eg-iframe.html so that examples in CoreUpstreamOOUI continue to work.

Event Timeline

Prtksxna created this task.Jun 26 2017, 5:30 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 26 2017, 5:30 AM

Do we want to add grunt-contrib-less to core to do this, is there another way? We'd probably also need mw.message for the labels inside the widget to work properly. This is what the preview looks like after only adding the scripts:

Anomie removed a subscriber: Anomie.Jun 26 2017, 2:05 PM

Just came to report this myself:

Uncaught ReferenceError: require is not defined
https://doc.wikimedia.org/mediawiki-core/master/js/modules/src/mediawiki.base/mediawiki.base.js:27
Uncaught TypeError: Cannot read property 'DateInputWidget' of undefined

Change 589768 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] ooui: Fix ButtonWidget jsduck demo

https://gerrit.wikimedia.org/r/589768

Change 589768 merged by jenkins-bot:
[mediawiki/core@master] ooui: Fix ButtonWidget jsduck demo

https://gerrit.wikimedia.org/r/589768