mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
✨ feat: add electron page tabs functionality (#12310)
* ✨ feat: add electron page tabs functionality Implement browser-style page tabs in the Electron titlebar: - Add TabBar component with explicit tab creation via context menu (desktop only) - Tab creation triggers: TopicItem/PageItem context menu "Open in New Tab" or double-click - TabBar only visible when tab count >= 2 - Update active tab's reference when navigating within it (tab follows user navigation) - Reuse existing plugin system (pluginRegistry, 11 page plugins, PageReference types) - Persist tabs to localStorage with automatic recovery on restart - Apply logic to TopicItem (agent & group) and PageItem Changes: - src/store/electron/actions/tabPages.ts: New store slice with tab state + actions - src/features/Electron/titlebar/TabBar/: New UI component + storage + hooks - src/features/Electron/navigation/: New useTabNavigation hook + extracted cachedData helper - src/app/.../Topic/List/Item/: Double-click creates tab, context menu "Open in New Tab" - src/app/.../page/.../Item/: Double-click creates tab, context menu "Open in New Tab" - i18n: New keys in topic.ts and file.ts namespaces * ✨ feat: enhance agent topic plugin and tab resolution logic - Added a new line to ensure the cached title is included when resolving tabs in the useResolvedTabs hook. - Minor adjustment in the agentTopicPlugin to improve code clarity. These changes improve the handling of cached titles in the tab resolution process and enhance the overall functionality of the agent topic plugin. Signed-off-by: Innei <tukon479@gmail.com> * ✨ feat: enhance agent and conversation handling in PageEditor - Refactored PageAgentProvider to eliminate direct pageAgentId prop, improving context management. - Updated Conversation and Copilot components to utilize conversation state for agent selection, ensuring better handling of chat-group session IDs. - Adjusted FileCopilot to synchronize active agent ID with conversation context, enhancing file interaction capabilities. These changes streamline agent management and improve the overall user experience in the PageEditor feature. Signed-off-by: Innei <tukon479@gmail.com> * 🔧 chore: update ESLint suppressions for chat service [skip ci] - Removed the suppression for `object-shorthand` in `src/services/chat/index.ts` to improve code quality. - Adjusted the ESLint suppressions in `eslint-suppressions.json` for better linting consistency. These changes enhance the linting process by ensuring adherence to coding standards in the chat service files. Signed-off-by: Innei <tukon479@gmail.com> * 🔧 chore: optimize NavigationBar panel width handling * ✨ feat: add tab context menu with close actions Add right-click context menu on tab items: - Close current tab - Close other tabs - Close tabs to the left (disabled on first tab) - Close tabs to the right (disabled on last tab) * 🐛 fix: defer single-click navigation on desktop to prevent double-click addTab race * ✨ feat: implement onActivate method for RecentlyViewed plugins to manage store state transitions - Added onActivate method to RecentlyViewedPlugin interface for handling tab activations. - Updated agentPlugin and agentTopicPlugin to switch topics based on tab activation. - Enhanced PluginRegistry to notify plugins on tab activation. - Modified TabBar to trigger onActivate when a tab is activated. - Improved AgentIdSync to preserve topic state during agent switches. Signed-off-by: Innei <tukon479@gmail.com> * refactor: update test for BackendProxyProtocolManager to throw on upstream fetch failure - Changed test description to reflect behavior change from returning a 502 status to throwing an error. - Updated test implementation to use expect().rejects.toThrow for handling fetch errors. Signed-off-by: Innei <tukon479@gmail.com> * refactor: use optional chaining for agent configuration properties - Updated agent configuration properties to use optional chaining for safer access. - This change prevents potential runtime errors when properties are undefined. Signed-off-by: Innei <tukon479@gmail.com> * refactor: optimize navigation handling in TabBar with startTransition - Introduced startTransition for navigation updates to improve performance and user experience. - Updated handleActivate, handleCloseOthers, handleCloseLeft, and handleCloseRight methods to use startTransition for routing. - Enhanced code readability by grouping navigation logic within startTransition. Signed-off-by: Innei <tukon479@gmail.com> --------- Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -93,6 +93,10 @@
|
||||
"sync.mode.useSelfHosted": "Use a self-hosted instance?",
|
||||
"sync.selfHosted.description": "Community version that you can deploy yourself",
|
||||
"sync.selfHosted.title": "Self-Hosted Instance",
|
||||
"tab.closeCurrentTab": "Close Tab",
|
||||
"tab.closeLeftTabs": "Close Tabs to the Left",
|
||||
"tab.closeOtherTabs": "Close Other Tabs",
|
||||
"tab.closeRightTabs": "Close Tabs to the Right",
|
||||
"updater.checkingUpdate": "Checking for updates",
|
||||
"updater.checkingUpdateDesc": "Retrieving version information...",
|
||||
"updater.downloadNewVersion": "Download new version",
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
"pageEditor.saving": "Saving...",
|
||||
"pageEditor.titlePlaceholder": "Untitled",
|
||||
"pageEditor.wordCount": "{{wordCount}} words",
|
||||
"pageList.actions.openInNewTab": "Open in New Tab",
|
||||
"pageList.copyContent": "Copy Full Text",
|
||||
"pageList.duplicate": "Duplicate",
|
||||
"pageList.empty": "No pages yet. Click the button above to create your first one.",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"actions.duplicate": "Duplicate",
|
||||
"actions.export": "Export Topics",
|
||||
"actions.import": "Import Conversation",
|
||||
"actions.openInNewTab": "Open in New Tab",
|
||||
"actions.openInNewWindow": "Open in a new window",
|
||||
"actions.removeAll": "Delete All Topics",
|
||||
"actions.removeUnstarred": "Delete Unstarred Topics",
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
"sync.mode.useSelfHosted": "使用自托管实例?",
|
||||
"sync.selfHosted.description": "自行部署的社区版本",
|
||||
"sync.selfHosted.title": "自托管实例",
|
||||
"tab.closeCurrentTab": "关闭标签页",
|
||||
"tab.closeLeftTabs": "关闭左侧标签页",
|
||||
"tab.closeOtherTabs": "关闭其他标签页",
|
||||
"tab.closeRightTabs": "关闭右侧标签页",
|
||||
"updater.checkingUpdate": "检查新版本",
|
||||
"updater.checkingUpdateDesc": "正在获取版本信息…",
|
||||
"updater.downloadNewVersion": "下载新版本",
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
"pageEditor.saving": "正在保存…",
|
||||
"pageEditor.titlePlaceholder": "无标题",
|
||||
"pageEditor.wordCount": "{{wordCount}} 字",
|
||||
"pageList.actions.openInNewTab": "在新标签页中打开",
|
||||
"pageList.copyContent": "复制全文",
|
||||
"pageList.duplicate": "创建副本",
|
||||
"pageList.empty": "还没有文稿。点击上方按钮创建第一篇",
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"actions.duplicate": "复制",
|
||||
"actions.export": "导出话题",
|
||||
"actions.import": "导入对话",
|
||||
"actions.openInNewTab": "在新标签页中打开",
|
||||
"actions.openInNewWindow": "打开独立窗口",
|
||||
"actions.removeAll": "删除全部话题",
|
||||
"actions.removeUnstarred": "删除未收藏话题",
|
||||
|
||||
Reference in New Issue
Block a user