Expand all

CodeMirrorVisualEditorOpenLinks

Modifier-click to open the page, template or URL under the pointer, for the VisualEditor source-mode integrations.

CodeMirror's own openLinks extension cannot serve them, because it handles the mousedown itself and CodeMirror receives no mouse events in either: the overlay integration is pointer-events: none, and the custom-highlight one renders no editor at all. So the events come from VisualEditor's surface, and only the resolution is shared.

The caller draws the mark, because the two integrations render by different means.

Inert until CodeMirrorVisualEditorOpenLinks#setEnabled is called.

Constructor

Properties

drawn :Object|null #

The drawn link's source offsets, so an unchanged token is not redrawn.

Type:

Source:
The drawn link's source offsets, so an unchanged token is not redrawn.

enabled :boolean #

frameHandle :number|null #

Pending requestAnimationFrame handle, coalescing resolves during pointer movement.

Type:

  • number | null
Source:
Pending requestAnimationFrame handle, coalescing resolves during pointer movement.

pointer :Object|null #

Last pointer position seen inside the surface, as the pageX/pageY pair ve.ce.Surface#getOffsetFromEventCoords reads. Null while the pointer is outside, so that pressing the modifier then resolves nothing.

Type:

Source:

Last pointer position seen inside the surface, as the pageX/pageY pair ve.ce.Surface#getOffsetFromEventCoords reads.

surface :ve.ui.Surface|null #

Null once destroyed.

Type:

Source:
Null once destroyed.

Methods

destroy() #

Tear down. Called when the VE surface is destroyed.

Source:
Tear down.

setEnabled(enabled) #

Enable or disable link opening.

Parameters:

Name Type Description
enabled boolean
Source:
Enable or disable link opening.