mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 02:51:50 +00:00
44035a2384
Begin to extract the wiring between a sidebar and the content pane of the template dialog booklet layout. Eventually, this helper class will present a high-level interface like "addPart(id)" and will take care of creating the outline item, content page, and connecting events. Start very simple, take over the "focus" method. Bug: T284632 Change-Id: I7bc73cc4386b99d95941fc6ed88ab5bd998de014
32 lines
830 B
JavaScript
32 lines
830 B
JavaScript
/**
|
|
* Hides some of the complexity of managing the panes of a bookletLayout.
|
|
*
|
|
* This class wires a simple, high-level interface to the details of how pages
|
|
* are added to the content pane and items to the sidebar.
|
|
*
|
|
* @class
|
|
*
|
|
* @constructor
|
|
* @param {OO.ui.BookletLayout} [bookletLayout] Layout to manage
|
|
*/
|
|
ve.ui.MWTransclusionsBooklet = function VeUiMWTransclusionsBooklet( bookletLayout ) {
|
|
this.bookletLayout = bookletLayout;
|
|
};
|
|
|
|
/* Setup */
|
|
|
|
OO.initClass( ve.ui.MWTransclusionsBooklet );
|
|
|
|
/**
|
|
* Set the current element in all panes, by ID.
|
|
*
|
|
* @param {string} id transclusion part id
|
|
*/
|
|
ve.ui.MWTransclusionsBooklet.prototype.focusPart = function ( id ) {
|
|
if ( this.bookletLayout.isOutlined() ) {
|
|
this.bookletLayout.getOutline().selectItemByData( id );
|
|
} else {
|
|
this.bookletLayout.setPage( id );
|
|
}
|
|
};
|