mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +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() {
|
||||
let dom = new BrowserDomAdapter();
|
||||
let el = dom.query('redoc');
|
||||
let elClone;
|
||||
let parent;
|
||||
let nextSibling;
|
||||
if (el) {
|
||||
|
@ -124,14 +125,15 @@ export default class Redoc extends BaseComponent {
|
|||
nextSibling = el.nextElementSibling;
|
||||
}
|
||||
|
||||
elClone = el.cloneNode(false);
|
||||
|
||||
if (Redoc.appRef) {
|
||||
Redoc.appRef.dispose();
|
||||
Redoc.appRef = null;
|
||||
|
||||
// Redoc dispose removes host element, so need to restore it
|
||||
el = dom.createElement('redoc');
|
||||
el.innerText = 'Loading...';
|
||||
parent && parent.insertBefore(el, nextSibling);
|
||||
elClone.innerHTML = 'Loading...';
|
||||
parent && parent.insertBefore(elClone, nextSibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user