@d-i-t-a/reader 2.0.2 → 2.0.3

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.
package/README.md CHANGED
@@ -46,13 +46,44 @@ Here is the original proposal, initiated by Aferdita Muriqi to the
46
46
 
47
47
  Subsequent development of R2D2BC has been supported by [DITA](https://github.com/d-i-t-a), [Bokbasen](https://www.bokbasen.no/), and [CAST](http://www.cast.org) - which explains the D2, B, and C in the name.
48
48
 
49
+ # Features & Functionalities
50
+ - ePub Reflowable + Fixed Layout
51
+ - Reader Settings
52
+ - Configurable Modules with Callbacks
53
+ - Injectable Fonts, CSS, Javascript
54
+ - Text Selection with Injectable Context Menu
55
+ - Bookmarks
56
+ - Highlights
57
+ - Annotations
58
+ - TTS - Text to speech / Read Aloud
59
+ - Media Overlays - Read Along
60
+ - Search
61
+ - Content Protection
62
+ - Definitions
63
+ - Popup Footnotes
64
+ - Page Breaks - Page Numbers in margin
65
+ - Sample Read
66
+ - Timeline
67
+ - Layers
68
+ - Line Focus (Beta Feature)
69
+ - Popups and Popovers
70
+
49
71
  # Extensions and Implementations
50
72
 
51
73
  The R2D2BC reader has been used in:
52
74
  - The [Clusive](https://github.com/cast-org/clusive) learning environment
53
- - Bokbasen's [Allbok.no](https://www.allbok.no) and [Allvit.no](https://www.allvit.no)
54
- - The UNODC [Fieldguides](https://fieldguides.github.io/library/)
55
- - The DITA Gateway [D2G](https://d2g.dita.digital)
75
+ - Bokbasen's [Allbok.no](https://www.allbok.no)
76
+ - Allvir's [Allvit.no](https://www.allvit.no) Reading Platform
77
+ - The UNODC [Fieldguides](https://fieldguides.github.io/library)
78
+ - The DITA Gateway [D2G](https://d2g.dita.digital) with several open collections
79
+ - [Ekitabu's](https://d2g.dita.digital) Web Reader Implementations through Dita Gateway
80
+ - [NYPL's](https://www.nypl.org/) Web Reader Implementations
81
+ - Bibliotheca's [CloudLibrary](https://www.yourcloudlibrary.com) as Sample Reader and Full ePub Reader
82
+ - Above the Treeline's [Edeweiss+](https://www.edelweiss.plus)
83
+ - [Bluefire's](https://www.bluefirereader.com) Web Reader Implementations
84
+ - In a Project in the Meta Verse (to be named once public)
85
+ - and a few more... :)
86
+
56
87
 
57
88
  # Contributing
58
89
  Contributions are always welcomed! Please see [CONTRIBUTING](CONTRIBUTING.md) for detailed guidelines.
@@ -70,5 +101,13 @@ npm run build && npm run examples
70
101
  ```
71
102
  Then visit `http://localhost:4444/`. Follow the prompts to view example apps.
72
103
 
104
+ ### WIKI
105
+ - [Implementation Guides and Examples](https://github.com/d-i-t-a/R2D2BC/wiki)
106
+
107
+ ### Migration Guides
108
+ - [Version 1.x -> 2.x](MIGRATION.md)
109
+ ### Change Log
110
+ - [2.0.x](CHANGELOG.md)
111
+
73
112
  ## Supporters
74
113
  [<img src="https://dita.digital/jetbrains.png" width="60">](https://www.jetbrains.com/?from=R2D2BC)
package/dist/esm/index.js CHANGED
@@ -52198,37 +52198,34 @@ var SearchModule = class {
52198
52198
  }
52199
52199
  let i = 0;
52200
52200
  if (tocItem) {
52201
- let href = this.publication.getAbsoluteHref(tocItem.Href);
52202
52201
  let doc = this.delegate.iframes[0].contentDocument;
52203
52202
  if (doc) {
52204
- await fetch(href).then((r) => r.text()).then(async (_data) => {
52205
- if (tocItem) {
52206
- searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
52207
- result.forEach((searchItem) => {
52208
- let selectionInfo = {
52209
- rangeInfo: searchItem.rangeInfo
52210
- };
52211
- setTimeout(() => {
52212
- let highlight;
52213
- if (i === index2) {
52214
- highlight = this.createSearchHighlight(selectionInfo, this.properties?.current);
52215
- this.jumpToMark(index2);
52216
- } else {
52217
- highlight = this.createSearchHighlight(selectionInfo, this.properties?.color);
52218
- }
52219
- searchItem.highlight = highlight;
52220
- localSearchResultChapter.push(searchItem);
52221
- this.currentChapterSearchResult.push(searchItem);
52222
- this.currentSearchHighlights.push(highlight);
52223
- i++;
52224
- }, 500);
52225
- });
52203
+ if (tocItem) {
52204
+ searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
52205
+ result.forEach((searchItem) => {
52206
+ let selectionInfo = {
52207
+ rangeInfo: searchItem.rangeInfo
52208
+ };
52226
52209
  setTimeout(() => {
52227
- callback(localSearchResultChapter);
52210
+ let highlight;
52211
+ if (i === index2) {
52212
+ highlight = this.createSearchHighlight(selectionInfo, this.properties?.current);
52213
+ this.jumpToMark(index2);
52214
+ } else {
52215
+ highlight = this.createSearchHighlight(selectionInfo, this.properties?.color);
52216
+ }
52217
+ searchItem.highlight = highlight;
52218
+ localSearchResultChapter.push(searchItem);
52219
+ this.currentChapterSearchResult.push(searchItem);
52220
+ this.currentSearchHighlights.push(highlight);
52221
+ i++;
52228
52222
  }, 500);
52229
52223
  });
52230
- }
52231
- });
52224
+ setTimeout(() => {
52225
+ callback(localSearchResultChapter);
52226
+ }, 500);
52227
+ });
52228
+ }
52232
52229
  }
52233
52230
  }
52234
52231
  }
@@ -57565,37 +57562,34 @@ var DefinitionsModule = class {
57565
57562
  }
57566
57563
  let localSearchDefinitions = [];
57567
57564
  if (tocItem) {
57568
- const href = this.publication.getAbsoluteHref(tocItem.Href);
57569
- await fetch(href).then((r) => r.text()).then(async (_data) => {
57570
- for (const termKey of item.terms) {
57571
- const tindex = item.terms.indexOf(termKey);
57572
- if (tocItem) {
57573
- await searchDocDomSeek(termKey, this.delegate.iframes[0].contentDocument, tocItem.Href, tocItem.Title, this.delegate.definitionsModule?.properties.fullWordSearch).then((result) => {
57574
- let i = void 0;
57575
- if (item.result == 1) {
57576
- i = 0;
57577
- } else if (item.result == 2) {
57578
- i = Math.floor(Math.random() * result.length - 1) + 1;
57579
- }
57580
- result.forEach((searchItem, index2) => {
57581
- if (i === void 0 || i === index2) {
57582
- const selectionInfo = {
57583
- rangeInfo: searchItem.rangeInfo
57584
- };
57585
- const highlight = this.createDefinitionHighlight(selectionInfo, item);
57586
- searchItem.highlight = highlight;
57587
- localSearchDefinitions.push(lodash3.omit(highlight, "definition"));
57588
- this.currentChapterPopupResult.push(searchItem);
57589
- this.currentPopupHighlights.push(highlight);
57590
- }
57591
- });
57592
- if (tindex === item.terms.length - 1) {
57593
- callback(localSearchDefinitions);
57565
+ for (const termKey of item.terms) {
57566
+ const tindex = item.terms.indexOf(termKey);
57567
+ if (tocItem) {
57568
+ await searchDocDomSeek(termKey, this.delegate.iframes[0].contentDocument, tocItem.Href, tocItem.Title, this.delegate.definitionsModule?.properties.fullWordSearch).then((result) => {
57569
+ let i = void 0;
57570
+ if (item.result == 1) {
57571
+ i = 0;
57572
+ } else if (item.result == 2) {
57573
+ i = Math.floor(Math.random() * result.length - 1) + 1;
57574
+ }
57575
+ result.forEach((searchItem, index2) => {
57576
+ if (i === void 0 || i === index2) {
57577
+ const selectionInfo = {
57578
+ rangeInfo: searchItem.rangeInfo
57579
+ };
57580
+ const highlight = this.createDefinitionHighlight(selectionInfo, item);
57581
+ searchItem.highlight = highlight;
57582
+ localSearchDefinitions.push(lodash3.omit(highlight, "definition"));
57583
+ this.currentChapterPopupResult.push(searchItem);
57584
+ this.currentPopupHighlights.push(highlight);
57594
57585
  }
57595
57586
  });
57596
- }
57587
+ if (tindex === item.terms.length - 1) {
57588
+ callback(localSearchDefinitions);
57589
+ }
57590
+ });
57597
57591
  }
57598
- });
57592
+ }
57599
57593
  }
57600
57594
  }
57601
57595
  async define(item) {