Skip to content

Conversation

@mbostock
Copy link
Member

Fixes #132. Based on https://observablehq.com/@mbostock/localfile. It looks like this:

Screen Shot 2021-09-30 at 10 25 22 AM

Copy link
Member

@visnup visnup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input makes me somewhat wonder if there's a UX workflow that "promotes" the locally uploaded file into a file attachment. Though I guess this also is another form of a more generic "snapshot this cell into a file attachment" or simply "snapshot this cell"…

* *required* - if true, the input must be a valid date.
* *validate* - a function to check whether the text input is valid.
* *accept* - the [acceptable file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept).
* *capture* - for [capturing image or video data](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#capture).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Object.defineProperty(this, "_url", {writable: true});
}
async url() {
return this._url || (this._url = URL.createObjectURL(this._));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@mbostock mbostock merged commit e043fba into main Oct 1, 2021
@mbostock mbostock deleted the mbostock/file branch October 1, 2021 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File input

3 participants