feat(前端界面): 统一WebUI文案,精简状态提示
build.yaml / build (push) Successful in 36s

This commit is contained in:
xiaoqidun committed 2026-09-10 14:56:53 +08:00
1 parent c3d8c0e8a0
commit ce6a9c8ec0
2 files changed
+17 -17

No files matched your search

+2 -2
View File
@@ -37,7 +37,7 @@
<button id="fitButton" class="button" type="button" data-short="宽" aria-label="适宽" disabled>适宽</button> <button id="fitButton" class="button" type="button" data-short="宽" aria-label="适宽" disabled>适宽</button>
<button id="fitHeightButton" class="button" type="button" data-short="高" aria-label="适高" disabled>适高</button> <button id="fitHeightButton" class="button" type="button" data-short="高" aria-label="适高" disabled>适高</button>
<button id="continuousButton" class="button" type="button" data-short="连" title="无距连续显示" aria-label="无距连续显示" aria-pressed="false" disabled>连续</button> <button id="continuousButton" class="button" type="button" data-short="连" title="无距连续显示" aria-label="无距连续显示" aria-pressed="false" disabled>连续</button>
<button id="annotationButton" class="button" type="button" data-short="注" title="渲染注解" aria-label="渲染注解" aria-pressed="true">注解</button> <button id="annotationButton" class="button" type="button" data-short="注" title="关闭注解" aria-label="关闭注解" aria-pressed="true">注解</button>
</div> </div>
<div class="tool-group"> <div class="tool-group">
<select id="pageExportFormat" class="format-select" title="单页格式" aria-label="单页格式" disabled></select> <select id="pageExportFormat" class="format-select" title="单页格式" aria-label="单页格式" disabled></select>
@@ -137,7 +137,7 @@
<button id="fontDirectoryButton" class="small-button" type="button" title="添加字体目录" aria-label="添加字体目录">目录</button> <button id="fontDirectoryButton" class="small-button" type="button" title="添加字体目录" aria-label="添加字体目录">目录</button>
</div> </div>
</div> </div>
<div id="fontPermissionHint" class="font-permission-hint" hidden>需授权读取系统字体</div> <div id="fontPermissionHint" class="font-permission-hint" hidden>系统字体需授权</div>
<div id="fontList" class="font-list"></div> <div id="fontList" class="font-list"></div>
</section> </section>
</aside> </aside>
+15 -15
View File
@@ -10,7 +10,7 @@ const STATUS = {
engine: "正在准备引擎", engine: "正在准备引擎",
recovering: "正在恢复引擎", recovering: "正在恢复引擎",
fonts: "正在匹配字体", fonts: "正在匹配字体",
exporting: "正在导出文档 PDF", exporting: "正在导出文档",
pageExporting: "正在导出单页", pageExporting: "正在导出单页",
}; };
const WASM_CALLBACKS = [ const WASM_CALLBACKS = [
@@ -692,7 +692,7 @@ async function loadLocalFonts() {
return; return;
} }
if (!canReadLocalFonts()) { if (!canReadLocalFonts()) {
setStatus("当前浏览器不支持读取系统字体"); setStatus("不支持读取系统字体");
return; return;
} }
setBusy(true, state.doc ? "正在匹配字体" : "正在请求授权", 12, state.doc ? STATUS.fonts : "正在请求授权"); setBusy(true, state.doc ? "正在匹配字体" : "正在请求授权", 12, state.doc ? STATUS.fonts : "正在请求授权");
@@ -708,7 +708,7 @@ async function loadLocalFonts() {
} }
} catch (err) { } catch (err) {
if (err && err.name === "NotAllowedError") { if (err && err.name === "NotAllowedError") {
setStatus("未授权读取系统字体"); setStatus("系统字体未授权");
} else { } else {
setStatus(String(err.message || err)); setStatus(String(err.message || err));
} }
@@ -727,7 +727,7 @@ async function requestLocalFontsBeforeOpen() {
setStatus(available.length ? `已授权 ${available.length} 个系统字体` : "未读取到系统字体"); setStatus(available.length ? `已授权 ${available.length} 个系统字体` : "未读取到系统字体");
} catch (err) { } catch (err) {
if (err && err.name === "NotAllowedError") { if (err && err.name === "NotAllowedError") {
setStatus("未授权读取系统字体"); setStatus("系统字体未授权");
return; return;
} }
setStatus(String(err.message || err)); setStatus(String(err.message || err));
@@ -766,7 +766,7 @@ async function autoLoadDocumentLocalFonts(openSeq) {
return await loadDocumentLocalFonts(available, openSeq); return await loadDocumentLocalFonts(available, openSeq);
} catch (err) { } catch (err) {
if (err && err.name === "NotAllowedError") { if (err && err.name === "NotAllowedError") {
setStatus("未授权读取系统字体"); setStatus("系统字体未授权");
return false; return false;
} }
setStatus(String(err.message || err)); setStatus(String(err.message || err));
@@ -786,7 +786,7 @@ async function loadDocumentLocalFonts(available, openSeq = state.openSeq) {
} }
if (!docNames.length) { if (!docNames.length) {
state.localFonts = []; state.localFonts = [];
setStatus("OFD 字体均为内嵌"); setStatus("文档字体均为内嵌");
updateFontSummary(); updateFontSummary();
renderFontList(); renderFontList();
return false; return false;
@@ -796,7 +796,7 @@ async function loadDocumentLocalFonts(available, openSeq = state.openSeq) {
if (!selected.length) { if (!selected.length) {
selected = selectLocalFonts(available, [], 6); selected = selectLocalFonts(available, [], 6);
} }
const emptyStatus = available.length === 0 ? "未读取到系统字体" : "未匹配到文档所需字体"; const emptyStatus = available.length === 0 ? "未读取到系统字体" : "未匹配到所需字体";
const fonts = []; const fonts = [];
for (let i = 0; i < selected.length; i += 1) { for (let i = 0; i < selected.length; i += 1) {
setProgress(`正在读取字体 ${i + 1}/${selected.length}`, 20 + Math.round(i / selected.length * 60)); setProgress(`正在读取字体 ${i + 1}/${selected.length}`, 20 + Math.round(i / selected.length * 60));
@@ -1093,7 +1093,7 @@ function fontSourceText(source) {
function updateLocalFontButton() { function updateLocalFontButton() {
const supported = canReadLocalFonts(); const supported = canReadLocalFonts();
el.localFontButton.disabled = !supported; el.localFontButton.disabled = !supported;
el.localFontButton.title = supported ? "授权读取浏览器可访问的系统字体" : "当前浏览器不支持读取系统字体"; el.localFontButton.title = supported ? "读取系统字体" : "不支持读取系统字体";
updateFontPermissionHint(); updateFontPermissionHint();
} }
@@ -1279,13 +1279,13 @@ async function exportPDF() {
} }
const openSeq = state.openSeq; const openSeq = state.openSeq;
setExportControlsDisabled(true); setExportControlsDisabled(true);
setBusy(true, "正在准备文档 PDF", 18, STATUS.exporting); setBusy(true, "正在准备 PDF", 18, STATUS.exporting);
try { try {
await waitForPaint(); await waitForPaint();
if (openSeq !== state.openSeq) { if (openSeq !== state.openSeq) {
return; return;
} }
setProgress("正在生成文档 PDF", 45); setProgress("正在生成 PDF", 45);
await waitForPaint(); await waitForPaint();
if (openSeq !== state.openSeq) { if (openSeq !== state.openSeq) {
return; return;
@@ -1294,10 +1294,10 @@ async function exportPDF() {
if (openSeq !== state.openSeq) { if (openSeq !== state.openSeq) {
return; return;
} }
setProgress("正在保存文档 PDF", 86); setProgress("正在保存 PDF", 86);
const bytes = result.bytes; const bytes = result.bytes;
downloadBytes(bytes, "application/pdf", pdfFileName()); downloadBytes(bytes, "application/pdf", pdfFileName());
setStatus(`文档 PDF 已导出 ${formatBytes(result.size || bytes.length)}`); setStatus(`PDF 已导出 ${formatBytes(result.size || bytes.length)}`);
} catch (err) { } catch (err) {
if (openSeq === state.openSeq) { if (openSeq === state.openSeq) {
showError(err, false); showError(err, false);
@@ -2182,7 +2182,7 @@ async function focusSignatureStamp(stamp) {
await renderPage(pageIndex, { fit: false, scroll: false }); await renderPage(pageIndex, { fit: false, scroll: false });
await nextFrame(); await nextFrame();
highlightSignatureStamp(stamp); highlightSignatureStamp(stamp);
setStatus(stamp.page ? `已定位签名外观 第 ${stamp.page} 页` : "已定位签名外观"); setStatus(`已定位签名 第 ${stamp.page} 页`);
} }
function highlightSignatureStamp(stamp) { function highlightSignatureStamp(stamp) {
@@ -2287,7 +2287,7 @@ function pageStatus(index, pageCount) {
function statusText(status) { function statusText(status) {
switch (status) { switch (status) {
case "pending": case "pending":
return "待检查"; return "待查";
case "embedded": case "embedded":
return "内嵌"; return "内嵌";
case "matched": case "matched":
@@ -2532,7 +2532,7 @@ function updateControls() {
function updateAnnotationButton() { function updateAnnotationButton() {
el.annotationButton.setAttribute("aria-pressed", String(state.renderAnnotations)); el.annotationButton.setAttribute("aria-pressed", String(state.renderAnnotations));
el.annotationButton.title = state.renderAnnotations ? "关闭注解渲染" : "开启注解渲染"; el.annotationButton.title = state.renderAnnotations ? "关闭注解" : "开启注解";
el.annotationButton.setAttribute("aria-label", el.annotationButton.title); el.annotationButton.setAttribute("aria-label", el.annotationButton.title);
} }