Use ve.ce.nodeFactory.createFromModel

Also use ve.dm.nodeFactory.createFromElement

Depends-On: I259face33154b795143c8820abdfb6b4a495f141
Depends-On: I7fc539f75a1c9d672efc139b7884ecdfdff5f301
Change-Id: I032182616c409e65138b16fe7b238e7f7b3a8710
This commit is contained in:
Ed Sanders 2018-05-10 17:21:51 +01:00 committed by Jforrester
parent 9e9a23add4
commit 2ae4cfe0ab
2 changed files with 3 additions and 2 deletions

View file

@ -275,7 +275,7 @@ ve.ce.MWReferencesListNode.prototype.update = function () {
// Generate reference HTML from first item in key
modelNode = internalList.getItemNode( firstNode.getAttribute( 'listIndex' ) );
if ( modelNode && modelNode.length ) {
viewNode = new ve.ce.InternalItemNode( modelNode );
viewNode = ve.ce.nodeFactory.createFromModel( modelNode );
// Use 'done' instead of 'then' so content is updated synchronously
// if possible, for clipboard conversion.

View file

@ -121,10 +121,11 @@ ve.dm.MWReferencesListNode.static.toDomElements = function ( data, doc, converte
if ( isForClipboard ) {
// Output needs to be read so re-render
modelNode = ve.dm.nodeFactory.createFromElement( dataElement );
modelNode = new ve.dm.MWReferencesListNode( dataElement );
// Build from original doc's internal list to get all refs (T186407)
modelNode.setDocument( converter.originalDocInternalList.getDocument() );
viewNode = new ve.ce.MWReferencesListNode( modelNode );
viewNode = ve.ce.nodeFactory.createFromModel( modelNode );
viewNode.modified = true;
viewNode.update();
els = [ doc.createElement( 'div' ) ];