mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 19:50:15 +08:00
[darwin] Add support for file input selection (#2209)
This will show a message on the console "+[CATransaction synchronize] called within transaction" but there's seem no way to mitigate that. Still everything works as expected.
This commit is contained in:
parent
aa5875e8ca
commit
7d61971f86
@ -29,7 +29,7 @@
|
|||||||
- (void) disableWindowConstraints;
|
- (void) disableWindowConstraints;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface WailsContext : NSObject <WKURLSchemeHandler,WKScriptMessageHandler,WKNavigationDelegate>
|
@interface WailsContext : NSObject <WKURLSchemeHandler,WKScriptMessageHandler,WKNavigationDelegate,WKUIDelegate>
|
||||||
|
|
||||||
@property (retain) WailsWindow* mainWindow;
|
@property (retain) WailsWindow* mainWindow;
|
||||||
@property (retain) WKWebView* webview;
|
@property (retain) WKWebView* webview;
|
||||||
|
@ -250,7 +250,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self.webview setNavigationDelegate:self];
|
[self.webview setNavigationDelegate:self];
|
||||||
|
self.webview.UIDelegate = self;
|
||||||
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
[defaults setBool:FALSE forKey:@"NSAutomaticQuoteSubstitutionEnabled"];
|
[defaults setBool:FALSE forKey:@"NSAutomaticQuoteSubstitutionEnabled"];
|
||||||
|
|
||||||
@ -407,6 +408,25 @@
|
|||||||
[self.webview evaluateJavaScript:script completionHandler:nil];
|
[self.webview evaluateJavaScript:script completionHandler:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters
|
||||||
|
initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * URLs))completionHandler {
|
||||||
|
|
||||||
|
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
||||||
|
openPanel.allowsMultipleSelection = parameters.allowsMultipleSelection;
|
||||||
|
if (@available(macOS 10.14, *)) {
|
||||||
|
openPanel.canChooseDirectories = parameters.allowsDirectories;
|
||||||
|
}
|
||||||
|
|
||||||
|
[openPanel
|
||||||
|
beginSheetModalForWindow:webView.window
|
||||||
|
completionHandler:^(NSInteger result) {
|
||||||
|
if (result == NSModalResponseOK)
|
||||||
|
completionHandler(openPanel.URLs);
|
||||||
|
else
|
||||||
|
completionHandler(nil);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) processURLResponse:(unsigned long long)requestId :(int)statusCode :(NSData *)headersJSON :(NSData *)data {
|
- (void) processURLResponse:(unsigned long long)requestId :(int)statusCode :(NSData *)headersJSON :(NSData *)data {
|
||||||
NSNumber *key = [NSNumber numberWithUnsignedLongLong:requestId];
|
NSNumber *key = [NSNumber numberWithUnsignedLongLong:requestId];
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- The `WindowSetAlwaysOnTop` method is now exposed in the JS runtime. Fixed by @gotid in [PR](https://github.com/wailsapp/wails/pull/2128)
|
- The `WindowSetAlwaysOnTop` method is now exposed in the JS runtime. Fixed by @gotid in [PR](https://github.com/wailsapp/wails/pull/2128)
|
||||||
- The [AssetServer](/docs/reference/options#assetserver) now supports serving the index.html file when requesting a directory. Added by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2110)
|
- The [AssetServer](/docs/reference/options#assetserver) now supports serving the index.html file when requesting a directory. Added by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2110)
|
||||||
- Added support for WebKit2GTK 2.36+ on Linux. This brings additional features for the [AssetServer](/docs/reference/options#assetserver), like support for HTTP methods and Headers. The app must be compiled with the Go build tag `webkit2_36` to activate support for this features. This also bumps the minimum requirement of WebKit2GTK to 2.36 for your app. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2151)
|
- Added support for WebKit2GTK 2.36+ on Linux. This brings additional features for the [AssetServer](/docs/reference/options#assetserver), like support for HTTP methods and Headers. The app must be compiled with the Go build tag `webkit2_36` to activate support for this features. This also bumps the minimum requirement of WebKit2GTK to 2.36 for your app. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2151)
|
||||||
|
- Added support for file input selection on macOS. Added by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2209)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- The `noreload` flag in wails dev wasn't applied. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2081)
|
- The `noreload` flag in wails dev wasn't applied. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2081)
|
||||||
|
Loading…
Reference in New Issue
Block a user