@paperbits/styles
Advanced tools
Comparing version 0.1.576 to 0.1.577
{ | ||
"name": "@paperbits/styles", | ||
"version": "0.1.576", | ||
"version": "0.1.577", | ||
"description": "Paperbits style editors.", | ||
@@ -19,3 +19,3 @@ "author": "Paperbits", | ||
"dependencies": { | ||
"@paperbits/common": "0.1.576", | ||
"@paperbits/common": "0.1.577", | ||
"@simonwep/pickr": "^1.7.4", | ||
@@ -22,0 +22,0 @@ "jss": "^10.4.0", |
@@ -0,2 +1,4 @@ | ||
import * as Utils from "@paperbits/common"; | ||
import { MimeTypes } from "@paperbits/common"; | ||
import { ISettingsProvider } from "@paperbits/common/configuration"; | ||
import { Attributes } from "@paperbits/common/html"; | ||
@@ -14,7 +16,17 @@ import { IBlobStorage } from "@paperbits/common/persistence"; | ||
private localStyleBuilder: StyleBuilder; | ||
private subresourceIntegrityEnabled: boolean; | ||
constructor(outputBlobStorage: IBlobStorage) { | ||
constructor( | ||
private readonly settingsProvider: ISettingsProvider, | ||
outputBlobStorage: IBlobStorage | ||
) { | ||
this.localStyleBuilder = new StyleBuilder(outputBlobStorage); | ||
} | ||
private initialize = Utils.debounce(this.loadSettings.bind(this)); | ||
private async loadSettings(): Promise<void> { | ||
this.subresourceIntegrityEnabled = !!await this.settingsProvider.getSetting<boolean>("features/subresourceIntegrity"); | ||
} | ||
private appendStyleLink(document: Document, href: string, integrity: string): void { | ||
@@ -24,3 +36,3 @@ const element: HTMLStyleElement = document.createElement("link"); | ||
if (integrity) { | ||
if (this.subresourceIntegrityEnabled && integrity) { | ||
element.setAttribute(Attributes.Integrity, integrity); | ||
@@ -36,2 +48,4 @@ } | ||
public async apply(document: Document, page: HtmlPage): Promise<void> { | ||
await this.initialize(); | ||
const styleManager: StyleManager = page.bindingContext?.styleManager; | ||
@@ -38,0 +52,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
416108
7827
+ Added@paperbits/common@0.1.577(transitive)
- Removed@paperbits/common@0.1.576(transitive)
Updated@paperbits/common@0.1.577