Skip to content

Commit cb3a559

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 757f663 + 15fc5c7 commit cb3a559

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/src/main/java/org/b3log/siyuan/JSAndroid.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public String getBlockURL() {
5959
return blockURL;
6060
}
6161

62+
@JavascriptInterface
63+
public void setWebViewDebuggingEnabled(final boolean debuggable) {
64+
activity.setWebViewDebuggable(debuggable);
65+
}
66+
6267
@JavascriptInterface
6368
public String readClipboard() {
6469
final ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);

app/src/main/java/org/b3log/siyuan/MainActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected void onCreate(final Bundle savedInstanceState) {
140140

141141
// 使用 Chromium 调试 WebView
142142
if (Utils.isDebugPackageAndMode(this)) {
143-
WebView.setWebContentsDebuggingEnabled(true);
143+
this.setWebViewDebuggable(true);
144144
}
145145

146146
// 注册工具栏显示/隐藏跟随软键盘状态
@@ -709,6 +709,10 @@ private void checkWebViewVer(final WebSettings ws) {
709709
}
710710
}
711711

712+
public void setWebViewDebuggable(final boolean debuggable) {
713+
WebView.setWebContentsDebuggingEnabled(debuggable);
714+
}
715+
712716
private static boolean syncing;
713717

714718
public static void startSyncData() {

0 commit comments

Comments
 (0)