From c979f7068526ee1ca0869c681360eaa38ace65d4 Mon Sep 17 00:00:00 2001 From: Albert Graef <aggraef@gmail.com> Date: Wed, 31 Jul 2019 15:50:11 +0200 Subject: [PATCH] Usability improvements in the documentation browser. This reworks the file button in the help browser so that it opens the file browser on whatever directory we visited last (as given by the current_dir variable), or the doc directory by default. --- pd/nw/dialog_search.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html index 19343356d..282bb2610 100644 --- a/pd/nw/dialog_search.html +++ b/pd/nw/dialog_search.html @@ -155,12 +155,16 @@ function click_toc(dir) { doc_search(); } +var current_dir; + function display_toc() { var results_elem = document.getElementById("results"), div, a, header, text_node; + // reset current_dir to doc + current_dir = path.join(pdgui.get_lib_dir(), "doc"); toc.forEach(function(doc, i, a) { div = document.createElement("div"); if (doc.id) { @@ -205,8 +209,6 @@ function clear_results() { document.getElementById("results").innerHTML = ""; } -var current_dir; - function display_directory_callback(err, files) { var doc, doc_path; if (err) { @@ -233,6 +235,10 @@ function display_directory(dir) { } function file_browser_click() { + // open the file browser on whatever directory we visited last, or the + // doc directory by default + document.getElementById("file_browser").setAttribute("nwworkingdir", + current_dir); document.getElementById("file_browser").click(); } @@ -501,6 +507,8 @@ function doc_search() { results, doc, i; + // reset current_dir to doc + current_dir = path.join(pdgui.get_lib_dir(), "doc"); // if the search term is empty then just redisplay the toc if (!search_text) { clear_results(); -- GitLab