diff --git a/src/README.md b/src/README.md index 0b8196c..1010880 100644 --- a/src/README.md +++ b/src/README.md @@ -37,6 +37,8 @@ component that displays the editor state and allows text input. @drawSelection +@getDrawSelectionConfig + @dropCursor @highlightActiveLine diff --git a/src/draw-selection.ts b/src/draw-selection.ts index 1dbe655..8ba34a2 100644 --- a/src/draw-selection.ts +++ b/src/draw-selection.ts @@ -53,6 +53,13 @@ export function drawSelection(config: SelectionConfig = {}): Extension { ] } +/// Retrieve the [`drawSelection`](#view.drawSelection) configuration +/// for this state. (Note that this will return a set of defaults even +/// if `drawSelection` isn't enabled.) +export function getDrawSelectionConfig(state: EditorState): SelectionConfig { + return state.facet(selectionConfig) +} + function configChanged(update: ViewUpdate) { return update.startState.facet(selectionConfig) != update.state.facet(selectionConfig) } diff --git a/src/index.ts b/src/index.ts index 7f0f88a..7b5898f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ export {BlockInfo} from "./heightmap" export {MouseSelectionStyle} from "./input" export {BidiSpan, Direction} from "./bidi" export {KeyBinding, keymap, runScopeHandlers} from "./keymap" -export {drawSelection} from "./draw-selection" +export {drawSelection, getDrawSelectionConfig} from "./draw-selection" export {dropCursor} from "./dropcursor" export {highlightSpecialChars} from "./special-chars" export {scrollPastEnd} from "./scrollpastend"