Skip to content

Commit

Permalink
fix(esl-note): fix broken connection between esl-note and esl-footnotes
Browse files Browse the repository at this point in the history
  • Loading branch information
dshovchko committed Aug 2, 2021
1 parent 2d407be commit 646ebbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/modules/esl-footnotes/core/esl-footnotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ESLFootnotes extends ESLBaseElement {
super.connectedCallback();

this.bindEvents();
EventUtils.dispatch(this, `${ESLNote.eventNs}:request`);
this._sendRequestToNote();
}

protected disconnectedCallback() {
Expand Down Expand Up @@ -102,4 +102,8 @@ export class ESLFootnotes extends ESLBaseElement {
note?.activate();
}
}

protected _sendRequestToNote() {
EventUtils.dispatch(this, `${ESLNote.eventNs}:request`);
}
}
9 changes: 6 additions & 3 deletions src/modules/esl-note/core/esl-note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ESLNote extends ESLBaseElement {
this._innerHTML = this.innerHTML;
super.connectedCallback();
this.bindEvents();
EventUtils.dispatch(this, `${ESLNote.eventNs}:response`);
this._sendResponseToFootnote();
}

@ready
Expand Down Expand Up @@ -96,7 +96,7 @@ export class ESLNote extends ESLBaseElement {
this._$footnotes = null;
this.innerHTML = this.html;
this.tabIndex = -1;
EventUtils.dispatch(this, `${ESLNote.eventNs}:ready`);
this._sendResponseToFootnote();
}

/** Merge params to pass to the toggleable */
Expand Down Expand Up @@ -160,7 +160,10 @@ export class ESLNote extends ESLBaseElement {
@bind
protected _onFootnotesReady(e: CustomEvent) {
if (this.linked) return;
EventUtils.dispatch(this, `${ESLNote.eventNs}:response`);
this._sendResponseToFootnote();
}

protected _sendResponseToFootnote() {
EventUtils.dispatch(this, `${ESLNote.eventNs}:response`);
}
}

0 comments on commit 646ebbc

Please sign in to comment.