Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

feat(plugins-runtime): allow openPage() to toggle opening a new window#219

Merged
Alotor merged 1 commit intopenpot:mainfrom
mdbenito:feature/open-page-new-tab
Nov 20, 2025
Merged

feat(plugins-runtime): allow openPage() to toggle opening a new window#219
Alotor merged 1 commit intopenpot:mainfrom
mdbenito:feature/open-page-new-tab

Conversation

@mdbenito
Copy link
Contributor

@mdbenito mdbenito commented Nov 14, 2025

Summary

This PR adds the extension to the :openPage command in page-proxy and context with an additional parameter submitted here. The parameter allows toggling the current default behaviour of always opening new Pages in separate browser tabs/windows.

I believe this is necessary because it's AFAICT otherwise impossible for plugins to navigate to shapes outside the current page. As it is right now, the plugin is unloaded in the new browser tab, making any action subsequent to openPage impossible.

Open questions:

  1. In order not to break expectations for API users, I've handled undefined in the second argument to have the previous behaviour. Maybe there's another preferred way of handling defaults.
  2. I have also done this in the frontend's code, which is redundant, but I'm not sure what the release process is, and whether or not it is possible for someone to mix versions
  3. I see that the page-proxy has an :openPage slot as well, but this is not exposed in the API. Should we add that? And if we do, wouldn't it make more sense to call it :open, since it's already inside Page?

@Alotor
Copy link
Member

Alotor commented Nov 14, 2025

Thanks! Looks good to me. I'll wait to merge until MR in core is done.

@mdbenito
Copy link
Contributor Author

Thanks! Looks good to me. I'll wait to merge until MR in core is done.

Regarding that PR, Andrey suggested that we use an options object, instead of positional parameters. This will require the introduction of a OpenPageOptions interface or some such. Does this sound good? Do you have any examples / pattern I should follow?

@niwinz
Copy link
Contributor

niwinz commented Nov 20, 2025

penpot/penpot#7753 merged. I mention it here for reference of a discussion on that PR about how to extend it on future.

@Alotor Alotor merged commit da8288b into penpot:main Nov 20, 2025
2 checks passed
@mdbenito mdbenito deleted the feature/open-page-new-tab branch November 20, 2025 17:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants