Skip to content

Commit

Permalink
primefaces#4602: Add NONCE to inline style
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jul 13, 2023
1 parent 2f479cd commit eb4c1ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/lib/hooks/useStyle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from 'react';
import { useContext, useEffect, useRef, useState } from 'react';
import PrimeReact, { PrimeReactContext } from '../api/Api';
import { DomHandler } from '../utils/Utils';

Expand All @@ -7,7 +7,7 @@ let _id = 0;
export const useStyle = (css, options = {}) => {
const [isLoaded, setIsLoaded] = useState(false);
const styleRef = useRef(null);
const context = React.useContext(PrimeReactContext);
const context = useContext(PrimeReactContext);

const defaultDocument = DomHandler.isClient() ? window.document : undefined;
const { document = defaultDocument, immediate = true, manual = false, name = `style_${++_id}`, id = undefined, media = undefined } = options;
Expand Down
4 changes: 2 additions & 2 deletions components/lib/utils/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export declare class DomHandler {
static applyStyle(el: HTMLElement, style: any): void;
static exportCSV(csv: any, filename: string): void;
static saveAs(file: { name: string; url: any }): boolean;
static createInlineStyle(nonce: string): HTMLElement;
static removeInlineStyle(styleElement: HTMLElement): HTMLElement | null;
static createInlineStyle(nonce?: string): HTMLStyleElement;
static removeInlineStyle(styleElement: HTMLStyleElement): HTMLStyleElement | null;
static getTargetElement(target: any): HTMLElement | null;
}

Expand Down

0 comments on commit eb4c1ae

Please sign in to comment.