mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
Fix TypeError in MWTocWidget.initFromMetaList
If a page contains __NOTOC__ magic word, it would break the VisualEditor
with "Uncaught (in promise) TypeError: Right-hand side of 'instanceof' is not
an object at VeUiMWTocWidget.ve.ui.MWTocWidget.initFromMetaList".
The issue seems to be that we removed ve.dm.MWTOCForceMetaItem and
ve.dm.MWTOCDisableMetaItem in commit 57a06a6e75
,
but the code in initFromMetaList still refers to them.
Change-Id: I857cddcc7d4aa73375357ef922591ed94d760166
This commit is contained in:
parent
d2fe2f7f8d
commit
4774fbdf5c
|
@ -101,15 +101,18 @@ ve.ui.MWTocWidget.prototype.onMetaListRemove = function ( metaItem ) {
|
|||
ve.ui.MWTocWidget.prototype.initFromMetaList = function () {
|
||||
var i = 0,
|
||||
items = this.metaList.getItemsInGroup( 'mwTOC' ),
|
||||
len = items.length;
|
||||
len = items.length,
|
||||
property;
|
||||
if ( len > 0 ) {
|
||||
for ( ; i < len; i++ ) {
|
||||
if ( items[ i ] instanceof ve.dm.MWTOCForceMetaItem ) {
|
||||
this.mwTOCForce = true;
|
||||
}
|
||||
// Needs testing
|
||||
if ( items[ i ] instanceof ve.dm.MWTOCDisableMetaItem ) {
|
||||
this.mwTOCDisable = true;
|
||||
if ( items[ i ] instanceof ve.dm.MWTOCMetaItem ) {
|
||||
property = items[ i ].getAttribute( 'property' );
|
||||
if ( property === 'mw:PageProp/forcetoc' ) {
|
||||
this.mwTOCForce = true;
|
||||
}
|
||||
if ( property === 'mw:PageProp/notoc' ) {
|
||||
this.mwTOCDisable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateVisibility();
|
||||
|
|
Loading…
Reference in a new issue