mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Update VE core submodule to master (a1fd90540)
New changes: 71baf1c02 Create an 'htmlMsg' function for HTML messages with HTML or DOM arguments 9a7af223e Use ve.htmlMsg to highlight values in attribute changes a1fd90540 DiffElement: Refactor describeChanges tests Local changes: Implement getHtmlMessage in mw.Platform and use for DiffElement Bug: T195243 Depends-On: Ib4ad16858e4241d33d018830dbcfded63ff703af Change-Id: Ib5fa39e4f2f529948354b03a141542e23d169fe0
This commit is contained in:
parent
4948925351
commit
534b3d66cb
2
lib/ve
2
lib/ve
|
@ -1 +1 @@
|
|||
Subproject commit e72749663a072bda113c672bcd4b9bc42743caa9
|
||||
Subproject commit a1fd90540cc79b045f4262c2420b90874609ecdd
|
|
@ -74,7 +74,7 @@ ve.dm.MWExternalLinkAnnotation.static.toDomElements = function ( dataElement, do
|
|||
|
||||
ve.dm.MWExternalLinkAnnotation.static.describeChange = function ( key, change ) {
|
||||
if ( key === 'href' ) {
|
||||
return ve.msg( 'visualeditor-changedesc-link-href', change.from, change.to );
|
||||
return ve.htmlMsg( 'visualeditor-changedesc-link-href', $( '<del>' ).text( change.from ), $( '<ins>' ).text( change.to ) );
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -212,7 +212,7 @@ ve.dm.MWInternalLinkAnnotation.static.getFragment = function ( original ) {
|
|||
|
||||
ve.dm.MWInternalLinkAnnotation.static.describeChange = function ( key, change ) {
|
||||
if ( key === 'title' ) {
|
||||
return ve.msg( 'visualeditor-changedesc-link-href', change.from, change.to );
|
||||
return ve.htmlMsg( 'visualeditor-changedesc-link-href', $( '<del>' ).text( change.from ), $( '<ins>' ).text( change.to ) );
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ ve.dm.MWRedirectMetaItem.static.toDomElements = function ( dataElement, doc ) {
|
|||
|
||||
ve.dm.MWRedirectMetaItem.static.describeChange = function ( key, change ) {
|
||||
if ( key === 'title' ) {
|
||||
return ve.msg( 'visualeditor-changedesc-mwredirect', change.from, change.to );
|
||||
return ve.htmlMsg( 'visualeditor-changedesc-mwredirect', $( '<del>' ).text( change.from ), $( '<ins>' ).text( change.to ) );
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -136,7 +136,9 @@ ve.dm.MWImageNode.static.describeChanges = function ( attributeChanges, attribut
|
|||
);
|
||||
}
|
||||
|
||||
descriptions.push( ve.msg( 'visualeditor-changedesc-image-size', sizeFrom, sizeTo ) );
|
||||
descriptions.push(
|
||||
ve.htmlMsg( 'visualeditor-changedesc-image-size', $( '<del>' ).text( sizeFrom ), $( '<ins>' ).text( sizeTo ) )
|
||||
);
|
||||
}
|
||||
for ( key in attributeChanges ) {
|
||||
if ( customKeys.indexOf( key ) === -1 ) {
|
||||
|
@ -154,13 +156,13 @@ ve.dm.MWImageNode.static.describeChanges = function ( attributeChanges, attribut
|
|||
ve.dm.MWImageNode.static.describeChange = function ( key, change ) {
|
||||
switch ( key ) {
|
||||
case 'align':
|
||||
return ve.msg( 'visualeditor-changedesc-align',
|
||||
return ve.htmlMsg( 'visualeditor-changedesc-align',
|
||||
// Messages used:
|
||||
// visualeditor-align-desc-left, visualeditor-align-desc-right,
|
||||
// visualeditor-align-desc-center, visualeditor-align-desc-default,
|
||||
// visualeditor-align-desc-none
|
||||
ve.msg( 'visualeditor-align-desc-' + change.from ),
|
||||
ve.msg( 'visualeditor-align-desc-' + change.to )
|
||||
$( '<del>' ).text( ve.msg( 'visualeditor-align-desc-' + change.from ) ),
|
||||
$( '<ins>' ).text( ve.msg( 'visualeditor-align-desc-' + change.to ) )
|
||||
);
|
||||
case 'originalClasses':
|
||||
case 'unrecognizedClasses':
|
||||
|
|
|
@ -70,6 +70,13 @@ ve.init.mw.Platform.prototype.addMessages = function ( messages ) {
|
|||
*/
|
||||
ve.init.mw.Platform.prototype.getMessage = mw.msg.bind( mw );
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.Platform.prototype.getHtmlMessage = function () {
|
||||
return mw.message.apply( mw.message, arguments ).parseDom();
|
||||
};
|
||||
|
||||
/**
|
||||
* @method
|
||||
* @inheritdoc
|
||||
|
|
|
@ -19,6 +19,26 @@
|
|||
};
|
||||
ve.test.utils.MWDummyTarget = MWDummyTarget;
|
||||
|
||||
function MWDummyPlatform() {
|
||||
MWDummyPlatform.super.apply( this, arguments );
|
||||
// Disable some API requests from platform
|
||||
this.imageInfoCache = null;
|
||||
}
|
||||
OO.inheritClass( MWDummyPlatform, ve.init.mw.Platform );
|
||||
MWDummyPlatform.prototype.getMessage = function () { return Array.prototype.join.call( arguments, ',' ); };
|
||||
MWDummyPlatform.prototype.getHtmlMessage = function () {
|
||||
var $wrapper = $( '<div>' );
|
||||
Array.prototype.forEach.call( arguments, function ( arg, i, args ) {
|
||||
$wrapper.append( arg );
|
||||
if ( i < args.length - 1 ) {
|
||||
$wrapper.append( ',' );
|
||||
}
|
||||
} );
|
||||
// Re-parse HTML to merge text nodes
|
||||
return $( $.parseHTML( $wrapper.html() ) );
|
||||
};
|
||||
ve.test.utils.MWDummyPlatform = MWDummyPlatform;
|
||||
|
||||
// Unregister MW override nodes.
|
||||
// They are temporarily registered in setup/teardown.
|
||||
ve.dm.modelRegistry.unregister( ve.dm.MWHeadingNode );
|
||||
|
@ -44,9 +64,7 @@
|
|||
|
||||
corePlatform = ve.init.platform;
|
||||
coreTarget = ve.init.target;
|
||||
mwPlatform = new ve.init.mw.Platform();
|
||||
// Disable some API requests from platform
|
||||
mwPlatform.imageInfoCache = null;
|
||||
mwPlatform = new ve.test.utils.MWDummyPlatform();
|
||||
// Unregister mwPlatform
|
||||
ve.init.platform = corePlatform;
|
||||
|
||||
|
|
Loading…
Reference in a new issue