mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 02:34:05 +08:00
`discourse-common` was created in the past to share logic between the 'wizard' app and the main 'discourse' app. Since then, the wizard has been consolidated into the main app, so the separation of `discourse-common` is no longer useful. This commit moves `discourse-common/(lib|utils)/*` into `discourse/lib/*`, adds shims for the imports, and updates existing uses in core.
38 lines
866 B
Text
Vendored
38 lines
866 B
Text
Vendored
import Component from "@glimmer/component";
|
|
import { service } from "@ember/service";
|
|
import { modifier } from "ember-modifier";
|
|
import deprecated from "discourse/lib/deprecated";
|
|
|
|
export default class DPopover extends Component {
|
|
@service tooltip;
|
|
|
|
registerDTooltip = modifier((element) => {
|
|
deprecated(
|
|
"`<DPopover />` is deprecated. Use `<DTooltip />` or the `tooltip` service instead.",
|
|
{ id: "discourse.d-popover" }
|
|
);
|
|
|
|
const trigger = element.children[0];
|
|
const content = element.children[1];
|
|
|
|
if (!trigger || !content) {
|
|
return;
|
|
}
|
|
|
|
const instance = this.tooltip.register(trigger, {
|
|
content,
|
|
});
|
|
|
|
content.remove();
|
|
|
|
return () => {
|
|
instance.destroy();
|
|
};
|
|
});
|
|
|
|
<template>
|
|
<div style="display:inline-flex;" {{this.registerDTooltip}}>
|
|
{{yield}}
|
|
</div>
|
|
</template>
|
|
}
|