From cf628016946b84b253b37758ab810930ce293dbd Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 6 Feb 2014 22:30:07 +0000 Subject: [PATCH] Move paste rules to Target Because ViewPageTarget isn't always loaded. Bug: 60912 Change-Id: I16bd6a329120b3dd7dcb0de3e76e69e84c18553f --- .../init/targets/ve.init.mw.ViewPageTarget.js | 13 ------------- modules/ve-mw/init/ve.init.mw.Target.js | 14 +++++++++++++- .../ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js | 4 ++-- .../ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js | 4 ++-- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index 5559a66e21..8000c66320 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -134,19 +134,6 @@ OO.inheritClass( ve.init.mw.ViewPageTarget, ve.init.mw.Target ); /* Static Properties */ -ve.init.mw.ViewPageTarget.static.pasteRules = { - 'external': { - 'blacklist': [ - // Annotations - 'link', 'textStyle/span', 'textStyle/underline', - // Nodes - 'image', 'div', 'alienInline', 'alienBlock' - ], - 'removeHtmlAttributes': true - }, - 'all': null -}; - /** * Compatibility map used with jQuery.client to black-list incompatible browsers. * diff --git a/modules/ve-mw/init/ve.init.mw.Target.js b/modules/ve-mw/init/ve.init.mw.Target.js index 5c246a4187..5ec9310bd7 100644 --- a/modules/ve-mw/init/ve.init.mw.Target.js +++ b/modules/ve-mw/init/ve.init.mw.Target.js @@ -198,9 +198,21 @@ ve.init.mw.Target.static.toolbarGroups = [ 'promote': [ 'reference', 'mediaInsert' ], 'demote': [ 'language', 'specialcharacter' ] } - ]; +ve.init.mw.Target.static.pasteRules = { + 'external': { + 'blacklist': [ + // Annotations + 'link', 'textStyle/span', 'textStyle/underline', + // Nodes + 'image', 'div', 'alienInline', 'alienBlock' + ], + 'removeHtmlAttributes': true + }, + 'all': null +}; + /* Static Methods */ /** diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js index 1584ae0411..cc73830080 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js @@ -92,11 +92,11 @@ ve.ui.MWMediaEditDialog.static.surfaceCommands = [ ]; ve.ui.MWMediaEditDialog.static.pasteRules = ve.extendObject( - ve.copy( ve.init.mw.ViewPageTarget.static.pasteRules ), + ve.copy( ve.init.mw.Target.static.pasteRules ), { 'all': { 'blacklist': OO.simpleArrayUnion( - ve.getProp( ve.init.mw.ViewPageTarget.static.pasteRules, 'all', 'blacklist' ) || [], + ve.getProp( ve.init.mw.Target.static.pasteRules, 'all', 'blacklist' ) || [], [ // Tables (but not lists) are possible in wikitext with a leading // line break but we prevent creating these with the UI diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js index dcd07f349a..35cfa89a57 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js @@ -90,11 +90,11 @@ ve.ui.MWReferenceDialog.static.surfaceCommands = [ ]; ve.ui.MWReferenceDialog.static.pasteRules = ve.extendObject( - ve.copy( ve.init.mw.ViewPageTarget.static.pasteRules ), + ve.copy( ve.init.mw.Target.static.pasteRules ), { 'all': { 'blacklist': OO.simpleArrayUnion( - ve.getProp( ve.init.mw.ViewPageTarget.static.pasteRules, 'all', 'blacklist' ) || [], + ve.getProp( ve.init.mw.Target.static.pasteRules, 'all', 'blacklist' ) || [], [ // Nested references are impossible 'mwReference', 'mwReferenceList',