Commit 3964313a authored by Medicean's avatar Medicean

浏览网站自定义URL

parent 176014e4
......@@ -24,6 +24,12 @@
* 虚拟终端界面下使用 `Ctrl` + `=`(和`+`在一起的那个键) 可放大, `Ctrl` + `-` 可缩小
#### 浏览网站
* 新增了地址栏, 面对需要先进入登录页面的 Shell, 可先在此处访问 login 页面,然后保存 Cookie 到 Shell 配置。 默认为 Shell 的 URL
* 调整了工具栏按钮的排列
* 关闭了默认自动打开 URL,需要手动点击「浏览」按钮
### Bug Fix
* 修正 windows 客户端下用户编码器路径解析错误的问题
......
......@@ -41,7 +41,7 @@ class ViewSite {
}, 1000);
// 打开浏览窗口
this._loadURL(opts.url);
// this._loadURL(opts.url);
}
/**
......@@ -51,9 +51,10 @@ class ViewSite {
_initToolbar() {
const toolbar = this.cell.attachToolbar();
toolbar.loadStruct([
{ id: 'save', type: 'button', icon: 'save', text: LANG['toolbar'].save },
{ type: 'separator' },
{ id: 'url', width: 400, type: 'buttonInput', value: this.opts.url || 'loading..' },
{ id: 'view', type: 'button', icon: 'chrome', text: LANG['toolbar'].view },
{ type: 'separator' },
{ id: 'save', type: 'button', icon: 'save', text: LANG['toolbar'].save },
]);
toolbar.attachEvent('onClick', (id) => {
switch(id) {
......@@ -61,9 +62,18 @@ class ViewSite {
this._saveCookie();
break;
case 'view':
this._loadURL(this.opts.url);
let url = toolbar.getInput('url').value;
this._loadURL(url);
}
})
});
toolbar.attachEvent('onEnter', (id, value) => {
switch(id) {
case 'url':
let url = toolbar.getInput('url').value;
this._loadURL(url);
break;
}
});
return toolbar;
}
......@@ -159,7 +169,7 @@ class ViewSite {
webPreferences: {
nodeIntegration: false,
},
title: this.opts.url
title: url
});
win.loadURL(url);
win.show();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment