From 7254fbe2cf220ea4f7e7da57dc4c8b4a60d28897 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 14 May 2018 12:55:31 +0100 Subject: [PATCH] Use better align change descriptions Adds support for align=none. Also don't show changes from class names. Change-Id: Ia00a51dd52af73183e98c8a87f4c60ee5380d81f Depends-On: Ic668454c4b4b069dab46a608530c85a5bb7e7ad8 --- extension.json | 5 +++++ modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js | 22 +++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/extension.json b/extension.json index 2314acc6ed..1e132f4b46 100644 --- a/extension.json +++ b/extension.json @@ -983,6 +983,11 @@ "visualeditor", "visualeditor-aliencontextitem-title", "visualeditor-aliennode-tooltip", + "visualeditor-align-desc-center", + "visualeditor-align-desc-default", + "visualeditor-align-desc-left", + "visualeditor-align-desc-none", + "visualeditor-align-desc-right", "visualeditor-align-widget-center", "visualeditor-align-widget-default", "visualeditor-align-widget-left", diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js index 7fc0c4b416..d8ef51ee26 100644 --- a/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js +++ b/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js @@ -147,14 +147,20 @@ ve.dm.MWImageNode.static.describeChanges = function ( attributeChanges, attribut }; ve.dm.MWImageNode.static.describeChange = function ( key, change ) { - if ( key === 'align' ) { - return ve.msg( 'visualeditor-changedesc-align', - // Messages used: - // visualeditor-align-widget-left, visualeditor-align-widget-right, - // visualeditor-align-widget-center, visualeditor-align-widget-default - ve.msg( 'visualeditor-align-widget-' + change.from ), - ve.msg( 'visualeditor-align-widget-' + change.to ) - ); + switch ( key ) { + case 'align': + return ve.msg( '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 ) + ); + case 'originalClasses': + case 'unrecognizedClasses': + return; + // TODO: Handle valign } // Parent method return ve.dm.Node.static.describeChange.apply( this, arguments );