Skip to content

Commit e4ba5d7

Browse files
committed
upd
1 parent fcf9225 commit e4ba5d7

File tree

8 files changed

+438
-410
lines changed

8 files changed

+438
-410
lines changed

src/web/settings.h

Lines changed: 395 additions & 393 deletions
Large diffs are not rendered by default.

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "settings",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"main": "index.js",
55
"scripts": {
66
"build": "webpack --config ./webpack.single.js & webpack --config ./webpack.index.js",

web/src/script/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export default class Settings {
196196
});
197197

198198
this.$main_col.addEventListener("widget_event", async (e) => {
199-
let res;
199+
let res = null;
200200
switch (e.data.action) {
201201
case 'click': res = await this.send('click', e.data.id); break;
202202
case 'set': res = await this.send('set', e.data.id, e.data.value); break;

web/src/script/ui/dialog.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@
4646

4747
.dialog textarea {
4848
display: block;
49+
max-height: 350px;
4950
width: 100%;
5051
box-sizing: border-box;
5152
margin-top: 10px;
5253
resize: none;
53-
overflow: hidden;
54+
overflow-y: scroll;
5455
background: var(--back);
5556
color: var(--font);
5657
border: none;
@@ -60,4 +61,18 @@
6061
line-height: 16px;
6162
min-height: 27px;
6263
border-radius: 4px;
64+
}
65+
66+
.dialog textarea::-webkit-scrollbar {
67+
width: 7px;
68+
height: 7px;
69+
}
70+
71+
.dialog textarea::-webkit-scrollbar-track {
72+
display: none;
73+
}
74+
75+
.dialog textarea::-webkit-scrollbar-thumb {
76+
background: var(--dark);
77+
border-radius: 4px;
6378
}

web/src/script/ui/dialog.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class DialogCont {
1818
}
1919
}
2020

21-
export function BaseDialog(label, content, actionOK, actionCancel) {
21+
export function BaseDialog(label, content, actionOK, actionCancel, postRender = null) {
2222
let dialog = new DialogCont();
2323

2424
Component.config(dialog.$root, {
@@ -71,19 +71,23 @@ export function BaseDialog(label, content, actionOK, actionCancel) {
7171
}
7272
}
7373
});
74+
if (postRender) postRender();
7475
}
7576

7677
export function AsyncPrompt(label, value) {
7778
return new Promise(resolve => {
7879
let area = Component.make('textarea', {
7980
text: value,
81+
rows: 1,
8082
events: {
8183
input: () => area.style.height = area.scrollHeight + "px",
8284
}
8385
});
84-
area.style.height = area.scrollHeight + "px";
85-
BaseDialog(label, area, () => resolve(area.value), () => resolve(null));
86-
setTimeout(() => area.focus(), 10);
86+
87+
BaseDialog(label, area, () => resolve(area.value), () => resolve(null), () => {
88+
area.focus();
89+
area.style.height = area.scrollHeight + "px";
90+
});
8791
});
8892
}
8993

web/src/script/widgets/input.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ import { AsyncPrompt } from "../ui/dialog";
44

55
export default class InputWidget extends WidgetBase {
66
empty = false;
7+
text = "";
8+
79
constructor(data) {
810
super(data);
911

1012
super.addOutput(Component.make('span', {
1113
context: this,
1214
class: 'value active',
13-
var: 'input',
15+
var: 'out',
1416
events: {
1517
click: async () => {
16-
let res = await AsyncPrompt(data.label, this.empty ? '' : this.$input.innerText);
17-
if (res != null) {
18-
this.sendEvent(res);
18+
let res = await AsyncPrompt(data.label, this.text);
19+
if (res !== null) {
20+
this.sendEvent(encodeURI(res));
1921
this.update(res);
2022
}
2123
}
@@ -26,8 +28,13 @@ export default class InputWidget extends WidgetBase {
2628
}
2729

2830
update(value) {
29-
value = value ? value.toString() : '';
30-
this.empty = (value.length == 0);
31-
this.$input.innerText = this.empty ? '...' : value;
31+
this.text = value ? value.toString() : '';
32+
let disp = '...';
33+
if (this.text.length) {
34+
let lines = this.text.split('\n');
35+
disp = lines[0];
36+
if (lines.length > 1) disp += '...';
37+
}
38+
this.$out.innerText = disp;
3239
}
3340
}

web/src/script/widgets/pass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import InputWidget from "./input";
33
export default class PassWidget extends InputWidget {
44
constructor(data) {
55
super(data);
6-
this.$input.style.filter = 'blur(4px)';
6+
this.$out.style.filter = 'blur(4px)';
77
}
88
}

web/src/script/widgets/select.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.select {
2-
max-height: 400px;
2+
max-height: 350px;
33
overflow-y: scroll;
44
padding: 0;
55
}
@@ -17,7 +17,7 @@
1717
}
1818

1919
.option {
20-
font-size: 20px;
20+
font-size: 19px;
2121
padding: 6px 8px;
2222
}
2323

0 commit comments

Comments
 (0)