mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #2835 from Tyriar/2822
Add linkTooltipHoverDuration setting
This commit is contained in:
@@ -7,9 +7,7 @@ import { Disposable } from 'common/Lifecycle';
|
||||
import { addDisposableDomListener } from 'browser/Lifecycle';
|
||||
import { IMouseService, ISelectionService } from 'browser/services/Services';
|
||||
import { IMouseZoneManager, IMouseZone } from 'browser/Types';
|
||||
import { IBufferService } from 'common/services/Services';
|
||||
|
||||
const HOVER_DURATION = 500;
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
|
||||
/**
|
||||
* The MouseZoneManager allows components to register zones within the terminal
|
||||
@@ -37,7 +35,8 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
|
||||
private readonly _screenElement: HTMLElement,
|
||||
@IBufferService private readonly _bufferService: IBufferService,
|
||||
@IMouseService private readonly _mouseService: IMouseService,
|
||||
@ISelectionService private readonly _selectionService: ISelectionService
|
||||
@ISelectionService private readonly _selectionService: ISelectionService,
|
||||
@IOptionsService private readonly _optionsService: IOptionsService
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -151,7 +150,7 @@ export class MouseZoneManager extends Disposable implements IMouseZoneManager {
|
||||
}
|
||||
|
||||
// Restart the tooltip timeout
|
||||
this._tooltipTimeout = <number><any>setTimeout(() => this._onTooltip(e), HOVER_DURATION);
|
||||
this._tooltipTimeout = window.setTimeout(() => this._onTooltip(e), this._optionsService.options.linkTooltipHoverDuration);
|
||||
}
|
||||
|
||||
private _onTooltip(e: MouseEvent): void {
|
||||
|
||||
@@ -31,6 +31,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
|
||||
fontWeight: 'normal',
|
||||
fontWeightBold: 'bold',
|
||||
lineHeight: 1.0,
|
||||
linkTooltipHoverDuration: 500,
|
||||
letterSpacing: 0,
|
||||
logLevel: 'info',
|
||||
scrollback: 1000,
|
||||
|
||||
@@ -262,6 +262,7 @@ export interface ITerminalOptions {
|
||||
fontWeightBold: FontWeight;
|
||||
letterSpacing: number;
|
||||
lineHeight: number;
|
||||
linkTooltipHoverDuration: number;
|
||||
logLevel: LogLevel;
|
||||
macOptionIsMeta: boolean;
|
||||
macOptionClickForcesSelection: boolean;
|
||||
|
||||
Vendored
+10
-2
@@ -118,7 +118,7 @@ declare module 'xterm' {
|
||||
fontWeightBold?: FontWeight;
|
||||
|
||||
/**
|
||||
* The spacing in whole pixels between characters..
|
||||
* The spacing in whole pixels between characters.
|
||||
*/
|
||||
letterSpacing?: number;
|
||||
|
||||
@@ -127,6 +127,13 @@ declare module 'xterm' {
|
||||
*/
|
||||
lineHeight?: number;
|
||||
|
||||
/**
|
||||
* The duration in milliseconds before link tooltip events fire when
|
||||
* hovering on a link.
|
||||
* @deprecated This will be removed when the link matcher API is removed.
|
||||
*/
|
||||
linkTooltipHoverDuration?: number;
|
||||
|
||||
/**
|
||||
* What log level to use, this will log for all levels below and including
|
||||
* what is set:
|
||||
@@ -305,7 +312,8 @@ declare module 'xterm' {
|
||||
validationCallback?: (uri: string, callback: (isValid: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* A callback that fires when the mouse hovers over a link for a moment.
|
||||
* A callback that fires when the mouse hovers over a link for a period of
|
||||
* time (defined by {@link ITerminalOptions.linkTooltipHoverDuration}).
|
||||
*/
|
||||
tooltipCallback?: (event: MouseEvent, uri: string, location: IViewportRange) => boolean | void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user