mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 10:13:31 +00:00
[PM-17407] [CL-665] Remove jQuery and Popper.js (#14621)
Now that the last usages of ModalService is removed from the web portions we can finally remove jQuery and Popper.js. This PR also removes bootstrap js imports since it would drag in jQuery as a peer dependency. Note: Both dependencies still exists in the lockfile as they are peer dependencies of boostrap.
This commit is contained in:
@@ -26,7 +26,6 @@ import {
|
||||
WINDOW,
|
||||
} from "@bitwarden/angular/services/injection-tokens";
|
||||
import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.module";
|
||||
import { ModalService as ModalServiceAbstraction } from "@bitwarden/angular/services/modal.service";
|
||||
import {
|
||||
RegistrationFinishService as RegistrationFinishServiceAbstraction,
|
||||
LoginComponentService,
|
||||
@@ -136,7 +135,6 @@ import { WebStorageServiceProvider } from "../platform/web-storage-service.provi
|
||||
import { EventService } from "./event.service";
|
||||
import { InitService } from "./init.service";
|
||||
import { ENV_URLS } from "./injection-tokens";
|
||||
import { ModalService } from "./modal.service";
|
||||
import { RouterService } from "./router.service";
|
||||
import { WebPlatformUtilsService } from "./web-platform-utils.service";
|
||||
|
||||
@@ -195,11 +193,6 @@ const safeProviders: SafeProvider[] = [
|
||||
useClass: WebPlatformUtilsService,
|
||||
useAngularDecorators: true,
|
||||
}),
|
||||
safeProvider({
|
||||
provide: ModalServiceAbstraction,
|
||||
useClass: ModalService,
|
||||
useAngularDecorators: true,
|
||||
}),
|
||||
safeProvider({
|
||||
provide: FileDownloadService,
|
||||
useClass: WebFileDownloadService,
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
import { Injectable, Injector } from "@angular/core";
|
||||
import * as jq from "jquery";
|
||||
import { first } from "rxjs/operators";
|
||||
|
||||
import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref";
|
||||
import { ModalService as BaseModalService } from "@bitwarden/angular/services/modal.service";
|
||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
|
||||
@Injectable()
|
||||
export class ModalService extends BaseModalService {
|
||||
el: any = null;
|
||||
modalOpen = false;
|
||||
|
||||
constructor(
|
||||
injector: Injector,
|
||||
private messagingService: MessagingService,
|
||||
) {
|
||||
super(injector);
|
||||
}
|
||||
|
||||
protected setupHandlers(modalRef: ModalRef) {
|
||||
modalRef.onCreated.pipe(first()).subscribe(() => {
|
||||
const modals = Array.from(document.querySelectorAll(".modal"));
|
||||
if (modals.length > 0) {
|
||||
this.el = jq(modals[0]);
|
||||
this.el.modal("show");
|
||||
|
||||
this.el.on("show.bs.modal", () => {
|
||||
modalRef.show();
|
||||
this.messagingService.send("modalShow");
|
||||
});
|
||||
this.el.on("shown.bs.modal", () => {
|
||||
modalRef.shown();
|
||||
this.messagingService.send("modalShown");
|
||||
if (!Utils.isMobileBrowser) {
|
||||
this.el.find("*[appAutoFocus]").focus();
|
||||
}
|
||||
});
|
||||
this.el.on("hide.bs.modal", () => {
|
||||
this.messagingService.send("modalClose");
|
||||
});
|
||||
this.el.on("hidden.bs.modal", () => {
|
||||
modalRef.closed();
|
||||
this.messagingService.send("modalClosed");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
modalRef.onClose.pipe(first()).subscribe(() => {
|
||||
if (this.el != null) {
|
||||
this.el.modal("hide");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user