@fluid-topics/ft-reader-content 2.0.4 → 2.0.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.
@@ -1,4 +1,4 @@
1
- import { TemplateResult } from "lit";
1
+ import { PropertyValues, TemplateResult } from "lit";
2
2
  import { Debouncer, ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
4
4
  import { FtReaderPage, FtReaderScrollTarget } from "@fluid-topics/ft-reader-context/build/store/model";
@@ -17,11 +17,12 @@ export declare class FtReaderContent extends FtReaderComponent implements FtRead
17
17
  renderBeforeFirst: number;
18
18
  renderAfterLast: number;
19
19
  mapId?: string;
20
- container?: FtInfiniteScroll<any>;
20
+ contentContainer?: FtInfiniteScroll<any>;
21
21
  private watermark?;
22
22
  private renderItem;
23
23
  private getItemKey;
24
24
  protected render(): TemplateResult<1>;
25
+ protected willUpdate(props: PropertyValues<FtReaderContent>): void;
25
26
  protected renderTopicInContext(tocId: string, index: number): TemplateResult<1>;
26
27
  protected getScrollTarget(): string | null;
27
28
  protected renderedTopicsDebouncer: Debouncer;
@@ -52,6 +52,15 @@ class FtReaderContent extends FtReaderComponent {
52
52
  .heightReference=${this.offsetParent}></ft-content-watermark>
53
53
  `;
54
54
  }
55
+ willUpdate(props) {
56
+ var _a;
57
+ super.willUpdate(props);
58
+ if (props.has("renderTopic")) {
59
+ // Propagates the renderTopic change to the children depending on renderItem
60
+ // Fix introduced in FT-15378 (https://youtrack.antidot.net/issue/FT-15378/Reader-designer-View-not-updated-when-changing-topic-template)
61
+ (_a = this.contentContainer) === null || _a === void 0 ? void 0 : _a.requestUpdate();
62
+ }
63
+ }
55
64
  renderTopicInContext(tocId, index) {
56
65
  return html `
57
66
  <ft-reader-topic-context tocId="${tocId}"
@@ -67,7 +76,7 @@ class FtReaderContent extends FtReaderComponent {
67
76
  return null;
68
77
  }
69
78
  // If there's a section specified and the target topic is visible, the topic itself will handle the scroll
70
- const isRendered = (_a = this.container) === null || _a === void 0 ? void 0 : _a.isRendered((_b = this.scrollTarget) === null || _b === void 0 ? void 0 : _b.tocId);
79
+ const isRendered = (_a = this.contentContainer) === null || _a === void 0 ? void 0 : _a.isRendered((_b = this.scrollTarget) === null || _b === void 0 ? void 0 : _b.tocId);
71
80
  if (((_c = this.scrollTarget) === null || _c === void 0 ? void 0 : _c.tocId) && (!isRendered || this.scrollTarget.section == null)) {
72
81
  return this.scrollTarget.tocId;
73
82
  }
@@ -126,7 +135,7 @@ __decorate([
126
135
  ], FtReaderContent.prototype, "mapId", void 0);
127
136
  __decorate([
128
137
  query(".ft-reader-content")
129
- ], FtReaderContent.prototype, "container", void 0);
138
+ ], FtReaderContent.prototype, "contentContainer", void 0);
130
139
  __decorate([
131
140
  redux({ selector: (state) => { var _a; return (_a = state.map) === null || _a === void 0 ? void 0 : _a.watermark; } })
132
141
  ], FtReaderContent.prototype, "watermark", void 0);