community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1864175 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/primer.js source/unified.js wizard.js
Date Thu, 01 Aug 2019 18:44:42 GMT
Author: humbedooh
Date: Thu Aug  1 18:44:42 2019
New Revision: 1864175

URL: http://svn.apache.org/viewvc?rev=1864175&view=rev
Log:
move cursor in report when selecting sections on left-hand side.

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
    comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js?rev=1864175&r1=1864174&r2=1864175&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js Thu Aug  1 18:44:42 2019
@@ -47,7 +47,7 @@ function prime_steps(state, json) {
     build_steps(0, true);
 }
 
-function build_steps(s, start) {
+function build_steps(s, start, noclick) {
     s = s || 0;
     
     let text = document.getElementById('step_text');
@@ -171,8 +171,8 @@ function build_steps(s, start) {
             let data = eval("%s(pdata);".format(step.tipgenerator));
             helper.innerHTML += data;
         }
-        
+        // If clicked to a section, move cursor
+        if (!noclick) set_position(step.description);
     }
-    
 }
 

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js?rev=1864175&r1=1864174&r2=1864175&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js Thu Aug  1 18:44:42
2019
@@ -44,9 +44,19 @@ function find_section() {
     }
     
     if (at_step) {
-        build_steps(at_step);
+        build_steps(at_step, false, true);
         
     } else {
         helper.innerText = "";
     }
+}
+
+function set_position(text) {
+    let editor = document.getElementById('unified-report');
+    let pos = editor.value.search(text);
+    if (pos && pos > 0) {
+        editor.selectionStart = (pos + text.length + 2);
+        editor.selectionEnd = (pos + text.length + 2);
+        editor.focus();
+    }
 }
\ No newline at end of file

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864175&r1=1864174&r2=1864175&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Thu Aug  1 18:44:42 2019
@@ -1493,7 +1493,7 @@ function prime_steps(state, json) {
     build_steps(0, true);
 }
 
-function build_steps(s, start) {
+function build_steps(s, start, noclick) {
     s = s || 0;
     
     let text = document.getElementById('step_text');
@@ -1617,9 +1617,9 @@ function build_steps(s, start) {
             let data = eval("%s(pdata);".format(step.tipgenerator));
             helper.innerHTML += data;
         }
-        
+        // If clicked to a section, move cursor
+        if (!noclick) set_position(step.description);
     }
-    
 }
 
 
@@ -1918,9 +1918,19 @@ function find_section() {
     }
     
     if (at_step) {
-        build_steps(at_step);
+        build_steps(at_step, false, true);
         
     } else {
         helper.innerText = "";
     }
+}
+
+function set_position(text) {
+    let editor = document.getElementById('unified-report');
+    let pos = editor.value.search(text);
+    if (pos && pos > 0) {
+        editor.selectionStart = (pos + text.length + 2);
+        editor.selectionEnd = (pos + text.length + 2);
+        editor.focus();
+    }
 }
\ No newline at end of file



Mime
View raw message