Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Open
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ PopOut Component has the following props:
```ts
export interface PopoutProps {
hidden?: boolean;
name?: string;
name?: string; // refers to the window.name attribute
title?: string; // refers to the document.title attribute (use this to give your new window's title bar a proper name!)
onClose?: () => void;
onBeforeUnload?: (evt: BeforeUnloadEvent) => string | null | undefined;
children?: any;
Expand Down
5 changes: 5 additions & 0 deletions src/Popout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export class Popout extends React.Component<PopoutProps, {}> {
} else {
this.id = `__${name}_container__`;
this.container = this.initializeChildWindow(this.id, this.child!);
this.child.document.title = getWindowTitle(this.props.title);
}
};

Expand Down Expand Up @@ -306,6 +307,10 @@ function getWindowName(name: string) {
);
}

function getWindowTitle(title?: string) {
return title || '';
}

function forEachStyleElement(
nodeList: NodeList,
callback: (element: HTMLElement, index?: number) => void,
Expand Down
1 change: 1 addition & 0 deletions src/PopoutProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { WindowFeaturesOptions } from './WindowFeaturesOptions';
export interface PopoutProps {
hidden?: boolean;
name?: string;
title?: string;
onClose?: () => void;
onBeforeUnload?: (evt: BeforeUnloadEvent) => string | null | undefined;
onBlocked?: () => void;
Expand Down
1 change: 1 addition & 0 deletions test/MyPopout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default class MyPopout extends React.Component<MyPopoutProps, any> {

return (
<Popout
title={this.props.title}
hidden={this.props.hidden}
html={`<!DOCTYPE html><html dir='ltr'><body class='${
styles.popout
Expand Down