fix(编辑能力): 修复字号间距字体等提交丢失
build.yaml / build (push) Successful in 45s

This commit is contained in:
xiaoqidun committed 2026-10-28 20:00:15 +08:00
1 parent 62631472ea
commit 12aaada982
2 files changed
+56 -36

No files matched your search

+13 -2
View File
@@ -131,7 +131,10 @@ export class FontPicker {
const changed = this.value !== String(index);
this.value = String(index);
this.close();
if (changed) return this.onChange();
if (changed) {
const task = this.changing = Promise.resolve(this.onChange());
return task.finally(() => { if (this.changing === task) this.changing = null; });
}
}
commitExact() {
@@ -140,7 +143,15 @@ export class FontPicker {
&& [font.fullName, font.name, font.postscriptName, ...(font.names || [])].some(name => name?.toLocaleLowerCase() === value);
const selected = Number(this.value);
const index = matches(this.fonts[selected]) ? selected : this.fonts.findIndex(matches);
if (index >= 0) this.choose(index);
if (index >= 0) return this.choose(index);
}
prepareCommit(event) {
if (this.open && (!event || ![this.input, this.toggle, this.list].some(node => node.contains(event.target)))) {
this.commitExact();
this.close();
}
return this.changing;
}
close() {