-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9988 from keymanapp/refactor/web/inactive-banner-…
…management refactor(web): inactive banner management 🎏
- Loading branch information
Showing
9 changed files
with
115 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Banner } from "./banner.js"; | ||
|
||
export class HTMLBanner extends Banner { | ||
readonly container: ShadowRoot | HTMLElement; | ||
readonly type = 'html'; | ||
|
||
constructor(contents?: string) { | ||
super(); | ||
|
||
const bannerHost = this.getDiv(); | ||
|
||
// Ensure any HTML styling applied for the banner contents only apply to the contents, | ||
// and not the banner's `position: 'relative'` hosting element. | ||
const div = document.createElement('div'); | ||
div.style.userSelect = 'none'; | ||
div.style.height = '100%'; | ||
div.style.width = '100%'; | ||
bannerHost.appendChild(div); | ||
|
||
// If possible, quarantine styling and JS for the banner contents within Shadow DOM. | ||
this.container = (div.attachShadow) ? div.attachShadow({mode: 'closed'}) : div; | ||
this.container.innerHTML = contents; | ||
} | ||
|
||
get innerHTML() { | ||
return this.container.innerHTML; | ||
} | ||
|
||
set innerHTML(raw: string) { | ||
this.container.innerHTML = raw; | ||
} | ||
} |
Oops, something went wrong.