mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
MWWikitextSurfaceFragment#convertFromSource: Don't make an invalid doc
Though neat, this hack to get the internal list doesn't seem to be used and creates an invalid document (just an internal list with no content, so the internal list is at the start and the default selection position is inside it). Instead, use the ve.dm.Document.static.newBlankDocument() utility function that was made for this use case. Bug: T153509 Change-Id: Iba5931cb5e3f939a803c1d59fa0d8f30a0513f84
This commit is contained in:
parent
1865702448
commit
6fd475e8ec
|
@ -155,7 +155,7 @@ ve.dm.MWWikitextSurfaceFragment.prototype.convertFromSource = function ( source
|
|||
var parsePromise;
|
||||
if ( !source ) {
|
||||
parsePromise = $.Deferred().resolve(
|
||||
this.getDocument().cloneFromRange( new ve.Range( 0 ) )
|
||||
ve.dm.Document.static.newBlankDocument()
|
||||
).promise();
|
||||
} else {
|
||||
parsePromise = new mw.Api().post( {
|
||||
|
|
Loading…
Reference in a new issue