bookish-press 0.5.19 → 0.5.192
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import smoothscroll from 'smoothscroll-polyfill';
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
|
-
import { onMount, setContext } from 'svelte';
|
|
3
|
+
import { onMount, setContext, tick } from 'svelte';
|
|
4
4
|
import { writable } from 'svelte/store';
|
|
5
5
|
import { BASE, DARK_MODE, } from './Contexts';
|
|
6
6
|
import { BookishTheme } from '../../models/book/Theme';
|
|
@@ -38,6 +38,9 @@ if (typeof window !== 'undefined' && window.location.hash.startsWith('#/'))
|
|
|
38
38
|
goto(location.hash.replace('#', ''));
|
|
39
39
|
/** Given a theme, sets the appropriate CSS rules in the browser to apply the theme.*/
|
|
40
40
|
function setTheme(theme) {
|
|
41
|
+
// Allow for prerendering; rely on mount callback to set the theme.
|
|
42
|
+
if (typeof document === 'undefined')
|
|
43
|
+
return;
|
|
41
44
|
// If the theme is being unset, make sure we've removed any overrding style declaration.
|
|
42
45
|
// This let's the default theme kick in.
|
|
43
46
|
let themeTagImports = document.getElementById('bookish-theme-imports');
|
|
@@ -59,7 +59,7 @@ export default class BookMedia {
|
|
|
59
59
|
// Try again in a bit.
|
|
60
60
|
.catch(() => attempt > 25
|
|
61
61
|
? error("Couldn't get the image's thumbnail URL")
|
|
62
|
-
: setTimeout(() => this.getThumbnailURL(url, thumbnailRef, error, finished, attempt + 1),
|
|
62
|
+
: setTimeout(() => this.getThumbnailURL(url, thumbnailRef, error, finished, attempt + 1), 200));
|
|
63
63
|
}
|
|
64
64
|
upload(file, _, errorHandler, finishedHandler) {
|
|
65
65
|
if (storage === undefined)
|