-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditor.html
35 lines (32 loc) · 920 Bytes
/
editor.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
<!DOCTYPE html>
<html>
<head>
<style>
#editor {
height: 200px;
border: 1px solid #ccc;
padding: 10px;
}
#output {
height: 200px;
border: 1px solid #ccc;
padding: 10px;
margin-top: 10px;
}
</style>
</head>
<body>
<div id="editor" contenteditable="true"></div>
<button onclick="convertToEquation()">Convert</button>
<div id="output"></div>
<script>
function convertToEquation() {
var editorContent = document.getElementById('editor').innerText;
var output = document.getElementById('output');
// This is a simple conversion, you may need to expand this to handle more complex equations
var equation = editorContent.replace(/\^(.)/g, '^($1)');
output.innerText = equation;
}
</script>
</body>
</html>