HackPlan / quark-shell-mac

Quark Shell for Mac helps web developers to create native-like Mac menubar app using HTML and JavaScript without writing any native code.
MIT License
910 stars 42 forks source link

Clipboard API #7

Open acketon opened 10 years ago

acketon commented 10 years ago

Could you add a simple copy to clipboard api? Since all of the content is in a web view I can't find a way to use Javascript to copy text/etc to the clipboard.

Node Webkit has a clipboard api that seems to work well: https://github.com/rogerwang/node-webkit/wiki/Clipboard

https://github.com/rogerwang/node-webkit/tree/897288eac99ca9895bf209367a9526be67579f1f/src/api/clipboard

Thanks

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3435202-clipboard-api?utm_campaign=plugin&utm_content=tracker%2F899498&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F899498&utm_medium=issues&utm_source=github).
acketon commented 10 years ago

I added this pasteboard example I found on stack overflow, but I don't really understand it. It works and I tied it to a mw.copyString() that I based off the openURL() function

-(void)copyString:(NSString)str { NSPasteboard pb = [NSPasteboard generalPasteboard]; NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil]; [pb declareTypes:types owner:self]; [pb setString: str forType:NSStringPboardType]; }

styfle commented 6 years ago

You can try using https://github.com/styfle/copee