Open exKAZUu opened 5 years ago
Hmm, or this plugin should try re-rendering the diagram of the DOM element double-clicked by a user ... ?
I thought that using MutationObserver would solve it.
observer = new MutationObserver(function() {
if (document.querySelectorAll("pre[lang='puml']").length > 0) {
run(config);
}
});
The following is a sample implementation. https://github.com/tsujimitsu/pegmatite/blob/support-github-dynamically/pegmatite/content-script.js#L201
Fired every time change github.com's DOM. This is bad point.
Some web apps (especially GitHub) renders web pages dynamically like SPA. However, this plugin doesn't render a diagram of PlantUML code inserted dynamically. So, I would recommend this plugin to detect DOM changes by watching DOM periodically (e.g. per 5 sec?) in order to render such a diagram.
Reproduction step