@fluid-topics/ft-reader-topic-content 2.2.16 → 2.2.18
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.
|
@@ -2,7 +2,7 @@ import { PropertyValues } from "lit";
|
|
|
2
2
|
import { FtReaderTopicContentProperties } from "./ft-reader-topic-content.properties";
|
|
3
3
|
import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
|
|
4
4
|
import { FtReaderPage, FtReaderScrollTarget } from "@fluid-topics/ft-reader-context/build/store/model";
|
|
5
|
-
import { FtMap } from "@fluid-topics/public-api";
|
|
5
|
+
import { FtMap, FtTocNodeFiltered } from "@fluid-topics/public-api";
|
|
6
6
|
import "@fluid-topics/ft-icon/build/define";
|
|
7
7
|
export declare class FtReaderTopicContent extends FtReaderTopicComponent implements FtReaderTopicContentProperties {
|
|
8
8
|
static styles: import("lit").CSSResult[];
|
|
@@ -15,6 +15,7 @@ export declare class FtReaderTopicContent extends FtReaderTopicComponent impleme
|
|
|
15
15
|
linkPreviewDialogId?: string;
|
|
16
16
|
scrollTarget?: FtReaderScrollTarget;
|
|
17
17
|
currentPage?: FtReaderPage;
|
|
18
|
+
filteredTocNodes?: Record<string, FtTocNodeFiltered>;
|
|
18
19
|
content?: string;
|
|
19
20
|
error?: Error;
|
|
20
21
|
searchInDocumentQuery?: string;
|
|
@@ -25,6 +26,7 @@ export declare class FtReaderTopicContent extends FtReaderTopicComponent impleme
|
|
|
25
26
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
26
27
|
protected update(props: PropertyValues): void;
|
|
27
28
|
private updateContent;
|
|
29
|
+
get isFiltered(): FtTocNodeFiltered | undefined;
|
|
28
30
|
protected contentAvailableCallback(props: PropertyValues<FtReaderTopicContent>): void;
|
|
29
31
|
processExpandingBlocks(): void;
|
|
30
32
|
processOpenApiSelect(): void;
|
|
@@ -20,7 +20,7 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
var _a, _b, _c;
|
|
23
|
-
if (!this.map || (!this.error && !this.content && ((_a = this.translationSourceLanguage) === null || _a === void 0 ? void 0 : _a.code) == ((_b = this.translationDestinationLanguage) === null || _b === void 0 ? void 0 : _b.code))) {
|
|
23
|
+
if (!this.map || (!this.error && !this.content && !this.isFiltered && ((_a = this.translationSourceLanguage) === null || _a === void 0 ? void 0 : _a.code) == ((_b = this.translationDestinationLanguage) === null || _b === void 0 ? void 0 : _b.code))) {
|
|
24
24
|
return html `
|
|
25
25
|
<section class="topic-loading"></section>
|
|
26
26
|
`;
|
|
@@ -36,7 +36,7 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
36
36
|
}
|
|
37
37
|
update(props) {
|
|
38
38
|
super.update(props);
|
|
39
|
-
if (["map", "tocNode", "translationDestinationLanguage", "translationProfileId"].some((p) => props.has(p))) {
|
|
39
|
+
if (["map", "tocNode", "translationDestinationLanguage", "translationProfileId", "filteredTocNodes"].some((p) => props.has(p))) {
|
|
40
40
|
this.updateContent();
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -44,10 +44,14 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
44
44
|
var _a;
|
|
45
45
|
this.error = undefined;
|
|
46
46
|
this.content = undefined;
|
|
47
|
-
if (this.
|
|
47
|
+
if (this.tocNode && !this.isFiltered) {
|
|
48
48
|
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.fetchTopicContent(this.tocNode).then((content) => this.contentPreprocessor(content || "<div class=\"empty-topic\"></div>")).then((content) => this.content = content).catch((e) => this.error = e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
get isFiltered() {
|
|
52
|
+
var _a;
|
|
53
|
+
return this.tocNode && ((_a = this.filteredTocNodes) === null || _a === void 0 ? void 0 : _a[this.tocNode.tocId]);
|
|
54
|
+
}
|
|
51
55
|
contentAvailableCallback(props) {
|
|
52
56
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
53
57
|
super.contentAvailableCallback(props);
|
|
@@ -143,7 +147,7 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
143
147
|
if (this.headingStartLevel != null && ((_d = this.currentPage) === null || _d === void 0 ? void 0 : _d.rootTocId)) {
|
|
144
148
|
topicLevel = (((_e = this.tocNode) === null || _e === void 0 ? void 0 : _e.depth) || 1) - (((_f = this.currentPage) === null || _f === void 0 ? void 0 : _f.rootDepth) || 1) + this.headingStartLevel;
|
|
145
149
|
}
|
|
146
|
-
return this.translationLoading || !this.content
|
|
150
|
+
return this.translationLoading || (!this.content && !this.isFiltered)
|
|
147
151
|
? html `
|
|
148
152
|
<ft-skeleton></ft-skeleton>`
|
|
149
153
|
: html `
|
|
@@ -201,6 +205,11 @@ __decorate([
|
|
|
201
205
|
__decorate([
|
|
202
206
|
redux({ store: "reader" })
|
|
203
207
|
], FtReaderTopicContent.prototype, "currentPage", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
redux({
|
|
210
|
+
store: "reader",
|
|
211
|
+
})
|
|
212
|
+
], FtReaderTopicContent.prototype, "filteredTocNodes", void 0);
|
|
204
213
|
__decorate([
|
|
205
214
|
state()
|
|
206
215
|
], FtReaderTopicContent.prototype, "content", void 0);
|