diff --git a/core/modules/macros/story/story.js b/core/modules/macros/story/story.js index 2557c4713..baddf6722 100644 --- a/core/modules/macros/story/story.js +++ b/core/modules/macros/story/story.js @@ -49,13 +49,31 @@ exports.handleEvent = function(event) { } }; +/* +Return the index of the story element that contains the specified tree node. Returns story.length if not found +*/ +exports.findStoryElementContainingNode = function(node) { + // Get the DOM node contained by the target node + while(node && !node.domNode) { + node = node.child; + } + // Step through the story elements + var slot = this.storyNode.children.length; + for(var t=0; t