bookish-press 0.4.43 → 0.4.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ $: id =
18
18
  $: classes =
19
19
  node.getLevel() === 0
20
20
  ? undefined
21
- : 'bookish-header' +
21
+ : 'page-header' +
22
22
  ($chapter && $chapter.highlightedID === id
23
23
  ? ' bookish-content-highlight'
24
24
  : '');
@@ -214,7 +214,7 @@ let editable = isBookEditable() ||
214
214
  <!-- Collapse the outline if a marginal is selected. -->
215
215
  <Outline
216
216
  slot="outline"
217
- collapse={marginal !== undefined}
217
+ collapse={$marginal !== undefined}
218
218
  previous={$edition.getPreviousChapterID(chapterID)}
219
219
  next={$edition.getNextChapterID(chapterID)}
220
220
  listener={(expanded) => {
@@ -77,7 +77,7 @@ function highlight() {
77
77
  const threshold = getHighlightThreshold();
78
78
  // Find the header that we're past so we can update the outline.
79
79
  let indexOfNearestHeaderAbove = -1; // -1 represents the title
80
- Array.from(document.getElementsByClassName('bookish-header')).forEach((header, index) => {
80
+ Array.from(document.getElementsByClassName('page-header')).forEach((header, index) => {
81
81
  // Is this a header we care about?
82
82
  if (header.tagName === 'H1' ||
83
83
  header.tagName === 'H2' ||
@@ -22,6 +22,7 @@ import PageParagraph from './PageParagraph.svelte';
22
22
  import Note from '../editor/Note.svelte';
23
23
  import Permissions from '../editor/Permissions.svelte';
24
24
  import Publish from './Publish.svelte';
25
+ import { onMount } from 'svelte';
25
26
  let auth = getUser();
26
27
  let book = getBook();
27
28
  let edition = getEdition();
@@ -61,6 +62,11 @@ function addChapter() {
61
62
  if ($edition)
62
63
  edition.set($edition.withNewChapter());
63
64
  }
65
+ /** Doing this on mount allows for prerendering an an update. */
66
+ let bookURL = '…';
67
+ onMount(() => {
68
+ bookURL = location.protocol + '//' + location.host + location.pathname;
69
+ });
64
70
  </script>
65
71
 
66
72
  {#if $edition}
@@ -270,10 +276,7 @@ function addChapter() {
270
276
  .getAuthors()
271
277
  .map((author) => Parser.parseFormat($edition, author).toText())
272
278
  .join(', ')} ({new Date().getFullYear()}).
273
- <em>{$edition.getTitle()}</em>. {location.protocol +
274
- '//' +
275
- location.host +
276
- location.pathname},
279
+ <em>{$edition.getTitle()}</em>. {bookURL},
277
280
  <em>retrieved {new Date().toLocaleDateString('en-US')}</em>.
278
281
  </PageParagraph>
279
282
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bookish-press",
3
3
  "private": false,
4
- "version": "0.4.43",
4
+ "version": "0.4.45",
5
5
  "type": "module",
6
6
  "description": "A platform for reading and writing readable, accessible, beautiful online books.",
7
7
  "license": "MIT",