mirror of
https://github.com/rait-09/obsidian-agent-client.git
synced 2026-07-22 06:43:37 +00:00
fix: sync hint overlay font and notify settings subscribers
This commit is contained in:
parent
70822af619
commit
fac4dc7a44
2 changed files with 21 additions and 15 deletions
|
|
@ -204,6 +204,23 @@ export class AgentClientSettingTab extends PluginSettingTab {
|
|||
return currentFontSize === null ? "" : String(currentFontSize);
|
||||
};
|
||||
|
||||
const persistChatFontSize = async (
|
||||
fontSize: number | null,
|
||||
): Promise<void> => {
|
||||
if (this.plugin.settings.displaySettings.fontSize === fontSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextSettings = {
|
||||
...this.plugin.settings,
|
||||
displaySettings: {
|
||||
...this.plugin.settings.displaySettings,
|
||||
fontSize,
|
||||
},
|
||||
};
|
||||
await this.plugin.saveSettingsAndNotify(nextSettings);
|
||||
};
|
||||
|
||||
text
|
||||
.setPlaceholder(
|
||||
`${CHAT_FONT_SIZE_MIN}-${CHAT_FONT_SIZE_MAX}`,
|
||||
|
|
@ -211,14 +228,7 @@ export class AgentClientSettingTab extends PluginSettingTab {
|
|||
.setValue(getCurrentDisplayValue())
|
||||
.onChange(async (value) => {
|
||||
if (value.trim().length === 0) {
|
||||
const hasChanged =
|
||||
this.plugin.settings.displaySettings.fontSize !==
|
||||
null;
|
||||
if (hasChanged) {
|
||||
this.plugin.settings.displaySettings.fontSize =
|
||||
null;
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
await persistChatFontSize(null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -244,9 +254,7 @@ export class AgentClientSettingTab extends PluginSettingTab {
|
|||
this.plugin.settings.displaySettings.fontSize !==
|
||||
parsedFontSize;
|
||||
if (hasChanged) {
|
||||
this.plugin.settings.displaySettings.fontSize =
|
||||
parsedFontSize;
|
||||
await this.plugin.saveSettings();
|
||||
await persistChatFontSize(parsedFontSize);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -268,9 +276,7 @@ export class AgentClientSettingTab extends PluginSettingTab {
|
|||
this.plugin.settings.displaySettings.fontSize !==
|
||||
parsedFontSize;
|
||||
if (hasChanged) {
|
||||
this.plugin.settings.displaySettings.fontSize =
|
||||
parsedFontSize;
|
||||
void this.plugin.saveSettings();
|
||||
void persistChatFontSize(parsedFontSize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -751,7 +751,7 @@ If your plugin does not need CSS, delete this file.
|
|||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
font-family: inherit;
|
||||
font-size: var(--font-text-size);
|
||||
font-size: var(--ac-chat-font-size);
|
||||
line-height: var(--line-height-normal);
|
||||
/* Text wrapping */
|
||||
white-space: pre-wrap;
|
||||
|
|
|
|||
Loading…
Reference in a new issue