-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Feature/Plugin API] Add clipboard wrapper methods to context app #3977
Conversation
4919ed6
to
b966bef
Compare
There was a problem hiding this 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',
},
]
b966bef
to
408619c
Compare
packages/insomnia-app/app/plugins/context/__tests__/app.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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!
packages/insomnia-app/app/plugins/context/__tests__/app.test.ts
Outdated
Show resolved
Hide resolved
- Adds clipboard object with `.readText` and `.writeText` methods using underlying electorn clipboard methods
Co-authored-by: Jason Blalock <jasonblalock@users.noreply.github.com>
98c6cd0
to
7be828a
Compare
There was a problem hiding this 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!
.readText
and.writeText
methods usingunderlying electorn clipboard methods
Closes INS-919