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

[Feature/Plugin API] Add clipboard wrapper methods to context app #3977

Conversation

jasonblalock
Copy link
Contributor

@jasonblalock jasonblalock commented Aug 30, 2021

  • Adds clipboard object with .readText and .writeText methods using
    underlying electorn clipboard methods

Closes INS-919

@develohpanda develohpanda self-requested a review August 31, 2021 00:38
@develohpanda develohpanda added the A-plugin-api Area: Plugin API / System label Aug 31, 2021
@develohpanda develohpanda force-pushed the feature/add-clipboard-to-plugin-api-context branch from 4919ed6 to b966bef Compare August 31, 2021 04:33
Copy link
Contributor

@develohpanda develohpanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Verified with a small plugin I made to QA, which exports a workspace directly into your clipboard! Ever since you talked about the clipboard API being available to plugins, I've had so many quality-of-life ideas which can be built out as plugins 🙌🏽

For anybody else looking at this, there is further discussion about this in the Insomnia Slack.

module.exports.workspaceActions = [
  {
    action: async (context, {workspace}) => {
      const exportContents = await context.data.export.insomnia(workspace);

      // This is new!!
      context.app.clipboard.writeText(exportContents);

      await context.app.alert('Exported to clipboard', `The workspace ${workspace.name} has been exported to your clipboard.`);
    },
    label: 'Export to clipboard',
  },
]

2021-08-31 16 52 24

@develohpanda develohpanda force-pushed the feature/add-clipboard-to-plugin-api-context branch from b966bef to 408619c Compare August 31, 2021 05:08
Copy link
Contributor

@wdawson wdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! ⛵ Thanks for the work on this!

Jason Blalock and others added 4 commits September 1, 2021 13:17
- Adds clipboard object with `.readText` and `.writeText` methods using
underlying electorn clipboard methods
Co-authored-by: Jason Blalock <jasonblalock@users.noreply.github.com>
@dimitropoulos dimitropoulos force-pushed the feature/add-clipboard-to-plugin-api-context branch from 98c6cd0 to 7be828a Compare September 1, 2021 17:18
Copy link
Contributor

@dimitropoulos dimitropoulos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thanks! This oughta be useful!

@jasonblalock jasonblalock deleted the feature/add-clipboard-to-plugin-api-context branch February 28, 2022 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-plugin-api Area: Plugin API / System
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants