mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 10:24:27 +08:00
fe16633a0c
menus and tooltips are now appended to their own portals. The service are the only responsible for managing the instances, prior to this commit, services could manage one instance, but the DMenu and DTooltip components could also take over which could cause unexpected states. This change also allows nested menus/tooltips. Other notable changes: - few months ago core copied the CloseOnClickOutside modifier of float-kit without removing the float-kit one, this commit now only use the core one. - the close function is now trully async - the close function accepts an instance or an identifier as parameter
19 lines
425 B
Plaintext
19 lines
425 B
Plaintext
import Component from "@glimmer/component";
|
|
import { isTesting } from "discourse-common/config/environment";
|
|
|
|
export default class DFloatPortal extends Component {
|
|
get inline() {
|
|
return this.args.inline ?? isTesting();
|
|
}
|
|
|
|
<template>
|
|
{{#if this.inline}}
|
|
{{yield}}
|
|
{{else}}
|
|
{{#in-element @portalOutletElement insertBefore=null}}
|
|
{{yield}}
|
|
{{/in-element}}
|
|
{{/if}}
|
|
</template>
|
|
}
|