1
0
Fork 0
forked from Mirrors/gomuks

web/main: use insertion effect for style injection

This commit is contained in:
Tulir Asokan 2024-11-08 15:27:23 +01:00
parent 0da7ed172d
commit c6992b0fca

View file

@ -13,7 +13,7 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import { use, useEffect, useMemo, useReducer, useState } from "react" import { use, useEffect, useInsertionEffect, useMemo, useReducer, useState } from "react"
import Client from "@/api/client.ts" import Client from "@/api/client.ts"
import { RoomStateStore } from "@/api/statestore" import { RoomStateStore } from "@/api/statestore"
import type { RoomID } from "@/api/types" import type { RoomID } from "@/api/types"
@ -93,7 +93,7 @@ const MainScreen = () => {
[client], [client],
) )
useEffect(() => context.keybindings.listen(), [context]) useEffect(() => context.keybindings.listen(), [context])
useEffect(() => { useInsertionEffect(() => {
const styleTags = document.createElement("style") const styleTags = document.createElement("style")
styleTags.textContent = ` styleTags.textContent = `
div.html-body > a.hicli-matrix-uri-user[href="matrix:u/${client.userID.slice(1).replaceAll(`"`, `\\"`)}"] { div.html-body > a.hicli-matrix-uri-user[href="matrix:u/${client.userID.slice(1).replaceAll(`"`, `\\"`)}"] {