mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
Preserve redoc element params after dispose
This commit is contained in:
parent
3f04192a15
commit
0fb88e99c2
|
@ -117,6 +117,7 @@ export default class Redoc extends BaseComponent {
|
||||||
static dispose() {
|
static dispose() {
|
||||||
let dom = new BrowserDomAdapter();
|
let dom = new BrowserDomAdapter();
|
||||||
let el = dom.query('redoc');
|
let el = dom.query('redoc');
|
||||||
|
let elClone;
|
||||||
let parent;
|
let parent;
|
||||||
let nextSibling;
|
let nextSibling;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
@ -124,14 +125,15 @@ export default class Redoc extends BaseComponent {
|
||||||
nextSibling = el.nextElementSibling;
|
nextSibling = el.nextElementSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elClone = el.cloneNode(false);
|
||||||
|
|
||||||
if (Redoc.appRef) {
|
if (Redoc.appRef) {
|
||||||
Redoc.appRef.dispose();
|
Redoc.appRef.dispose();
|
||||||
Redoc.appRef = null;
|
Redoc.appRef = null;
|
||||||
|
|
||||||
// Redoc dispose removes host element, so need to restore it
|
// Redoc dispose removes host element, so need to restore it
|
||||||
el = dom.createElement('redoc');
|
elClone.innerHTML = 'Loading...';
|
||||||
el.innerText = 'Loading...';
|
parent && parent.insertBefore(elClone, nextSibling);
|
||||||
parent && parent.insertBefore(el, nextSibling);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user