Skip to content

Document window.Native.getPathForFile for dropped files - #603

Open
PunchRockgroin wants to merge 2 commits into
NativePHP:mainfrom
PunchRockgroin:docs/native-get-path-for-file
Open

PunchRockgroin wants to merge 2 commits into
NativePHP:mainfrom
PunchRockgroin:docs/native-get-path-for-file

Conversation

@PunchRockgroin

Copy link
Copy Markdown

Documents window.Native.getPathForFile(), added in NativePHP/desktop#170, as requested there. It adds a "Getting the path of a dropped file" section to the Desktop v2 Files page.

The section covers how to use it from a drop handler, when it returns an empty string, what happens with files dragged from a web browser, and how to stop a stray drop navigating the window. The browser behaviour comes from the testing in NativePHP/desktop#170.

Notes

  • Expose webUtils.getPathForFile as window.Native.getPathForFile for dropped files desktop#170 isn't in a tagged release yet (the latest is 2.4.0), so you may want to hold this until the release that includes it. I haven't named a version in the docs because I don't know which one that will be.
  • The rest of this page uses [aside] and [warning], which show up as literal text on the live site. This section uses <aside> like the other Desktop v2 pages. I've left the existing ones alone to keep this PR focused, and I'm happy to fix them separately.

Testing

I rendered the new section with league/commonmark using the site's core and GFM extensions and html_input setting: the aside and both code blocks came out correctly. I haven't run the full site locally, so Torchlight highlighting and the final styling are unchecked.

NativePHP/desktop#170 added getPathForFile to window.Native because Electron
32 removed File.path. Explain how to use it, what it returns when there's no
file on disk, and how to stop stray drops navigating the window.
The docs use 'the browser' for the user's web browser, and the next paragraph of this section does too, so describe JavaScript running in a window instead.

This branch has not been deployed

No deployments
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.

1 participant