mirror of
https://github.com/convergencelabs/monaco-collab-ext.git
synced 2024-10-27 20:34:17 +00:00
Add showTooltipOnHover option
This commit is contained in:
parent
a3b0b8a57c
commit
38713d59b9
@ -24,7 +24,7 @@ export interface IRemoteCursorManagerOptions {
|
|||||||
editor: monaco.editor.ICodeEditor;
|
editor: monaco.editor.ICodeEditor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if tooltips will be shown when the cursor is moved.
|
* Determines if tooltips will be shown when the cursor is moved or hovered.
|
||||||
*/
|
*/
|
||||||
tooltips?: boolean;
|
tooltips?: boolean;
|
||||||
|
|
||||||
@ -33,6 +33,11 @@ export interface IRemoteCursorManagerOptions {
|
|||||||
* it was last moved.
|
* it was last moved.
|
||||||
*/
|
*/
|
||||||
tooltipDuration?: number;
|
tooltipDuration?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the tooltip when the cursor is hovered
|
||||||
|
*/
|
||||||
|
showTooltipOnHover?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +125,7 @@ export class RemoteCursorManager {
|
|||||||
label,
|
label,
|
||||||
this._options.tooltips,
|
this._options.tooltips,
|
||||||
tooltipDurationMs,
|
tooltipDurationMs,
|
||||||
|
this._options.showTooltipOnHover,
|
||||||
() => this.removeCursor(id));
|
() => this.removeCursor(id));
|
||||||
this._cursorWidgets.set(id, cursorWidget);
|
this._cursorWidgets.set(id, cursorWidget);
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ export class RemoteCursorWidget implements editor.IContentWidget, IDisposable {
|
|||||||
label: string,
|
label: string,
|
||||||
tooltipEnabled: boolean,
|
tooltipEnabled: boolean,
|
||||||
tooltipDuration: number,
|
tooltipDuration: number,
|
||||||
|
showTooltipOnHover: boolean,
|
||||||
onDisposed: OnDisposed) {
|
onDisposed: OnDisposed) {
|
||||||
this._editor = codeEditor;
|
this._editor = codeEditor;
|
||||||
this._tooltipDuration = tooltipDuration;
|
this._tooltipDuration = tooltipDuration;
|
||||||
@ -81,6 +82,16 @@ export class RemoteCursorWidget implements editor.IContentWidget, IDisposable {
|
|||||||
this._scrollListener = this._editor.onDidScrollChange(() => {
|
this._scrollListener = this._editor.onDidScrollChange(() => {
|
||||||
this._updateTooltipPosition();
|
this._updateTooltipPosition();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (showTooltipOnHover) {
|
||||||
|
this._domNode.style.pointerEvents = 'auto';
|
||||||
|
this._domNode.addEventListener('mouseover', () => {
|
||||||
|
this._setTooltipVisible(true);
|
||||||
|
})
|
||||||
|
this._domNode.addEventListener('mouseout', () => {
|
||||||
|
this._setTooltipVisible(false);
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this._tooltipNode = null;
|
this._tooltipNode = null;
|
||||||
this._scrollListener = null;
|
this._scrollListener = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user