X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/ce24094b892d3fb0faf000b5e2bf64f58ce4aae5..104d3449c7d2c5ada68cc49f4a67d6e70973b492:/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'; } });