Better docs for plugin api

The more I’ve worked with the api, the more I’ve felt its limitations, perhaps because the docs don’t illuminate the possibilities. I tried twice to create a plugin meeting 2 seemingly simple requirements:

  1. It should style elements matching a selector — easy!
  2. It should provide a visual indication (a flag) of whether blocks matching the criteria in 1 exist anywhere on the main section of the page — difficult!

The first attempt tries to discover what content is on the page using the DB, but there are limits as Journal pages, for example, lazily load content. Plus there are other sections like reference links. The plugin can’t consistently tell what blocks appear somewhere on the page.

The second attempt accesses the parent DOM but—I forgot about iframe isolation boundaries!—that presents cross-frame issues. When I was developing it locally everything worked fine. It wasn’t until I installed from the marketplace that the issue revealed its ugly head.

Both attempts at matching content have their shortcomings.

Maybe the someone else who takes a stab at these 2 requirements can decide how robust the plugin api is. It appears to be good for rendering new, independent UIs, but it feels too restrictive to coordinate with the main UI.

1 Like