PHP Classes

File: public/js/tinymce/src/plugins/paste/src/test/js/module/test/MockDataTransfer.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/paste/src/test/js/module/test/MockDataTransfer.js   Download  
File: public/js/tinymce/src/plugins/paste/src/test/js/module/test/MockDataTransfer.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,504 bytes
 

Contents

Class file image Download
define( 'tinymce.plugins.paste.test.MockDataTransfer', [ 'ephox.katamari.api.Arr', 'ephox.katamari.api.Obj' ], function (Arr, Obj) { var notImplemented = function () { throw new Error('Mockup function is not implemented.'); }; var createDataTransferItem = function (mime, content) { return { kind: 'string', type: mime, getAsFile: notImplemented, getAsString: function () { return content; } }; }; var create = function (inputData) { var data = {}, result; var clearData = function () { data = {}; result.items = []; result.types = []; }; var getData = function (mime) { return mime in data ? data[mime] : ''; }; var setData = function (mime, content) { data[mime] = content; result.types = Obj.keys(data); result.items = Arr.map(result.types, function (type) { return createDataTransferItem(type, data[type]); }); }; result = { dropEffect: '', effectAllowed: 'all', files: [], items: [], types: [], clearData: clearData, getData: getData, setData: setData, setDragImage: notImplemented, addElement: notImplemented }; Obj.each(inputData, function (value, key) { setData(key, value); }); return result; }; return { create: create }; } );