DropConfig

An interface for describing drop types.

PropertyTypeDescription
type*stringThe drop type.
name*stringThe name of the drop type. Displayed to users.
description*stringA short description of the drop type. Displayed to users.
dataTypesstring[]
The data types from which this kind of drop can be created. Omit if this drop type does not support data.
fileTypesstring[]
The file types from which this kind of drop can be created. Omit if this drop type does not support files.
multiFileboolean
If true, indicates that this drop type supports multiple files at once.
requiresDataboolean If true, this drop type requires a data for creation. If both requiresData and requiresFile are true, either one will satisfy the condition.
requiresFileboolean If true, this drop type requires a file for creation. If both requiresData and requiresFile are true, either one will satisfy the condition.
create*functionCalled to create a new drop of this type. See below for details.
insertDatafunctionCalled when data is dropped or pasted onto the drop. Omit if updating the drop using data is not supported. See below for more details.

Called to create a new drop of this type. Should return an object containing the drop type as well as any custom data used by the drop.

For example, imagine a web bookmark drop which has a url and title property. The create method should return an object defining these properties:

{
type: 'bookmark',
url: 'https://minddrop.app',
title: "MindDrop - Your mind's visual workspace",
}
  • A FileReference must be created for any files from the data which need to be preserved using the Files.create method.

  • If a drop cannot be created due to invalid or missing data, a InvalidDropDataError should be thrown.

  • A promise resolving to the drop's data can be returned if an asyncronous action is required to create it.

create(core: Core, data?: DataInsert): CreateDropData | Promise<CreateDropData>
ArgumentTypeDescription
core*CoreA MindDrop core instance.
dataDataInsert

A DataInsert object containing the data from which the drop is to be created.

Note that this function can be called without data if neither requiresData nor requiresFile. If a drop cannot be created without data, be sure to set either or both properties to true.

Called when data is dropped or pasted onto the drop. Omit if updating the drop in this way is not supported. Must return a promise which resolves to the updated drop (or original drop if it was not updated).

  • Should make use of the Drops.update method in order to update the drop.

  • A FileReference must be created for any files from the data which need to be preserved using the Files.create method.

insertData(core: Core, drop: Drop, data: DataInsert): Promise<Drop>;
ArgumentTypeDescription
core*CoreA MindDrop core instance.
drop*DropThe drop into which the data was inserted.
data*DataInsertThe data dropped or pasted onto the drop.