UNPKG

3.65 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="zh-cn">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <link rel="shortcut icon" href="./logo.png">
9 <script src="./dist/wscode.js"></script>
10 <title>Web Studio Code</title>
11
12 <style>
13 body {
14 margin: 0;
15 }
16
17 div#wscode {
18 width: 100vw;
19 height: 100vh;
20 }
21
22 .github {
23 position: fixed;
24 transform: rotate(45deg);
25 top: 60px;
26 line-height: 1.6em;
27 right: -60px;
28 background-color: #9e9695;
29 outline: 4px solid #9e9695;
30 transform-origin: 150px 23px;
31 border: 2px dashed #faf6f5;
32 width: 300px;
33 text-align: center;
34 color: #f7f3f2;
35 z-index: 2;
36 font-family: sans-serif;
37 text-decoration: none;
38 }
39
40 input[type='button'] {
41 position: fixed;
42 left: 16px;
43 bottom: 18px;
44 cursor: pointer;
45 width: 70px;
46 height: 26px;
47 border: 1px solid #9e9695;
48 outline: none;
49 }
50
51 .help {
52 position: fixed;
53 left: 100px;
54 bottom: 18px;
55 font-size: 12px;
56 height: 26px;
57 line-height: 26px;
58 background-color: #9e9695;
59 color: white;
60 padding: 0 10px;
61 white-space: nowrap;
62 }
63
64 .help>a {
65 font-weight: 800;
66 }
67 </style>
68
69</head>
70
71<body>
72
73 <a href="https://github.com/yelloxing/Web-Studio-Code" class='github' target="_blank">Fork me on Github</a>
74
75 <div id="wscode"></div>
76 <input type='button' value='格式化' onclick='doFormat()' title='点击我格式化代码'>
77 <span class='help'>
78 Web Studio Code : 当前启用的是HTML语言编辑器,你可以在特殊标签中嵌套JS和CSS并测试他们,有任何意见你都可以
79 <a href="https://github.com/yelloxing/Web-Studio-Code/issues" target="_blank">提Issue</a>
80 来告知我们!
81 </span>
82
83 <script>
84 window.wscode = new WSCode({
85
86 // 编辑器挂载点
87 el: document.getElementById('wscode'),
88
89 // 设置字体
90 "font-family": "serif",
91
92 // 设置字重
93 "font-weight": 800,
94
95 // 设置tab代表多少空格
96 tabSpace: 2,
97
98 // 设置语言
99 lang: {
100 type: "html",
101 color: {
102
103 }
104 },
105
106 // 初始化文本
107 content: "<html lang=\"zh-cn\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Example | Web Studio Code</title>\n <style>\n /*css样式*/\n body {\n margin: 0px;\n }\n </style>\n</head>\n<body>\n <script>\n\n /*js代码*/\n function doit() {\n console.log('你好,世界!');\n }\n\n \</script\>\n</body>\n</html>\n\n<!-- Developed by 心叶(yelloxing@gmail.com) -->"
108 });
109
110 console.log(wscode);
111
112 wscode.updated(function(){
113 console.log('数据更新了'+new Date());
114 });
115
116 function doFormat(){
117 wscode.format();
118 }
119 </script>
120
121</body>
122
123</html>
\No newline at end of file