mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
This commit is contained in:
1 parent
85baeda7f9
commit
ac2eb2b5c7
8 files changed
+105
-3
No files matched your search
@@ -193,6 +193,14 @@
|
||||
<button id="batchPagesButton" class="editor-group-action" type="button">页面</button>
|
||||
</div>
|
||||
</div>
|
||||
<dialog id="aboutPanel" class="form-dialog about-dialog" aria-labelledby="aboutTitle">
|
||||
<form method="dialog">
|
||||
<h2 id="aboutTitle" class="form-title">OFDGo</h2>
|
||||
<div class="about-row"><span>构建版本</span><span id="aboutVersion">develop</span></div>
|
||||
<div class="about-row"><span>项目官网</span><a href="https://ofdgo.aite.me/" target="_blank" rel="noreferrer">https://ofdgo.aite.me/</a></div>
|
||||
<div class="about-row"><span>项目仓库</span><a href="https://github.com/xiaoqidun/ofdgo" target="_blank" rel="noreferrer">https://github.com/xiaoqidun/ofdgo</a></div>
|
||||
</form>
|
||||
</dialog>
|
||||
<dialog id="closePanel" class="form-dialog confirm-dialog" aria-labelledby="closeTitle">
|
||||
<form method="dialog">
|
||||
<h2 id="closeTitle" class="form-title">关闭文档</h2>
|
||||
@@ -841,7 +849,7 @@
|
||||
</main>
|
||||
|
||||
<footer class="app-footer app-bar">
|
||||
<a class="footer-brand" href="https://github.com/xiaoqidun/ofdgo" target="_blank" rel="noreferrer">OFDGo</a>
|
||||
<button id="aboutButton" class="footer-brand" type="button">OFDGo</button>
|
||||
<div id="statusText" class="status-text">正在准备引擎</div>
|
||||
<nav class="footer-links">
|
||||
<a href="https://aite.me/" target="_blank" rel="noreferrer">官方网站</a>
|
||||
|
||||
@@ -866,6 +866,30 @@ button:not(:disabled):hover {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.about-dialog {
|
||||
width: 460px;
|
||||
}
|
||||
|
||||
.about-row {
|
||||
display: grid;
|
||||
grid-template-columns: 4em minmax(0, 1fr);
|
||||
align-items: start;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.about-row > span:first-child {
|
||||
text-align-last: justify;
|
||||
}
|
||||
|
||||
.about-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.about-row a {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
margin: -12px -12px 12px;
|
||||
padding: 10px 12px;
|
||||
@@ -4135,8 +4159,19 @@ audio.page-media {
|
||||
flex: 0 0 var(--sidebar-width);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--accent-strong);
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.footer-brand:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
|
||||
+37
-1
@@ -190,6 +190,9 @@ const el = {
|
||||
documentTitleBar: document.querySelector("#documentTitleBar"),
|
||||
documentTabs: document.querySelector("#documentTabs"),
|
||||
documentNewTab: document.querySelector("#documentNewTab"),
|
||||
aboutButton: document.querySelector("#aboutButton"),
|
||||
aboutPanel: document.querySelector("#aboutPanel"),
|
||||
aboutVersion: document.querySelector("#aboutVersion"),
|
||||
signButton: document.querySelector("#signButton"),
|
||||
signPanel: document.querySelector("#signPanel"),
|
||||
signForm: document.querySelector("#signForm"),
|
||||
@@ -1466,6 +1469,13 @@ el.pageForm.addEventListener("submit", async (event) => {
|
||||
el.pagePanel.close();
|
||||
}
|
||||
});
|
||||
el.aboutButton.addEventListener("click", openAboutPanel);
|
||||
let aboutBackdrop = false;
|
||||
el.aboutPanel.addEventListener("pointerdown", event => { aboutBackdrop = event.target === el.aboutPanel; });
|
||||
el.aboutPanel.addEventListener("click", event => {
|
||||
if (aboutBackdrop && event.target === el.aboutPanel) el.aboutPanel.close();
|
||||
aboutBackdrop = false;
|
||||
});
|
||||
el.ofdButton.addEventListener("click", openOFDFile);
|
||||
el.closeButton.addEventListener("pointerdown", event => event.preventDefault());
|
||||
el.closeButton.addEventListener("click", () => closeDocument().catch(error => showError(error, false)));
|
||||
@@ -1966,10 +1976,36 @@ function handleKeyDown(event) {
|
||||
}
|
||||
|
||||
function formDialogOpen() {
|
||||
return Boolean(sealPreview || resourceManager.pick) || el.closePanel.open || el.attachmentDialog.open || settingsElements.Panel.open || fontBindingElements.Panel.open || el.signPanel.open || el.verifyPanel.open || el.credentialsPanel.open || el.encryptionPanel.open || batchElements.Panel.open || el.exportPanel.open || el.createPanel.open || el.insertPanel.open || el.pagePanel.open || el.paragraphPanel.open || el.importPanel.open || el.infoPanel.open || el.documentPanel.open
|
||||
return Boolean(sealPreview || resourceManager.pick) || el.aboutPanel.open || el.closePanel.open || el.attachmentDialog.open || settingsElements.Panel.open || fontBindingElements.Panel.open || el.signPanel.open || el.verifyPanel.open || el.credentialsPanel.open || el.encryptionPanel.open || batchElements.Panel.open || el.exportPanel.open || el.createPanel.open || el.insertPanel.open || el.pagePanel.open || el.paragraphPanel.open || el.importPanel.open || el.infoPanel.open || el.documentPanel.open
|
||||
|| resourceElements.Panel.open || el.structureDialog.open || el.versionPanel.open || el.batchPagesPanel.open || el.objectStylePanel.open || el.outlinePanel.open || el.objectBoundsPanel.open || el.annotationNote.open || el.annotationCreate.open || el.objectPicker.open;
|
||||
}
|
||||
|
||||
async function openAboutPanel() {
|
||||
el.aboutVersion.textContent = "读取中";
|
||||
documentDialogs.showApplication(el.aboutPanel);
|
||||
let raw = "";
|
||||
try {
|
||||
const response = await fetch("./", { cache: "no-store" });
|
||||
if (response.ok) raw = response.headers.get("X-OFDGo-Build-Version") || "";
|
||||
} catch {
|
||||
if (el.aboutPanel.open) el.aboutVersion.textContent = "版本信息不可用";
|
||||
return;
|
||||
}
|
||||
if (!el.aboutPanel.open) return;
|
||||
if (!raw) {
|
||||
el.aboutVersion.textContent = "develop";
|
||||
return;
|
||||
}
|
||||
const match = /^(\d+)-([0-9a-f]{40}|[0-9a-f]{64})$/i.exec(raw);
|
||||
const seconds = Number(match?.[1]);
|
||||
const date = new Date(seconds * 1000);
|
||||
if (!match || !Number.isSafeInteger(seconds) || Number.isNaN(date.getTime())) {
|
||||
el.aboutVersion.textContent = "版本信息异常";
|
||||
return;
|
||||
}
|
||||
el.aboutVersion.textContent = `${date.toISOString().slice(0, 10).replaceAll("-", "")}-${match[2].slice(0, 7)}`;
|
||||
}
|
||||
|
||||
function setObjectDimension(input, value) {
|
||||
input.value = String(Number(value.toFixed(2)));
|
||||
input.defaultValue = input.value;
|
||||
|
||||
Reference in new issue
Block a user