Skip to content

Commit

Permalink
修复节点不存在报错,和markdown带HTML标签的展示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 17, 2015
1 parent 3d5eb5f commit 0abcd90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion build/MDEditor.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,10 @@
}
MDEditor.prototype = {
load: function() {
if (!this.obj) return;
var self = this, box = self.obj[0], index = 0;
if (box) {
if (box.innerHTML !== "") self.opts.value = box.innerHTML.replace(/\&gt\;/g, ">").replace(/\&lt\;/g, "<"),
if (box.children.length > 0) self.opts.value = box.children[0].innerHTML.replace(/\&gt\;/g, ">").replace(/\&lt\;/g, "<"),
box.innerHTML = "";
box.appendChild(self.preview_el), box.appendChild(self.tools), box.appendChild(self.textarea);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/MDEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@
MDEditor.prototype = {
//加载编辑器
load:function(){
if(!this.obj) return;
var self = this,box = self.obj[0],index=0;

if(box) {
if(box.innerHTML!=="")
self.opts.value = box.innerHTML
.replace(/\&gt\;/g,'>')
.replace(/\&lt\;/g,'<'),
if(box.children.length>0)
self.opts.value = box.children[0].innerHTML
.replace(/\&gt\;/g,'>').replace(/\&lt\;/g,'<'),
box.innerHTML='';
box.appendChild(self.preview_el),
box.appendChild(self.tools),
Expand Down

0 comments on commit 0abcd90

Please sign in to comment.