replace getElementById for querySelector in widgets
This commit is contained in:
parent
12002ece0c
commit
2d4510d320
@ -14,7 +14,7 @@ interface Props {
|
|||||||
export default function OpenQuizButton({ selector, quizId, fixedSide }: Props) {
|
export default function OpenQuizButton({ selector, quizId, fixedSide }: Props) {
|
||||||
const [isQuizDialogOpen, setIsQuizDialogOpen] = useState<boolean>(false);
|
const [isQuizDialogOpen, setIsQuizDialogOpen] = useState<boolean>(false);
|
||||||
|
|
||||||
const portalContainer = !fixedSide && selector ? document.getElementById(selector)! : document.body;
|
const portalContainer = !fixedSide && selector ? document.querySelector(selector)! : document.body;
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<ThemeProvider theme={lightTheme}>
|
<ThemeProvider theme={lightTheme}>
|
||||||
|
@ -9,7 +9,7 @@ export class ContainerWidget {
|
|||||||
quizId: string;
|
quizId: string;
|
||||||
selector: string;
|
selector: string;
|
||||||
}) {
|
}) {
|
||||||
const element = document.getElementById(selector);
|
const element = document.querySelector(selector);
|
||||||
if (!element) throw new Error("Element for widget doesn't exist");
|
if (!element) throw new Error("Element for widget doesn't exist");
|
||||||
|
|
||||||
this.root = createRoot(element);
|
this.root = createRoot(element);
|
||||||
|
Loading…
Reference in New Issue
Block a user