feat(前端界面): 统一按钮与提示文案,精简文字,优化间距和弹窗对齐
build.yaml / build (push) Successful in 37s

This commit is contained in:
xiaoqidun committed 2026-09-17 23:56:46 +08:00
1 parent 2ffbf573ba
commit 7eac28284a
3 files changed
+25 -17

No files matched your search

+3 -3
View File
@@ -41,7 +41,7 @@
<button id="rotateButton" class="button" type="button" data-short="转" title="顺时针旋转90°" aria-label="旋转" disabled>旋转</button>
<button id="panButton" 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 class="tool-group">
<select id="exportFormat" class="format-select" title="导出格式" aria-label="导出格式" disabled></select>
@@ -57,7 +57,7 @@
</header>
<div id="editorTools" class="editor-toolbar" role="toolbar" aria-label="编辑工具" hidden>
<div class="editor-group editor-file">
<button id="saveButton" class="button" type="button" title="另存为OFD" aria-label="保存OFD" aria-keyshortcuts="Control+S Meta+S">保存</button>
<button id="saveButton" class="button" type="button" title="另存为OFD" aria-label="另存为OFD" aria-keyshortcuts="Control+S Meta+S">保存</button>
<button id="undoButton" class="button" type="button" disabled>撤销</button>
<button id="redoButton" class="button" type="button" disabled>重做</button>
<span>文件</span>
@@ -452,7 +452,7 @@
</section>
<section class="doc-font-panel" aria-labelledby="docFontPanelTitle">
<div class="panel-row">
<div id="docFontPanelTitle" class="panel-title compact">OFD 字体</div>
<div id="docFontPanelTitle" class="panel-title compact">文档字体</div>
<span id="docFontSummary" class="count-pill">0</span>
</div>
<div id="docFontList" class="doc-font-list"></div>
+5
View File
@@ -798,6 +798,10 @@ button:not(:disabled):hover {
gap: 8px;
}
.form-actions > button:only-child {
grid-column: -2;
}
.form-actions button[type="submit"] {
border-color: var(--accent);
background: var(--accent);
@@ -1795,6 +1799,7 @@ button.outline-link:hover {
.annotation-detail {
display: grid;
gap: 8px;
margin-bottom: 12px;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
+17 -14
View File
@@ -1306,7 +1306,7 @@ async function toggleEditor() {
function confirmTextReflow(item) {
return canEditObject(item, "reflow") && (canEditObject(item, "layoutKnown")
|| window.confirm("原文排版未知,此操作将重新排版。继续?"));
|| window.confirm("此操作将重新排版原文,继续?"));
}
function openCreatePanel() {
@@ -2177,7 +2177,7 @@ async function boot() {
}
setProgress("引擎准备完成", 70);
await loadExportFormats();
setEmpty("选择 OFD 文件");
setEmpty(STATUS.ready);
updateFontSummary();
renderFontList();
updateControls();
@@ -2499,7 +2499,7 @@ async function openOFD(file) {
}
if (!isOFDFile(file)) {
el.ofdInput.value = "";
showError(new Error("选择 OFD 文件"), !state.doc);
showError(new Error(STATUS.ready), !state.doc);
return;
}
if (!discardChanges()) {
@@ -3857,7 +3857,7 @@ async function pasteEditorContent(event) {
if (token) {
const clipboard = state.objectClipboard;
if (!clipboard || token !== clipboard.token) {
setStatus("复制内容已失效,请重新复制");
setStatus("内容已失效,请重新复制");
return;
}
const openSeq = state.openSeq;
@@ -4628,7 +4628,7 @@ function renderPageList() {
button.type = "button";
button.className = "page-list-item";
button.dataset.pageIndex = String(page.index);
button.title = `${formatSize(page.width)} x ${formatSize(page.height)} mm`;
button.title = `${formatSize(page.width)}×${formatSize(page.height)}mm`;
setPageItemCurrent(button, page.index === state.pageIndex);
layoutThumbnail(button, page);
@@ -4643,7 +4643,7 @@ function renderPageList() {
const size = document.createElement("span");
size.className = "thumb-size";
size.textContent = `${formatSize(page.width)} x ${formatSize(page.height)} mm`;
size.textContent = button.title;
button.append(thumb, label, size);
if (state.editing && pageCan("move", page.index)) enablePageDrag(button, page.index);
@@ -4949,8 +4949,8 @@ function renderAttachments() {
const item = document.createElement("button");
item.type = "button";
item.className = "attachment-item";
item.title = `下载 ${attachment.fileName}`;
item.setAttribute("aria-label", `下载 ${attachment.name}`);
item.title = `下载:${attachment.fileName}`;
item.setAttribute("aria-label", `下载:${attachment.name}`);
const name = document.createElement("span");
name.className = "attachment-name";
name.textContent = attachment.name;
@@ -5290,7 +5290,7 @@ function fontSummary(fonts) {
const missing = fonts.filter((font) => font.status === "missing").length;
const fallback = fonts.filter((font) => font.status === "fallback").length;
if (missing || fallback) {
return `${fonts.length} · 缺失 ${missing} · 回退 ${fallback}`;
return [String(fonts.length), missing ? `缺失${missing}` : "", fallback ? `回退${fallback}` : ""].filter(Boolean).join(" · ");
}
return `共${fonts.length}`;
}
@@ -5317,7 +5317,7 @@ function statusText(status) {
function fontResult(font) {
const parts = [];
if (font.matched) {
parts.push(font.embedded || font.status === "embedded" ? `内嵌 ${font.matched}` : `匹配 ${font.matched}`);
parts.push(font.embedded || font.status === "embedded" ? `内嵌:${font.matched}` : `匹配:${font.matched}`);
}
if (font.matchedFace?.fullName) {
parts.push(font.matchedFace.fullName);
@@ -5332,10 +5332,10 @@ function fontResult(font) {
function fontMeta(font) {
const parts = [];
if (font.familyName && font.familyName !== font.fontName) {
parts.push(`字族 ${font.familyName}`);
parts.push(`字族:${font.familyName}`);
}
if (font.charset) {
parts.push(`字集 ${font.charset}`);
parts.push(`字集:${font.charset}`);
}
return parts.join(" · ");
}
@@ -5528,7 +5528,7 @@ function setScale(nextScale, updateStatus = true, fitMode = "free") {
}
el.zoomLabel.textContent = `${Math.round(state.scale * 100)}%`;
if (updateStatus && state.doc && !state.exporting) {
setStatus(`第 ${state.pageIndex + 1} / ${state.doc.pageCount} 页`);
setStatus(pageStatus(state.pageIndex, state.doc.pageCount));
}
updateControls();
}
@@ -5688,6 +5688,9 @@ function updateObjectControls(item, reset = false) {
el.objectDistribute.disabled = el.objectAlign.disabled || !item.items || item.items.length < 3;
el.editObjectButton.disabled = disabled || Boolean(item.items) || !canEditObject(item, "enter") && (item.type === "PathObject"
|| !canEditObject(item, item.type === "TextObject" ? "reflow" : item.type === "ImageObject" ? "replaceImage" : "update"));
el.editObjectButton.textContent = canEditObject(item, "enter") ? "进入" : item?.type === "ImageObject" ? "替换" : "修改";
el.editObjectButton.title = canEditObject(item, "enter") ? "进入组合" : item?.type === "ImageObject" ? "替换图片" : "修改对象";
el.editObjectButton.setAttribute("aria-label", el.editObjectButton.title);
el.multiSelectButton.disabled = !state.editing || !canvasEditor.enabled || !state.ready || state.exporting;
const selection = selectedText(item);
const text = selection ? currentTextStyle() : state.textDefaults;
@@ -5753,7 +5756,7 @@ function updateObjectControls(item, reset = false) {
function updateAnnotationButton() {
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);
}