Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cleanup]: Remove useMonaco hook #50

Merged
merged 4 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import React, { useState, useEffect } from "react";
import React, { useState } from "react";

import { useColorMode } from "@docusaurus/theme-common";
import Editor, { useMonaco } from "@monaco-editor/react";
import Editor, { Monaco } from "@monaco-editor/react";

import styles from "./styles.module.css";

Expand All @@ -20,19 +20,9 @@ interface Props {

function VSCode({ value, language, onChange }: Props) {
const [focused, setFocused] = useState(false);
const monaco = useMonaco();
const { isDarkTheme } = useColorMode();

useEffect(() => {
// do conditional chaining
monaco?.languages.typescript.javascriptDefaults.setEagerModelSync(true);
// or make sure that it exists by other ways
if (monaco) {
console.log("here is the monaco instance:", monaco);
}
}, [monaco]);

function handleEditorWillMount(monaco: any) {
function handleEditorWillMount(monaco: Monaco) {
const styles = getComputedStyle(document.documentElement);

function getColor(property: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
:root {
--openapi-required: var(--ifm-color-danger);
}

.apiItemContainer article > *:first-child,
.apiItemContainer header + * {
margin-top: 0;
Expand Down