Web fixes
This commit is contained in:
parent
8aaa4710bc
commit
6be8c56e57
|
|
@ -436,7 +436,9 @@ void handleDocumentAction(
|
|||
final DocumentEntity? document =
|
||||
store.state.documentState.map[documentIds.first];
|
||||
if (kIsWeb) {
|
||||
WebUtils.downloadBinaryFile(document!.name, document.data);
|
||||
if (document?.data != null) {
|
||||
WebUtils.downloadBinaryFile(document!.name, document.data!);
|
||||
}
|
||||
} else {
|
||||
final directory = await (isDesktopOS()
|
||||
? getDownloadsDirectory() as FutureOr<file.Directory>
|
||||
|
|
|
|||
|
|
@ -53,18 +53,18 @@ class WebUtils {
|
|||
|
||||
static void reloadBrowser() => window.location.reload();
|
||||
|
||||
static void registerWebView(String html) {
|
||||
static void registerWebView(String? html) {
|
||||
// ignore: undefined_prefixed_name
|
||||
ui.platformViewRegistry.registerViewFactory(
|
||||
html,
|
||||
html ?? '',
|
||||
(int viewId) => IFrameElement()
|
||||
..src = html
|
||||
..style.border = 'none');
|
||||
}
|
||||
|
||||
static void warnChanges(Store<AppState> store) {
|
||||
static void warnChanges(Store<AppState>? store) {
|
||||
window.onBeforeUnload.listen((Event e) {
|
||||
if (store.state.hasChanges()) {
|
||||
if (store!.state.hasChanges()) {
|
||||
(e as BeforeUnloadEvent).returnValue =
|
||||
'Changes you made may not be saved.';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class WebUtils {
|
|||
|
||||
static void downloadTextFile(String filename, String data) {}
|
||||
|
||||
static void downloadBinaryFile(String filename, Uint8List? data) {}
|
||||
static void downloadBinaryFile(String filename, Uint8List data) {}
|
||||
|
||||
static void reloadBrowser() {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue