daybrush / infinite-viewer

Infinite Viewer is Document Viewer Component with infinite scrolling.
https://daybrush.com/infinite-viewer/
MIT License
296 stars 33 forks source link

new InfiniteViewer will empty the iframe #52

Open zlyyyy opened 1 year ago

zlyyyy commented 1 year ago

There is an iframe in the viewport, and the content of the iframe will be cleared after the new InfiniteViewer

zlyyyy commented 1 year ago

Here is my minimal rendition https://stackblitz.com/edit/stackblitz-starters-rb32s7?file=src%2FApp.tsx

zlyyyy commented 1 year ago

image emty dom

zlyyyy commented 1 year ago

@daybrush Trying to downgrade the version can't solve it, it seems to be a persistent problem

zlyyyy commented 1 year ago

image It is normal to write before iframe write, and init will reproduce after write

zlyyyy commented 1 year ago

After looking at the source code, these two lines of code lead to

        if (!wrapperElement) {
            wrapperElement = doc.createElement("div");
            wrapperElement.insertBefore(this._viewportElement, null);
            containerElement.insertBefore(wrapperElement, null);
        }