Files
kiss-translator/src/libs/popupManager.js

27 lines
667 B
JavaScript
Raw Normal View History

2025-10-21 02:07:33 +08:00
import ShadowDomManager from "./shadowDomManager";
2025-10-22 01:50:49 +08:00
import { APP_CONSTS, EVENT_KISS, MSG_POPUP_TOGGLE } from "../config";
2025-10-21 02:07:33 +08:00
import Action from "../views/Action";
export class PopupManager extends ShadowDomManager {
2025-10-22 01:50:49 +08:00
constructor({ translator, processActions }) {
2025-10-21 02:07:33 +08:00
super({
id: APP_CONSTS.popupID,
className: "notranslate",
reactComponent: Action,
2025-10-22 01:50:49 +08:00
props: { translator, processActions },
2025-10-21 02:07:33 +08:00
});
}
2025-10-22 01:50:49 +08:00
toggle(props) {
if (this.isVisible) {
document.dispatchEvent(
new CustomEvent(EVENT_KISS, {
detail: { action: MSG_POPUP_TOGGLE },
})
);
} else {
this.show(props || this._props);
}
}
2025-10-21 02:07:33 +08:00
}