-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
100 lines (89 loc) · 1.88 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MyGrammerly</title>
<script src="./js/vue.js"></script>
<script src="./js/latex_util.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
#app {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
padding: 5px;
flex-direction: column;
}
.top_bar button {
width: 10em;
}
#the_textarea {
padding: 5px;
margin-top: 5px;
width: calc(100% - 10px);
font-size: 1.5em;
flex-grow: 1;
overflow-y: auto;
border: 1px lightgrey solid;
/*outline: none;*/
/*outline:1px darkblue solid;*/
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
resize: none;
}
.the_help {
color: gray;
font-size: 0.5em;
position: fixed;
right: 10px;
top: 10px;
cursor: pointer;
}
.the_help:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div id="app">
<div class="top_bar">
<button @click="latex2text">转换</button>
<button @click="writeBack">回写</button>
<span class="the_help" @click="showHelp">Help</span>
</div>
<textarea id="the_textarea" v-model="content"></textarea>
</div>
<script>
new Vue({
el: '#app',
data: {
content: null,
},
methods: {
async latex2text() {
const text = this.content
const [new_text, mapping] = trans(text)
this.content = new_text
this.mapping = mapping
},
async writeBack() {
if (!this.content) {
return
}
this.content = go_back(this.content, this.mapping)
},
showHelp() {
window.open("https://www.huacishu.com/2022/08/27/my_grammarly/", '_blank').focus();
}
},
})
</script>
</body>
</html>