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

[dialogs] Improve display of dialogs #7080

Merged
merged 1 commit into from
Feb 26, 2020
Merged
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
22 changes: 22 additions & 0 deletions packages/core/src/browser/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ import { FrontendApplicationContribution } from './frontend-application';
@injectable()
export class DialogProps {
readonly title: string;
/**
* Determines the maximum width of the dialog in pixels.
* Default value is undefined, which would result in the css property 'max-width: none' being applied to the dialog.
*/
maxWidth?: number;
/**
* Determine the word wrapping behavior for content in the dialog.
* - `normal`: breaks words at allowed break points.
* - `break-word`: breaks otherwise unbreakable words.
* - `initial`: sets the property to it's default value.
* - `inherit`: inherit this property from it's parent element.
* Default value is undefined, which would result in the css property 'word-wrap' not being applied to the dialog.
*/
wordWrap?: 'normal' | 'break-word' | 'initial' | 'inherit';
}

export type DialogMode = 'open' | 'preview';
Expand Down Expand Up @@ -138,6 +152,11 @@ export abstract class AbstractDialog<T> extends BaseWidget {
}));
const container = document.createElement('div');
container.classList.add('dialogBlock');
if (props.maxWidth === undefined) {
container.setAttribute('style', 'max-width: none');
} else {
container.setAttribute('style', `max-width: ${props.maxWidth}px; min-width: 0px`);
}
this.node.appendChild(container);

const titleContentNode = document.createElement('div');
Expand All @@ -156,6 +175,9 @@ export abstract class AbstractDialog<T> extends BaseWidget {

this.contentNode = document.createElement('div');
this.contentNode.classList.add('dialogContent');
if (props.wordWrap !== undefined) {
this.contentNode.setAttribute('style', `word-wrap: ${props.wordWrap}`);
}
container.appendChild(this.contentNode);

this.controlPanel = document.createElement('div');
Expand Down