jenkins-bot has submitted this change and it was merged.

Change subject: Rename file drop to data transfer
......................................................................


Rename file drop to data transfer

Makes way for them to be able to handle content pastes too.

Change-Id: I3ea9d548ed1f658fbb649100d1870cb840e25b8e
---
M .docs/categories.json
M .docs/eg-iframe.html
M build/modules.json
M demos/ve/desktop.html
M demos/ve/mobile.html
M src/ce/ve.ce.Surface.js
R src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js
A src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js
A src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js
D src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js
D src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js
R src/ui/ve.ui.DataTransferHandler.js
A src/ui/ve.ui.DataTransferHandlerFactory.js
D src/ui/ve.ui.FileDropHandlerFactory.js
M src/ui/ve.ui.js
M tests/index.html
16 files changed, 289 insertions(+), 289 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.docs/categories.json b/.docs/categories.json
index 81d5261..036965e 100644
--- a/.docs/categories.json
+++ b/.docs/categories.json
@@ -123,7 +123,7 @@
                                        "ve.ui.TargetToolbar",
                                        "ve.ui.DebugBar",
                                        "ve.ui.Trigger",
-                                       "ve.ui.*FileDropHandler"
+                                       "ve.ui.*TransferHandler"
                                ]
                        },
                        {
diff --git a/.docs/eg-iframe.html b/.docs/eg-iframe.html
index 56fe838..4d1ce0d 100644
--- a/.docs/eg-iframe.html
+++ b/.docs/eg-iframe.html
@@ -304,8 +304,8 @@
                <script src="../src/ui/ve.ui.SequenceRegistry.js"></script>
                <script src="../src/ui/ve.ui.Action.js"></script>
                <script src="../src/ui/ve.ui.ActionFactory.js"></script>
-               <script src="../src/ui/ve.ui.FileDropHandler.js"></script>
-               <script 
src="../src/ui/ve.ui.FileDropHandlerFactory.js"></script>
+               <script src="../src/ui/ve.ui.DataTransferHandler.js"></script>
+               <script 
src="../src/ui/ve.ui.DataTransferHandlerFactory.js"></script>
                <script src="../src/ui/ve.ui.WindowManager.js"></script>
                <script 
src="../src/ui/actions/ve.ui.AnnotationAction.js"></script>
                <script src="../src/ui/actions/ve.ui.ContentAction.js"></script>
@@ -326,9 +326,9 @@
                <script 
src="../src/ui/dialogs/ve.ui.CommandHelpDialog.js"></script>
                <script 
src="../src/ui/dialogs/ve.ui.FindAndReplaceDialog.js"></script>
                <script 
src="../src/ui/dialogs/ve.ui.ProgressDialog.js"></script>
-               <script 
src="../src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js"></script>
-               <script 
src="../src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js"></script>
-               <script 
src="../src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js"></script>
+               <script 
src="../src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js"></script>
+               <script 
src="../src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js"></script>
+               <script 
src="../src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js"></script>
                <script 
src="../src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js"></script>
                <script src="../src/ui/widgets/ve.ui.AlignWidget.js"></script>
                <script 
src="../src/ui/widgets/ve.ui.LanguageSearchWidget.js"></script>
diff --git a/build/modules.json b/build/modules.json
index f37276f..981741b 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -328,8 +328,8 @@
                        "src/ui/ve.ui.SequenceRegistry.js",
                        "src/ui/ve.ui.Action.js",
                        "src/ui/ve.ui.ActionFactory.js",
-                       "src/ui/ve.ui.FileDropHandler.js",
-                       "src/ui/ve.ui.FileDropHandlerFactory.js",
+                       "src/ui/ve.ui.DataTransferHandler.js",
+                       "src/ui/ve.ui.DataTransferHandlerFactory.js",
                        "src/ui/ve.ui.WindowManager.js",
                        "src/ui/actions/ve.ui.AnnotationAction.js",
                        "src/ui/actions/ve.ui.ContentAction.js",
@@ -350,9 +350,9 @@
                        "src/ui/dialogs/ve.ui.CommandHelpDialog.js",
                        "src/ui/dialogs/ve.ui.FindAndReplaceDialog.js",
                        "src/ui/dialogs/ve.ui.ProgressDialog.js",
-                       "src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js",
-                       
"src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js",
-                       "src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js",
+                       
"src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js",
+                       
"src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js",
+                       
"src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js",
                        
"src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js",
                        "src/ui/widgets/ve.ui.AlignWidget.js",
                        "src/ui/widgets/ve.ui.LanguageSearchWidget.js",
diff --git a/demos/ve/desktop.html b/demos/ve/desktop.html
index 23f6d91..cf2c404 100644
--- a/demos/ve/desktop.html
+++ b/demos/ve/desktop.html
@@ -317,8 +317,8 @@
                <script src="../../src/ui/ve.ui.SequenceRegistry.js"></script>
                <script src="../../src/ui/ve.ui.Action.js"></script>
                <script src="../../src/ui/ve.ui.ActionFactory.js"></script>
-               <script src="../../src/ui/ve.ui.FileDropHandler.js"></script>
-               <script 
src="../../src/ui/ve.ui.FileDropHandlerFactory.js"></script>
+               <script 
src="../../src/ui/ve.ui.DataTransferHandler.js"></script>
+               <script 
src="../../src/ui/ve.ui.DataTransferHandlerFactory.js"></script>
                <script src="../../src/ui/ve.ui.WindowManager.js"></script>
                <script 
src="../../src/ui/actions/ve.ui.AnnotationAction.js"></script>
                <script 
src="../../src/ui/actions/ve.ui.ContentAction.js"></script>
@@ -339,9 +339,9 @@
                <script 
src="../../src/ui/dialogs/ve.ui.CommandHelpDialog.js"></script>
                <script 
src="../../src/ui/dialogs/ve.ui.FindAndReplaceDialog.js"></script>
                <script 
src="../../src/ui/dialogs/ve.ui.ProgressDialog.js"></script>
-               <script 
src="../../src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js"></script>
-               <script 
src="../../src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js"></script>
-               <script 
src="../../src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js"></script>
+               <script 
src="../../src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js"></script>
+               <script 
src="../../src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js"></script>
+               <script 
src="../../src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js"></script>
                <script 
src="../../src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js"></script>
                <script 
src="../../src/ui/widgets/ve.ui.AlignWidget.js"></script>
                <script 
src="../../src/ui/widgets/ve.ui.LanguageSearchWidget.js"></script>
diff --git a/demos/ve/mobile.html b/demos/ve/mobile.html
index f423327..545566c 100644
--- a/demos/ve/mobile.html
+++ b/demos/ve/mobile.html
@@ -318,8 +318,8 @@
                <script src="../../src/ui/ve.ui.SequenceRegistry.js"></script>
                <script src="../../src/ui/ve.ui.Action.js"></script>
                <script src="../../src/ui/ve.ui.ActionFactory.js"></script>
-               <script src="../../src/ui/ve.ui.FileDropHandler.js"></script>
-               <script 
src="../../src/ui/ve.ui.FileDropHandlerFactory.js"></script>
+               <script 
src="../../src/ui/ve.ui.DataTransferHandler.js"></script>
+               <script 
src="../../src/ui/ve.ui.DataTransferHandlerFactory.js"></script>
                <script src="../../src/ui/ve.ui.WindowManager.js"></script>
                <script 
src="../../src/ui/actions/ve.ui.AnnotationAction.js"></script>
                <script 
src="../../src/ui/actions/ve.ui.ContentAction.js"></script>
@@ -340,9 +340,9 @@
                <script 
src="../../src/ui/dialogs/ve.ui.CommandHelpDialog.js"></script>
                <script 
src="../../src/ui/dialogs/ve.ui.FindAndReplaceDialog.js"></script>
                <script 
src="../../src/ui/dialogs/ve.ui.ProgressDialog.js"></script>
-               <script 
src="../../src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js"></script>
-               <script 
src="../../src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js"></script>
-               <script 
src="../../src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js"></script>
+               <script 
src="../../src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js"></script>
+               <script 
src="../../src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js"></script>
+               <script 
src="../../src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js"></script>
                <script 
src="../../src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js"></script>
                <script 
src="../../src/ui/widgets/ve.ui.AlignWidget.js"></script>
                <script 
src="../../src/ui/widgets/ve.ui.LanguageSearchWidget.js"></script>
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 2e61877..725b6d9 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -1023,10 +1023,10 @@
                }
        } else if ( dataTransfer.files.length ) {
                for ( i = 0, l = dataTransfer.files.length; i < l; i++ ) {
-                       name = 
ve.ui.fileDropHandlerFactory.getHandlerNameForType( dataTransfer.files[i].type 
);
+                       name = 
ve.ui.dataTransferHandlerFactory.getHandlerNameForType( 
dataTransfer.files[i].type );
                        if ( name ) {
                                fileHandlers.push(
-                                       ve.ui.fileDropHandlerFactory.create( 
name, this.surface, dataTransfer.files[i] )
+                                       
ve.ui.dataTransferHandlerFactory.create( name, this.surface, 
dataTransfer.files[i] )
                                );
                        }
                }
diff --git a/src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js 
b/src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js
similarity index 63%
rename from src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js
rename to src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js
index ad1fe39..853dbf7 100644
--- a/src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js
+++ b/src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js
@@ -1,40 +1,40 @@
 /*!
- * VisualEditor UserInterface delimiter-separated values file drop handler 
class.
+ * VisualEditor UserInterface delimiter-separated values file transfer handler 
class.
  *
  * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
  */
 
 /**
- * Delimiter-separated values file drop handler.
+ * Delimiter-separated values file transfer handler.
  *
  * @class
- * @extends ve.ui.FileDropHandler
+ * @extends ve.ui.DataTransferHandler
  *
  * @constructor
  * @param {ve.ui.Surface} surface
  * @param {File} file
  */
-ve.ui.DSVFileDropHandler = function VeUiDSVFileDropHandler() {
+ve.ui.DSVFileTransferHandler = function VeUiDSVFileTransferHandler() {
        // Parent constructor
-       ve.ui.DSVFileDropHandler.super.apply( this, arguments );
+       ve.ui.DSVFileTransferHandler.super.apply( this, arguments );
 };
 
 /* Inheritance */
 
-OO.inheritClass( ve.ui.DSVFileDropHandler, ve.ui.FileDropHandler );
+OO.inheritClass( ve.ui.DSVFileTransferHandler, ve.ui.DataTransferHandler );
 
 /* Static properties */
 
-ve.ui.DSVFileDropHandler.static.name = 'dsv';
+ve.ui.DSVFileTransferHandler.static.name = 'dsv';
 
-ve.ui.DSVFileDropHandler.static.types = [ 'text/csv', 
'text/tab-separated-values' ];
+ve.ui.DSVFileTransferHandler.static.types = [ 'text/csv', 
'text/tab-separated-values' ];
 
 /* Methods */
 
 /**
  * @inheritdoc
  */
-ve.ui.DSVFileDropHandler.prototype.process = function () {
+ve.ui.DSVFileTransferHandler.prototype.process = function () {
        this.createProgress( this.insertableDataDeferred.promise() );
        this.reader.readAsText( this.file );
 };
@@ -42,7 +42,7 @@
 /**
  * @inheritdoc
  */
-ve.ui.DSVFileDropHandler.prototype.onFileProgress = function ( e ) {
+ve.ui.DSVFileTransferHandler.prototype.onFileProgress = function ( e ) {
        if ( e.lengthComputable ) {
                this.setProgress( 100 * e.loaded / e.total );
        } else {
@@ -53,7 +53,7 @@
 /**
  * @inheritdoc
  */
-ve.ui.DSVFileDropHandler.prototype.onFileLoad = function () {
+ve.ui.DSVFileTransferHandler.prototype.onFileLoad = function () {
        var i, j, line,
                data = [],
                input = Papa.parse( this.reader.result );
@@ -89,7 +89,7 @@
 /**
  * @inheritdoc
  */
-ve.ui.DSVFileDropHandler.prototype.onFileLoadEnd = function () {
+ve.ui.DSVFileTransferHandler.prototype.onFileLoadEnd = function () {
        // 'loadend' fires after 'load'/'abort'/'error'.
        // Reject the deferred if it hasn't already resolved.
        this.insertableDataDeferred.reject();
@@ -98,13 +98,13 @@
 /**
  * @inheritdoc
  */
-ve.ui.DSVFileDropHandler.prototype.abort = function () {
+ve.ui.DSVFileTransferHandler.prototype.abort = function () {
        // Parent method
-       ve.ui.DSVFileDropHandler.super.prototype.abort.call( this );
+       ve.ui.DSVFileTransferHandler.super.prototype.abort.call( this );
 
        this.reader.abort();
 };
 
 /* Registration */
 
-ve.ui.fileDropHandlerFactory.register( ve.ui.DSVFileDropHandler );
+ve.ui.dataTransferHandlerFactory.register( ve.ui.DSVFileTransferHandler );
diff --git a/src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js 
b/src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js
new file mode 100644
index 0000000..2ec1203
--- /dev/null
+++ b/src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js
@@ -0,0 +1,84 @@
+/*!
+ * VisualEditor UserInterface HTML file transfer handler class.
+ *
+ * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
+ */
+
+/**
+ * HTML file transfer handler.
+ *
+ * @class
+ * @extends ve.ui.DataTransferHandler
+ *
+ * @constructor
+ * @param {ve.ui.Surface} surface
+ * @param {File} file
+ */
+ve.ui.HTMLFileTransferHandler = function VeUiHTMLFileTransferHandler() {
+       // Parent constructor
+       ve.ui.HTMLFileTransferHandler.super.apply( this, arguments );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.HTMLFileTransferHandler, ve.ui.DataTransferHandler );
+
+/* Static properties */
+
+ve.ui.HTMLFileTransferHandler.static.name = 'html';
+
+ve.ui.HTMLFileTransferHandler.static.types = [ 'text/html', 
'application/xhtml+xml' ];
+
+/* Methods */
+
+/**
+ * @inheritdoc
+ */
+ve.ui.HTMLFileTransferHandler.prototype.process = function () {
+       this.createProgress( this.insertableDataDeferred.promise() );
+       this.reader.readAsText( this.file );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.HTMLFileTransferHandler.prototype.onFileProgress = function ( e ) {
+       if ( e.lengthComputable ) {
+               this.setProgress( 100 * e.loaded / e.total );
+       } else {
+               this.setProgress( false );
+       }
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.HTMLFileTransferHandler.prototype.onFileLoad = function () {
+       this.insertableDataDeferred.resolve(
+               this.surface.getModel().getDocument().newFromHtml( 
this.reader.result )
+       );
+       this.setProgress( 100 );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.HTMLFileTransferHandler.prototype.onFileLoadEnd = function () {
+       // 'loadend' fires after 'load'/'abort'/'error'.
+       // Reject the deferred if it hasn't already resolved.
+       this.insertableDataDeferred.reject();
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.HTMLFileTransferHandler.prototype.abort = function () {
+       // Parent method
+       ve.ui.HTMLFileTransferHandler.super.prototype.abort.call( this );
+
+       this.reader.abort();
+};
+
+/* Registration */
+
+ve.ui.dataTransferHandlerFactory.register( ve.ui.HTMLFileTransferHandler );
diff --git a/src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js 
b/src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js
new file mode 100644
index 0000000..fe78634
--- /dev/null
+++ b/src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js
@@ -0,0 +1,93 @@
+/*!
+ * VisualEditor UserInterface plain text file data transfer handler class.
+ *
+ * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
+ */
+
+/**
+ * Plain text data transfer filetransfer handler.
+ *
+ * @class
+ * @extends ve.ui.DataTransferHandler
+ *
+ * @constructor
+ * @param {ve.ui.Surface} surface
+ * @param {File} file
+ */
+ve.ui.PlainTextFileTransferHandler = function 
VeUiPlainTextFileTransferHandler() {
+       // Parent constructor
+       ve.ui.PlainTextFileTransferHandler.super.apply( this, arguments );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.PlainTextFileTransferHandler, ve.ui.DataTransferHandler 
);
+
+/* Static properties */
+
+ve.ui.PlainTextFileTransferHandler.static.name = 'plainText';
+
+ve.ui.PlainTextFileTransferHandler.static.types = ['text/plain'];
+
+/* Methods */
+
+/**
+ * @inheritdoc
+ */
+ve.ui.PlainTextFileTransferHandler.prototype.process = function () {
+       this.createProgress( this.insertableDataDeferred.promise() );
+       this.reader.readAsText( this.file );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.PlainTextFileTransferHandler.prototype.onFileProgress = function ( e ) {
+       if ( e.lengthComputable ) {
+               this.setProgress( 100 * e.loaded / e.total );
+       } else {
+               this.setProgress( false );
+       }
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.PlainTextFileTransferHandler.prototype.onFileLoad = function () {
+       var i, l,
+               data = [],
+               lines = this.reader.result.split( /[\r\n]+/ );
+
+       for ( i = 0, l = lines.length; i < l; i++ ) {
+               if ( lines[i].length ) {
+                       data.push( { type: 'paragraph' } );
+                       data = data.concat( lines[i].split( '' ) );
+                       data.push( { type: '/paragraph' } );
+               }
+       }
+       this.insertableDataDeferred.resolve( data );
+       this.setProgress( 100 );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.PlainTextFileTransferHandler.prototype.onFileLoadEnd = function () {
+       // 'loadend' fires after 'load'/'abort'/'error'.
+       // Reject the deferred if it hasn't already resolved.
+       this.insertableDataDeferred.reject();
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.PlainTextFileTransferHandler.prototype.abort = function () {
+       // Parent method
+       ve.ui.PlainTextFileTransferHandler.super.prototype.abort.call( this );
+
+       this.reader.abort();
+};
+
+/* Registration */
+
+ve.ui.dataTransferHandlerFactory.register( ve.ui.PlainTextFileTransferHandler 
);
diff --git a/src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js 
b/src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js
deleted file mode 100644
index c81f642..0000000
--- a/src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*!
- * VisualEditor UserInterface HTML file drop handler class.
- *
- * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
- */
-
-/**
- * HTML file drop handler.
- *
- * @class
- * @extends ve.ui.FileDropHandler
- *
- * @constructor
- * @param {ve.ui.Surface} surface
- * @param {File} file
- */
-ve.ui.HTMLFileDropHandler = function VeUiHTMLFileDropHandler() {
-       // Parent constructor
-       ve.ui.HTMLFileDropHandler.super.apply( this, arguments );
-};
-
-/* Inheritance */
-
-OO.inheritClass( ve.ui.HTMLFileDropHandler, ve.ui.FileDropHandler );
-
-/* Static properties */
-
-ve.ui.HTMLFileDropHandler.static.name = 'html';
-
-ve.ui.HTMLFileDropHandler.static.types = [ 'text/html', 
'application/xhtml+xml' ];
-
-/* Methods */
-
-/**
- * @inheritdoc
- */
-ve.ui.HTMLFileDropHandler.prototype.process = function () {
-       this.createProgress( this.insertableDataDeferred.promise() );
-       this.reader.readAsText( this.file );
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.HTMLFileDropHandler.prototype.onFileProgress = function ( e ) {
-       if ( e.lengthComputable ) {
-               this.setProgress( 100 * e.loaded / e.total );
-       } else {
-               this.setProgress( false );
-       }
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.HTMLFileDropHandler.prototype.onFileLoad = function () {
-       this.insertableDataDeferred.resolve(
-               this.surface.getModel().getDocument().newFromHtml( 
this.reader.result )
-       );
-       this.setProgress( 100 );
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.HTMLFileDropHandler.prototype.onFileLoadEnd = function () {
-       // 'loadend' fires after 'load'/'abort'/'error'.
-       // Reject the deferred if it hasn't already resolved.
-       this.insertableDataDeferred.reject();
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.HTMLFileDropHandler.prototype.abort = function () {
-       // Parent method
-       ve.ui.HTMLFileDropHandler.super.prototype.abort.call( this );
-
-       this.reader.abort();
-};
-
-/* Registration */
-
-ve.ui.fileDropHandlerFactory.register( ve.ui.HTMLFileDropHandler );
diff --git a/src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js 
b/src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js
deleted file mode 100644
index c904cfb..0000000
--- a/src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*!
- * VisualEditor UserInterface plain text file drop handler class.
- *
- * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
- */
-
-/**
- * Plain text file drop handler.
- *
- * @class
- * @extends ve.ui.FileDropHandler
- *
- * @constructor
- * @param {ve.ui.Surface} surface
- * @param {File} file
- */
-ve.ui.PlainTextFileDropHandler = function VeUiPlainTextFileDropHandler() {
-       // Parent constructor
-       ve.ui.PlainTextFileDropHandler.super.apply( this, arguments );
-};
-
-/* Inheritance */
-
-OO.inheritClass( ve.ui.PlainTextFileDropHandler, ve.ui.FileDropHandler );
-
-/* Static properties */
-
-ve.ui.PlainTextFileDropHandler.static.name = 'plainText';
-
-ve.ui.PlainTextFileDropHandler.static.types = ['text/plain'];
-
-/* Methods */
-
-/**
- * @inheritdoc
- */
-ve.ui.PlainTextFileDropHandler.prototype.process = function () {
-       this.createProgress( this.insertableDataDeferred.promise() );
-       this.reader.readAsText( this.file );
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.PlainTextFileDropHandler.prototype.onFileProgress = function ( e ) {
-       if ( e.lengthComputable ) {
-               this.setProgress( 100 * e.loaded / e.total );
-       } else {
-               this.setProgress( false );
-       }
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.PlainTextFileDropHandler.prototype.onFileLoad = function () {
-       var i, l,
-               data = [],
-               lines = this.reader.result.split( /[\r\n]+/ );
-
-       for ( i = 0, l = lines.length; i < l; i++ ) {
-               if ( lines[i].length ) {
-                       data.push( { type: 'paragraph' } );
-                       data = data.concat( lines[i].split( '' ) );
-                       data.push( { type: '/paragraph' } );
-               }
-       }
-       this.insertableDataDeferred.resolve( data );
-       this.setProgress( 100 );
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.PlainTextFileDropHandler.prototype.onFileLoadEnd = function () {
-       // 'loadend' fires after 'load'/'abort'/'error'.
-       // Reject the deferred if it hasn't already resolved.
-       this.insertableDataDeferred.reject();
-};
-
-/**
- * @inheritdoc
- */
-ve.ui.PlainTextFileDropHandler.prototype.abort = function () {
-       // Parent method
-       ve.ui.PlainTextFileDropHandler.super.prototype.abort.call( this );
-
-       this.reader.abort();
-};
-
-/* Registration */
-
-ve.ui.fileDropHandlerFactory.register( ve.ui.PlainTextFileDropHandler );
diff --git a/src/ui/ve.ui.FileDropHandler.js 
b/src/ui/ve.ui.DataTransferHandler.js
similarity index 71%
rename from src/ui/ve.ui.FileDropHandler.js
rename to src/ui/ve.ui.DataTransferHandler.js
index 0cc579d..b44dcc7 100644
--- a/src/ui/ve.ui.FileDropHandler.js
+++ b/src/ui/ve.ui.DataTransferHandler.js
@@ -1,11 +1,11 @@
 /*!
- * VisualEditor UserInterface file drop handler class.
+ * VisualEditor UserInterface data transfer handler class.
  *
  * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
  */
 
 /**
- * File drop handler.
+ * Data transfer handler.
  *
  * @class
  * @abstract
@@ -14,7 +14,7 @@
  * @param {ve.ui.Surface} surface Surface
  * @param {File} file File to handle
  */
-ve.ui.FileDropHandler = function VeUiFileDropHandler( surface, file ) {
+ve.ui.DataTransferHandler = function VeUiDataTransferHandler( surface, file ) {
        // Properties
        this.surface = surface;
        this.file = file;
@@ -34,7 +34,7 @@
 
 /* Inheritance */
 
-OO.initClass( ve.ui.FileDropHandler );
+OO.initClass( ve.ui.DataTransferHandler );
 
 /* Static properties */
 
@@ -45,7 +45,7 @@
  * @property {string}
  * @inheritable
  */
-ve.ui.FileDropHandler.static.name = null;
+ve.ui.DataTransferHandler.static.name = null;
 
 /**
  * List of mime types supported by this handler
@@ -54,7 +54,7 @@
  * @property {string[]}
  * @inheritable
  */
-ve.ui.FileDropHandler.static.types = [];
+ve.ui.DataTransferHandler.static.types = [];
 
 /* Methods */
 
@@ -63,8 +63,8 @@
  *
  * Implementations should aim to resolve this.insertableDataDeferred.
  */
-ve.ui.FileDropHandler.prototype.process = function () {
-       throw new Error( 've.ui.FileDropHandler subclass must implement 
process' );
+ve.ui.DataTransferHandler.prototype.process = function () {
+       throw new Error( 've.ui.DataTransferHandler subclass must implement 
process' );
 };
 
 /**
@@ -72,7 +72,7 @@
  *
  * @return {jQuery.Promise} Promise which resolves with data to insert
  */
-ve.ui.FileDropHandler.prototype.getInsertableData = function () {
+ve.ui.DataTransferHandler.prototype.getInsertableData = function () {
        this.process();
 
        return this.insertableDataDeferred.promise();
@@ -83,26 +83,26 @@
  *
  * @param {Event} e Progress event
  */
-ve.ui.FileDropHandler.prototype.onFileProgress = function () {};
+ve.ui.DataTransferHandler.prototype.onFileProgress = function () {};
 
 /**
  * Handle load events from the file reader
  *
  * @param {Event} e Load event
  */
-ve.ui.FileDropHandler.prototype.onFileLoad = function () {};
+ve.ui.DataTransferHandler.prototype.onFileLoad = function () {};
 
 /**
  * Handle load end events from the file reader
  *
  * @param {Event} e Load end event
  */
-ve.ui.FileDropHandler.prototype.onFileLoadEnd = function () {};
+ve.ui.DataTransferHandler.prototype.onFileLoadEnd = function () {};
 
 /**
- * Abort the file drop handler
+ * Abort the data transfer handler
  */
-ve.ui.FileDropHandler.prototype.abort = function () {
+ve.ui.DataTransferHandler.prototype.abort = function () {
        this.insertableDataDeferred.reject();
 };
 
@@ -112,7 +112,7 @@
  * @param {jQuery.Promise} progressCompletePromise Promise which resolves when 
the progress action is complete
  * @param {jQuery|string|Function} [label] Progress bar label, defaults to 
file name
  */
-ve.ui.FileDropHandler.prototype.createProgress = function ( 
progressCompletePromise, label ) {
+ve.ui.DataTransferHandler.prototype.createProgress = function ( 
progressCompletePromise, label ) {
        var handler = this;
 
        this.surface.createProgress( progressCompletePromise, label || 
this.file.name ).done( function ( progressBar, cancelPromise ) {
@@ -130,7 +130,7 @@
  *
  * @param {number} progress Progress percent
  */
-ve.ui.FileDropHandler.prototype.setProgress = function ( progress ) {
+ve.ui.DataTransferHandler.prototype.setProgress = function ( progress ) {
        this.progress = progress;
        if ( this.progressBar ) {
                this.progressBar.setProgress( this.progress );
diff --git a/src/ui/ve.ui.DataTransferHandlerFactory.js 
b/src/ui/ve.ui.DataTransferHandlerFactory.js
new file mode 100644
index 0000000..4997c80
--- /dev/null
+++ b/src/ui/ve.ui.DataTransferHandlerFactory.js
@@ -0,0 +1,52 @@
+/*!
+ * VisualEditor DataTransferHandlerFactory class.
+ *
+ * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
+ */
+
+/**
+ * Drop handler Factory.
+ *
+ * @class
+ * @extends OO.Factory
+ * @constructor
+ */
+ve.ui.DataTransferHandlerFactory = function VeUiDataTransferHandlerFactory() {
+       // Parent constructor
+       ve.ui.DataTransferHandlerFactory.super.apply( this, arguments );
+
+       this.handlerNamesByType = {};
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.DataTransferHandlerFactory, OO.Factory );
+
+/* Methods */
+
+/**
+ * @inheritdoc
+ */
+ve.ui.DataTransferHandlerFactory.prototype.register = function ( constructor ) 
{
+       // Parent method
+       ve.ui.DataTransferHandlerFactory.super.prototype.register.call( this, 
constructor );
+
+       var i, l, types = constructor.static.types;
+       for ( i = 0, l = types.length; i < l; i++ ) {
+               this.handlerNamesByType[types[i]] = constructor.static.name;
+       }
+};
+
+/**
+ * Returns the primary command for for node.
+ *
+ * @param {string} type File type
+ * @returns {string|undefined} Handler name, or undefined if not found
+ */
+ve.ui.DataTransferHandlerFactory.prototype.getHandlerNameForType = function ( 
type ) {
+       return this.handlerNamesByType[type];
+};
+
+/* Initialization */
+
+ve.ui.dataTransferHandlerFactory = new ve.ui.DataTransferHandlerFactory();
diff --git a/src/ui/ve.ui.FileDropHandlerFactory.js 
b/src/ui/ve.ui.FileDropHandlerFactory.js
deleted file mode 100644
index 518c0a8..0000000
--- a/src/ui/ve.ui.FileDropHandlerFactory.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*!
- * VisualEditor FileDropHandlerFactory class.
- *
- * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
- */
-
-/**
- * Drop handler Factory.
- *
- * @class
- * @extends OO.Factory
- * @constructor
- */
-ve.ui.FileDropHandlerFactory = function VeUiFileDropHandlerFactory() {
-       // Parent constructor
-       ve.ui.FileDropHandlerFactory.super.apply( this, arguments );
-
-       this.handlerNamesByType = {};
-};
-
-/* Inheritance */
-
-OO.inheritClass( ve.ui.FileDropHandlerFactory, OO.Factory );
-
-/* Methods */
-
-/**
- * @inheritdoc
- */
-ve.ui.FileDropHandlerFactory.prototype.register = function ( constructor ) {
-       // Parent method
-       ve.ui.FileDropHandlerFactory.super.prototype.register.call( this, 
constructor );
-
-       var i, l, types = constructor.static.types;
-       for ( i = 0, l = types.length; i < l; i++ ) {
-               this.handlerNamesByType[types[i]] = constructor.static.name;
-       }
-};
-
-/**
- * Returns the primary command for for node.
- *
- * @param {string} type File type
- * @returns {string|undefined} Handler name, or undefined if not found
- */
-ve.ui.FileDropHandlerFactory.prototype.getHandlerNameForType = function ( type 
) {
-       return this.handlerNamesByType[type];
-};
-
-/* Initialization */
-
-ve.ui.fileDropHandlerFactory = new ve.ui.FileDropHandlerFactory();
diff --git a/src/ui/ve.ui.js b/src/ui/ve.ui.js
index b1ba867..be84c89 100644
--- a/src/ui/ve.ui.js
+++ b/src/ui/ve.ui.js
@@ -15,7 +15,7 @@
        //'commandRegistry' instantiated in ve.ui.CommandRegistry.js
        //'triggerRegistry' instantiated in ve.ui.TriggerRegistry.js
        //'toolFactory' instantiated in ve.ui.ToolFactory.js
-       //'fileDropHandlerFactory' instantiated in 
ve.ui.FileDropHandlerFactory.js
+       //'dataTransferHandlerFactory' instantiated in 
ve.ui.DataTransferHandlerFactory.js
        windowFactory: new OO.Factory()
 };
 
diff --git a/tests/index.html b/tests/index.html
index 7b50768..43bd38c 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -259,8 +259,8 @@
                <script src="../src/ui/ve.ui.SequenceRegistry.js"></script>
                <script src="../src/ui/ve.ui.Action.js"></script>
                <script src="../src/ui/ve.ui.ActionFactory.js"></script>
-               <script src="../src/ui/ve.ui.FileDropHandler.js"></script>
-               <script 
src="../src/ui/ve.ui.FileDropHandlerFactory.js"></script>
+               <script src="../src/ui/ve.ui.DataTransferHandler.js"></script>
+               <script 
src="../src/ui/ve.ui.DataTransferHandlerFactory.js"></script>
                <script src="../src/ui/ve.ui.WindowManager.js"></script>
                <script 
src="../src/ui/actions/ve.ui.AnnotationAction.js"></script>
                <script src="../src/ui/actions/ve.ui.ContentAction.js"></script>
@@ -281,9 +281,9 @@
                <script 
src="../src/ui/dialogs/ve.ui.CommandHelpDialog.js"></script>
                <script 
src="../src/ui/dialogs/ve.ui.FindAndReplaceDialog.js"></script>
                <script 
src="../src/ui/dialogs/ve.ui.ProgressDialog.js"></script>
-               <script 
src="../src/ui/filedrophandlers/ve.ui.DSVFileDropHandler.js"></script>
-               <script 
src="../src/ui/filedrophandlers/ve.ui.PlainTextFileDropHandler.js"></script>
-               <script 
src="../src/ui/filedrophandlers/ve.ui.HTMLFileDropHandler.js"></script>
+               <script 
src="../src/ui/datatransferhandlers/ve.ui.DSVFileTransferHandler.js"></script>
+               <script 
src="../src/ui/datatransferhandlers/ve.ui.PlainTextFileTransferHandler.js"></script>
+               <script 
src="../src/ui/datatransferhandlers/ve.ui.HTMLFileTransferHandler.js"></script>
                <script 
src="../src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js"></script>
                <script src="../src/ui/widgets/ve.ui.AlignWidget.js"></script>
                <script 
src="../src/ui/widgets/ve.ui.LanguageSearchWidget.js"></script>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ea9d548ed1f658fbb649100d1870cb840e25b8e
Gerrit-PatchSet: 4
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to