From fdb7390d271350d871094aee669da153286be814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 24 Oct 2022 18:36:31 +0200 Subject: [PATCH] Allow 'nofollow' on external links in Parsoid output Bug: T321437 Change-Id: I4070b3b16c8b2b76a0e7a67599efd914cbde63aa --- modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js | 2 ++ modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js | 3 +++ modules/ve-mw/dm/nodes/ve.dm.MWNumberedExternalLinkNode.js | 3 +++ 3 files changed, 8 insertions(+) diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js b/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js index 2a6228e588..208c9d3db6 100644 --- a/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js +++ b/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js @@ -35,6 +35,8 @@ OO.inheritClass( ve.dm.MWExternalLinkAnnotation, ve.dm.LinkAnnotation ); ve.dm.MWExternalLinkAnnotation.static.name = 'link/mwExternal'; +// Allow 'nofollow' in Parsoid output (T321437) +// Allow all unknown types for external paste (handled in toDataElement) ve.dm.MWExternalLinkAnnotation.static.allowedRdfaTypes = null; ve.dm.MWExternalLinkAnnotation.static.toDataElement = function ( domElements, converter ) { diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js index cc82bf0171..e881e2f1bf 100644 --- a/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js +++ b/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js @@ -39,6 +39,9 @@ ve.dm.MWMagicLinkNode.static.matchTagNames = [ 'a' ]; ve.dm.MWMagicLinkNode.static.matchRdfaTypes = [ 'mw:WikiLink', 'mw:ExtLink' ]; +// Allow 'nofollow' in Parsoid output (T321437) +ve.dm.MWMagicLinkNode.static.allowedRdfaTypes = [ 'nofollow' ]; + ve.dm.MWMagicLinkNode.static.disallowedAnnotationTypes = [ 'link' ]; /** diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWNumberedExternalLinkNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWNumberedExternalLinkNode.js index 5c9c32374b..1954cdc906 100644 --- a/modules/ve-mw/dm/nodes/ve.dm.MWNumberedExternalLinkNode.js +++ b/modules/ve-mw/dm/nodes/ve.dm.MWNumberedExternalLinkNode.js @@ -39,6 +39,9 @@ ve.dm.MWNumberedExternalLinkNode.static.matchTagNames = [ 'a' ]; ve.dm.MWNumberedExternalLinkNode.static.matchRdfaTypes = [ 'mw:ExtLink', 've:NumberedLink' ]; +// Allow 'nofollow' in Parsoid output (T321437) +ve.dm.MWNumberedExternalLinkNode.static.allowedRdfaTypes = [ 'nofollow' ]; + ve.dm.MWNumberedExternalLinkNode.static.disallowedAnnotationTypes = [ 'link' ]; ve.dm.MWNumberedExternalLinkNode.static.matchFunction = function ( domElement ) {