forked from pandao/editor.md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresettings.html
144 lines (125 loc) · 6.18 KB
/
resettings.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Resettings - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Resettings</h1>
<p>只能设置依赖模块加载完成之后的相关配置或者使用拖动加载模块方式。</p>
<p>Only be resetting the relevant configuration of dependent module loaded after, or using manually load modules mode.</p>
</header>
<div class="btns">
<button id="show-btn">Show editor</button>
<button id="hide-btn">Hide editor</button>
<button id="get-md-btn">Get Markdown</button>
<button id="get-html-btn">Get HTML</button>
<button id="watch-btn">Watch</button>
<button id="unwatch-btn">Unwatch</button>
<button id="preview-btn">Preview HTML(Press ESC cancel)</button>
<button id="fullscreen-btn">Fullscreen (Press ESC cancel)</button>
<button id="show-toolbar-btn">Show toolbar</button>
<button id="close-toolbar-btn">Hide toolbar</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">#### Resetting examples
```javascript
this.config("lineNumbers", false);
this.config({
toc : false,
tex : false,
previewCodeHighlight : true, // before set previewCodeHighlight == false, editor not load pretty.js, so now codes can't highlight and display line numbers.
flowChart : false,
sequenceDiagram : false,
dialogLockScreen : false,
dialogDraggable : false,
dialogMaskBgColor : "teal",
toolbar : true
});
this.config("onresize", function() {
console.log("onresize =>", this);
});
```</textarea></div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
$.get("test.md", function(md) {
testEditor = editormd("test-editormd", {
width : "90%",
height : 740,
path : "../lib/",
appendMarkdown : "\n" + md,
saveHTMLToTextarea : true,
watch : false,
htmlDecode : true,
toolbar : false,
previewCodeHighlight : false,
tex : true,
flowChart : true,
sequenceDiagram : true,
emoji : true,
taskList : true,
onload : function() {
console.log('onload', this);
this.config("lineNumbers", false);
this.config({
toc : false,
tex : false,
toolbar : true,
previewCodeHighlight : true, // before set previewCodeHighlight == false, editor not load pretty.js, so now codes can't highlight and display line numbers.
flowChart : false,
sequenceDiagram : false,
dialogLockScreen : false,
dialogMaskOpacity : 0.5, // 设置透明遮罩层的透明度,全局通用,默认值为0.1
dialogDraggable : false,
dialogMaskBgColor : "#000"
});
this.config("onresize", function() {
console.log("onresize =>", this);
});
this.watch();
}
});
});
$("#show-btn").click(function(){
testEditor.show();
});
$("#hide-btn").click(function(){
testEditor.hide();
});
$("#get-md-btn").click(function(){
alert(testEditor.getMarkdown());
});
$("#get-html-btn").click(function() {
alert(testEditor.getHTML());
});
$("#watch-btn").click(function() {
testEditor.watch();
});
$("#unwatch-btn").click(function() {
testEditor.unwatch();
});
$("#preview-btn").click(function() {
testEditor.previewing();
});
$("#fullscreen-btn").click(function() {
testEditor.fullscreen();
});
$("#show-toolbar-btn").click(function() {
testEditor.showToolbar();
});
$("#close-toolbar-btn").click(function() {
testEditor.hideToolbar();
});
});
</script>
</body>
</html>