Skip to content

Commit 8bb5426

Browse files
ehussDylan-DPC
authored andcommitted
Fix keyboard chapter navigation for file urls. (#915)
1 parent a674c9e commit 8bb5426

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/renderer/html_handlebars/search.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) ->
3535
utils::fs::write_file(
3636
destination,
3737
"searchindex.js",
38-
format!("window.search = {};", index).as_bytes(),
38+
format!("Object.assign(window.search, {});", index).as_bytes(),
3939
)?;
4040
utils::fs::write_file(destination, "searcher.js", searcher::JS)?;
4141
utils::fs::write_file(destination, "mark.min.js", searcher::MARK_JS)?;

tests/rendered_output.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ mod search {
427427
fn read_book_index(root: &Path) -> serde_json::Value {
428428
let index = root.join("book/searchindex.js");
429429
let index = file_to_string(index).unwrap();
430-
let index = index.trim_start_matches("window.search = ");
431-
let index = index.trim_end_matches(';');
430+
let index = index.trim_start_matches("Object.assign(window.search, ");
431+
let index = index.trim_end_matches(");");
432432
serde_json::from_str(&index).unwrap()
433433
}
434434

0 commit comments

Comments
 (0)