mirror of
https://github.com/tsl0922/ttyd.git
synced 2025-12-21 19:34:19 +01:00
html: reformat code
This commit is contained in:
@@ -2,10 +2,13 @@ root = true
|
|||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
indent_style = space
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[{*.json, *.scss}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|||||||
6
html/prettier.config.js
Normal file
6
html/prettier.config.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
trailingComma: "es5",
|
||||||
|
tabWidth: 4,
|
||||||
|
printWidth: 120,
|
||||||
|
singleQuote: true,
|
||||||
|
};
|
||||||
@@ -10,17 +10,10 @@ if ((module as any).hot) {
|
|||||||
|
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
||||||
const wsPath = window.location.pathname.endsWith('/') ? 'ws' : '/ws';
|
const wsPath = window.location.pathname.endsWith('/') ? 'ws' : '/ws';
|
||||||
const url = [
|
const url = [protocol, window.location.host, window.location.pathname, wsPath, window.location.search].join('');
|
||||||
protocol,
|
|
||||||
window.location.host,
|
|
||||||
window.location.pathname,
|
|
||||||
wsPath,
|
|
||||||
window.location.search,
|
|
||||||
].join('');
|
|
||||||
const termOptions = {
|
const termOptions = {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily:
|
fontFamily: 'Menlo For Powerline,Consolas,Liberation Mono,Menlo,Courier,monospace',
|
||||||
'Menlo For Powerline,Consolas,Liberation Mono,Menlo,Courier,monospace',
|
|
||||||
theme: {
|
theme: {
|
||||||
foreground: '#d2d2d2',
|
foreground: '#d2d2d2',
|
||||||
background: '#2b2b2b',
|
background: '#2b2b2b',
|
||||||
|
|||||||
@@ -125,10 +125,7 @@ export class Xterm extends Component<Props> {
|
|||||||
});
|
});
|
||||||
terminal.onData(this.onTerminalData);
|
terminal.onData(this.onTerminalData);
|
||||||
terminal.onResize(this.onTerminalResize);
|
terminal.onResize(this.onTerminalResize);
|
||||||
if (
|
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
||||||
document.queryCommandSupported &&
|
|
||||||
document.queryCommandSupported('copy')
|
|
||||||
) {
|
|
||||||
terminal.onSelectionChange(() => {
|
terminal.onSelectionChange(() => {
|
||||||
overlayAddon.showOverlay('\u2702', 200);
|
overlayAddon.showOverlay('\u2702', 200);
|
||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ interface State {
|
|||||||
modal: boolean;
|
modal: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ZmodemAddon extends Component<Props, State>
|
export class ZmodemAddon extends Component<Props, State> implements ITerminalAddon {
|
||||||
implements ITerminalAddon {
|
|
||||||
private terminal: Terminal | undefined;
|
private terminal: Terminal | undefined;
|
||||||
private sentry: Zmodem.Sentry;
|
private sentry: Zmodem.Sentry;
|
||||||
private session: Zmodem.Session;
|
private session: Zmodem.Session;
|
||||||
@@ -34,12 +33,7 @@ export class ZmodemAddon extends Component<Props, State>
|
|||||||
return (
|
return (
|
||||||
<Modal show={modal}>
|
<Modal show={modal}>
|
||||||
<label class="file-label">
|
<label class="file-label">
|
||||||
<input
|
<input onChange={this.sendFile} class="file-input" type="file" multiple />
|
||||||
onChange={this.sendFile}
|
|
||||||
class="file-input"
|
|
||||||
type="file"
|
|
||||||
multiple
|
|
||||||
/>
|
|
||||||
<span class="file-cta">
|
<span class="file-cta">
|
||||||
<strong>Choose files…</strong>
|
<strong>Choose files…</strong>
|
||||||
</span>
|
</span>
|
||||||
@@ -143,9 +137,7 @@ export class ZmodemAddon extends Component<Props, State>
|
|||||||
const offset = xfer.get_offset();
|
const offset = xfer.get_offset();
|
||||||
const percent = ((100 * offset) / size).toFixed(2);
|
const percent = ((100 * offset) / size).toFixed(2);
|
||||||
|
|
||||||
terminal.write(
|
terminal.write(`${name} ${percent}% ${bytesHuman(offset, 2)}/${bytesHuman(size, 2)}\r`);
|
||||||
`${name} ${percent}% ${bytesHuman(offset, 2)}/${bytesHuman(size, 2)}\r`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bytesHuman(bytes: any, precision: number): string {
|
private bytesHuman(bytes: any, precision: number): string {
|
||||||
|
|||||||
2
src/index.html
vendored
2
src/index.html
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user