Skip to content

Commit

Permalink
feat: 优化构建
Browse files Browse the repository at this point in the history
  • Loading branch information
neo committed Jul 25, 2022
1 parent 5f8ea32 commit e64bff9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 50 deletions.
3 changes: 3 additions & 0 deletions packages/app/scripts/package.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"@fast-dev/core": "{{version}}",
"is-browser": "2.1.0",
"json5": "^2.1.3"
},
"devDependencies": {
"electron": "16.0.2"
}
}
52 changes: 2 additions & 50 deletions packages/app/src/renderer/pages/Hosts/index.tsx
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;

0 comments on commit e64bff9

Please sign in to comment.