Skip to main content

extension-positioner

Home > @remirror/extension-positioner

extension-positioner package

Classes

ClassDescription
PositionerThis is the positioner. It exists to report the position of things in the editor. Typically you will use it to get the position of the cursor. But you can be more ambitious and get the position all the active nodes of a certain type. Or all visible nodes of a certain type in the editor, updated as it scrolls. The positions returned have a rect which is the viewport position. There are also the top, left, right, bottom which represent the absolute positioned rectangle of the position in questions. For a cursor position left and right are probably the same.
PositionerExtensionThis is the positioner extension which is used to track the positions of different parts of your editor. For example, you can track the cursor or all visible paragraph nodes.

Functions

FunctionDescription
createMarkPositioner(props)Create a positioner for the currently selected mark
getPositioner(positioner)This is a helper method for getting the positioner. The props can either be a named positioner or a positioner that you've created for the purpose.
hasStateChanged(props)Checks the transaction for changes or compares the state with the previous state. Return true when a change is detected in the document or the selection.
isPositionerUpdateTransaction(tr, key)Checks if the given transaction force updates positioners.
isPositionVisible(rect, element, options)Checks that the rect is visible within the provided element. This is specific for the remirror editor.

Interfaces

InterfaceDescription
BasePositioner
BasePositionerProps
ElementsAddedProps
GetActiveProps
GetPositionProps
MarkPositionerProps
PositionerHandler
PositionerOptions
PositionerPositionThe absolutely positioned coordinates relative to the editor element. With these coordinates you can perfectly simulate a position within the text editor and render it as you decide.
Rect
SetActiveElement
VisibleProps

Variables

VariableDescription
alwaysPositionerAlways render a position regardless of selection.
blockNodePositionerCreates a positioner for the current block node. It spans the full width and height of the block.
cursorPositionerThis can be used to position a menu that is inline with the first character of the selection. This is useful for suggestions since they should typically appear while typing without a multi character selection.
defaultAbsolutePosition
emptyBlockNodeEndPositionerReturns the position as a single pixel width for the end of the current block node.
emptyBlockNodePositionerReturns the block node position only when it is empty and the selection is empty.
emptyBlockNodeStartPositionerReturns the position as a single pixel width for the start of the block node as a position
nearestWordPositionerCreates a position which captures the current active word. Nothing is returned if no word is active. This is only active when the selection is empty (cursor selection)
POSITIONER_UPDATE_ALL
POSITIONER_UPDATE_KEY
POSITIONER_WIDGET_KEY
positioners
selectionPositionerCreate a position that fully capture the selected text. When the selection spans multiple lines, the position is created as a box that fully captures the start cursor and end cursor.

Type Aliases

Type AliasDescription
CallbackPositioner
PositionerChangeHandlerMethodThis type is used for setting elements which are associated with the relevant positioner. Once teh
PositionerParam
PositionerUpdateEventThe events that can trigger a positioner update.
StringPositioner