Fix problem with position of dropdown container for @ and # references, fix problem with scrolling to bootom of ChatPanel instead of last message

This commit is contained in:
dimitrievgs 2025-09-27 23:25:53 +03:00
parent 4b31725936
commit bc9424877c
3 changed files with 292 additions and 264 deletions

View File

@ -209,12 +209,12 @@ export class ChatPanel {
) )
.join(''); .join('');
// Прокручиваем к последнему сообщению // Прокручиваем к самому низу родительского контейнера (view-content)
if (this.chatHistory.length > 0) { if (this.chatHistory.length > 0) {
setTimeout(() => { setTimeout(() => {
const lastMessage = historyContainer.lastElementChild as HTMLElement; const scrollContainer = this.container.closest('.view-content') as HTMLElement;
if (lastMessage) { if (scrollContainer) {
lastMessage.scrollIntoView({ behavior: 'smooth', block: 'end' }); scrollContainer.scrollTop = scrollContainer.scrollHeight;
} }
}, 0); }, 0);
} }

View File

@ -433,7 +433,9 @@
} }
.model-option.selected { .model-option.selected {
background-color: var(--background-modifier-selected); /* Или другой подходящий цвет */ background-color: var(
--background-modifier-selected
); /* Или другой подходящий цвет */
color: var(--text-highlighted); /* Или другой подходящий цвет */ color: var(--text-highlighted); /* Или другой подходящий цвет */
} }
@ -790,3 +792,24 @@
.setting-item.llm-agent-excluded-folder-item .setting-item-control input { .setting-item.llm-agent-excluded-folder-item .setting-item-control input {
flex-grow: 1; /* Поле ввода занимает все доступное пространство */ flex-grow: 1; /* Поле ввода занимает все доступное пространство */
} }
/* ----------------------------------------------- Obsidian core override ------------------------------------------------------------ */
.status-bar-item {
display: none;
padding: 0;
&.plugin-editor-width-slider {
display: inline-flex;
& .editor-width-slider {
width: 80px !important;
}
& .editor-width-slider-value {
padding: 4px 3px !important;
font-size: 10px !important;
margin: 0 !important;
}
}
}

View File

@ -40,7 +40,8 @@ export class ReferenceAutocomplete {
this.currentReference = reference; this.currentReference = reference;
// Получаем опции в зависимости от типа ссылки // Получаем опции в зависимости от типа ссылки
const options = reference.type === 'file' const options =
reference.type === 'file'
? await this.autocompleteManager.getFileOptions(reference.name) ? await this.autocompleteManager.getFileOptions(reference.name)
: await this.autocompleteManager.getPromptOptions(reference.name); : await this.autocompleteManager.getPromptOptions(reference.name);
@ -220,9 +221,12 @@ export class ReferenceAutocomplete {
/** /**
* Позиционирует dropdown относительно курсора * Позиционирует dropdown относительно курсора
* @param position - желаемая позиция * @param cursorRect - DOMRect объекта курсора, для определения позиции.
*/ */
private positionDropdown(cursorRect: DOMRect): void { private positionDropdown(cursorRect: DOMRect): void {
// Чтобы получить корректные размеры, устанавливаем display: 'block'
this.dropdown.style.display = 'block';
const inputRect = this.inputElement.getBoundingClientRect(); const inputRect = this.inputElement.getBoundingClientRect();
const containerRect = this.container.getBoundingClientRect(); const containerRect = this.container.getBoundingClientRect();
const dropdownRect = this.dropdown.getBoundingClientRect(); // Получаем размеры дропдауна const dropdownRect = this.dropdown.getBoundingClientRect(); // Получаем размеры дропдауна
@ -248,6 +252,7 @@ export class ReferenceAutocomplete {
const maxRight = inputRect.right - containerRect.left; const maxRight = inputRect.right - containerRect.left;
if (left + dropdownRect.width > maxRight) { if (left + dropdownRect.width > maxRight) {
left = maxRight - dropdownRect.width; left = maxRight - dropdownRect.width;
if (left < 0) left = 0; // Если дропдаун шире контейнера, прижимаем к левому краю
} }
// Убедимся, что дропдаун не выходит за границы контейнера слева // Убедимся, что дропдаун не выходит за границы контейнера слева
if (left < 0) { if (left < 0) {