Jforrester has uploaded a new change for review. https://gerrit.wikimedia.org/r/324609
Change subject: Use canonical ve.dm.TransactionBuilder.static.newFrom* methods ...................................................................... Use canonical ve.dm.TransactionBuilder.static.newFrom* methods Change-Id: I082048a677baa2699d94e21548373952d52db61b --- M modules/ve-mw/dm/models/ve.dm.MWImageModel.js M modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js M modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js M modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js M modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js M modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js M modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js M modules/ve-mw/ui/ve.ui.MWExtensionWindow.js 8 files changed, 16 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/09/324609/1 diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js index d92fa18..800d937 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js @@ -404,7 +404,7 @@ // Remove contents of old caption surfaceModel.change( - ve.dm.Transaction.newFromRemoval( + ve.dm.TransactionBuilder.static.newFromRemoval( doc, captionRange, true @@ -413,7 +413,7 @@ // Add contents of new caption surfaceModel.change( - ve.dm.Transaction.newFromDocumentInsertion( + ve.dm.TransactionBuilder.static.newFromDocumentInsertion( doc, captionRange.start, this.getCaptionDocument() @@ -423,7 +423,7 @@ // Update attributes surfaceModel.change( - ve.dm.Transaction.newFromAttributeChanges( + ve.dm.TransactionBuilder.static.newFromAttributeChanges( doc, node.getOffset(), this.getUpdatedAttributes() @@ -473,7 +473,7 @@ if ( captionDoc.data.hasContent() ) { // Add contents of new caption surfaceModel.change( - ve.dm.Transaction.newFromDocumentInsertion( + ve.dm.TransactionBuilder.static.newFromDocumentInsertion( surfaceModel.getDocument(), fragment.getSelection().getRange().start + 2, this.getCaptionDocument() diff --git a/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js b/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js index bcf9c46..6268fd9 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWTransclusionModel.js @@ -84,7 +84,7 @@ // (which generates a removal and insertion) as blanking a reference triggers T135127. // TODO: Once T135127 is fixed, revert to using surfaceFragment.insert. surfaceFragment.getSurface().change( - ve.dm.Transaction.newFromReplacement( surfaceFragment.getDocument(), range, data ) + ve.dm.TransactionBuilder.static.newFromReplacement( surfaceFragment.getDocument(), range, data ) ); } deferred.resolve(); diff --git a/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js b/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js index 9cc7ddd..f56608e 100644 --- a/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js +++ b/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js @@ -129,7 +129,7 @@ // do not contain any link annotations. data.setAnnotationsAtOffset( 0, annotations ); data.setAnnotationsAtOffset( 1, annotations ); - return ve.dm.Transaction.newFromReplacement( + return ve.dm.TransactionBuilder.static.newFromReplacement( doc, range, data.getData() ); } ); diff --git a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js index 74e8dc0..dd298a4 100644 --- a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js +++ b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js @@ -124,7 +124,7 @@ for ( i = data.length - 1; i >= 0; i-- ) { if ( ve.getProp( data[ i ], 'attributes', 'mw', 'autoGenerated' ) ) { surface.change( - ve.dm.Transaction.newFromRemoval( + ve.dm.TransactionBuilder.static.newFromRemoval( doc, surface.getDocument().getDocumentNode().getNodeFromOffset( i + 1 ).getOuterRange() ) @@ -139,7 +139,7 @@ // Attempt to undo outermost p-wrapping if possible try { surface.change( - ve.dm.Transaction.newFromWrap( doc, new ve.Range( 0, doc.data.countNonInternalElements() ), [], [], [ { type: 'paragraph' } ], [] ) + ve.dm.TransactionBuilder.static.newFromWrap( doc, new ve.Range( 0, doc.data.countNonInternalElements() ), [], [], [ { type: 'paragraph' } ], [] ) ); } catch ( e ) { // Sometimes there is no p-wrapping, for example: "* foo" diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js index 331b877..ce23bd2 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWExtensionPreviewDialog.js @@ -82,7 +82,7 @@ this.updateMwData( mwData ); doc.commit( - ve.dm.Transaction.newFromAttributeChanges( + ve.dm.TransactionBuilder.static.newFromAttributeChanges( doc, this.previewNode.getOuterRange().start, { mw: mwData } ) ); diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js index 5f801a2..f53b843 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkNodeInspector.js @@ -117,7 +117,7 @@ if ( remove ) { surfaceModel.change( - ve.dm.Transaction.newFromRemoval( doc, nodeRange ) + ve.dm.TransactionBuilder.static.newFromRemoval( doc, nodeRange ) ); } else if ( convert ) { annotation = new ve.dm.MWExternalLinkAnnotation( { @@ -131,7 +131,7 @@ content = value.split( '' ); ve.dm.Document.static.addAnnotationsToData( content, annotations ); surfaceModel.change( - ve.dm.Transaction.newFromReplacement( doc, nodeRange, content ) + ve.dm.TransactionBuilder.static.newFromReplacement( doc, nodeRange, content ) ); setTimeout( function () { // This just removed the node and turned it into an annotation. Thus, this inspector @@ -152,7 +152,7 @@ } ); } else { surfaceModel.change( - ve.dm.Transaction.newFromAttributeChanges( + ve.dm.TransactionBuilder.static.newFromAttributeChanges( doc, nodeRange.start, { href: value } ) ); diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js index 4554818..9ae730b 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWMagicLinkNodeInspector.js @@ -152,7 +152,7 @@ if ( remove ) { surfaceModel.change( - ve.dm.Transaction.newFromRemoval( doc, nodeRange ) + ve.dm.TransactionBuilder.static.newFromRemoval( doc, nodeRange ) ); } else if ( convert ) { annotation = ve.dm.MWMagicLinkNode.static.annotationFromContent( @@ -164,12 +164,12 @@ content = value.split( '' ); ve.dm.Document.static.addAnnotationsToData( content, annotations ); surfaceModel.change( - ve.dm.Transaction.newFromReplacement( doc, nodeRange, content ) + ve.dm.TransactionBuilder.static.newFromReplacement( doc, nodeRange, content ) ); } } else if ( done && this.validate( value ) ) { surfaceModel.change( - ve.dm.Transaction.newFromAttributeChanges( + ve.dm.TransactionBuilder.static.newFromAttributeChanges( doc, nodeRange.start, { content: value } ) ); diff --git a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js index 48a54ad..8c69352 100644 --- a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js +++ b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js @@ -159,7 +159,7 @@ mwData = ve.copy( this.selectedNode.getAttribute( 'mw' ) ); this.updateMwData( mwData ); surfaceModel.change( - ve.dm.Transaction.newFromAttributeChanges( + ve.dm.TransactionBuilder.static.newFromAttributeChanges( surfaceModel.getDocument(), this.selectedNode.getOuterRange().start, { mw: mwData } -- To view, visit https://gerrit.wikimedia.org/r/324609 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I082048a677baa2699d94e21548373952d52db61b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits