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
|
||||
indent_size = 2
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[{*.json, *.scss}]
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
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 wsPath = window.location.pathname.endsWith('/') ? 'ws' : '/ws';
|
||||
const url = [
|
||||
protocol,
|
||||
window.location.host,
|
||||
window.location.pathname,
|
||||
wsPath,
|
||||
window.location.search,
|
||||
].join('');
|
||||
const url = [protocol, window.location.host, window.location.pathname, wsPath, window.location.search].join('');
|
||||
const termOptions = {
|
||||
fontSize: 13,
|
||||
fontFamily:
|
||||
'Menlo For Powerline,Consolas,Liberation Mono,Menlo,Courier,monospace',
|
||||
fontFamily: 'Menlo For Powerline,Consolas,Liberation Mono,Menlo,Courier,monospace',
|
||||
theme: {
|
||||
foreground: '#d2d2d2',
|
||||
background: '#2b2b2b',
|
||||
|
||||
@@ -125,10 +125,7 @@ export class Xterm extends Component<Props> {
|
||||
});
|
||||
terminal.onData(this.onTerminalData);
|
||||
terminal.onResize(this.onTerminalResize);
|
||||
if (
|
||||
document.queryCommandSupported &&
|
||||
document.queryCommandSupported('copy')
|
||||
) {
|
||||
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
||||
terminal.onSelectionChange(() => {
|
||||
overlayAddon.showOverlay('\u2702', 200);
|
||||
document.execCommand('copy');
|
||||
|
||||
@@ -13,8 +13,7 @@ interface State {
|
||||
modal: boolean;
|
||||
}
|
||||
|
||||
export class ZmodemAddon extends Component<Props, State>
|
||||
implements ITerminalAddon {
|
||||
export class ZmodemAddon extends Component<Props, State> implements ITerminalAddon {
|
||||
private terminal: Terminal | undefined;
|
||||
private sentry: Zmodem.Sentry;
|
||||
private session: Zmodem.Session;
|
||||
@@ -34,12 +33,7 @@ export class ZmodemAddon extends Component<Props, State>
|
||||
return (
|
||||
<Modal show={modal}>
|
||||
<label class="file-label">
|
||||
<input
|
||||
onChange={this.sendFile}
|
||||
class="file-input"
|
||||
type="file"
|
||||
multiple
|
||||
/>
|
||||
<input onChange={this.sendFile} class="file-input" type="file" multiple />
|
||||
<span class="file-cta">
|
||||
<strong>Choose files…</strong>
|
||||
</span>
|
||||
@@ -143,9 +137,7 @@ export class ZmodemAddon extends Component<Props, State>
|
||||
const offset = xfer.get_offset();
|
||||
const percent = ((100 * offset) / size).toFixed(2);
|
||||
|
||||
terminal.write(
|
||||
`${name} ${percent}% ${bytesHuman(offset, 2)}/${bytesHuman(size, 2)}\r`
|
||||
);
|
||||
terminal.write(`${name} ${percent}% ${bytesHuman(offset, 2)}/${bytesHuman(size, 2)}\r`);
|
||||
}
|
||||
|
||||
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