mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 06:53:43 +00:00
feat: add generate button to empty state panel
When a note has no cached parallel notes, the empty state now shows a clickable "Generate" button so users can trigger generation directly without going through the command palette. Closes #2. Change-Id: I879897168ef77c44e0ab570e9c094fa9af9f66d4
This commit is contained in:
parent
6aba90bfd3
commit
6e83d216c2
4 changed files with 18 additions and 7 deletions
14
main.js
14
main.js
File diff suppressed because one or more lines are too long
|
|
@ -52,6 +52,7 @@ export const STRINGS: Record<string, Record<string, string>> = {
|
|||
noCancelableJob: '当前没有可取消的生成任务',
|
||||
cancelRequested: '已请求取消生成',
|
||||
cancelRequestedApiInFlight: '已请求取消生成;当前 API 请求无法立即中断,返回后会丢弃结果。',
|
||||
actionGenerate: '生成对照笔记',
|
||||
fileMenuGenerate: '生成对照笔记',
|
||||
fileMenuRegen: '强制重新生成对照笔记',
|
||||
fileMenuClear: '清除对照笔记缓存',
|
||||
|
|
@ -210,6 +211,7 @@ export const STRINGS: Record<string, Record<string, string>> = {
|
|||
cancelRequested: 'Cancel requested',
|
||||
cancelRequestedApiInFlight:
|
||||
'Cancel requested. The in-flight API request cannot be aborted immediately; its result will be ignored.',
|
||||
actionGenerate: 'Generate parallel notes',
|
||||
fileMenuGenerate: 'Generate parallel notes',
|
||||
fileMenuRegen: 'Regenerate parallel notes',
|
||||
fileMenuClear: 'Clear parallel-note cache',
|
||||
|
|
|
|||
|
|
@ -148,6 +148,10 @@ export class ParallelReaderView extends ItemView {
|
|||
hint.createEl('h3', { text: file.basename });
|
||||
hint.createEl('p', { text: this.plugin.t('emptyNoCache') });
|
||||
hint.createEl('code', { text: this.plugin.t('commandGenerate') });
|
||||
addTextButton(hint, null, this.plugin.t('actionGenerate'), () => {
|
||||
if (this.plugin.isGeneratingFile(file)) return;
|
||||
this.plugin.runForFile(file, false);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
|||
|
|
@ -350,6 +350,11 @@
|
|||
font-size: 11px;
|
||||
}
|
||||
|
||||
.parallel-reader-empty .parallel-reader-text-button {
|
||||
display: flex;
|
||||
margin: 12px auto 0;
|
||||
}
|
||||
|
||||
.parallel-reader-stream-text {
|
||||
margin-top: 10px;
|
||||
max-height: 200px;
|
||||
|
|
|
|||
Loading…
Reference in a new issue