fix: improve handling of config and rte plugin

This commit is contained in:
Michael Zetterberg
2024-03-26 14:40:24 +01:00
parent 8cad5ea290
commit 7c6dda1781
3 changed files with 20 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import { useEffect, useState } from "react"
export class SDKLoadingError extends Error {}
export default function useApp() {
const modalElementId = "field"
const [, setError] = useState()
const [sdk, setSdk] = useState<UiLocation>()
const [config, setConfig] = useState<Record<string, string>>()
@@ -19,7 +20,7 @@ export default function useApp() {
const config = await initSdk.getConfig()
setConfig(config)
const iframeWrapperRef = document.getElementById("field")
const iframeWrapperRef = document.getElementById(modalElementId)
window.iframeRef = iframeWrapperRef
window.postRobot = initSdk.postRobot
} catch (e) {
@@ -42,5 +43,6 @@ export default function useApp() {
return {
sdk,
config,
modalElementId,
}
}