From dadc8d9721fd895c4301afc0b7c20376bdf9ef66 Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Sat, 13 Aug 2016 18:50:44 +0200 Subject: [PATCH] support all HTML tags that can carry source lines, not only DIV elements --- .../org/asciidoc/intellij/editor/javafx/scrollToElement.js | 4 ++-- src/main/resources/sourceline-treeprocessor.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/org/asciidoc/intellij/editor/javafx/scrollToElement.js b/src/main/resources/org/asciidoc/intellij/editor/javafx/scrollToElement.js index 73f96b971..e773e53ee 100644 --- a/src/main/resources/org/asciidoc/intellij/editor/javafx/scrollToElement.js +++ b/src/main/resources/org/asciidoc/intellij/editor/javafx/scrollToElement.js @@ -24,8 +24,8 @@ window.__IntelliJTools.scrollToLine = (function () { var scrollToLine = function (newLineToScroll, lineCount) { - // the sourcelines will be as CSS class on div elements only - var blocks = document.getElementsByTagName('div'); + // the sourcelines will be as CSS class elements that also have class has-source-line + var blocks = document.getElementsByClassName('has-source-line'); var startY; var startLine; var endY; diff --git a/src/main/resources/sourceline-treeprocessor.rb b/src/main/resources/sourceline-treeprocessor.rb index 8d2e6c8b0..951b404d3 100644 --- a/src/main/resources/sourceline-treeprocessor.rb +++ b/src/main/resources/sourceline-treeprocessor.rb @@ -10,7 +10,7 @@ def process document # on each node add the source file information as role (will result in CSS class in HTML) if (node.source_location) then - node.attributes['role'] = 'data-line-' + (node.source_location.file || 'stdin') + "-#{node.source_location.lineno}" + node.attributes['role'] = 'has-source-line data-line-' + (node.source_location.file || 'stdin') + "-#{node.source_location.lineno}" end end nil