X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/421c624a25e602a3d3bb72bd6c01cbb04cbf7d11..c2f61b78499f7c1f4f722ef4a4b5514c95598505:/modules/documentCanvas/canvas/documentElement.js diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index 3a89bd1..7e5824b 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -80,6 +80,27 @@ $.extend(DocumentElement.prototype, { markAsCurrent: function() { this.canvas.markAsCurrent(this); + }, + + getVerticallyFirstTextElement: function() { + var toret; + this.children().some(function(child) { + if(!child.isVisible()) + return false; // continue + if(child instanceof DocumentTextElement) { + toret = child; + return true; // break + } else { + toret = child.getVerticallyFirstTextElement(); + if(toret) + return true; // break + } + }); + return toret; + }, + + isVisible: function() { + return this instanceof DocumentTextElement || this.getWlxmlTag() !== 'metadata'; } });