@d-i-t-a/reader 2.1.5 → 2.1.6
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/dist/esm/index.js +50 -21
- package/dist/esm/index.js.map +2 -2
- package/dist/reader.js +17 -17
- package/dist/reader.js.map +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -43140,18 +43140,33 @@ var SearchModule = class {
|
|
|
43140
43140
|
}
|
|
43141
43141
|
if (tocItem) {
|
|
43142
43142
|
let href = this.publication.getAbsoluteHref(tocItem.Href);
|
|
43143
|
-
|
|
43144
|
-
|
|
43145
|
-
|
|
43146
|
-
|
|
43147
|
-
|
|
43148
|
-
|
|
43149
|
-
|
|
43150
|
-
|
|
43143
|
+
if (this.delegate.api?.getContent) {
|
|
43144
|
+
this.delegate.api?.getContent(href).then((content) => {
|
|
43145
|
+
let parser = new DOMParser();
|
|
43146
|
+
let doc = parser.parseFromString(this.delegate.requestConfig?.encoded ? this.decodeBase64(content) : content, "application/xhtml+xml");
|
|
43147
|
+
if (tocItem) {
|
|
43148
|
+
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
43149
|
+
result.forEach((searchItem) => {
|
|
43150
|
+
localSearchResultBook.push(searchItem);
|
|
43151
|
+
this.bookSearchResult.push(searchItem);
|
|
43152
|
+
});
|
|
43151
43153
|
});
|
|
43152
|
-
}
|
|
43153
|
-
}
|
|
43154
|
-
}
|
|
43154
|
+
}
|
|
43155
|
+
});
|
|
43156
|
+
} else {
|
|
43157
|
+
await fetch(href, this.delegate.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
43158
|
+
let parser = new DOMParser();
|
|
43159
|
+
let doc = parser.parseFromString(this.delegate.requestConfig?.encoded ? this.decodeBase64(data) : data, "application/xhtml+xml");
|
|
43160
|
+
if (tocItem) {
|
|
43161
|
+
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
43162
|
+
result.forEach((searchItem) => {
|
|
43163
|
+
localSearchResultBook.push(searchItem);
|
|
43164
|
+
this.bookSearchResult.push(searchItem);
|
|
43165
|
+
});
|
|
43166
|
+
});
|
|
43167
|
+
}
|
|
43168
|
+
});
|
|
43169
|
+
}
|
|
43155
43170
|
}
|
|
43156
43171
|
if (index2 === this.publication.readingOrder.length - 1) {
|
|
43157
43172
|
return localSearchResultBook;
|
|
@@ -43177,17 +43192,31 @@ var SearchModule = class {
|
|
|
43177
43192
|
}
|
|
43178
43193
|
if (tocItem) {
|
|
43179
43194
|
let href = this.publication.getAbsoluteHref(tocItem.Href);
|
|
43180
|
-
|
|
43181
|
-
|
|
43182
|
-
|
|
43183
|
-
|
|
43184
|
-
|
|
43185
|
-
|
|
43186
|
-
|
|
43195
|
+
if (this.delegate.api?.getContent) {
|
|
43196
|
+
this.delegate.api?.getContent(href).then((content) => {
|
|
43197
|
+
let parser = new DOMParser();
|
|
43198
|
+
let doc = parser.parseFromString(this.delegate.requestConfig?.encoded ? this.decodeBase64(content) : content, "application/xhtml+xml");
|
|
43199
|
+
if (tocItem) {
|
|
43200
|
+
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
43201
|
+
result.forEach((searchItem) => {
|
|
43202
|
+
localSearchResultBook.push(searchItem);
|
|
43203
|
+
});
|
|
43187
43204
|
});
|
|
43188
|
-
}
|
|
43189
|
-
}
|
|
43190
|
-
}
|
|
43205
|
+
}
|
|
43206
|
+
});
|
|
43207
|
+
} else {
|
|
43208
|
+
await fetch(href, this.delegate.requestConfig).then((r) => r.text()).then(async (data) => {
|
|
43209
|
+
let parser = new DOMParser();
|
|
43210
|
+
let doc = parser.parseFromString(this.delegate.requestConfig?.encoded ? this.decodeBase64(data) : data, "application/xhtml+xml");
|
|
43211
|
+
if (tocItem) {
|
|
43212
|
+
searchDocDomSeek(term, doc, tocItem.Href, tocItem.Title).then((result) => {
|
|
43213
|
+
result.forEach((searchItem) => {
|
|
43214
|
+
localSearchResultBook.push(searchItem);
|
|
43215
|
+
});
|
|
43216
|
+
});
|
|
43217
|
+
}
|
|
43218
|
+
});
|
|
43219
|
+
}
|
|
43191
43220
|
}
|
|
43192
43221
|
return localSearchResultBook;
|
|
43193
43222
|
}
|