cooronx commented on code in PR #466:
URL: https://github.com/apache/casbin-website/pull/466#discussion_r3073136692
##########
src/pages/editor.js:
##########
@@ -1,56 +1,28 @@
-import React, {useEffect, useState} from "react";
+import React, {useEffect} from "react";
+import Head from "@docusaurus/Head";
import Layout from "@theme/Layout";
-import Giscus from "@giscus/react";
-import {useColorMode} from "@docusaurus/theme-common";
-import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
+import Link from "@docusaurus/Link";
-function EditorContent() {
- const {colorMode} = useColorMode();
- const {i18n} = useDocusaurusContext();
- const currentLanguage = i18n.currentLocale;
- const [editorUrl, setEditorUrl] = useState("");
+const EDITOR_URL = "https://editor.casbin.org/";
+function Editor() {
useEffect(() => {
-
setEditorUrl(`https://editor.casbin.org/?theme=${colorMode}&lang=${currentLanguage}`);
- }, [colorMode, currentLanguage]);
-
- return (
- <>
- <div className="editor-container">
- <iframe
- src={editorUrl}
- className="editor-iframe"
- title="Apache Casbin Editor"
- />
- </div>
- <div className="comments-container">
- <Giscus
- id="comments"
- repo="casbin/casbin"
- repoId="MDEwOlJlcG9zaXRvcnk4NzYxNzUwOA=="
- category="Docs comments"
- categoryId="DIC_kwDOBTjv5M4CRIiA"
- mapping="pathname"
- strict="0"
- reactionsEnabled="1"
- emitMetadata="0"
- inputPosition="top"
- theme={colorMode}
- lang="en"
- loading="lazy"
- />
- </div>
- </>
- );
-}
+ window.location.replace(EDITOR_URL);
+ }, []);
Review Comment:
now we open a new tab, i don't think this is needed for simplicity
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]