4 ms·
This is very impressive. I'm curious how generic it is, is it possible to extend this to work with other structures like Canvas drawings or a React app?
by slmjkdbtl 5y ago
This is very impressive. I'm curious how generic it is, is it possible to extend this to work with other structures like Canvas drawings or a React app?
- cetinsert 5y agoIt is entirely generic and should work with all standards-compliant HTML (built-in and custom) elements. No code was written special-casing specific elements. If you right-click in the playground (https://try.webpdf.pro/ https://try.webpdf.pro/) and pick the "Foreign (Markdown)" context menu item, you will find an example that uses https://zerodevx.github.io/zero-md/ https://zerodevx.github.io/zero-md/ for Markdown editing/formatting via web components. The reason I force update-by-(re)load on other foreign elements is because there are lots of low-quality web component custom elements that do not deal with attribute or content changes as well as the standard HTML elements.
- cetinsert 5y agoHere is a demo involving a canvas element: https://try.webpdf.pro/canvas/ https://try.webpdf.pro/canvas/ Draw • draw in the gray box to update img src • right-click/long-tap on canvas to clear Play • add text around canvas or img elements • change canvas style attribute value