Add move-up message button

This commit is contained in:
dimitrievgs 2025-10-14 21:54:41 +03:00
parent 7be9aa3d2e
commit 66ce396b48
2 changed files with 36 additions and 1 deletions

18
main.js

File diff suppressed because one or more lines are too long

View File

@ -866,6 +866,25 @@ export class ChatPanel {
// Передаем выбранную модель при регенерации
this.props.plugin.eventBus.emit('regenerate-message', { graphId, nodeId, model: this.selectedModel });
});
// Кнопка "Наверх сообщения"
const scrollToTopButton = toolsetContainer.createEl('button', {
cls: 'text-token-text-secondary hover:bg-token-bg-secondary rounded-lg ml-1',
attr: {
'aria-label': 'Перейти к началу сообщения',
'data-testid': 'scroll-to-message-top-button',
'data-state': 'closed'
}
});
const scrollToTopIconContainer = scrollToTopButton.createSpan({ cls: 'flex items-center justify-center touch:w-10 h-8 w-8' });
setIcon(scrollToTopIconContainer, 'arrow-up'); // Иконка стрелки вверх
scrollToTopButton.addEventListener('click', () => {
// Прокручиваем родительский контейнер (view-content) к началу этого сообщения
const scrollContainer = this.container.closest('.view-content') as HTMLElement;
if (scrollContainer) {
scrollContainer.scrollTop = messageElement.offsetTop;
}
});
}
private copyMessageContent(content: string): Promise<void> {