App

An interface for interacting with the MindDrop application.

Hooks and methods for retrieving and managing topics.

Returns root topics as an array ordered according their order of appearance in the app sidebar.

useRootTopics(): Topic[]

Returns archived root topics as an array ordered according their order of appearance in the app sidebar.

useArchivedRootTopics(): Topic[]

Returns the drop configs for the drop types enabled on the given topic.

useTopicDropConfigs(topicId: string): DropConfig[]
ArgumentTypeDescription
topicId*stringThe ID of the topic.

Creates a new topic along with a default view for it. Returns the new topic.

App.createTopic(core: Core, data?: CreateTopicData): Topic
ArgumentTypeDescription
core*CoreA MindDrop core instance.
dataCreateTopicData The default topic property values. See the Topics interface page for details.

Adds topics to the root level and dispaches an app:root-topics:add event.

App.addRootTopics(core: Core, topicIds: string[], position?: number): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topicIds*string[]The IDs of the topics to add to the root level.
positionnumberThe index at which to add the new root topics.

Removes topics from the root level and dispaches an app:root-topics:remove event.

App.removeRootTopics(core: Core, topicIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topicIds*string[]The IDs of the topics to remove from the root level.

Sets a new sort order for root topics. The provided root topic IDs must contain the same IDs as the current value, only in a different order. Dispatches a app:root-topics:sort event.

  • Throws a InvalidParameterError if the given topic IDs differ from the current root topic IDs in anything but order.

App.sortRootTopics(core: Core, topicIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topicIds*string[]The IDs of the root topics in their new sort order.

Removes subtopics from a parent topic and adds them to the root level. Dispatches an app:move-subtopics-root event.

App.moveSubtopicsToRoot(core: Core, parentTopicId: string, subtopicIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
parentTopicId*stringThe ID of the parent topic from which to move the subtopics.
subtopicIds*string[]The IDs of the subtopics to move to the root level.

Removes topics from the root level and adds them as subtopics to a specified topic. Dispatches a app:root-topics:move event.

App.moveRootTopicsToParentTopic(
core: Core,
parentTopicId: string,
topicIds: string[],
position?: number,
): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
parentTopicId*stringThe ID of the parent topic into which to move the topics.
topicIds*string[]The IDs of the topics to move to from root level.
positionnumberThe index at which to add the topics into the subtopics list.

Archives root level topics and dispaches an app:root-topics:archive event.

App.archiveRootTopics(core: Core, topicIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topicIds*string[]The IDs of the root level topics to archive.

Unarchives root level topics and dispaches an app:root-topics:unarchive event.

App.unarchiveRootTopics(core: Core, topicIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topicIds*string[]The IDs of the root level topics to unarchive.

Returns root topics as an array ordered according their order of appearance in the app sidebar.

App.getRootTopics(): Topic[]

Returns archived root topics as an array ordered according their order of appearance in the app sidebar.

App.getArchivedRootTopics(): Topic[]

Handles data inserts into a topic depending on the insert's action parameter:

  • insert: creates drops from the raw data and adds them to the topic

  • copy: data insert's drops are duplicated and duplicates added to the topic

  • cut: data insert's drops are added to the topic (removal from source is handled at the time of the cut)

  • move: data insert's drops are added to the topic and removed from the source topic

  • add: data insert's drops are added to the topic

Any other action is ignored. Returns a boolean indicating whether or not the data insert was handled (false if action is not one of the ones listed above).

App.insertDataIntoTopic(core: Core, topicId: string, data: DataInsert, metada: AddDropsMetadata): Promise<boolean>
ArgumentTypeDescription
core*CoreA MindDrop core instance.
topicId*stringThe ID of the topic into which to insert the data.
data*DataInsertThe data insert.
metadataAddDropsMetadata Optional metadata about the data insert added by the topic view instance that triggered the event. See the TopicView interface for details.

Returns the drop configs for the drop types enabled on the given topic.

App.getTopicDropConfigs(topicId: string): DropConfig[]
ArgumentTypeDescription
topicId*stringThe ID of the topic.

Renders a drop using the appropriate component.

Drops.render(drop: Drop, parent?: DropParentReference): ReactElement;
ArgumentTypeDescription
drop*DropThe drop to render.
parent*DropParentReference The reference of the parent inside which the drop is being rendered. See the Drop interface docs for more details.

Adds global tags and dispaches an app:add-global-tags event.

App.addGlobalTags(core: Core, tagIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
tagIds*string[]The IDs of the tags to add to the root level.

Removes global tags and dispaches an app:remove-global-tags event.

App.removeGlobalTags(core: Core, tagIds: string[]): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
tagIds*string[]The IDs of the tags to remove from the global level.

Returns an object containing the currently open view and view instance (set to null if no view instance is open).

useCurrentView(): { view: View, instance: ViewInstance | null }

Returns an object containing the currently open view and view instance (set to null if no view instance is open).

App.getCurrentView(): { view: View, instance: ViewInstance | null }

Opens a view in the app and dispatches a app:view:open event. If opening a view instance, use App.openViewInstance instead.

App.openView(core: Core, view: viewId): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewId*stringThe ID of the view to open.

Opens a view instance in the app and dispatches a app:view:open event. If opening a static view, use App.openView instead.

App.openViewInstance(core: Core, view: viewInstanceId): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
viewInstanceId*stringThe ID of the view instance to open.

Adds a UI extension at a given location.

App.addUiExtension(location: UiLocation, element: UiComponentConfig | ReactElement): void
ArgumentTypeDescription
location*UiLocation The location at which to extend the UI. See the UiLocation page for available locations. Extensions can also provide their own UI extension locations using the Slot component.
element*| UiComponentConfig
| ReactElement
The UI element to render. Either a UiComponentConfig object or a React element.

Removes a UI extension from a given location. The location and element must be the same as the ones used when adding the extension.

App.removeUiExtension(location: UiLocation, element: UiComponentConfig | ReactElement): void
ArgumentTypeDescription
location*UiLocationThe location from which to remove the UI extension.
element*| UiComponentConfig
| ReactElement
The UI element to remove.

Removes all UI extensions added by the extension. Optionally, a location can be specified to remove UI extensions only from the specified location.

App.removeAllUiExtensions(core: Core, location?: UiLocation): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
locationstringThe location from which to remove all UI extensions. If ommited, UI extensions will be removed from all locations.

Adds app specific event listeners. Equivalent to calling addEventListener directly on core, but provides more advanced type definitions.

App.addEventListener(core: Core, event: AppEvent, callback: EventListenerCallback): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
event*AppEventThe event type to listen for. See the app events section below for available events.
callback*EventListenerCallbackThe callback fired when the event occurs. See the app events section below for the data passed to the callback.

Removes app specific event listeners. Equivalent to calling removeEventListener directly on core, but provides more advanced type definitions.

App.removeEventListener(core: Core, event: AppEvent, callback: EventListenerCallback): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
event*AppEventThe event type for which to remove the event listener.
callback*EventListenerCallbackThe callback of the event listener to remove.

App events are prefixed with the namespace app.

See below the table for more details on the data passed by app related events.

NameDataDescription
app:view:openAppViewDispatched when a view is opened.
app:root-topics:addTopicMapDispatched when topics are added to the root level.
app:root-topics:removeTopicMapDispatched when topics are removed from the root level.
app:move-subtopics-rootMoveSubtopicsEventDataDispatched when subtopics are moved to the root level.
app:root-topics:moveMoveRootTopicsEventDataDispatched when root level topics are moved into a parent topic.
app:root-topics:archiveTopicMapDispatched when root level topics are archived.
app:root-topics:unarchiveTopicMapDispatched when root level topics are unarchived.
app:tags:addTagMapDispatched when global tags are added.
app:tags:removeTagMapDispatched when global tags are removed.
app:selection:select-dropsDropMapDispatched when drops are selected.
app:selection:unselect-dropsDropMapDispatched when drops are unselected.
app:selection:select-topicsTopicMapDispatched when topics are selected.
app:selection:unselect-topicsTopicMapDispatched when topics are unselected.
app:selection:clearNo dataDispatched when the selection is cleared.

AppView

PropertyTypeDescription
view*ViewThe view object.
instance*ViewInstance | null The view instance object or null if no view instance is included.
PropertyTypeDescription
fromTopic*TopicThe topic from which the subtopics were moved.
subtopics*TopicMapThe moved subtopics.
PropertyTypeDescription
toTopic*TopicThe topic into which the topics were moved.
topics*TopicMapThe moved topics.