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[]
Argument | Type | Description |
---|---|---|
topicId* | string | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
data | CreateTopicData | 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
topicIds* | string[] | The IDs of the topics to add to the root level. |
position | number | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A 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
Argument | Type | Description |
---|---|---|
core* | Core | A 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
parentTopicId* | string | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
parentTopicId* | string | The ID of the parent topic into which to move the topics. |
topicIds* | string[] | The IDs of the topics to move to from root level. |
position | number | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A 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
Argument | Type | Description |
---|---|---|
core* | Core | A 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>
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
topicId* | string | The ID of the topic into which to insert the data. |
data* | DataInsert | The data insert. |
metadata | AddDropsMetadata | 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[]
Argument | Type | Description |
---|---|---|
topicId* | string | The ID of the topic. |
Renders a drop using the appropriate component.
Drops.render(drop: Drop, parent?: DropParentReference): ReactElement;
Argument | Type | Description |
---|---|---|
drop* | Drop | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A 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
Argument | Type | Description |
---|---|---|
core* | Core | A 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
viewId* | string | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
viewInstanceId* | string | The ID of the view instance to open. |
Adds a UI extension at a given location.
App.addUiExtension(location: UiLocation, element: UiComponentConfig | ReactElement): void
Argument | Type | Description |
---|---|---|
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 | 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
Argument | Type | Description |
---|---|---|
location* | UiLocation | The location from which to remove the UI extension. |
element* | | UiComponentConfig | 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
location | string | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
event* | AppEvent | The event type to listen for. See the app events section below for available events. |
callback* | EventListenerCallback | The 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
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
event* | AppEvent | The event type for which to remove the event listener. |
callback* | EventListenerCallback | The 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.
Name | Data | Description |
---|---|---|
app:view:open | AppView | Dispatched when a view is opened. |
app:root-topics:add | TopicMap | Dispatched when topics are added to the root level. |
app:root-topics:remove | TopicMap | Dispatched when topics are removed from the root level. |
app:move-subtopics-root | MoveSubtopicsEventData | Dispatched when subtopics are moved to the root level. |
app:root-topics:move | MoveRootTopicsEventData | Dispatched when root level topics are moved into a parent topic. |
app:root-topics:archive | TopicMap | Dispatched when root level topics are archived. |
app:root-topics:unarchive | TopicMap | Dispatched when root level topics are unarchived. |
app:tags:add | TagMap | Dispatched when global tags are added. |
app:tags:remove | TagMap | Dispatched when global tags are removed. |
app:selection:select-drops | DropMap | Dispatched when drops are selected. |
app:selection:unselect-drops | DropMap | Dispatched when drops are unselected. |
app:selection:select-topics | TopicMap | Dispatched when topics are selected. |
app:selection:unselect-topics | TopicMap | Dispatched when topics are unselected. |
app:selection:clear | Dispatched when the selection is cleared. |
Property | Type | Description |
---|---|---|
view* | View | The view object. |
instance* | ViewInstance | null | The view instance object or null if no view instance is included. |
Property | Type | Description |
---|---|---|
fromTopic* | Topic | The topic from which the subtopics were moved. |
subtopics* | TopicMap | The moved subtopics. |
Property | Type | Description |
---|---|---|
toTopic* | Topic | The topic into which the topics were moved. |
topics* | TopicMap | The moved topics. |