From 425e58161312aeed1c25c422238d0ada00452842 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sat, 16 May 2015 18:02:33 +0100 Subject: [PATCH] Unregister core image types Once MW images are registered, we should remove core image support so we don't accidentally match to them (e.g. an MW inline image with an unsupported extra RDFa type). Change-Id: I1c8567346c371fe338f95b232c9ac53e009c5a46 --- modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js | 1 + modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js | 1 + modules/ve-mw/init/ve.init.mw.Target.js | 2 +- modules/ve-mw/tests/ve.test.utils.js | 5 ++++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js index 3f7ee0fb7c..1af33b080c 100644 --- a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js +++ b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js @@ -251,4 +251,5 @@ ve.dm.MWBlockImageNode.prototype.getCaptionNode = function () { /* Registration */ +ve.dm.modelRegistry.unregister( ve.dm.BlockImageNode ); ve.dm.modelRegistry.register( ve.dm.MWBlockImageNode ); diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js index cbe5cc252d..521fb368fc 100644 --- a/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js +++ b/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js @@ -211,4 +211,5 @@ ve.dm.MWInlineImageNode.static.toDomElements = function ( data, doc ) { /* Registration */ +ve.dm.modelRegistry.unregister( ve.dm.InlineImageNode ); ve.dm.modelRegistry.register( ve.dm.MWInlineImageNode ); diff --git a/modules/ve-mw/init/ve.init.mw.Target.js b/modules/ve-mw/init/ve.init.mw.Target.js index 109f685d01..b52abbbdeb 100644 --- a/modules/ve-mw/init/ve.init.mw.Target.js +++ b/modules/ve-mw/init/ve.init.mw.Target.js @@ -240,7 +240,7 @@ ve.init.mw.Target.static.importRules = { // Annotations 'link', 'textStyle/span', 'textStyle/font', 'textStyle/underline', 'meta/language', // Nodes - 'inlineImage', 'blockImage', 'div', 'alienInline', 'alienBlock', 'comment' + 'div', 'alienInline', 'alienBlock', 'comment' ], removeOriginalDomElements: true }, diff --git a/modules/ve-mw/tests/ve.test.utils.js b/modules/ve-mw/tests/ve.test.utils.js index 4d12e0badb..9d370cadf1 100644 --- a/modules/ve-mw/tests/ve.test.utils.js +++ b/modules/ve-mw/tests/ve.test.utils.js @@ -37,7 +37,10 @@ ve.test.utils.mwEnvironment = ( function () { ve.dm.MWPreformattedNode, ve.dm.MWTableNode ], - overridden = []; + overridden = [ + ve.dm.InlineImageNode, + ve.dm.BlockImageNode + ]; function setupOverrides() { var i;