Skip to content

Commit

Permalink
dialog: add maxWidth attribute (#12642)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladarama authored Jul 5, 2023
1 parent 70ad9fd commit becfd76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/browser/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ export abstract class AbstractDialog<T> extends BaseWidget {
container.classList.add('dialogBlock');
if (props.maxWidth === undefined) {
container.setAttribute('style', 'max-width: none');
} else {
} else if (props.maxWidth < 400) {
container.setAttribute('style', `max-width: ${props.maxWidth}px; min-width: 0px`);
} else {
container.setAttribute('style', `max-width: ${props.maxWidth}px`);
}
this.node.appendChild(container);

Expand Down
1 change: 1 addition & 0 deletions packages/keymaps/src/browser/keybindings-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ export class KeybindingWidget extends ReactWidget implements StatefulWidget {
const oldKeybinding = item.keybinding;
const dialog = new EditKeybindingDialog({
title: nls.localize('theia/keymaps/editKeybindingTitle', 'Edit Keybinding for {0}', command),
maxWidth: 400,
initialValue: oldKeybinding?.keybinding,
validate: newKeybinding => this.validateKeybinding(command, oldKeybinding?.keybinding, newKeybinding),
}, this.keymapsService, item);
Expand Down
3 changes: 3 additions & 0 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export class WorkspaceCommandContribution implements CommandContribution {

const dialog = new WorkspaceInputDialog({
title: nls.localizeByDefault('New File...'),
maxWidth: 400,
parentUri: parentUri,
initialValue: vacantChildUri.path.base,
placeholder: nls.localize('theia/workspace/newFilePlaceholder', 'File Name'),
Expand All @@ -260,6 +261,7 @@ export class WorkspaceCommandContribution implements CommandContribution {
const vacantChildUri = FileSystemUtils.generateUniqueResourceURI(parent, targetUri, true);
const dialog = new WorkspaceInputDialog({
title: nls.localizeByDefault('New Folder...'),
maxWidth: 400,
parentUri: parentUri,
initialValue: vacantChildUri.path.base,
placeholder: nls.localize('theia/workspace/newFolderPlaceholder', 'Folder Name'),
Expand All @@ -285,6 +287,7 @@ export class WorkspaceCommandContribution implements CommandContribution {
const oldName = uri.path.base;
const dialog = new SingleTextInputDialog({
title: nls.localizeByDefault('Rename'),
maxWidth: 400,
initialValue: oldName,
initialSelectionRange: {
start: 0,
Expand Down

0 comments on commit becfd76

Please sign in to comment.