mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
MWWikitextStringTransferHandler: Perform Parsoid cleanup on result
Parsoid markup delivered as a result of a paste was being handled differently. Bug: T183173 Change-Id: Ic563d2c5cd1f663f35860892b369fb7ba34b9c55
This commit is contained in:
parent
b82c7692be
commit
d97b734352
|
@ -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: '<h2 id="Tudnivalók"><span id="Tudnival.C3.B3k" typeof="mw:FallbackId"></span> Tudnivalók </h2>',
|
||||
annotations: [],
|
||||
assertDom: true,
|
||||
expectedData: [
|
||||
{ type: 'mwHeading', attributes: { level: 2 }, originalDomElements: $( '<h2 id="Tudnivalók"> Tudnivalók </h2>' ).toArray() },
|
||||
'T', 'u', 'd', 'n', 'i', 'v', 'a', 'l', 'ó', 'k',
|
||||
{ type: '/mwHeading' },
|
||||
{ type: 'internalList' },
|
||||
{ type: '/internalList' }
|
||||
]
|
||||
},
|
||||
{
|
||||
msg: 'Magic link (RFC)',
|
||||
pasteString: 'RFC 1234',
|
||||
|
|
|
@ -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, {} );
|
||||
|
|
Loading…
Reference in a new issue