clippy
所属分类:内容生成
开发工具:Dart
文件大小:25KB
下载次数:0
上传日期:2022-05-11 07:31:57
上 传 者:
sh-1993
说明: Dart中的访问系统剪贴板(服务器和浏览器)
(Access system clipboard in Dart (Server&Browser))
文件列表:
.travis.yml (148, 2018-08-10)
CHANGELOG.md (156, 2018-08-10)
LICENSE (1494, 2018-08-10)
analysis_options.yaml (374, 2018-08-10)
appveyor.yml (206, 2018-08-10)
example (0, 2018-08-10)
example\pubspec.yaml (249, 2018-08-10)
example\server (0, 2018-08-10)
example\server\main.dart (191, 2018-08-10)
example\web (0, 2018-08-10)
example\web\index.html (1967, 2018-08-10)
example\web\main.dart (732, 2018-08-10)
lib (0, 2018-08-10)
lib\browser.dart (1401, 2018-08-10)
lib\server.dart (449, 2018-08-10)
lib\src (0, 2018-08-10)
lib\src\backends (0, 2018-08-10)
lib\src\backends\windows (0, 2018-08-10)
lib\src\backends\windows\copy.exe (18432, 2018-08-10)
lib\src\backends\windows\paste.exe (17920, 2018-08-10)
lib\src\browser.dart (1935, 2018-08-10)
lib\src\clipboard.dart (105, 2018-08-10)
lib\src\server.dart (2698, 2018-08-10)
pubspec.yaml (296, 2018-08-10)
test (0, 2018-08-10)
test\server_test.dart (501, 2018-08-10)
_**Clippy ”** Access system clipboard in Dart (Server & Browser)_
[![Pub](https://img.shields.io/pub/v/clippy.svg?style=flat-square)](https://pub.dartlang.org/packages/clippy)
[![Build Status](https://travis-ci.org/andresaraujo/clippy.svg?branch=master)](https://travis-ci.org/andresaraujo/clippy)
[![Build status](https://ci.appveyor.com/api/projects/status/ufiu8o0wvugr149b?svg=true)](https://ci.appveyor.com/project/andresaraujo/clippy)
A library to access the clipboard (copy/paste) for server and browser
### Install
Add `clippy` to dependencies/dev_dependencies in in your pubspec.yaml
### Usage
#### Server
In the server Clippy supports writing and reading from the clipboard. It uses system tools for this:
- On linux uses `xsel` (Install if needed)
- On Mac uses `pbcopy`/`pbpaste`
- On windows it embeds a copy/paste tool [win-clipboard](https://github.com/sindresorhus/win-clipboard)
```dart
import 'package:clippy/server.dart' as clippy;
main() async {
// Write to clipboard
await clippy.write('https://github.com/andresaraujo/clippy');
// Read from clipboard
final clipboard = await clippy.read();
}
```
See [example/server](/example/server)
#### Browser
In the browser Clippy supports writing and listening to paste events.
```dart
import 'package:clippy/browser.dart' as clippy;
main() async {
// Write a string to clipboard
await clippy.write('https://github.com/andresaraujo/clippy');
// Write text from an element to clipboard
await clippy.write(element);
// Write current selection to clipboard
await clippy.write();
// Listen to paste event
clippy.onPaste.listen((text) => print('OnPaste: $text'));
}
```
See [example/web](/example/web)
近期下载者:
相关文件:
收藏者: