-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
neo
committed
Jul 25, 2022
1 parent
5f8ea32
commit e64bff9
Showing
2 changed files
with
5 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,7 @@ | ||
import CodeMirror from "@uiw/react-codemirror"; | ||
import "@codemirror/comment"; | ||
import e from "../../utils/editor"; | ||
import { classHighlightStyle } from "@codemirror/highlight"; | ||
|
||
const txt = [ | ||
"52.74.223.119 github.com", | ||
"52.74.223.119 gist.github.com", | ||
"54.169.195.247 api.github.com", | ||
"185.199.111.153 assets-cdn.github.com", | ||
"151.101.76.133 raw.githubusercontent.com", | ||
"151.101.76.133 gist.githubusercontent.com", | ||
"151.101.76.133 cloud.githubusercontent.com", | ||
"151.101.76.133 camo.githubusercontent.com" | ||
]; | ||
|
||
import { tags, HighlightStyle } from "@codemirror/highlight"; | ||
|
||
const myHighlightStyle = HighlightStyle.define([ | ||
{ tag: tags.atom, color: "#096dd9" }, | ||
{ tag: tags.comment, color: "#090" } | ||
]); | ||
|
||
import { EditorView } from "@codemirror/view"; | ||
|
||
let myTheme = EditorView.theme({ | ||
".cm-content": {}, | ||
".cm-selectionMatch": { | ||
backgroundColor: "#fff" | ||
}, | ||
".cm-gutters": { | ||
backgroundColor: "#fff", | ||
color: "#999", | ||
border: "none" | ||
} | ||
}); | ||
import React from "react"; | ||
|
||
function Hosts() { | ||
return ( | ||
<div className="hosts bg-white h-full"> | ||
<CodeMirror | ||
theme={[myHighlightStyle, myTheme]} | ||
value={txt.join("\r\n")} | ||
height="200px" | ||
editable={false} | ||
extensions={[e, classHighlightStyle]} | ||
onChange={(value, viewUpdate) => { | ||
console.log("value:", value); | ||
}} | ||
/> | ||
</div> | ||
); | ||
return <div className="hosts bg-white h-full" />; | ||
} | ||
|
||
export default Hosts; |