Text
Helpers to make working with native text data easiercontainsText
Useful to know whether text data ("text/plain") is being dragged. Keep in mind that multiple
pieces of native data can be dragged at once.
import { containsText } from '@atlaskit/pragmatic-drag-and-drop/external/text';
dropTargetForExternal({
element: myElement,
canDrop: containsText,
});
monitorForExternal({
canMonitor: containsText,
});getText
A helper to extract text data ("text/plain") from drop data. Get text will return null when
there is no text data.
import { getText } from '@atlaskit/pragmatic-drag-and-drop/external/text';
dropTargetForExternal({
element: myElement,
onDrop({ source }) {
const text: string | null = getText({ source });
},
});
monitorForExternal({
onDrop({ source }) {
const text: string | null = getText({ source });
},
});