Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/324800

Change subject: Add #convertNodes to SourceSurfaceFragment
......................................................................

Add #convertNodes to SourceSurfaceFragment

Change-Id: I0143e35e8188818c592d94b461e943bfd466b1e9
---
M src/dm/ve.dm.SourceSurfaceFragment.js
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/00/324800/1

diff --git a/src/dm/ve.dm.SourceSurfaceFragment.js 
b/src/dm/ve.dm.SourceSurfaceFragment.js
index a4b4b77..5283ca3 100644
--- a/src/dm/ve.dm.SourceSurfaceFragment.js
+++ b/src/dm/ve.dm.SourceSurfaceFragment.js
@@ -48,6 +48,30 @@
 /**
  * @inheritdoc
  */
+ve.dm.SourceSurfaceFragment.prototype.convertNodes = function () {
+       var tempFragment, tempSurfaceModel,
+               args = arguments,
+               fragment = this,
+               text = this.getText( true );
+
+       this.convertFromSource( text ).then( function ( selectionDocument ) {
+               tempSurfaceModel = new ve.dm.Surface( selectionDocument );
+               tempFragment = tempSurfaceModel.getLinearFragment(
+                       // TODO: Find content offsets
+                       new ve.Range( 0, 
selectionDocument.getInternalList().getListNode().getOuterRange().start )
+               );
+               tempFragment.convertNodes.apply( tempFragment, args );
+
+               fragment.insertDocument( tempFragment.getDocument() );
+       } );
+
+
+       return this;
+};
+
+/**
+ * @inheritdoc
+ */
 ve.dm.SourceSurfaceFragment.prototype.insertContent = function ( content ) {
        var data;
 

-- 
To view, visit https://gerrit.wikimedia.org/r/324800
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0143e35e8188818c592d94b461e943bfd466b1e9
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to