mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 02:38:40 +00:00
Let users set __NOTOC__ & __FORCETOC__ status
This creates a new panel in the meta dialog, "Page settings", where page- level settings will be, err, set. For now, this exposes just the behavioural switches for the presence/absence of the Table Of Contents – __NOTOC__ and __FORCETOC__. As part of this change, the meta dialog is renamed to "Options" to be less confusing, and the icon for the meta dialog is changed to the generic one for dialogs, which was previously unused. The page settings pane is provided first in this list, given that the categories pane (amongst others) is now directly accessible through the toolbar menu. Bug: 56866 Bug: 56867 Change-Id: I33ce05c19d2e19b249e1cefd26fd0e3697d0085d
This commit is contained in:
parent
880a972166
commit
0fadc2bc77
|
@ -525,6 +525,8 @@ $wgResourceModules += array(
|
|||
'modules/ve-mw/dm/metaitems/ve.dm.MWDefaultSortMetaItem.js',
|
||||
'modules/ve-mw/dm/metaitems/ve.dm.MWLanguageMetaItem.js',
|
||||
'modules/ve-mw/dm/metaitems/ve.dm.MWTransclusionMetaItem.js',
|
||||
'modules/ve-mw/dm/metaitems/ve.dm.MWTOCDisableMetaItem.js',
|
||||
'modules/ve-mw/dm/metaitems/ve.dm.MWTOCForceMetaItem.js',
|
||||
|
||||
'modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js',
|
||||
'modules/ve-mw/dm/models/ve.dm.MWTransclusionPartModel.js',
|
||||
|
@ -570,6 +572,7 @@ $wgResourceModules += array(
|
|||
'modules/ve-mw/ui/widgets/ve.ui.MWReferenceResultWidget.js',
|
||||
'modules/ve-mw/ui/widgets/ve.ui.MWTitleInputWidget.js',
|
||||
|
||||
'modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js',
|
||||
'modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js',
|
||||
'modules/ve-mw/ui/pages/ve.ui.MWLanguagesPage.js',
|
||||
'modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js',
|
||||
|
@ -642,6 +645,12 @@ $wgResourceModules += array(
|
|||
'visualeditor-dialog-meta-languages-name-label',
|
||||
'visualeditor-dialog-meta-languages-readonlynote',
|
||||
'visualeditor-dialog-meta-languages-section',
|
||||
'visualeditor-dialog-meta-settings-label',
|
||||
'visualeditor-dialog-meta-settings-section',
|
||||
'visualeditor-dialog-meta-settings-toc-default',
|
||||
'visualeditor-dialog-meta-settings-toc-disable',
|
||||
'visualeditor-dialog-meta-settings-toc-force',
|
||||
'visualeditor-dialog-meta-settings-toc-label',
|
||||
'visualeditor-dialog-meta-title',
|
||||
'visualeditor-dialog-reference-insert-button',
|
||||
'visualeditor-dialog-reference-insert-title',
|
||||
|
@ -715,6 +724,7 @@ $wgResourceModules += array(
|
|||
'visualeditor-savedialog-warning-dirty',
|
||||
'visualeditor-saveerror',
|
||||
'visualeditor-serializeerror',
|
||||
'visualeditor-settings-tool',
|
||||
'visualeditor-toolbar-cancel',
|
||||
'visualeditor-toolbar-insert',
|
||||
'visualeditor-toolbar-savedialog',
|
||||
|
|
47
modules/ve-mw/dm/metaitems/ve.dm.MWTOCDisableMetaItem.js
Normal file
47
modules/ve-mw/dm/metaitems/ve.dm.MWTOCDisableMetaItem.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*!
|
||||
* VisualEditor DataModel MWTOCDisableMetaItem class.
|
||||
*
|
||||
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* DataModel disable TOC meta item.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.dm.MetaItem
|
||||
* @constructor
|
||||
* @param {Object} element Reference to element in meta-linmod
|
||||
*/
|
||||
ve.dm.MWTOCDisableMetaItem = function VeDmMWTOCDisableMetaItem( element ) {
|
||||
// Parent constructor
|
||||
ve.dm.MetaItem.call( this, element );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
OO.inheritClass( ve.dm.MWTOCDisableMetaItem, ve.dm.MetaItem );
|
||||
|
||||
/* Static Properties */
|
||||
|
||||
ve.dm.MWTOCDisableMetaItem.static.name = 'mwTOCDisable';
|
||||
|
||||
ve.dm.MWTOCDisableMetaItem.static.group = 'mwTOC';
|
||||
|
||||
ve.dm.MWTOCDisableMetaItem.static.matchTagNames = [ 'meta' ];
|
||||
|
||||
ve.dm.MWTOCDisableMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/notoc' ];
|
||||
|
||||
ve.dm.MWTOCDisableMetaItem.static.toDataElement = function ( ) {
|
||||
return { 'type': this.name };
|
||||
};
|
||||
|
||||
ve.dm.MWTOCDisableMetaItem.static.toDomElements = function ( dataElement, doc ) {
|
||||
var meta = doc.createElement( 'meta' );
|
||||
meta.setAttribute( 'property', 'mw:PageProp/notoc' );
|
||||
return [ meta ];
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
||||
ve.dm.modelRegistry.register( ve.dm.MWTOCDisableMetaItem );
|
47
modules/ve-mw/dm/metaitems/ve.dm.MWTOCForceMetaItem.js
Normal file
47
modules/ve-mw/dm/metaitems/ve.dm.MWTOCForceMetaItem.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*!
|
||||
* VisualEditor DataModel MWTOCForceMetaItem class.
|
||||
*
|
||||
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* DataModel force TOC meta item.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.dm.MetaItem
|
||||
* @constructor
|
||||
* @param {Object} element Reference to element in meta-linmod
|
||||
*/
|
||||
ve.dm.MWTOCForceMetaItem = function VeDmMWTOCForceMetaItem( element ) {
|
||||
// Parent constructor
|
||||
ve.dm.MetaItem.call( this, element );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
OO.inheritClass( ve.dm.MWTOCForceMetaItem, ve.dm.MetaItem );
|
||||
|
||||
/* Static Properties */
|
||||
|
||||
ve.dm.MWTOCForceMetaItem.static.name = 'mwTOCForce';
|
||||
|
||||
ve.dm.MWTOCForceMetaItem.static.group = 'mwTOC';
|
||||
|
||||
ve.dm.MWTOCForceMetaItem.static.matchTagNames = [ 'meta' ];
|
||||
|
||||
ve.dm.MWTOCForceMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/forcetoc' ];
|
||||
|
||||
ve.dm.MWTOCForceMetaItem.static.toDataElement = function ( ) {
|
||||
return { 'type': this.name };
|
||||
};
|
||||
|
||||
ve.dm.MWTOCForceMetaItem.static.toDomElements = function ( dataElement, doc ) {
|
||||
var meta = doc.createElement( 'meta' );
|
||||
meta.setAttribute( 'property', 'mw:PageProp/forcetoc' );
|
||||
return [ meta ];
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
||||
ve.dm.modelRegistry.register( ve.dm.MWTOCForceMetaItem );
|
|
@ -57,7 +57,13 @@
|
|||
"visualeditor-dialog-meta-languages-name-label": "Language",
|
||||
"visualeditor-dialog-meta-languages-readonlynote": "This is a list of pages in other languages that are linked to this one; for now, it can only be edited in source mode or on Wikidata.",
|
||||
"visualeditor-dialog-meta-languages-section": "Languages",
|
||||
"visualeditor-dialog-meta-title": "Page settings",
|
||||
"visualeditor-dialog-meta-settings-label": "Page settings",
|
||||
"visualeditor-dialog-meta-settings-section": "Page settings",
|
||||
"visualeditor-dialog-meta-settings-toc-default": "Show if needed",
|
||||
"visualeditor-dialog-meta-settings-toc-disable": "Never show",
|
||||
"visualeditor-dialog-meta-settings-toc-force": "Always show",
|
||||
"visualeditor-dialog-meta-settings-toc-label": "Show the Table of Contents",
|
||||
"visualeditor-dialog-meta-title": "Options",
|
||||
"visualeditor-dialog-reference-insert-button": "Insert reference",
|
||||
"visualeditor-dialog-reference-insert-title": "Insert reference",
|
||||
"visualeditor-dialog-reference-options-group-label": "Use this group",
|
||||
|
@ -103,7 +109,7 @@
|
|||
"visualeditor-loadwarning-token": "Error loading edit token from server: $1. Would you like to retry?",
|
||||
"visualeditor-mainnamespacepagelink": "Project:Main namespace",
|
||||
"visualeditor-media-input-placeholder": "Search for media",
|
||||
"visualeditor-meta-tool": "Page settings",
|
||||
"visualeditor-meta-tool": "Options",
|
||||
"visualeditor-mwalienextensioninspector-title": "MediaWiki extension",
|
||||
"visualeditor-mweditmodesource-title": "Switch to source editing",
|
||||
"visualeditor-mweditmodesource-warning": "You are about to switch to source editing.\nAny changes you've made to this document will be kept, but you will not be able switch back to VisualEditor without saving or reloading the page.\nDo you want to continue?",
|
||||
|
@ -160,6 +166,7 @@
|
|||
"visualeditor-savedialog-warning-dirty": "Your edit may have been corrupted – please review before saving.",
|
||||
"visualeditor-saveerror": "Error saving data to server: $1.",
|
||||
"visualeditor-serializeerror": "Error loading data from server: $1.",
|
||||
"visualeditor-settings-tool": "Page settings",
|
||||
"visualeditor-toolbar-cancel": "Cancel",
|
||||
"visualeditor-toolbar-savedialog": "Save page",
|
||||
"visualeditor-usernamespacepagelink": "Project:User namespace",
|
||||
|
|
|
@ -60,7 +60,13 @@
|
|||
"visualeditor-dialog-meta-languages-name-label": "Column header for the language links table, giving the language name of the remote wiki.\n{{Identical|Language}}",
|
||||
"visualeditor-dialog-meta-languages-readonlynote": "Text of a note informing users that the language links cannot yet be edited.\n\nSee also:\n* {{msg-mw|Visualeditor-referencelist-missingref}}",
|
||||
"visualeditor-dialog-meta-languages-section": "Label for the language links dialog section.\n{{Identical|Language}}",
|
||||
"visualeditor-dialog-meta-title": "MetaData dialog title text.\n{{Identical|Page settings}}",
|
||||
"visualeditor-dialog-meta-settings-label": "Title for the page settings dialog section",
|
||||
"visualeditor-dialog-meta-settings-section": "Label for the page settings dialog section.",
|
||||
"visualeditor-dialog-meta-settings-toc-default": "Label for the default TOC behaviour option.",
|
||||
"visualeditor-dialog-meta-settings-toc-disable": "Label for the TOC behaviour option to never show.",
|
||||
"visualeditor-dialog-meta-settings-toc-force": "Label for the TOC behaviour option to always show.",
|
||||
"visualeditor-dialog-meta-settings-toc-label": "Prompt to let the user set the Table Of Contents (TOC) behaviour.",
|
||||
"visualeditor-dialog-meta-title": "Text of the title for the meta dialog to set categories, language links and other page settings.\n{{Identical|Options}}",
|
||||
"visualeditor-dialog-reference-insert-button": "Used as label for the button.\n{{Identical|Insert reference}}",
|
||||
"visualeditor-dialog-reference-insert-title": "Reference insert dialog title text.\n{{Identical|Insert reference}}",
|
||||
"visualeditor-dialog-reference-options-group-label": "Label for the reference group input",
|
||||
|
@ -106,7 +112,7 @@
|
|||
"visualeditor-loadwarning-token": "Text (JavaScript confirm()) shown when the editor fails to load properly.\n\nParameters:\n* $1 - the error message from the server.",
|
||||
"visualeditor-mainnamespacepagelink": "Name of a page describing the main namespace (NS0) in this project.\n{{doc-important|Do not translate \"Project\"; it is automatically converted to the wiki's project namespace.}}",
|
||||
"visualeditor-media-input-placeholder": "Place holder text for media search input",
|
||||
"visualeditor-meta-tool": "Text of tool in the toolbar the lets users set categories, language links and other page settings.\n{{Identical|Page settings}}",
|
||||
"visualeditor-meta-tool": "Text of tool in the toolbar the lets users set categories, language links and other page settings.\n{{Identical|Options}}",
|
||||
"visualeditor-mwalienextensioninspector-title": "Used as title for unknown MediaWiki extensions.\n{{Identical|MediaWiki extension}}",
|
||||
"visualeditor-mweditmodesource-title": "Label for changing edit mode to source editing.",
|
||||
"visualeditor-mweditmodesource-warning": "Warning message show before changing edit mode to source editing.",
|
||||
|
@ -163,6 +169,7 @@
|
|||
"visualeditor-savedialog-warning-dirty": "Note displayed to users in the save dialog if VisualEditor believes that it may have corrupted the page.",
|
||||
"visualeditor-saveerror": "Text shown when the editor fails to save properly.\n\nParameters:\n* $1 is an error message, in English.",
|
||||
"visualeditor-serializeerror": "Text shown when the editor fails to load the wikitext for saving.\n\nParameters:\n* $1 is an error message, in English.",
|
||||
"visualeditor-settings-tool": "Text of tool in the toolbar the lets users set specific page settings.\n{{Identical|Page settings}}.",
|
||||
"visualeditor-toolbar-cancel": "Label text for button to exit from VisualEditor.\n{{Identical|Cancel}}",
|
||||
"visualeditor-toolbar-savedialog": "Label text for button to open save dialog.\n\nUsed in:\n* {{msg-mw|Guidedtour-tour-gettingstartedtasktoolbarve-click-save-description}}.\n{{Identical|Save page}}",
|
||||
"visualeditor-usernamespacepagelink": "Name of a page describing the user namespace (NS2) in this project.\n{{doc-important|Do not translate \"Project\"; it is automatically converted to the wiki's project namespace.}}",
|
||||
|
|
|
@ -1019,7 +1019,7 @@ ve.init.mw.ViewPageTarget.prototype.attachToolbarButtons = function () {
|
|||
{
|
||||
'type': 'list',
|
||||
'icon': 'menu',
|
||||
'include': [ 'meta', 'categories', 'languages', 'editModeSource' ] }
|
||||
'include': [ 'meta', 'settings', 'categories', 'languages', 'editModeSource' ] }
|
||||
] );
|
||||
|
||||
$actionTools
|
||||
|
|
|
@ -30,7 +30,7 @@ ve.ui.MWMetaDialog.static.name = 'meta';
|
|||
|
||||
ve.ui.MWMetaDialog.static.titleMessage = 'visualeditor-dialog-meta-title';
|
||||
|
||||
ve.ui.MWMetaDialog.static.icon = 'settings';
|
||||
ve.ui.MWMetaDialog.static.icon = 'window';
|
||||
|
||||
/* Methods */
|
||||
|
||||
|
@ -48,6 +48,7 @@ ve.ui.MWMetaDialog.prototype.initialize = function () {
|
|||
'label': ve.msg( 'visualeditor-dialog-action-apply' ),
|
||||
'flags': ['primary']
|
||||
} );
|
||||
this.settingsPage = new ve.ui.MWSettingsPage( this.surface, 'settings', { '$': this.$ } );
|
||||
this.categoriesPage = new ve.ui.MWCategoriesPage( this.surface, 'categories', {
|
||||
'$': this.$, '$overlay': this.$overlay
|
||||
} );
|
||||
|
@ -59,7 +60,11 @@ ve.ui.MWMetaDialog.prototype.initialize = function () {
|
|||
// Initialization
|
||||
this.$body.append( this.bookletLayout.$element );
|
||||
this.$foot.append( this.applyButton.$element );
|
||||
this.bookletLayout.addPages( [ this.categoriesPage, this.languagesPage ] );
|
||||
this.bookletLayout.addPages( [
|
||||
this.settingsPage,
|
||||
this.categoriesPage,
|
||||
this.languagesPage
|
||||
] );
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -82,6 +87,8 @@ ve.ui.MWMetaDialog.prototype.setup = function ( data ) {
|
|||
surfaceModel.breakpoint();
|
||||
surfaceModel.stopHistoryTracking();
|
||||
|
||||
// Let each page set itself up ('languages' page doesn't need this yet)
|
||||
this.settingsPage.setup( data );
|
||||
this.categoriesPage.setup( data );
|
||||
};
|
||||
|
||||
|
@ -90,6 +97,7 @@ ve.ui.MWMetaDialog.prototype.setup = function ( data ) {
|
|||
*/
|
||||
ve.ui.MWMetaDialog.prototype.teardown = function ( data ) {
|
||||
var surfaceModel = this.surface.getModel(),
|
||||
// Place transactions made while dialog was open in a common history state
|
||||
hasTransactions = surfaceModel.breakpoint();
|
||||
|
||||
// Undo everything done in the dialog and prevent redoing those changes
|
||||
|
@ -98,6 +106,8 @@ ve.ui.MWMetaDialog.prototype.teardown = function ( data ) {
|
|||
surfaceModel.truncateUndoStack();
|
||||
}
|
||||
|
||||
// Let each page tear itself down ('languages' page doesn't need this yet)
|
||||
this.settingsPage.teardown( data );
|
||||
this.categoriesPage.teardown( data );
|
||||
|
||||
// Return to normal tracking behavior
|
||||
|
|
|
@ -27,8 +27,7 @@ ve.ui.MWCategoriesPage = function VeUiMWCategoriesPage( surface, name, config )
|
|||
OO.ui.PageLayout.call( this, name, config );
|
||||
|
||||
// Properties
|
||||
this.surface = surface;
|
||||
this.metaList = this.surface.getModel().metaList;
|
||||
this.metaList = surface.getModel().metaList;
|
||||
this.defaultSortKeyTouched = false;
|
||||
this.fallbackDefaultSortKey = mw.config.get( 'wgTitle' );
|
||||
this.label = ve.msg( 'visualeditor-dialog-meta-categories-section' );
|
||||
|
@ -148,8 +147,7 @@ ve.ui.MWCategoriesPage.prototype.onMetaListRemove = function ( metaItem ) {
|
|||
* @returns {string} Default sort key item
|
||||
*/
|
||||
ve.ui.MWCategoriesPage.prototype.getDefaultSortKeyItem = function () {
|
||||
var items = this.metaList.getItemsInGroup( 'mwDefaultSort' );
|
||||
return items.length ? items[0] : null;
|
||||
return this.metaList.getItemsInGroup( 'mwDefaultSort' )[0] || null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
135
modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js
Normal file
135
modules/ve-mw/ui/pages/ve.ui.MWSettingsPage.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*!
|
||||
* VisualEditor user interface MWSettingsPage class.
|
||||
*
|
||||
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* MediaWiki meta dialog settings page.
|
||||
*
|
||||
* @class
|
||||
* @extends OO.ui.PageLayout
|
||||
*
|
||||
* @constructor
|
||||
* @param {ve.ui.Surface} surface Surface being worked on
|
||||
* @param {string} name Unique symbolic name of page
|
||||
* @param {Object} [config] Configuration options
|
||||
*/
|
||||
ve.ui.MWSettingsPage = function VeUiMWSettingsPage( surface, name, config ) {
|
||||
// Configuration initialization
|
||||
config = ve.extendObject( config, { 'icon': 'settings' } );
|
||||
|
||||
// Parent constructor
|
||||
OO.ui.PageLayout.call( this, name, config );
|
||||
|
||||
// Properties
|
||||
this.metaList = surface.getModel().metaList;
|
||||
this.tocOptionTouched = false;
|
||||
this.label = ve.msg( 'visualeditor-dialog-meta-settings-section' );
|
||||
|
||||
this.settingsFieldset = new OO.ui.FieldsetLayout( {
|
||||
'$': this.$,
|
||||
'label': ve.msg( 'visualeditor-dialog-meta-settings-label' ),
|
||||
'icon': 'settings'
|
||||
} );
|
||||
this.tocOptionSelector = new OO.ui.SelectWidget( { '$': this.$ } );
|
||||
this.tocOptionWidgets = {
|
||||
'default': new OO.ui.OptionWidget(
|
||||
'default',
|
||||
{ 'label': ve.msg( 'visualeditor-dialog-meta-settings-toc-default' ) }
|
||||
),
|
||||
'mwTOCForce': new OO.ui.OptionWidget(
|
||||
'mwTOCForce',
|
||||
{ 'label': ve.msg( 'visualeditor-dialog-meta-settings-toc-force' ) }
|
||||
),
|
||||
'mwTOCDisable': new OO.ui.OptionWidget(
|
||||
'mwTOCDisable',
|
||||
{ 'label': ve.msg( 'visualeditor-dialog-meta-settings-toc-disable' ) }
|
||||
)
|
||||
};
|
||||
this.tocOptionSelector.addItems( ve.getObjectValues( this.tocOptionWidgets ) );
|
||||
|
||||
// Events
|
||||
this.tocOptionSelector.connect( this, {
|
||||
'select': 'onTOCOptionChange'
|
||||
} );
|
||||
|
||||
// Initialization
|
||||
this.settingsFieldset.$element.append(
|
||||
this.$( '<span>' )
|
||||
.text( ve.msg( 'visualeditor-dialog-meta-settings-toc-label' ) ),
|
||||
this.tocOptionSelector.$element
|
||||
);
|
||||
this.$element.append( this.settingsFieldset.$element );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
OO.inheritClass( ve.ui.MWSettingsPage, OO.ui.PageLayout );
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* Handle Table Of Contents display change events.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.ui.MWSettingsPage.prototype.onTOCOptionChange = function () {
|
||||
this.tocOptionTouched = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Table Of Contents option
|
||||
*
|
||||
* @returns {ve.dm.MetaItem|null} TOC option, if any
|
||||
*/
|
||||
ve.ui.MWSettingsPage.prototype.getTOCOptionItem = function () {
|
||||
return this.metaList.getItemsInGroup( 'mwTOC' )[0] || null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup settings page.
|
||||
*
|
||||
* @param {Object} [data] Dialog setup data
|
||||
*/
|
||||
ve.ui.MWSettingsPage.prototype.setup = function () {
|
||||
var tocOption = this.getTOCOptionItem(),
|
||||
tocType = tocOption && tocOption.element.type || 'default';
|
||||
|
||||
this.tocOptionSelector.selectItem( this.tocOptionWidgets[tocType] );
|
||||
this.tocOptionTouched = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tear down settings page.
|
||||
*
|
||||
* @param {Object} [data] Dialog tear down data
|
||||
*/
|
||||
ve.ui.MWSettingsPage.prototype.teardown = function ( data ) {
|
||||
// Data initialisation
|
||||
data = data || {};
|
||||
|
||||
var currentTOCItem = this.getTOCOptionItem(),
|
||||
newTOCData = this.tocOptionSelector.getSelectedItem();
|
||||
|
||||
// Alter the TOC option flag iff it's been touched & is actually different
|
||||
if ( this.tocOptionTouched ) {
|
||||
if ( newTOCData.data === 'default' ) {
|
||||
if ( currentTOCItem ) {
|
||||
currentTOCItem.remove();
|
||||
}
|
||||
} else {
|
||||
if ( !currentTOCItem ) {
|
||||
this.metaList.insertMeta( { 'type': newTOCData.data } );
|
||||
} else if ( currentTOCItem.getType() !== newTOCData.data ) {
|
||||
currentTOCItem.replaceWith(
|
||||
ve.extendObject( true, {},
|
||||
currentTOCItem.getElement(),
|
||||
{ 'type': newTOCData.data }
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
|
@ -115,7 +115,7 @@ ve.ui.MWTransclusionDialogTool.static.modelClasses = [ ve.dm.MWTransclusionNode
|
|||
ve.ui.toolFactory.register( ve.ui.MWTransclusionDialogTool );
|
||||
|
||||
/**
|
||||
* MediaWiki UserInterface categories tool.
|
||||
* MediaWiki UserInterface meta dialog tool.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.ui.DialogTool
|
||||
|
@ -129,12 +129,34 @@ ve.ui.MWMetaDialogTool = function VeUiMWMetaDialogTool( toolbar, config ) {
|
|||
OO.inheritClass( ve.ui.MWMetaDialogTool, ve.ui.DialogTool );
|
||||
ve.ui.MWMetaDialogTool.static.name = 'meta';
|
||||
ve.ui.MWMetaDialogTool.static.group = 'utility';
|
||||
ve.ui.MWMetaDialogTool.static.icon = 'settings';
|
||||
ve.ui.MWMetaDialogTool.static.icon = 'window';
|
||||
ve.ui.MWMetaDialogTool.static.titleMessage = 'visualeditor-meta-tool';
|
||||
ve.ui.MWMetaDialogTool.static.dialog = 'meta';
|
||||
ve.ui.MWMetaDialogTool.static.autoAdd = false;
|
||||
ve.ui.toolFactory.register( ve.ui.MWMetaDialogTool );
|
||||
|
||||
/**
|
||||
* MediaWiki UserInterface page settings tool.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.ui.DialogTool
|
||||
* @constructor
|
||||
* @param {OO.ui.Toolbar} toolbar
|
||||
* @param {Object} [config] Configuration options
|
||||
*/
|
||||
ve.ui.MWPageSettingsDialogTool = function VeUiMWPageSettingsDialogTool( toolbar, config ) {
|
||||
ve.ui.DialogTool.call( this, toolbar, config );
|
||||
};
|
||||
OO.inheritClass( ve.ui.MWPageSettingsDialogTool, ve.ui.DialogTool );
|
||||
ve.ui.MWPageSettingsDialogTool.static.name = 'settings';
|
||||
ve.ui.MWPageSettingsDialogTool.static.group = 'utility';
|
||||
ve.ui.MWPageSettingsDialogTool.static.icon = 'settings';
|
||||
ve.ui.MWPageSettingsDialogTool.static.titleMessage = 'visualeditor-settings-tool';
|
||||
ve.ui.MWPageSettingsDialogTool.static.dialog = 'meta';
|
||||
ve.ui.MWPageSettingsDialogTool.static.config = { 'page': 'settings' };
|
||||
ve.ui.MWPageSettingsDialogTool.static.autoAdd = false;
|
||||
ve.ui.toolFactory.register( ve.ui.MWPageSettingsDialogTool );
|
||||
|
||||
/**
|
||||
* MediaWiki UserInterface categories tool.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue