xterm-addon-clipboard to scoped module
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
## xterm-addon-clipboard
|
||||
## @xterm/addon-clipboard
|
||||
|
||||
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables accessing the system clipboard. This addon requires xterm.js v4+.
|
||||
|
||||
### Install
|
||||
|
||||
```bash
|
||||
npm install --save xterm-addon-clipboard
|
||||
npm install --save @xterm/addon-clipboard
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```ts
|
||||
import { Terminal } from 'xterm';
|
||||
import { ClipboardAddon } from 'xterm-addon-clipboard';
|
||||
import { ClipboardAddon } from '@xterm/addon-clipboard';
|
||||
|
||||
const terminal = new Terminal();
|
||||
const clipboardAddon = new ClipboardAddon();
|
||||
@@ -23,7 +23,7 @@ To use a custom clipboard provider
|
||||
|
||||
```ts
|
||||
import { Terminal, IClipboardProvider, ClipboardSelection } from 'xterm';
|
||||
import { ClipboardAddon } from 'xterm-addon-clipboard';
|
||||
import { ClipboardAddon } from '@xterm/addon-clipboard';
|
||||
|
||||
function b64Encode(data: string): string {
|
||||
// Base64 encode impl
|
||||
@@ -49,4 +49,4 @@ const clipboardAddon = new ClipboardAddon(new MyCustomClipboardProvider());
|
||||
terminal.loadAddon(clipboardAddon);
|
||||
```
|
||||
|
||||
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-clipboard/typings/xterm-addon-clipboard.d.ts) for more advanced usage.
|
||||
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-clipboard/typings/addon-clipboard.d.ts) for more advanced usage.
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "xterm-addon-clipboard",
|
||||
"name": "@xterm/addon-clipboard",
|
||||
"version": "0.1.0",
|
||||
"author": {
|
||||
"name": "The xterm.js authors",
|
||||
"url": "https://xtermjs.org/"
|
||||
},
|
||||
"main": "lib/xterm-addon-clipboard.js",
|
||||
"types": "typings/xterm-addon-clipboard.d.ts",
|
||||
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-clipboard",
|
||||
"main": "lib/addon-clipboard.js",
|
||||
"types": "typings/addon-clipboard.d.ts",
|
||||
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-clipboard",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"terminal",
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { ClipboardProvider } from './ClipboardProvider';
|
||||
import { IClipboardProvider, IDisposable, ITerminalAddon, Terminal } from 'xterm';
|
||||
import { IClipboardProvider, IDisposable, ITerminalAddon, Terminal } from '@xterm/xterm';
|
||||
|
||||
export class ClipboardAddon implements ITerminalAddon {
|
||||
private _disposable: IDisposable | undefined;
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { Base64 } from 'js-base64';
|
||||
import { ClipboardSelectionType, IClipboardProvider } from 'xterm';
|
||||
import { ClipboardSelectionType, IClipboardProvider } from '@xterm/xterm';
|
||||
|
||||
export class ClipboardProvider implements IClipboardProvider {
|
||||
constructor(
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Terminal, ITerminalAddon, IClipboardProvider, ClipboardSelection as ClipboardSelectionType } from 'xterm';
|
||||
|
||||
declare module 'xterm-addon-clipboard' {
|
||||
declare module '@xterm/addon-clipboard' {
|
||||
export class ClipboardProvider implements IClipboardProvider{
|
||||
public readText(selection: ClipboardSelectionType): Promise<string>;
|
||||
public writeText(selection: ClipboardSelectionType, data: string): Promise<void>;
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
const path = require('path');
|
||||
|
||||
const addonName = 'ClipboardAddon';
|
||||
const mainFile = 'xterm-addon-clipboard.js';
|
||||
const mainFile = 'addon-clipboard.js';
|
||||
|
||||
module.exports = {
|
||||
entry: `./out/${addonName}.js`,
|
||||
Reference in New Issue
Block a user