fix: position of copy button support javascript syntax
This commit is contained in:
parent
9ed42672e7
commit
359119e7c2
@ -11,6 +11,7 @@ import {
|
||||
} from "@codemirror/commands";
|
||||
import { bracketMatching } from "@codemirror/language";
|
||||
import { html } from "@codemirror/lang-html";
|
||||
import { javascript } from "@codemirror/lang-javascript";
|
||||
import { EditorTheme } from "@/types";
|
||||
import { FaCopy } from "react-icons/fa";
|
||||
|
||||
@ -35,6 +36,7 @@ function CodeMirror({ code, editorTheme, onCodeChange, doCopyCode }: Props) {
|
||||
]),
|
||||
lineNumbers(),
|
||||
bracketMatching(),
|
||||
javascript(), // Added JavaScript support
|
||||
html(),
|
||||
editorTheme === EditorTheme.ESPRESSO ? espresso : cobalt,
|
||||
EditorView.lineWrapping,
|
||||
@ -73,7 +75,7 @@ function CodeMirror({ code, editorTheme, onCodeChange, doCopyCode }: Props) {
|
||||
<div className="overflow-x-scroll overflow-y-scroll mx-2 border-[4px] border-black rounded-[20px]" ref={ref} />
|
||||
<span
|
||||
title="Copy Code"
|
||||
className="flex items-center justify-center w-10 h-10 text-gray-500 hover:bg-gray-100 cursor-pointer rounded-lg text-sm p-2.5 absolute top-[20px] right-[20px]"
|
||||
className="flex items-center justify-center text-gray-500 hover:bg-gray-100 cursor-pointer rounded-lg text-sm p-2.5 absolute top-[0px] right-[20px]"
|
||||
onClick={doCopyCode}
|
||||
>
|
||||
<FaCopy />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user