bookish-press 0.4.37 → 0.4.38

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,7 +1,7 @@
1
1
  <svelte:options immutable={true} />
2
2
 
3
3
  <script>import { storage } from '../../models/Firebase';
4
- import { getCaret, getBook } from '../page/Contexts';
4
+ import { getCaret, getBook, getBase } from '../page/Contexts';
5
5
  import Figure from './Figure.svelte';
6
6
  import { getContext } from 'svelte';
7
7
  export let node;
@@ -12,6 +12,7 @@ $: url = node.getURL();
12
12
  $: description = node.getDescription();
13
13
  let caret = getCaret();
14
14
  let book = getBook();
15
+ let base = getBase();
15
16
  // Bookish editor should have passed down a way to set the active editor.
16
17
  let claimCaret = getContext('claimeditor');
17
18
  let dragging = false;
@@ -130,7 +131,7 @@ function handleClick() {
130
131
  {:else}
131
132
  <img
132
133
  class={'bookish-figure-image'}
133
- src={url.startsWith('http') ? url : 'images/' + url}
134
+ src={url.startsWith('http') ? url : `${$base}/images/${url}`}
134
135
  srcset={node.hasSmallURL()
135
136
  ? `${node.getSmallURL()} 320w, ${url} 1024w`
136
137
  : undefined}
@@ -1,9 +1,14 @@
1
- <script>export let url;
1
+ <script>import { getBase } from './Contexts';
2
+ export let url;
2
3
  export let alt;
4
+ let base = getBase();
3
5
  </script>
4
6
 
5
7
  <figure class={'media-preview'}>
6
- <img src={url} {alt} />
8
+ <img
9
+ src={url.startsWith('http') ? url : `${$base}/images/small/${url}`}
10
+ {alt}
11
+ />
7
12
  <figcaption class="credit"><slot /></figcaption>
8
13
  </figure>
9
14
 
@@ -1,15 +1,18 @@
1
1
  <script>import EmbedNode from '../../models/chapter/EmbedNode';
2
2
  import Parser from '../../models/chapter/Parser';
3
- import { getEdition } from './Contexts';
3
+ import { getBase, getEdition } from './Contexts';
4
4
  export let embed;
5
5
  let edition = getEdition();
6
+ let base = getBase();
6
7
  $: embedNode = embed === null ? null : Parser.parseEmbed($edition, embed);
7
8
  </script>
8
9
 
9
10
  {#if embedNode instanceof EmbedNode}
10
11
  <img
11
12
  style="width: 5em"
12
- src={embedNode.getSmallURL()}
13
+ src={embedNode.isLocal()
14
+ ? `${$base}/${embedNode.getSmallURL()}`
15
+ : embedNode.getSmallURL()}
13
16
  alt={embedNode.getDescription()}
14
17
  />
15
18
  {/if}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bookish-press",
3
3
  "private": false,
4
- "version": "0.4.37",
4
+ "version": "0.4.38",
5
5
  "type": "module",
6
6
  "description": "A platform for reading and writing readable, accessible, beautiful online books.",
7
7
  "license": "MIT",