Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

浏览器打开链接 #777

Open
Ren-Boo opened this issue Apr 4, 2024 · 4 comments
Open

浏览器打开链接 #777

Ren-Boo opened this issue Apr 4, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Ren-Boo
Copy link

Ren-Boo commented Apr 4, 2024

Is your feature request related to a problem? / 你想要的功能和什么问题相关?

通过ChatALL应用打开的新窗口不如在浏览器上打开的网页方便我操作,因为我的浏览器有很多插件而ChatALL打开的新窗口没有。
The new window opened through the ChatALL application is not as convenient as the web page opened on the browser because my browser has many plugins and the new window opened by ChatALL is not.

Describe the solution you'd like. / 你想要的解决方案是什么?

在设置里增加一个选项,通过浏览器打开链接,而不是通过ChatALL的新窗口。
An option is added to the settings to open the link via the browser instead of via the new ChatALL window.

Describe alternatives you've considered. / 你考虑过的其他方案是什么?

No response

Additional context / 其他信息

No response

@Ren-Boo Ren-Boo added the enhancement New feature or request label Apr 4, 2024
@DevBuddyConnor
Copy link

Issue分析及修改建议

问题描述:用户希望在ChatALL应用中增加一个选项,以通过默认的网页浏览器打开链接,而不是通过ChatALL的新窗口。这是因为用户的浏览器中有许多插件,而ChatALL打开的新窗口没有。

解决方案

  1. 更新应用设置:在应用的设置存储(例如,可能在 Vuex store 或 Electron 的配置文件中)里加入一个新的布尔选项,用来控制外部链接的打开方式。
  2. 修改链接打开逻辑:根据用户的设置,在处理外部链接时选择通过新窗口还是系统默认浏览器打开。
  3. 更新UI:在设置页面添加一个新的开关或者选项框,让用户可以修改这个新选项。

示范代码
假设使用 Vuex 管理状态,在store添加状态和mutation来存储用户的设置。
处理外部链接的逻辑根据设置来判断打开方式。

结论:这样的改动可以在不影响当前用户体验的前提下,为希望使用默认浏览器插件的用户提供便利,增强了应用的灵活性和用户满意度。

注意:人工智能生成内容仅供参考。

@DevBuddyConnor
Copy link

Issue #777 分析和具体化的修改建议

Vuex Store更新

// src/store/index.js
const store = createStore({
  state: {
    // 其他状态...
    openLinksExternally: false, // 默认为false,使用内部窗口
  },
  mutations: {
    // 其他mutations...
    toggleOpenLinksExternally(state) {
      state.openLinksExternally = !state.openLinksExternally;
    },
  },
});

Electron主进程中的更改

// Vue组件内请求打开外部链接
if (this.$store.state.openLinksExternally) {
  ipcRenderer.send('open-link-externally', 'https://example.com');
} else {
  window.open('https://example.com');
}

// Electron主进程监听打开链接的请求
ipcMain.on('open-link-externally', (event, url) => {
  shell.openExternal(url);
});

设置页面中的UI更新

在设置页面添加一个开关以让用户可以选择是否希望通过外部浏览器打开链接。

请注意这些示范代码基于对项目结构的假设,实际需要根据项目的实现细节进行调整和完善。

注意:人工智能生成内容仅供参考。

@asyncButNeverAwaits
Copy link
Contributor

If it’s the login link, it must opened through the ChatALL to ensure the chatbot functions properly.

@Ren-Boo
Copy link
Author

Ren-Boo commented Apr 8, 2024

image
我想通过自己的浏览器打开图中这样的链接。
It's OK. I only want to open such a link through my browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants