feat: disable webview long-press menu on launcher pages except inputs
This commit is contained in:
@@ -8,6 +8,19 @@
|
|||||||
/* 移除 WebView 默认蓝色点击高亮,改用下方 :active 的 Miuix 风格反馈 */
|
/* 移除 WebView 默认蓝色点击高亮,改用下方 :active 的 Miuix 风格反馈 */
|
||||||
/* Remove the default blue tap highlight; use the Miuix-style :active feedback below */
|
/* Remove the default blue tap highlight; use the Miuix-style :active feedback below */
|
||||||
-webkit-tap-highlight-color: transparent;
|
-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%; }
|
html, body { height: 100%; }
|
||||||
|
|||||||
@@ -8,6 +8,18 @@
|
|||||||
<link rel="stylesheet" href="css/app.css">
|
<link rel="stylesheet" href="css/app.css">
|
||||||
<script src="js/theme.js"></script>
|
<script src="js/theme.js"></script>
|
||||||
<script src="js/glass.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="wallpaper-dim"></div>
|
<div id="wallpaper-dim"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user