feat: refine table presentation and editable Word export

This commit is contained in:
2026-11-04 15:40:52 +08:00
parent 31d0ccfde5
commit 3bb2cc5438
15 changed files with 337 additions and 58 deletions
+10 -1
View File
@@ -195,6 +195,12 @@ document.addEventListener("DOMContentLoaded", () => {
const wrapper = document.createElement("div");
wrapper.className = "table-wrapper";
const scroll = document.createElement("div");
scroll.className = "table-scroll";
scroll.tabIndex = 0;
scroll.setAttribute("role", "region");
scroll.setAttribute("aria-label", "表格内容,可横向滚动");
table.setAttribute("data-mdh-table", "");
const tools = document.createElement("div");
tools.className = "table-tools";
@@ -203,6 +209,8 @@ document.addEventListener("DOMContentLoaded", () => {
copyButton.type = "button";
copyButton.className = "copy-table-button";
copyButton.textContent = "复制表格";
copyButton.setAttribute("aria-label", "复制表格");
copyButton.title = "复制表格";
copyButton.addEventListener("click", async () => {
const rows = [...table.querySelectorAll("tr")].map((row) =>
@@ -220,7 +228,8 @@ document.addEventListener("DOMContentLoaded", () => {
tools.appendChild(copyButton);
table.parentNode.insertBefore(wrapper, table);
wrapper.appendChild(tools);
wrapper.appendChild(table);
wrapper.appendChild(scroll);
scroll.appendChild(table);
});
const lightbox = document.createElement("div");