feat(remote-control): 优化 Web 展示、状态同步与桥接控制流程 (#288)

Co-authored-by: chengzifeng <chengzifeng@meituan.com>
This commit is contained in:
Cheng Zi Feng
2026-04-17 16:21:27 +08:00
committed by GitHub
parent b5c299f5d2
commit 72a2093cd6
64 changed files with 4138 additions and 312 deletions

View File

@@ -2,11 +2,23 @@
* Remote Control — Shared Utilities
*/
const HTML_ESCAPE_MAP = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
};
export function esc(str) {
if (!str) return "";
const div = document.createElement("div");
div.textContent = String(str);
return div.innerHTML;
const value = String(str);
if (typeof document !== "undefined" && typeof document.createElement === "function") {
const div = document.createElement("div");
div.textContent = value;
return div.innerHTML;
}
return value.replace(/[&<>"']/g, (char) => HTML_ESCAPE_MAP[char]);
}
export function formatTime(ts) {