bookish-press 0.4.39 → 0.4.41

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.
@@ -117,7 +117,7 @@ function handleClick() {
117
117
  {:else}
118
118
  <p class="bookish-figure-unspecified">No image or video</p>
119
119
  {/if}
120
- {:else if url.includes('https://www.youtube.com') || url.includes('https://youtu.be') || url.includes('https://www.tiktok.com') || url.includes('vimeo.com')}
120
+ {:else if node.isVideo()}
121
121
  <article class="bookish-figure-embed">
122
122
  <iframe
123
123
  class="bookish-figure-frame"
@@ -6,12 +6,13 @@ import ChapterIDs from '../../models/book/ChapterID';
6
6
  import Format from '../chapter/Format.svelte';
7
7
  import MediaPreview from './MediaPreview.svelte';
8
8
  import { onMount } from 'svelte';
9
- import { getBook, getEdition, isBookEditable, isEditionEditable, } from './Contexts';
9
+ import { getBase, getBook, getEdition, isBookEditable, isEditionEditable, } from './Contexts';
10
10
  import Button from '../app/Button.svelte';
11
11
  import PageHeader from './PageHeader.svelte';
12
12
  let book = getBook();
13
13
  let edition = getEdition();
14
14
  let editable = isBookEditable();
15
+ let base = getBase();
15
16
  let images = [];
16
17
  $: embeds = $edition?.getEmbeds() ?? [];
17
18
  $: media = $book?.getMedia();
@@ -56,27 +57,31 @@ $: unused = images?.filter((image) => embeds.find((embed) => embed.getURL() ===
56
57
  {#if embeds.length === 0}
57
58
  <p>No images or videos appear in the book.</p>
58
59
  {:else}
59
- <p>These are the images and videos in the book:</p>
60
+ <p>These are the images in the book:</p>
60
61
  {/if}
61
62
  {#each embeds as embed}
62
- <MediaPreview
63
- url={embed.getSmallURL()}
64
- alt={embed.getDescription() === ''
65
- ? 'no description, image not used'
66
- : embed.getDescription()}
67
- >
68
- <span
69
- >{#if editable}{images &&
70
- images.find((i) => i.url === embed.getURL()) ===
71
- undefined
72
- ? 'linked'
73
- : 'uploaded'}{embed.getCredit().isEmptyText()
74
- ? ''
75
- : ' • '}{/if}<Format
76
- node={embed.getCredit()}
77
- /></span
63
+ {#if !embed.isVideo()}
64
+ <MediaPreview
65
+ url={embed.isLocal()
66
+ ? `${$base}/${embed.getSmallURL()}`
67
+ : embed.getSmallURL()}
68
+ alt={embed.getDescription() === ''
69
+ ? 'no description, image not used'
70
+ : embed.getDescription()}
78
71
  >
79
- </MediaPreview>
72
+ <span
73
+ >{#if editable}{images &&
74
+ images.find((i) => i.url === embed.getURL()) ===
75
+ undefined
76
+ ? 'linked'
77
+ : 'uploaded'}{embed.getCredit().isEmptyText()
78
+ ? ''
79
+ : ' • '}{/if}<Format
80
+ node={embed.getCredit()}
81
+ /></span
82
+ >
83
+ </MediaPreview>
84
+ {/if}
80
85
  {/each}
81
86
  {#if editable && unused !== undefined && unused.length > 0}
82
87
  <PageHeader id="unused">Unused</PageHeader>
@@ -1,14 +1,9 @@
1
- <script>import { getBase } from './Contexts';
2
- export let url;
1
+ <script>export let url;
3
2
  export let alt;
4
- let base = getBase();
5
3
  </script>
6
4
 
7
5
  <figure class={'media-preview'}>
8
- <img
9
- src={url.startsWith('http') ? url : `${$base}/images/small/${url}`}
10
- {alt}
11
- />
6
+ <img src={url.startsWith('http') ? url : `${url}`} {alt} />
12
7
  <figcaption class="credit"><slot /></figcaption>
13
8
  </figure>
14
9
 
package/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { default as References } from "./components/page/References.svelte";
5
5
  export { default as PossibleChapter } from "./components/page/PossibleChapter.svelte";
6
6
  export { default as Media } from "./components/page/Media.svelte";
7
7
  export { default as Print } from "./components/page/Print.svelte";
8
+ export { default as Unknown } from "./components/page/Unknown.svelte";
8
9
  export { default as Glossary } from "./components/page/Glossary.svelte";
9
10
  export { default as Edition } from "./components/page/Edition.svelte";
10
11
  export { default as Feedback } from "./components/app/Feedback.svelte";
package/index.js CHANGED
@@ -5,6 +5,7 @@ export { default as References } from './components/page/References.svelte';
5
5
  export { default as PossibleChapter } from './components/page/PossibleChapter.svelte';
6
6
  export { default as Media } from './components/page/Media.svelte';
7
7
  export { default as Print } from './components/page/Print.svelte';
8
+ export { default as Unknown } from './components/page/Unknown.svelte';
8
9
  export { default as Glossary } from './components/page/Glossary.svelte';
9
10
  export { default as Edition } from './components/page/Edition.svelte';
10
11
  export { default as Feedback } from './components/app/Feedback.svelte';
@@ -9,6 +9,7 @@ export default class EmbedNode extends BlockNode {
9
9
  #private;
10
10
  constructor(url: string, description: string, caption?: FormatNode, credit?: FormatNode, position?: Position);
11
11
  getType(): string;
12
+ isVideo(): boolean;
12
13
  getURL(): string;
13
14
  getSmallURL(): string;
14
15
  hasSmallURL(): boolean;
@@ -30,6 +30,12 @@ export default class EmbedNode extends BlockNode {
30
30
  getType() {
31
31
  return 'embed';
32
32
  }
33
+ isVideo() {
34
+ return (this.#urls.includes('https://www.youtube.com') ||
35
+ this.#urls.includes('https://youtu.be') ||
36
+ this.#urls.includes('https://www.tiktok.com') ||
37
+ this.#urls.includes('vimeo.com'));
38
+ }
33
39
  getURL() {
34
40
  return this.#urls.split(URL_SEPARATOR)[0];
35
41
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bookish-press",
3
3
  "private": false,
4
- "version": "0.4.39",
4
+ "version": "0.4.41",
5
5
  "type": "module",
6
6
  "description": "A platform for reading and writing readable, accessible, beautiful online books.",
7
7
  "license": "MIT",