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

Partially support IE11 #2216

Merged
merged 4 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,9 @@ The xterm.js team maintains the following addons but they can be built by anyone

## Browser Support

Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Here is a list of the versions we aim to support:
Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Specifically the latest versions of *Chrome*, *Edge*, *Firefox* and *Safari*.

- Chrome latest
- Edge latest
- Firefox latest
- Safari latest
- IE11
We also partially support *Intenet Explorer 11*, meaning xterm.js should work for the most part, but we reserve the right to not provide workarounds specifically for it unless it's absolutely necessary to get the basic input/output flow working.

Xterm.js works seamlessly in [Electron](https://electronjs.org/) apps and may even work on earlier versions of the browsers, these are the versions we strive to keep working.

Expand Down
29 changes: 4 additions & 25 deletions src/Clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@

import { ITerminal, ISelectionManager } from './Types';

interface IWindow extends Window {
clipboardData?: {
getData(format: string): string;
setData(format: string, data: string): void;
};
}

declare var window: IWindow;

/**
* Prepares text to be pasted into the terminal by normalizing the line endings
* @param text The pasted text that needs processing before inserting into the terminal
Expand All @@ -38,12 +29,7 @@ export function bracketTextForPaste(text: string, bracketedPasteMode: boolean):
* @param ev The original copy event to be handled
*/
export function copyHandler(ev: ClipboardEvent, term: ITerminal, selectionManager: ISelectionManager): void {
if (term.browser.isMSIE) {
window.clipboardData.setData('Text', selectionManager.selectionText);
} else {
ev.clipboardData.setData('text/plain', selectionManager.selectionText);
}

ev.clipboardData.setData('text/plain', selectionManager.selectionText);
// Prevent or the original text will be copied.
ev.preventDefault();
}
Expand All @@ -66,16 +52,9 @@ export function pasteHandler(ev: ClipboardEvent, term: ITerminal): void {
term.cancel(ev);
};

if (term.browser.isMSIE) {
if (window.clipboardData) {
text = window.clipboardData.getData('Text');
dispatchPaste(text);
}
} else {
if (ev.clipboardData) {
text = ev.clipboardData.getData('text/plain');
dispatchPaste(text);
}
if (ev.clipboardData) {
text = ev.clipboardData.getData('text/plain');
dispatchPaste(text);
}
}

Expand Down
4 changes: 0 additions & 4 deletions src/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
: ev.which !== null && ev.which !== undefined
? ev.which - 1
: null;

if (Browser.isMSIE) {
button = button === 1 ? 0 : button === 4 ? 1 : button;
}
break;
case 'mouseup':
button = 3;
Expand Down
1 change: 0 additions & 1 deletion src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ export interface IBrowser {
userAgent: string;
platform: string;
isFirefox: boolean;
isMSIE: boolean;
isMac: boolean;
isIpad: boolean;
isIphone: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/common/Platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const platform = (isNode) ? 'node' : navigator.platform;

export const isFirefox = !!~userAgent.indexOf('Firefox');
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
export const isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident');

// Find the users platform. We use this to interpret the meta key
// and ISO third level shifts.
Expand Down