Skip to content

Commit f88ce6a

Browse files
save file
1 parent 060c136 commit f88ce6a

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

utils/editors/markdown-editor/html/output-md/v2.0/output-md-v2.0.html

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,33 @@
88

99
<style>
1010

11-
#output {height:100%;border:2px solid lightgray;box-sizing:border-box;padding:10px}
12-
11+
#root
12+
{height:100%;display:flex;flex-direction:column;gap:10px}
13+
14+
#hdr
15+
{display:flex}
16+
.radio
17+
{border:1px solid lightgray;padding:2px 10px;border-radius:5px;cursor:pointer;display:flex;align-items:center}
18+
19+
20+
#output
21+
{height:100%;border:2px solid lightgray;box-sizing:border-box;padding:10px}
22+
1323
</style>
1424

15-
<div id=output class=markdown-body>
25+
<div id=root>
26+
27+
<div id=hdr>
28+
<span id=html class=radio>
29+
<input type=checkbox checked>
30+
html
31+
</span>
32+
33+
</div>
34+
35+
<div id=output class=markdown-body>
36+
</div>
37+
1638
</div>
1739

1840
</template>
@@ -40,8 +62,8 @@
4062
var md;
4163

4264
var shadow;
43-
4465
var output;
66+
var chk = {};
4567

4668

4769
//:
@@ -69,7 +91,6 @@
6991

7092
function onload(){
7193

72-
md = markdownit();
7394
resolve();
7495

7596
}//onload
@@ -84,6 +105,9 @@
84105

85106
shadow = host.shadowRoot;
86107

108+
var hdr = $(shadow,'#hdr');
109+
chk.html = $.chkbox(shadow,'#html');
110+
87111
output = $(shadow,'#output');
88112

89113

@@ -95,10 +119,15 @@
95119

96120

97121
obj.display = async function(txt){
98-
122+
debug('display');
99123
await libs;
100124

125+
var opts = {};
126+
opts.html = chk.html.checked;
127+
debug(opts);
128+
var md = markdownit(opts);
101129
var html = md.render(txt);
130+
102131
output.innerHTML = html;
103132

104133
}//show
@@ -120,9 +149,13 @@
120149
}//vert
121150

122151

152+
153+
123154
return obj;
124155

125-
})//output_md
156+
//output_md
157+
})
158+
126159

127160
</script>
128161

0 commit comments

Comments
 (0)