diff --git a/packages/editor-skeleton/src/components/popup/index.tsx b/packages/editor-skeleton/src/components/popup/index.tsx index d6cdef2ba..194174d4e 100644 --- a/packages/editor-skeleton/src/components/popup/index.tsx +++ b/packages/editor-skeleton/src/components/popup/index.tsx @@ -11,7 +11,10 @@ export class PopupPipe { private currentId?: string; - create(props?: object): { send: (content: ReactNode, title: ReactNode) => void; show: (target: Element) => void } { + create(props?: object): { + send: (content: ReactNode, title: ReactNode) => void; + show: (target: Element) => void; + } { let sendContent: ReactNode = null; let sendTitle: ReactNode = null; const id = uniqueId('popup'); @@ -60,26 +63,30 @@ export class PopupPipe { } } -export default class PopupService extends Component<{ popupPipe?: PopupPipe; actionKey?: string; safeId?: string }> { +export default class PopupService extends Component<{ + popupPipe?: PopupPipe; + actionKey?: string; + safeId?: string; + popupContainer?: string; +}> { private popupPipe = this.props.popupPipe || new PopupPipe(); componentWillUnmount() { this.popupPipe.purge(); } - render() { - const { children, actionKey, safeId } = this.props; + const { children, actionKey, safeId, popupContainer } = this.props; return ( {children} - + ); } } -export class PopupContent extends PureComponent<{ safeId?: string }> { +export class PopupContent extends PureComponent<{ safeId?: string; popupContainer?: string }> { static contextType = PopupContext; popupContainerId = uniqueId('popupContainer'); @@ -143,11 +150,11 @@ export class PopupContent extends PureComponent<{ safeId?: string }> { visible={visible} offset={[offsetX, 0]} hasMask={false} - onVisibleChange={(visible, type) => { + onVisibleChange={(_visible, type) => { if (avoidLaterHidden) { return; } - if (!visible && type === 'closeClick') { + if (!_visible && type === 'closeClick') { this.setState({ visible: false }); } }} @@ -159,10 +166,11 @@ export class PopupContent extends PureComponent<{ safeId?: string }> { id={this.props.safeId} safeNode={id} closeable + container={this.props.popupContainer} >
{title}
- + {content} @@ -170,6 +178,7 @@ export class PopupContent extends PureComponent<{ safeId?: string }> {
+
); }