Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Windowing APIs to Other Plugins #51

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anonhostpi
Copy link

@anonhostpi anonhostpi commented Jun 23, 2024

This is a very short PR. I just expose the following functions at the plugin object:

Exposed API:

  • getWindows()
  • showWindows()
  • hideWindows()
  • toggleWindows()

Why?

Make it so that other plugins can make use of your Windowing API. An example usage would be within DataviewJS or Templater to switch window focus back when another plugin like Teleprompter switches focus away.

Example usage:

Say you work in customer service, and you want to open a teleprompter in one window and a modal form in another. The teleprompter window tells you what questions to ask, and you fill out the modal form

# Customer Contact Form:
<%-*
// templater script:
const teleprompter = app.plugins.plugins.teleprompter.api
const modalForms = app.plugins.plugins.modalForms.api

const tray = app.plugins.plugins.tray

const thisWindow = tray.getCurrentWindow()

// open Teleprompter in another window
await teleprompter.open({
  file: "Customer Questionaire",
  placement: "window",
  pin: true,
  play: true
});

// return focus back to this window
thisWindow.focus()

const responses = await modalForm.openForm("customer-responses");

teleprompter.close()
%>

exposes:
- getWindows()
- showWindows()
- hideWindows()
- toggleWindows()
@anonhostpi anonhostpi changed the title Patch 1 Expose Windowing APIs to Other Plugins Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant