feat: disable webview long-press menu on launcher pages except inputs

This commit is contained in:
2026-08-17 21:55:37 +08:00
parent 8b9a707cce
commit 885be2fe85
2 changed files with 25 additions and 0 deletions
+13
View File
@@ -8,6 +8,19 @@
/* 移除 WebView 默认蓝色点击高亮,改用下方 :active 的 Miuix 风格反馈 */
/* Remove the default blue tap highlight; use the Miuix-style :active feedback below */
-webkit-tap-highlight-color: transparent;
/* 禁用文本选择,避免长按弹出 WebView 选择/复制菜单(输入框除外) */
/* Disable text selection to avoid the long-press WebView context menu (except inputs) */
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
/* 输入框/文本域/可编辑区保留文本选择,长按可复制粘贴 */
/* Inputs / textareas / editable areas keep text selection for copy/paste */
input, textarea, [contenteditable="true"] {
-webkit-user-select: text;
user-select: text;
-webkit-touch-callout: default;
}
html, body { height: 100%; }
+12
View File
@@ -8,6 +8,18 @@
<link rel="stylesheet" href="css/app.css">
<script src="js/theme.js"></script>
<script src="js/glass.js"></script>
<script>
// 阻止非输入框的 WebView 长按菜单(文本/图片的复制、保存等),
// 输入框/文本域/可编辑区保留系统菜单以便复制粘贴
// Block the WebView long-press context menu on non-input elements (copy/save
// image); keep it for inputs/textareas/contenteditable for copy/paste
document.addEventListener('contextmenu', function (e) {
var t = e.target;
var tag = t.tagName;
if (tag === 'INPUT' || tag === 'TEXTAREA' || t.isContentEditable) return;
e.preventDefault();
}, true);
</script>
</head>
<body>
<div id="wallpaper-dim"></div>