DEV: allows for multiple menus/tooltips (#26823)

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
This commit is contained in:
Joffrey JAFFEUX
2024-05-07 23:48:44 +02:00
committed by GitHub
parent 95302cc7ed
commit fe16633a0c
38 changed files with 544 additions and 435 deletions

View File

@ -361,7 +361,7 @@ export default {
},
]);
return tooltip.close();
return tooltip.close("local-date");
}
if (!event?.target?.classList?.contains("discourse-local-date")) {
@ -370,6 +370,7 @@ export default {
const siteSettings = this.container.lookup("service:site-settings");
return tooltip.show(event.target, {
identifier: "local-date",
content: htmlSafe(buildHtmlPreview(event.target, siteSettings)),
});
},