diff --git a/build/guppy.min.js b/build/guppy.min.js index 1895e78b..eb94ce2c 100644 --- a/build/guppy.min.js +++ b/build/guppy.min.js @@ -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; } @@ -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; } diff --git a/build/guppy_backend.min.js b/build/guppy_backend.min.js index 454b1ed7..c7a408d4 100644 --- a/build/guppy_backend.min.js +++ b/build/guppy_backend.min.js @@ -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; } diff --git a/build/guppy_doc.min.js b/build/guppy_doc.min.js index aa9dbfa6..f2198286 100644 --- a/build/guppy_doc.min.js +++ b/build/guppy_doc.min.js @@ -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; } diff --git a/build/guppy_render.min.js b/build/guppy_render.min.js index babc33df..558bdd0f 100644 --- a/build/guppy_render.min.js +++ b/build/guppy_render.min.js @@ -30,6 +30,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; } diff --git a/src/guppy.js b/src/guppy.js index 64721477..579414d2 100644 --- a/src/guppy.js +++ b/src/guppy.js @@ -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; } diff --git a/src/guppy_doc.js b/src/guppy_doc.js index 2056f4ba..f6b20bb2 100644 --- a/src/guppy_doc.js +++ b/src/guppy_doc.js @@ -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; }