From d894c6a35d8e74eaa01dd6e192aec62a4ce22012 Mon Sep 17 00:00:00 2001 From: shijie Date: Sat, 12 Oct 2024 13:47:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?webview=E6=98=BE=E7=A4=BAhtml=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?a=E6=A0=87=E7=AD=BE=E9=94=9A=E7=82=B9=E6=97=A0=E6=95=88=20Signe?= =?UTF-8?q?d-off-by:=20shijie=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets index a86a563c7..64ff1a24f 100644 --- a/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets +++ b/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/WebViewHostApiImpl.ets @@ -81,7 +81,8 @@ export class WebViewHostApiImpl extends WebViewHostApi { const webView: WebViewPlatformView = this.instanceManager.getInstance(instanceId); await webView.waitControllerAttached(); try { - webView.getController().loadData(data, mimeType, encoding, baseUrl == null ? " " : baseUrl , historyUrl == null ? " " : historyUrl); + // 当baseUrl为空时,其值默认为resource://rawfile/。这样设置的原因是为了解决标签锚点无效的问题。 + webView.getController().loadData(data, mimeType, encoding, baseUrl == null || baseUrl.trim().length === 0 ? "resource://rawfile/" : baseUrl , historyUrl == null ? " " : historyUrl); } catch (err) { Log.e(TAG, "loadDataWithBaseUrl err = " + err); } -- Gitee From e5501e36b2c92fed6a74651fbdcb8d5c9ab7a253 Mon Sep 17 00:00:00 2001 From: shijie Date: Wed, 30 Oct 2024 17:34:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?webview=5Fflutter=5Fv4=20H5=20=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=96=87=E4=BB=B6=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shijie --- .../webview_flutter/FileChooserParamsFlutterApiImpl.ets | 2 +- .../webview_flutter/GeneratedOhosWebView.ets | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/FileChooserParamsFlutterApiImpl.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/FileChooserParamsFlutterApiImpl.ets index ade29b90b..627d03a7e 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/FileChooserParamsFlutterApiImpl.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/FileChooserParamsFlutterApiImpl.ets @@ -53,7 +53,7 @@ export class FileChooserParamsFlutterApiImpl extends FileChooserParamsFlutterApi instance.isCapture(), instance.getAcceptType(), this.toFileChooserEnumData(instance.getMode()), - //instance.getFilenameHint(), + instance.getTitle(), callback ); } diff --git a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets index 089728112..a5ca14a22 100644 --- a/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets +++ b/packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/GeneratedOhosWebView.ets @@ -2918,7 +2918,7 @@ export class FileChooserParamsFlutterApi { isCaptureEnabledArg: boolean, acceptTypesArg: string[], modeArg: FileChooserMode, - //filenameHintArg:string, + filenameHintArg:string, callback: Reply ) { const channel: BasicMessageChannel = new BasicMessageChannel( @@ -2928,7 +2928,7 @@ export class FileChooserParamsFlutterApi { ); channel.send( [instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, - //filenameHintArg + filenameHintArg ], (channelReply: ESObject) => callback.reply(null) ); -- Gitee