Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialog: adding maxWidth to SingleTextInputDialog #12642

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`);
msujew marked this conversation as resolved.
Show resolved Hide resolved
}
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
Loading