-
Couldn't load subscription status.
- Fork 22
Moving web view to KotlinJS
PDF Viewer plugin code is divided into two main parts:
- Actual plugin code that runs in the IDE process
-
web-viewcode that runs in the JCEF browser and does actual rendering of the PDFs
The actual PDF rendering component is provided by ng2-pdfjs-viewer. As the ng2-pdfjs-viewer runs PDF.js viewer in an iframe, it introduces a lot of issues, such as slow reloads and losing scroll/zoom states between updates. To fix these issues, I decided to use a custom build of PDF.js and run it on the actual webpage instead of an iframe. Because of that, web-view code can now be written without Angular.
Both parts use a lot of the same code (internal state representation and messaging infrastructure). To minimize code duplication, both parts are now written in Kotlin and use shared code from mpi module.
In summary:
- Most of the code is now written in Kotlin
- Shared logic is moved to the
mpimodule (compiles to JVM bytecode and JS) -
web-viewis split into two modules:-
bootstrap(initial setups for the PDF.js) -
viewer(actual viewer logic)
-
You can check the kotlinjs-migrate branch if you are interested.