mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Rename outline "container" widget
I can't really tell what insight we get from the word "container". Every widget is a "container" in some sense, isn't it? This widget is just _the_ outline, I would argue. Other suggestions? Change-Id: I1fb27ee58c1a3dd790022504e978198dadf7ea02
This commit is contained in:
parent
654cf8c3a8
commit
63d9969861
|
@ -2160,9 +2160,9 @@
|
|||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineButtonWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineParameterSelectWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePlaceholderWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineWidget.js",
|
||||
"modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineWikitextWidget.js"
|
||||
],
|
||||
"styles": [
|
||||
|
@ -2831,12 +2831,12 @@
|
|||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWParameterSearchWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTemplateTitleInputWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineButtonWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineParameterSelectWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineParameterWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlinePlaceholderWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineWidget.test.js",
|
||||
"modules/ve-mw/tests/ui/widgets/ve.ui.MWTransclusionOutlineWikitextWidget.test.js",
|
||||
"lib/ve/tests/ce/ve.ce.TestRunner.js",
|
||||
"lib/ve/tests/ce/ve.ce.imetests.test.js",
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
QUnit.module( 've.ui.MWTransclusionOutlineContainerWidget' );
|
||||
QUnit.module( 've.ui.MWTransclusionOutlineWidget' );
|
||||
|
||||
QUnit.test( 'Constructor', ( assert ) => {
|
||||
const widget = new ve.ui.MWTransclusionOutlineContainerWidget();
|
||||
const widget = new ve.ui.MWTransclusionOutlineWidget();
|
||||
|
||||
// eslint-disable-next-line no-jquery/no-class-state
|
||||
assert.ok( widget.$element.hasClass( 've-ui-mwTransclusionOutlineContainerWidget' ) );
|
||||
assert.ok( widget.$element.hasClass( 've-ui-mwTransclusionOutlineWidget' ) );
|
||||
assert.deepEqual( widget.partWidgets, {} );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Supports all ve.dm.MWTransclusionPartModel subclasses', ( assert ) => {
|
||||
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||
widget = new ve.ui.MWTransclusionOutlineContainerWidget();
|
||||
widget = new ve.ui.MWTransclusionOutlineWidget();
|
||||
|
||||
widget.onReplacePart( null, new ve.dm.MWTemplateModel( transclusion, {} ) );
|
||||
widget.onReplacePart( null, new ve.dm.MWTemplatePlaceholderModel( transclusion ) );
|
||||
|
@ -25,7 +25,7 @@ QUnit.test( 'Basic functionality', ( assert ) => {
|
|||
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||
part0 = new ve.dm.MWTransclusionContentModel( transclusion ),
|
||||
part1 = new ve.dm.MWTransclusionContentModel( transclusion ),
|
||||
widget = new ve.ui.MWTransclusionOutlineContainerWidget();
|
||||
widget = new ve.ui.MWTransclusionOutlineWidget();
|
||||
|
||||
widget.onReplacePart();
|
||||
assert.deepEqual( widget.partWidgets, {} );
|
||||
|
@ -46,7 +46,7 @@ QUnit.test( 'Adding and moving parts to specific positions', ( assert ) => {
|
|||
part0 = new ve.dm.MWTransclusionContentModel( transclusion ),
|
||||
part1 = new ve.dm.MWTransclusionContentModel( transclusion ),
|
||||
part2 = new ve.dm.MWTransclusionContentModel( transclusion ),
|
||||
widget = new ve.ui.MWTransclusionOutlineContainerWidget();
|
||||
widget = new ve.ui.MWTransclusionOutlineWidget();
|
||||
|
||||
// This adds the parts at an invalid position, at the start, and in the middle
|
||||
widget.onReplacePart( null, part0, 666 );
|
||||
|
@ -83,7 +83,7 @@ QUnit.test( 'Adding and moving parts to specific positions', ( assert ) => {
|
|||
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
||||
partWidget = new ve.ui.MWTransclusionOutlineTemplateWidget( template ),
|
||||
widget = new ve.ui.MWTransclusionOutlineContainerWidget();
|
||||
widget = new ve.ui.MWTransclusionOutlineWidget();
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
widget.partWidgets.part_0 = partWidget;
|
|
@ -493,7 +493,7 @@ ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
|
|||
// FIXME: This is created at the wrong time. That's why we run into the situation
|
||||
// where an old instance exists. Should be in initialize().
|
||||
if ( !this.pocSidebar ) {
|
||||
this.pocSidebar = new ve.ui.MWTransclusionOutlineContainerWidget();
|
||||
this.pocSidebar = new ve.ui.MWTransclusionOutlineWidget();
|
||||
this.pocSidebar.connect( this, {
|
||||
focusPageByName: 'focusPart',
|
||||
filterPagesByName: 'onFilterPagesByName',
|
||||
|
@ -627,7 +627,7 @@ ve.ui.MWTemplateDialog.prototype.onUpdateOutlineControlButtons = function ( page
|
|||
// FIXME: This hack re-implements what OO.ui.SelectWidget.selectItem would do, without firing
|
||||
// the "select" event. This will stop working when we disconnect the old sidebar.
|
||||
this.bookletLayout.getOutline().items.forEach( function ( item ) {
|
||||
// This repeats what ve.ui.MWTransclusionOutlineContainerWidget.selectPartByPageName did, but for
|
||||
// This repeats what ve.ui.MWTransclusionOutlineWidget.selectPartByPageName did, but for
|
||||
// the old sidebar
|
||||
item.setSelected( item.getData() === pageName );
|
||||
} );
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
.ve-ui-mwTransclusionOutlineContainerWidget {
|
||||
.ve-ui-mwTransclusionOutlineWidget {
|
||||
/* .oo-ui-window-head uses a 1px outline which overlaps the top pixel of the sidebar */
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* VisualEditor user interface MWTransclusionOutlineContainerWidget class.
|
||||
* VisualEditor user interface MWTransclusionOutlineWidget class.
|
||||
*
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
@ -14,10 +14,10 @@
|
|||
* @property {Object.<string,ve.ui.MWTransclusionOutlinePartWidget>} partWidgets Map of top-level
|
||||
* items currently visible in this container, indexed by part id
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget = function VeUiMWTransclusionOutlineContainerWidget() {
|
||||
ve.ui.MWTransclusionOutlineWidget = function VeUiMWTransclusionOutlineWidget() {
|
||||
// Parent constructor
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.super.call( this, {
|
||||
classes: [ 've-ui-mwTransclusionOutlineContainerWidget' ]
|
||||
ve.ui.MWTransclusionOutlineWidget.super.call( this, {
|
||||
classes: [ 've-ui-mwTransclusionOutlineWidget' ]
|
||||
} );
|
||||
|
||||
// Initialization
|
||||
|
@ -26,7 +26,7 @@ ve.ui.MWTransclusionOutlineContainerWidget = function VeUiMWTransclusionOutlineC
|
|||
|
||||
/* Inheritance */
|
||||
|
||||
OO.inheritClass( ve.ui.MWTransclusionOutlineContainerWidget, OO.ui.Widget );
|
||||
OO.inheritClass( ve.ui.MWTransclusionOutlineWidget, OO.ui.Widget );
|
||||
|
||||
/* Events */
|
||||
|
||||
|
@ -53,7 +53,7 @@ OO.inheritClass( ve.ui.MWTransclusionOutlineContainerWidget, OO.ui.Widget );
|
|||
* @param {ve.dm.MWTransclusionPartModel|null} added Added part
|
||||
* @param {number} [newPosition]
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.onReplacePart = function ( removed, added, newPosition ) {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.onReplacePart = function ( removed, added, newPosition ) {
|
||||
if ( removed ) {
|
||||
this.removePartWidget( removed );
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.onReplacePart = function (
|
|||
/**
|
||||
* @param {ve.dm.MWTransclusionModel} transclusionModel
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.onTransclusionModelChange = function ( transclusionModel ) {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.onTransclusionModelChange = function ( transclusionModel ) {
|
||||
var newOrder = transclusionModel.getParts();
|
||||
|
||||
for ( var i = 0; i < newOrder.length; i++ ) {
|
||||
|
@ -87,7 +87,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.onTransclusionModelChange =
|
|||
* @param {string} pageName
|
||||
* @fires focusPageByName
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.onTransclusionPartSelected = function ( pageName ) {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.onTransclusionPartSelected = function ( pageName ) {
|
||||
this.emit( 'focusPageByName', pageName );
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.onTransclusionPartSelected
|
|||
* @private
|
||||
* @param {ve.dm.MWTransclusionPartModel} part
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.removePartWidget = function ( part ) {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.removePartWidget = function ( part ) {
|
||||
var id = part.getId();
|
||||
if ( id in this.partWidgets ) {
|
||||
this.partWidgets[ id ]
|
||||
|
@ -113,7 +113,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.removePartWidget = function
|
|||
* @param {number} [newPosition]
|
||||
* @fires filterPagesByName
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.addPartWidget = function ( part, newPosition ) {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, newPosition ) {
|
||||
var widget;
|
||||
|
||||
if ( part instanceof ve.dm.MWTemplateModel ) {
|
||||
|
@ -150,7 +150,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.addPartWidget = function (
|
|||
*
|
||||
* @param {string} pageName
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = function ( pageName ) {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.selectPartByPageName = function ( pageName ) {
|
||||
var partId = pageName.split( '/', 1 )[ 0 ],
|
||||
isParameterId = pageName.length > partId.length,
|
||||
changed = false;
|
||||
|
@ -186,7 +186,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = func
|
|||
*
|
||||
* @return {string|undefined}
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.findSelectedPartId = function () {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.findSelectedPartId = function () {
|
||||
for ( var id in this.partWidgets ) {
|
||||
var part = this.partWidgets[ id ];
|
||||
if ( part.isSelected() ) {
|
||||
|
@ -198,7 +198,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.findSelectedPartId = functi
|
|||
/**
|
||||
* Removes all {@see ve.ui.MWTransclusionOutlinePartWidget}, i.e. empties the list.
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.prototype.clear = function () {
|
||||
ve.ui.MWTransclusionOutlineWidget.prototype.clear = function () {
|
||||
for ( var id in this.partWidgets ) {
|
||||
this.partWidgets[ id ]
|
||||
.disconnect( this )
|
Loading…
Reference in a new issue