@codemirror/view 6.18.1 → 6.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -408,6 +408,12 @@ interface PluginSpec<V extends PluginValue> {
408
408
  */
409
409
  eventHandlers?: DOMEventHandlers<V>;
410
410
  /**
411
+ Registers [event observers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventObservers)
412
+ for the plugin. Will, when called, have their `this` bound to
413
+ the plugin value.
414
+ */
415
+ eventObservers?: DOMEventHandlers<V>;
416
+ /**
411
417
  Specify that the plugin provides additional extensions when
412
418
  added to an editor configuration.
413
419
  */
@@ -1056,6 +1062,15 @@ declare class EditorView {
1056
1062
  */
1057
1063
  static domEventHandlers(handlers: DOMEventHandlers<any>): Extension;
1058
1064
  /**
1065
+ Create an extension that registers DOM event observers. Contrary
1066
+ to event [handlers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventHandlers),
1067
+ observers can't be prevented from running by a higher-precedence
1068
+ handler returning true. They also don't prevent other handlers
1069
+ and observers from running when they return true, and should not
1070
+ call `preventDefault`.
1071
+ */
1072
+ static domEventObservers(observers: DOMEventHandlers<any>): Extension;
1073
+ /**
1059
1074
  An input handler can override the way changes to the editable
1060
1075
  DOM content are handled. Handlers are passed the document
1061
1076
  positions between which the change was found, and the new
@@ -1399,6 +1414,12 @@ layout information that's only available after laying out the
1399
1414
  content).
1400
1415
  */
1401
1416
  declare function drawSelection(config?: SelectionConfig): Extension;
1417
+ /**
1418
+ Retrieve the [`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) configuration
1419
+ for this state. (Note that this will return a set of defaults even
1420
+ if `drawSelection` isn't enabled.)
1421
+ */
1422
+ declare function getDrawSelectionConfig(state: EditorState): SelectionConfig;
1402
1423
 
1403
1424
  /**
1404
1425
  Draws a cursor at the current drop position when something is
@@ -2035,4 +2056,4 @@ trailing whitespace.
2035
2056
  */
2036
2057
  declare function highlightTrailingWhitespace(): Extension;
2037
2058
 
2038
- export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
2059
+ export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
package/dist/index.d.ts CHANGED
@@ -408,6 +408,12 @@ interface PluginSpec<V extends PluginValue> {
408
408
  */
409
409
  eventHandlers?: DOMEventHandlers<V>;
410
410
  /**
411
+ Registers [event observers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventObservers)
412
+ for the plugin. Will, when called, have their `this` bound to
413
+ the plugin value.
414
+ */
415
+ eventObservers?: DOMEventHandlers<V>;
416
+ /**
411
417
  Specify that the plugin provides additional extensions when
412
418
  added to an editor configuration.
413
419
  */
@@ -1056,6 +1062,15 @@ declare class EditorView {
1056
1062
  */
1057
1063
  static domEventHandlers(handlers: DOMEventHandlers<any>): Extension;
1058
1064
  /**
1065
+ Create an extension that registers DOM event observers. Contrary
1066
+ to event [handlers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventHandlers),
1067
+ observers can't be prevented from running by a higher-precedence
1068
+ handler returning true. They also don't prevent other handlers
1069
+ and observers from running when they return true, and should not
1070
+ call `preventDefault`.
1071
+ */
1072
+ static domEventObservers(observers: DOMEventHandlers<any>): Extension;
1073
+ /**
1059
1074
  An input handler can override the way changes to the editable
1060
1075
  DOM content are handled. Handlers are passed the document
1061
1076
  positions between which the change was found, and the new
@@ -1399,6 +1414,12 @@ layout information that's only available after laying out the
1399
1414
  content).
1400
1415
  */
1401
1416
  declare function drawSelection(config?: SelectionConfig): Extension;
1417
+ /**
1418
+ Retrieve the [`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) configuration
1419
+ for this state. (Note that this will return a set of defaults even
1420
+ if `drawSelection` isn't enabled.)
1421
+ */
1422
+ declare function getDrawSelectionConfig(state: EditorState): SelectionConfig;
1402
1423
 
1403
1424
  /**
1404
1425
  Draws a cursor at the current drop position when something is
@@ -2035,4 +2056,4 @@ trailing whitespace.
2035
2056
  */
2036
2057
  declare function highlightTrailingWhitespace(): Extension;
2037
2058
 
2038
- export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
2059
+ export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };