Fixed too early initialize

canary
WolverinDEV 2020-12-21 20:24:00 +01:00
parent 68388f693a
commit 65406447f5
1 changed files with 20 additions and 7 deletions

View File

@ -1,16 +1,29 @@
import * as loader from "tc-loader";
import {Stage} from "tc-loader";
import * as React from "react";
import {Context} from "react";
import TextRenderer from "vendor/xbbcode/renderer/text"; import TextRenderer from "vendor/xbbcode/renderer/text";
import ReactRenderer from "vendor/xbbcode/renderer/react"; import ReactRenderer from "vendor/xbbcode/renderer/react";
import HTMLRenderer from "vendor/xbbcode/renderer/html"; import HTMLRenderer from "vendor/xbbcode/renderer/html";
export const BBCodeHandlerContext = React.createContext<string>(undefined);
export const rendererText = new TextRenderer();
export const rendererReact = new ReactRenderer();
export const rendererHTML = new HTMLRenderer(rendererReact);
import "./emoji"; import "./emoji";
import "./highlight"; import "./highlight";
import "./youtube"; import "./youtube";
import "./url"; import "./url";
import "./image"; import "./image";
import * as React from "react";
export let BBCodeHandlerContext: Context<string>;
export const rendererText = new TextRenderer();
export const rendererReact = new ReactRenderer();
export const rendererHTML = new HTMLRenderer(rendererReact);
loader.register_task(Stage.JAVASCRIPT_INITIALIZING, {
name: "BBCode handler context",
function: async () => {
BBCodeHandlerContext = React.createContext<string>(undefined);
},
priority: 80
})