Skip to content

Commit

Permalink
Fix for copy-paste on mac, width of url attribute in http panel
Browse files Browse the repository at this point in the history
  • Loading branch information
eatonphil committed Jul 1, 2021
1 parent 298b34c commit d80aa88
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
24 changes: 24 additions & 0 deletions desktop/app.ts
Expand Up @@ -52,6 +52,30 @@ const menuTemplate = (win: BrowserWindow) => [
},
],
},
...(process.platform === 'darwin'
? [
{
label: 'Edit',
submenu: [
{ label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' },
{
label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z',
selector: 'redo:',
},
{ type: 'separator' },
{ label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:' },
{ label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' },
{ label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' },
{
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
selector: 'selectAll:',
},
],
},
]
: []),
...(DEBUG
? [
{
Expand Down
2 changes: 2 additions & 0 deletions ui/HTTPPanel.tsx
Expand Up @@ -64,6 +64,8 @@ export function HTTPPanelDetails({
panel.http.http.url = value;
updatePanel(panel);
}}
type="url"
autoWidth={true}
/>
</div>
<div className="form-row">
Expand Down
3 changes: 1 addition & 2 deletions ui/Panel.tsx
Expand Up @@ -465,8 +465,7 @@ export function Panel({
{panel.type === 'http' && (
<div className="alert alert-info">
Use the textarea to supply a HTTP request body. This will be
ignored for <code>GET</code> and
<code>HEAD</code> requests.
ignored for <code>GET</code> and <code>HEAD</code> requests.
</div>
)}
</div>
Expand Down
5 changes: 4 additions & 1 deletion ui/component-library/Input.tsx
Expand Up @@ -11,8 +11,9 @@ export function Input({
label,
disabled,
readOnly,
autoWidth,
}: {
type?: 'text' | 'number' | 'email' | 'password';
type?: 'text' | 'number' | 'email' | 'password' | 'url';
placeholder?: string;
className?: string;
onChange: (value: string) => void;
Expand All @@ -22,6 +23,7 @@ export function Input({
label?: string;
disabled?: boolean;
readOnly?: boolean;
autoWidth?: boolean;
}) {
let inputClass = `input ${className ? ' ' + className : ''}`;

Expand All @@ -38,6 +40,7 @@ export function Input({
min={min}
max={max}
placeholder={placeholder}
size={autoWidth ? Math.min(100, value.length) : undefined}
/>
);

Expand Down
7 changes: 7 additions & 0 deletions ui/style.css
Expand Up @@ -294,6 +294,13 @@ header > div {
margin-top: 15px;
}

.panel-details label.select select,
.panel-details select.select,
.panel-details label.input input,
.panel-details input.input {
max-width: 100%;
}

.panel-body-container {
overflow: auto;
resize: vertical;
Expand Down

0 comments on commit d80aa88

Please sign in to comment.