mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
@@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="app">
|
<div class="app">
|
||||||
<header class="toolbar app-bar">
|
<header class="toolbar app-bar">
|
||||||
<input id="ofdInput" class="file-input" type="file" accept=".ofd,application/ofd,application/zip">
|
<input id="ofdInput" class="file-input" type="file" accept=".ofd">
|
||||||
<input id="fontInput" class="file-input" type="file" accept=".ttf,.otf,.ttc,font/*" multiple>
|
<input id="fontInput" class="file-input" type="file" accept=".ttf,.otf,.ttc,font/*" multiple>
|
||||||
<div class="tool-group">
|
<div class="tool-group">
|
||||||
<button id="ofdButton" class="button primary" type="button" data-short="打开">打开</button>
|
<button id="ofdButton" class="button primary" type="button" data-short="打开">打开</button>
|
||||||
|
|||||||
@@ -361,6 +361,11 @@ async function openSelectedOFD() {
|
|||||||
if (!file) {
|
if (!file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isOFDFile(file)) {
|
||||||
|
el.ofdInput.value = "";
|
||||||
|
showError(new Error("请选择 .ofd 文件"), !state.doc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
state.wasmRecoveries = 0;
|
state.wasmRecoveries = 0;
|
||||||
setBusy(true, "正在读取 OFD", 10, STATUS.opening);
|
setBusy(true, "正在读取 OFD", 10, STATUS.opening);
|
||||||
try {
|
try {
|
||||||
@@ -373,6 +378,10 @@ async function openSelectedOFD() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOFDFile(file) {
|
||||||
|
return /\.ofd$/i.test(file.name || "");
|
||||||
|
}
|
||||||
|
|
||||||
async function openSelectedFonts() {
|
async function openSelectedFonts() {
|
||||||
const files = Array.from(el.fontInput.files || []);
|
const files = Array.from(el.fontInput.files || []);
|
||||||
if (!files.length) {
|
if (!files.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user