Skip to main content

Module exchange

Module exchange 

Source
Expand description

What comes into the document from outside it: an import, a block’s icon, an image of its own — picked from a dialog, or dropped on the diagram.

Three effects, one door. The browser will only open a file picker from inside a user gesture, and the gesture that asked is already over by the time the effect reaches the shell — so the input is in the page, hidden, and the effect clicks it. What the pick was for is the shell’s own record of the flow (Wanted), so a pick that took a while still lands where the press that asked for it meant it to.

A dropped file is read the same way wherever it lands: Dropped::of names what it is, and the zone it was dropped on says what to do with it. Dropping a document on the diagram embeds it as a block of this one; dropping it on the Diagrams section files it in the origin. Two zones, two meanings — and one reading of the name, so they cannot disagree about what a file is.

What the bytes mean is blockworx_editor::import’s, and the size a document will accept is the kernel’s; neither is decided here.

Re-exports§

pub use FilePick_completions::Component::FilePick;

Structs§

FilePickProps
Properties for the FilePick component.

Enums§

Dropped
What a dropped file is, read off its name.
Zone
Where a file was dropped, which is what its being a document means.

Constants§

ACCEPTS 🔒
What the picker offers. The same two the desktop’s dialog filters to: a document draws SVG symbols and PNG artwork and nothing else.

Functions§

FilePick
Props
carried_by
The first file a drop carries. One at a time: a library door takes the document out of the session for as long as it is open, so a second file would be waiting on the first with nothing to say what it was for.
drops
A dropped file, taken in by what it is and where it fell.
reads 🔒
Read one file and hand its bytes to whatever asked for them. FileReader is the only way to the bytes on the main thread, and it answers on an event rather than returning, so the hand-off happens in the callback.