TopicViewConfig

A configuration object used to register topic views.

Topics render their content using instances of a special type of view called topic views. Topic views need to be registered using the Topics.registerView method before they can be used.

PropertyTypeDescription
id*stringThe ID of the topic view. Must be unique accross the app.
name*stringThe name of the view. Dispalyed to users.
description*stringA short, single sentence description of the view. Displayed to users.
component*React.ComponentTypeThe React component rendered by the view.
onCreatefunctionCalled when a new instance of the topic view is created. See below for details.
onDeletefunctionCalled when an instance of the topic view is deleted. See below for details.
onAddDropsfunctionCalled when drops are added, unarchived, or restored to the topic. See below for details.
onRemoveDropfunctionCalled when drops are archived, deleted, or permanently deleted from the topic. See below for details.
onAddSubtopicsfunctionCalled when subtopics are added, unarchived, or restored to the topic. See below for details.
onRemoveSubtopicsfunctionCalled when subtopics are archived, deleted, or permanently deleted from the topic. See below for details.
onInsertDatafunctionCalled when data is inserted into an open topic view instance, usually in the form of a drag and drop or paste event.

Called when a new instance of the topic view is created. Should return any custom data used to setup the view.

Note that default TopicViewInstance data such as id, view, topic, createdAt, etc. are set automatically and should not be returned by this method.

onCreate(core: Core, topic: Topic): object
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topic*TopicThe topic for which the view was created.

Called when an instance of the topic view is deleted. Useful for cleaning up any artifacts created by the view instance.

Note that this method does not need to delete the topic view instance itself, just any data that would be left over.

onDelete(core: Core, viewInstance: ViewInstance): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewInstance*ViewInstanceThe deleted view instance.

Called on all of a topic's views when drops are added, unarchived, or restored to the topic.

onAddDrops(core: Core, viewInstance: ViewInstance, drops: DropMap, metadata: AddDropMetadata): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewInstance*ViewInstanceThe view instance.
drops*DropMapThe drops which were added to the topic.
metadataAddDropsMetadataMetadata about the event. See below for details.

AddDropsMetadata

Metadata about the event when drops are added to a topic. Contains the ID of the view instance into which the drop was added (or null if not added by a view) and any other data added by the view which added the drop.

PropertyTypeDescription
viewInstance*string | null The ID of the view instance into which the drop was inserted.null if the drop was not inserted into a view.

Additionally, the metadata object can contain values added by the view which added the drop.

Called on all of a topic's views when drops are archived, deleted, or permanently deleted from the topic.

onRemoveDrops(core: Core, topic: Topic, viewInstance: ViewInstance, drops: DropMap): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topic*TopicThe topic from which the drop was removed.
viewInstance*ViewInstanceThe view instance.
drops*DropMapThe drops which were removed from the topic.

Called on all view instances when subtopics are added, unarchived, or restored into a topic.

onAddSubtopics(core: Core, viewInstance: ViewInstance, subtopics: TopicMap): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewInstance*ViewInstanceThe view instance.
subtopics*TopicMapThe topics which were added as subtopics to the topic.

Called on all view instances when subtopics are removed, unarchived, or restored from a topic.

onRemoveSubtopics(core: Core, viewInstance: ViewInstance, subtopics: TopicMap): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewInstance*ViewInstanceThe view instance.
subtopics*TopicMapThe topics which were removed as subtopics from the topic.

Called when data is inserted into an open topic view instance, usually in the from of a drag and drop or paste event. Only called on the affected view.

Note that this method is only called when raw data such as text or files are inserted. If the data consists of drops or topics, onAddDrops or onAddTopics are called instead.

onInsertData(core: Core, viewInstance: ViewInstance, data: DataInsert): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewInstance*ViewInstanceThe view instance.
data*DataInsertThe inserted data.