Skip to content

Commit

Permalink
blank bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel3735928559 committed Jul 3, 2017
1 parent 4c96088 commit 1f31a90
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
9 changes: 8 additions & 1 deletion build/guppy.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ Guppy.prototype.render_node = function(t){
}

Guppy.prototype.render = function(updated){
if(!this.editor_active && GuppyUtils.is_blank(this.backend.doc.root().firstChild)){
if(!this.editor_active && this.backend.doc.is_blank()){
katex.render(this.empty_content,this.editor);
return;
}
Expand Down Expand Up @@ -2769,6 +2769,13 @@ GuppyDoc.prototype.ensure_text_nodes = function(){
}
}

GuppyDoc.prototype.is_blank = function(){
if(this.base.getElementsByTagName("f").length > 0) return false;
var l = this.base.getElementsByTagName("e");
if(l.length == 1 && (!(l[0].firstChild) || l[0].firstChild.textContent == "")) return true;
return false;
}

GuppyDoc.prototype.root = function(){
return this.base.documentElement;
}
Expand Down
7 changes: 7 additions & 0 deletions build/guppy_backend.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,13 @@ GuppyDoc.prototype.ensure_text_nodes = function(){
}
}

GuppyDoc.prototype.is_blank = function(){
if(this.base.getElementsByTagName("f").length > 0) return false;
var l = this.base.getElementsByTagName("e");
if(l.length == 1 && (!(l[0].firstChild) || l[0].firstChild.textContent == "")) return true;
return false;
}

GuppyDoc.prototype.root = function(){
return this.base.documentElement;
}
Expand Down
7 changes: 7 additions & 0 deletions build/guppy_doc.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ GuppyDoc.prototype.ensure_text_nodes = function(){
}
}

GuppyDoc.prototype.is_blank = function(){
if(this.base.getElementsByTagName("f").length > 0) return false;
var l = this.base.getElementsByTagName("e");
if(l.length == 1 && (!(l[0].firstChild) || l[0].firstChild.textContent == "")) return true;
return false;
}

GuppyDoc.prototype.root = function(){
return this.base.documentElement;
}
Expand Down
7 changes: 7 additions & 0 deletions build/guppy_render.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/guppy.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ Guppy.prototype.render_node = function(t){
}

Guppy.prototype.render = function(updated){
if(!this.editor_active && GuppyUtils.is_blank(this.backend.doc.root().firstChild)){
if(!this.editor_active && this.backend.doc.is_blank()){
katex.render(this.empty_content,this.editor);
return;
}
Expand Down
7 changes: 7 additions & 0 deletions src/guppy_doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ GuppyDoc.prototype.ensure_text_nodes = function(){
}
}

GuppyDoc.prototype.is_blank = function(){
if(this.base.getElementsByTagName("f").length > 0) return false;
var l = this.base.getElementsByTagName("e");
if(l.length == 1 && (!(l[0].firstChild) || l[0].firstChild.textContent == "")) return true;
return false;
}

GuppyDoc.prototype.root = function(){
return this.base.documentElement;
}
Expand Down

0 comments on commit 1f31a90

Please sign in to comment.