diff --git a/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js b/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js index d913356687..e9b9c8cae6 100644 --- a/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js +++ b/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js @@ -175,6 +175,21 @@ QUnit.test( 'convert', function ( assert ) { { type: '/internalList' } ] }, + { + msg: 'Headings, parsoid fallback ids don\'t interfere with whitespace stripping', + pasteString: '== Tudnivalók ==', + pasteType: 'text/plain', + parsoidResponse: '

Tudnivalók

', + annotations: [], + assertDom: true, + expectedData: [ + { type: 'mwHeading', attributes: { level: 2 }, originalDomElements: $( '

Tudnivalók

' ).toArray() }, + 'T', 'u', 'd', 'n', 'i', 'v', 'a', 'l', 'ó', 'k', + { type: '/mwHeading' }, + { type: 'internalList' }, + { type: '/internalList' } + ] + }, { msg: 'Magic link (RFC)', pasteString: 'RFC 1234', diff --git a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js index 10aedba918..dfe8b831c2 100644 --- a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js +++ b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js @@ -128,6 +128,9 @@ ve.ui.MWWikitextStringTransferHandler.prototype.process = function () { } } + // Strip legacy IDs, for example in section headings + ve.stripParsoidFallbackIds( htmlDoc.body ); + // Pass an empty object for the second argument (importRules) so that clipboard mode is used // TODO: Fix that API doc = handler.surface.getModel().getDocument().newFromHtml( htmlDoc, {} );